@nebula.js/sn-funnel-chart 1.6.0 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,11 @@
1
1
  /*
2
- * @nebula.js/sn-funnel-chart v1.6.0
2
+ * @nebula.js/sn-funnel-chart v1.6.2
3
3
  * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
6
6
 
7
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@nebula.js/stardust")):"function"==typeof define&&define.amd?define(["@nebula.js/stardust"],e):(t="undefined"!=typeof globalThis?globalThis:t||self)["sn-funnel-chart"]=e(t.stardust)}(this,(function(t){"use strict";var e={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=/([astvzqmhlc])([^astvzqmhlc]*)/gi,i=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;var r=function(t){var r=[],o=String(t).trim();return"M"!==o[0]&&"m"!==o[0]||o.replace(n,(function(t,n,o){var a=n.toLowerCase(),s=function(t){var e=t.match(i);return e?e.map(Number):[]}(o),l=n;if("m"===a&&s.length>2&&(r.push([l].concat(s.splice(0,2))),a="l",l="m"===l?"l":"L"),s.length<e[a])return"";for(r.push([l].concat(s.splice(0,e[a])));s.length>=e[a]&&s.length&&e[a];)r.push([l].concat(s.splice(0,e[a])));return""})),r};function o(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function a(t){return function(t){if(Array.isArray(t))return s(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 s(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(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 s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var l=r;function c(t,e){var n=t.x*Math.cos(e)-t.y*Math.sin(e),i=t.y*Math.cos(e)+t.x*Math.sin(e);t.x=n,t.y=i}function u(t,e,n){t.x+=e,t.y+=n}function h(t,e){t.x*=e,t.y*=e}var d=r,f=function(t){if(void 0!==t&&t.CanvasRenderingContext2D&&(!t.Path2D||!function(t){var e=t.document.createElement("canvas").getContext("2d"),n=new t.Path2D("M0 0 L1 1");return e.strokeStyle="red",e.lineWidth=1,e.stroke(n),255===e.getImageData(0,0,1,1).data[0]}(t))){var e=function(){function t(e){var n;(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.segments=[],e&&e instanceof t)?(n=this.segments).push.apply(n,a(e.segments)):e&&(this.segments=l(e))}var e,n,i;return e=t,(n=[{key:"addPath",value:function(e){var n;e&&e instanceof t&&(n=this.segments).push.apply(n,a(e.segments))}},{key:"moveTo",value:function(t,e){this.segments.push(["M",t,e])}},{key:"lineTo",value:function(t,e){this.segments.push(["L",t,e])}},{key:"arc",value:function(t,e,n,i,r,o){this.segments.push(["AC",t,e,n,i,r,!!o])}},{key:"arcTo",value:function(t,e,n,i,r){this.segments.push(["AT",t,e,n,i,r])}},{key:"ellipse",value:function(t,e,n,i,r,o,a,s){this.segments.push(["E",t,e,n,i,r,o,a,!!s])}},{key:"closePath",value:function(){this.segments.push(["Z"])}},{key:"bezierCurveTo",value:function(t,e,n,i,r,o){this.segments.push(["C",t,e,n,i,r,o])}},{key:"quadraticCurveTo",value:function(t,e,n,i){this.segments.push(["Q",t,e,n,i])}},{key:"rect",value:function(t,e,n,i){this.segments.push(["R",t,e,n,i])}}])&&o(e.prototype,n),i&&o(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),n=t.CanvasRenderingContext2D.prototype.fill,i=t.CanvasRenderingContext2D.prototype.stroke;t.CanvasRenderingContext2D.prototype.fill=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var r="nonzero";if(0===e.length||1===e.length&&"string"==typeof e[0])n.apply(this,e);else{2===arguments.length&&(r=e[1]);var o=e[0];s(this,o.segments),n.call(this,r)}},t.CanvasRenderingContext2D.prototype.stroke=function(t){t?(s(this,t.segments),i.call(this)):i.call(this)};var r=t.CanvasRenderingContext2D.prototype.isPointInPath;t.CanvasRenderingContext2D.prototype.isPointInPath=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if("Path2D"===e[0].constructor.name){var i=e[1],o=e[2],a=e[3]||"nonzero",l=e[0];return s(this,l.segments),r.apply(this,[i,o,a])}return r.apply(this,e)},t.Path2D=e}function s(t,e){var n,i,r,o,a,s,l,d,f,p,g,m,y,v,x,b,w,k,_,M,S,C,N,R,q,A,D={x:0,y:0},E={x:0,y:0};t.beginPath();for(var O=0;O<e.length;++O){var I=e[O];switch("S"!==(M=I[0])&&"s"!==M&&"C"!==M&&"c"!==M&&(C=null,N=null),"T"!==M&&"t"!==M&&"Q"!==M&&"q"!==M&&(R=null,q=null),M){case"m":case"M":"m"===M?(g+=I[1],y+=I[2]):(g=I[1],y=I[2]),"M"!==M&&D||(D={x:g,y:y}),t.moveTo(g,y);break;case"l":g+=I[1],y+=I[2],t.lineTo(g,y);break;case"L":g=I[1],y=I[2],t.lineTo(g,y);break;case"H":g=I[1],t.lineTo(g,y);break;case"h":g+=I[1],t.lineTo(g,y);break;case"V":y=I[1],t.lineTo(g,y);break;case"v":y+=I[1],t.lineTo(g,y);break;case"a":case"A":"a"===M?(g+=I[6],y+=I[7]):(g=I[6],y=I[7]),b=I[1],w=I[2],l=I[3]*Math.PI/180,r=!!I[4],o=!!I[5],a={x:g,y:y},c(s={x:(E.x-a.x)/2,y:(E.y-a.y)/2},-l),(d=s.x*s.x/(b*b)+s.y*s.y/(w*w))>1&&(b*=d=Math.sqrt(d),w*=d),f=b*b*w*w,p=b*b*s.y*s.y+w*w*s.x*s.x,h(S={x:b*s.y/w,y:-w*s.x/b},o!==r?Math.sqrt((f-p)/p)||0:-Math.sqrt((f-p)/p)||0),i=Math.atan2((s.y-S.y)/w,(s.x-S.x)/b),n=Math.atan2(-(s.y+S.y)/w,-(s.x+S.x)/b),c(S,l),u(S,(a.x+E.x)/2,(a.y+E.y)/2),t.save(),t.translate(S.x,S.y),t.rotate(l),t.scale(b,w),t.arc(0,0,1,i,n,!o),t.restore();break;case"C":C=I[3],N=I[4],g=I[5],y=I[6],t.bezierCurveTo(I[1],I[2],C,N,g,y);break;case"c":t.bezierCurveTo(I[1]+g,I[2]+y,I[3]+g,I[4]+y,I[5]+g,I[6]+y),C=I[3]+g,N=I[4]+y,g+=I[5],y+=I[6];break;case"S":null!==C&&null!==N||(C=g,N=y),t.bezierCurveTo(2*g-C,2*y-N,I[1],I[2],I[3],I[4]),C=I[1],N=I[2],g=I[3],y=I[4];break;case"s":null!==C&&null!==N||(C=g,N=y),t.bezierCurveTo(2*g-C,2*y-N,I[1]+g,I[2]+y,I[3]+g,I[4]+y),C=I[1]+g,N=I[2]+y,g+=I[3],y+=I[4];break;case"Q":R=I[1],q=I[2],g=I[3],y=I[4],t.quadraticCurveTo(R,q,g,y);break;case"q":R=I[1]+g,q=I[2]+y,g+=I[3],y+=I[4],t.quadraticCurveTo(R,q,g,y);break;case"T":null!==R&&null!==q||(R=g,q=y),R=2*g-R,q=2*y-q,g=I[1],y=I[2],t.quadraticCurveTo(R,q,g,y);break;case"t":null!==R&&null!==q||(R=g,q=y),R=2*g-R,q=2*y-q,g+=I[1],y+=I[2],t.quadraticCurveTo(R,q,g,y);break;case"z":case"Z":g=D.x,y=D.y,D=void 0,t.closePath();break;case"AC":g=I[1],y=I[2],x=I[3],i=I[4],n=I[5],A=I[6],t.arc(g,y,x,i,n,A);break;case"AT":m=I[1],v=I[2],g=I[3],y=I[4],x=I[5],t.arcTo(m,v,g,y,x);break;case"E":g=I[1],y=I[2],b=I[3],w=I[4],l=I[5],i=I[6],n=I[7],A=I[8],t.save(),t.translate(g,y),t.rotate(l),t.scale(b,w),t.arc(0,0,1,i,n,A),t.restore();break;case"R":g=I[1],y=I[2],k=I[3],_=I[4],D={x:g,y:y},t.rect(g,y,k,_)}E.x=g,E.y=y}}};"undefined"!=typeof window&&f(window);var p={path2dPolyfill:f,parsePath:d},g=Object.prototype.hasOwnProperty,m=Object.prototype.toString,y=Object.defineProperty,v=Object.getOwnPropertyDescriptor,x=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===m.call(t)},b=function(t){if(!t||"[object Object]"!==m.call(t))return!1;var e,n=g.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&g.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;for(e in t);return void 0===e||g.call(t,e)},w=function(t,e){y&&"__proto__"===e.name?y(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},k=function(t,e){if("__proto__"===e){if(!g.call(t,e))return;if(v)return v(t,e).value}return t[e]},_=function t(){var e,n,i,r,o,a,s=arguments[0],l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),(null==s||"object"!=typeof s&&"function"!=typeof s)&&(s={});l<c;++l)if(null!=(e=arguments[l]))for(n in e)i=k(s,n),s!==(r=k(e,n))&&(u&&r&&(b(r)||(o=x(r)))?(o?(o=!1,a=i&&x(i)?i:[]):a=i&&b(i)?i:{},w(s,{name:n,newValue:t(u,a,r)})):void 0!==r&&w(s,{name:n,newValue:r}));return s},M="2.2.2";function S(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function C(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?S(Object(n),!0).forEach((function(e){N(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function N(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;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:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function R(t){return!!t.changedTouches}function q(t){return"number"==typeof t&&!isNaN(t)}function A(t){return"number"!=typeof t||isNaN(t)}function D(t){const e=t.length;let n=NaN,i=NaN,r=NaN,o=NaN;for(let a=0;a<e;a++)n=isNaN(n)?t[a].x:Math.min(n,t[a].x),i=isNaN(i)?t[a].x:Math.max(i,t[a].x),r=isNaN(r)?t[a].y:Math.min(r,t[a].y),o=isNaN(o)?t[a].y:Math.max(o,t[a].y);return[n,r,i,o]}function E(t){return[{x:t.x1||0,y:t.y1||0},{x:t.x2||0,y:t.y2||0}]}function O(t){return[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}]}function I(t){const[e,n,i,r]=D(t);return{x:e,y:n,width:i-e,height:r-n}}function T(t){return{x1:t[0].x,y1:t[0].y,x2:t[1].x,y2:t[1].y}}function j(t){const{x:e,y:n,width:i,height:r,x1:o,x2:a,y1:s,y2:l,cx:c,cy:u,r:h,vertices:d}=t||{};return q(c)&&q(u)&&q(h)?"circle":q(o)&&q(a)&&q(s)&&q(l)?"line":q(e)&&q(n)&&q(i)&&q(r)?"rect":q(e)&&q(n)?"point":Array.isArray(d)?d.every((t=>Array.isArray(t)))?"geopolygon":"polygon":null}function P(t,e){return{x:e.x-t,y:e.y-t,width:e.width+t,height:e.height+t}}function z(t,e){let{types:n,logger:i}=e;const r={},o=[];Array.isArray(t)?o.push(...t):(i.warn('Deprecated: "data-source" configuration"'),o.push(t)),o.forEach(((t,e)=>{let o=n(t.type);if(o){let n=t.key;void 0===t.key&&(i.warn("Missing key for dataset. Using index '".concat(e,"' as key.")),n=e);let a=o({key:n,data:t.data,config:t.config});r[n]=a}}));return t=>t?r[t]:r[Object.keys(r)[0]]}var F=Math.PI,L=2*F,B=1e-6,H=L-B;function $(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function V(){return new $}function W(t){return function(){return t}}$.prototype=V.prototype={constructor:$,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,i){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(t,e,n,i,r,o){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+o)},arcTo:function(t,e,n,i,r){t=+t,e=+e,n=+n,i=+i,r=+r;var o=this._x1,a=this._y1,s=n-t,l=i-e,c=o-t,u=a-e,h=c*c+u*u;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(h>B)if(Math.abs(u*s-l*c)>B&&r){var d=n-o,f=i-a,p=s*s+l*l,g=d*d+f*f,m=Math.sqrt(p),y=Math.sqrt(h),v=r*Math.tan((F-Math.acos((p+h-g)/(2*m*y)))/2),x=v/y,b=v/m;Math.abs(x-1)>B&&(this._+="L"+(t+x*c)+","+(e+x*u)),this._+="A"+r+","+r+",0,0,"+ +(u*d>c*f)+","+(this._x1=t+b*s)+","+(this._y1=e+b*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,i,r,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(i),s=n*Math.sin(i),l=t+a,c=e+s,u=1^o,h=o?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+l+","+c:(Math.abs(this._x1-l)>B||Math.abs(this._y1-c)>B)&&(this._+="L"+l+","+c),n&&(h<0&&(h=h%L+L),h>H?this._+="A"+n+","+n+",0,1,"+u+","+(t-a)+","+(e-s)+"A"+n+","+n+",0,1,"+u+","+(this._x1=l)+","+(this._y1=c):h>B&&(this._+="A"+n+","+n+",0,"+ +(h>=F)+","+u+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};var U=Math.abs,Y=Math.atan2,X=Math.cos,K=Math.max,G=Math.min,Z=Math.sin,J=Math.sqrt,Q=1e-12,tt=Math.PI,et=tt/2,nt=2*tt;function it(t){return t>1?0:t<-1?tt:Math.acos(t)}function rt(t){return t>=1?et:t<=-1?-et:Math.asin(t)}function ot(t){return t.innerRadius}function at(t){return t.outerRadius}function st(t){return t.startAngle}function lt(t){return t.endAngle}function ct(t){return t&&t.padAngle}function ut(t,e,n,i,r,o,a,s){var l=n-t,c=i-e,u=a-r,h=s-o,d=h*l-u*c;if(!(d*d<Q))return[t+(d=(u*(e-o)-h*(t-r))/d)*l,e+d*c]}function ht(t,e,n,i,r,o,a){var s=t-n,l=e-i,c=(a?o:-o)/J(s*s+l*l),u=c*l,h=-c*s,d=t+u,f=e+h,p=n+u,g=i+h,m=(d+p)/2,y=(f+g)/2,v=p-d,x=g-f,b=v*v+x*x,w=r-o,k=d*g-p*f,_=(x<0?-1:1)*J(K(0,w*w*b-k*k)),M=(k*x-v*_)/b,S=(-k*v-x*_)/b,C=(k*x+v*_)/b,N=(-k*v+x*_)/b,R=M-m,q=S-y,A=C-m,D=N-y;return R*R+q*q>A*A+D*D&&(M=C,S=N),{cx:M,cy:S,x01:-u,y01:-h,x11:M*(r/w-1),y11:S*(r/w-1)}}function dt(){var t=ot,e=at,n=W(0),i=null,r=st,o=lt,a=ct,s=null;function l(){var l,c,u=+t.apply(this,arguments),h=+e.apply(this,arguments),d=r.apply(this,arguments)-et,f=o.apply(this,arguments)-et,p=U(f-d),g=f>d;if(s||(s=l=V()),h<u&&(c=h,h=u,u=c),h>Q)if(p>nt-Q)s.moveTo(h*X(d),h*Z(d)),s.arc(0,0,h,d,f,!g),u>Q&&(s.moveTo(u*X(f),u*Z(f)),s.arc(0,0,u,f,d,g));else{var m,y,v=d,x=f,b=d,w=f,k=p,_=p,M=a.apply(this,arguments)/2,S=M>Q&&(i?+i.apply(this,arguments):J(u*u+h*h)),C=G(U(h-u)/2,+n.apply(this,arguments)),N=C,R=C;if(S>Q){var q=rt(S/u*Z(M)),A=rt(S/h*Z(M));(k-=2*q)>Q?(b+=q*=g?1:-1,w-=q):(k=0,b=w=(d+f)/2),(_-=2*A)>Q?(v+=A*=g?1:-1,x-=A):(_=0,v=x=(d+f)/2)}var D=h*X(v),E=h*Z(v),O=u*X(w),I=u*Z(w);if(C>Q){var T,j=h*X(x),P=h*Z(x),z=u*X(b),F=u*Z(b);if(p<tt&&(T=ut(D,E,z,F,j,P,O,I))){var L=D-T[0],B=E-T[1],H=j-T[0],$=P-T[1],W=1/Z(it((L*H+B*$)/(J(L*L+B*B)*J(H*H+$*$)))/2),K=J(T[0]*T[0]+T[1]*T[1]);N=G(C,(u-K)/(W-1)),R=G(C,(h-K)/(W+1))}}_>Q?R>Q?(m=ht(z,F,D,E,h,R,g),y=ht(j,P,O,I,h,R,g),s.moveTo(m.cx+m.x01,m.cy+m.y01),R<C?s.arc(m.cx,m.cy,R,Y(m.y01,m.x01),Y(y.y01,y.x01),!g):(s.arc(m.cx,m.cy,R,Y(m.y01,m.x01),Y(m.y11,m.x11),!g),s.arc(0,0,h,Y(m.cy+m.y11,m.cx+m.x11),Y(y.cy+y.y11,y.cx+y.x11),!g),s.arc(y.cx,y.cy,R,Y(y.y11,y.x11),Y(y.y01,y.x01),!g))):(s.moveTo(D,E),s.arc(0,0,h,v,x,!g)):s.moveTo(D,E),u>Q&&k>Q?N>Q?(m=ht(O,I,j,P,u,-N,g),y=ht(D,E,z,F,u,-N,g),s.lineTo(m.cx+m.x01,m.cy+m.y01),N<C?s.arc(m.cx,m.cy,N,Y(m.y01,m.x01),Y(y.y01,y.x01),!g):(s.arc(m.cx,m.cy,N,Y(m.y01,m.x01),Y(m.y11,m.x11),!g),s.arc(0,0,u,Y(m.cy+m.y11,m.cx+m.x11),Y(y.cy+y.y11,y.cx+y.x11),g),s.arc(y.cx,y.cy,N,Y(y.y11,y.x11),Y(y.y01,y.x01),!g))):s.arc(0,0,u,w,b,g):s.lineTo(O,I)}else s.moveTo(0,0);if(s.closePath(),l)return s=null,l+""||null}return l.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,i=(+r.apply(this,arguments)+ +o.apply(this,arguments))/2-tt/2;return[X(i)*n,Z(i)*n]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:W(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:W(+t),l):e},l.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:W(+t),l):n},l.padRadius=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:W(+t),l):i},l.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:W(+t),l):r},l.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:W(+t),l):o},l.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:W(+t),l):a},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function ft(t){this._context=t}function pt(t){return new ft(t)}function gt(t){return t[0]}function mt(t){return t[1]}function yt(){var t=gt,e=null,n=W(0),i=mt,r=W(!0),o=null,a=pt,s=null;function l(l){var c,u,h,d,f,p=l.length,g=!1,m=new Array(p),y=new Array(p);for(null==o&&(s=a(f=V())),c=0;c<=p;++c){if(!(c<p&&r(d=l[c],c,l))===g)if(g=!g)u=c,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),h=c-1;h>=u;--h)s.point(m[h],y[h]);s.lineEnd(),s.areaEnd()}g&&(m[c]=+t(d,c,l),y[c]=+n(d,c,l),s.point(e?+e(d,c,l):m[c],i?+i(d,c,l):y[c]))}if(f)return s=null,f+""||null}function c(){return function(){var t=gt,e=mt,n=W(!0),i=null,r=pt,o=null;function a(a){var s,l,c,u=a.length,h=!1;for(null==i&&(o=r(c=V())),s=0;s<=u;++s)!(s<u&&n(l=a[s],s,a))===h&&((h=!h)?o.lineStart():o.lineEnd()),h&&o.point(+t(l,s,a),+e(l,s,a));if(c)return o=null,c+""||null}return a.x=function(e){return arguments.length?(t="function"==typeof e?e:W(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:W(+t),a):e},a.defined=function(t){return arguments.length?(n="function"==typeof t?t:W(!!t),a):n},a.curve=function(t){return arguments.length?(r=t,null!=i&&(o=r(i)),a):r},a.context=function(t){return arguments.length?(null==t?i=o=null:o=r(i=t),a):i},a}().defined(r).curve(a).context(o)}return l.x=function(n){return arguments.length?(t="function"==typeof n?n:W(+n),e=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:W(+e),l):t},l.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:W(+t),l):e},l.y=function(t){return arguments.length?(n="function"==typeof t?t:W(+t),i=null,l):n},l.y0=function(t){return arguments.length?(n="function"==typeof t?t:W(+t),l):n},l.y1=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:W(+t),l):i},l.lineX0=l.lineY0=function(){return c().x(t).y(n)},l.lineY1=function(){return c().x(t).y(i)},l.lineX1=function(){return c().x(e).y(n)},l.defined=function(t){return arguments.length?(r="function"==typeof t?t:W(!!t),l):r},l.curve=function(t){return arguments.length?(a=t,null!=o&&(s=a(o)),l):a},l.context=function(t){return arguments.length?(null==t?o=s=null:s=a(o=t),l):o},l}function vt(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function xt(t){return t}ft.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var bt=Array.prototype.slice;function wt(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function kt(t){this._context=t}function _t(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Mt(t,e){this._context=t,this._k=(1-e)/6}kt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:wt(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:wt(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Mt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:_t(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:_t(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var St=function t(e){function n(t){return new Mt(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Ct(t,e){this._context=t,this._alpha=e}Ct.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:!function(t,e,n){var i=t._x1,r=t._y1,o=t._x2,a=t._y2;if(t._l01_a>Q){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);i=(i*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,r=(r*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>Q){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-e*t._l12_2a)/u,a=(a*c+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(i,r,o,a,t._x2,t._y2)}(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Nt=function t(e){function n(t){return e?new Ct(t,e):new Mt(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Rt(t){return t<0?-1:1}function qt(t,e,n){var i=t._x1-t._x0,r=e-t._x1,o=(t._y1-t._y0)/(i||r<0&&-0),a=(n-t._y1)/(r||i<0&&-0),s=(o*r+a*i)/(i+r);return(Rt(o)+Rt(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function At(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Dt(t,e,n){var i=t._x0,r=t._y0,o=t._x1,a=t._y1,s=(o-i)/3;t._context.bezierCurveTo(i+s,r+s*e,o-s,a-s*n,o,a)}function Et(t){this._context=t}function Ot(t){this._context=new It(t)}function It(t){this._context=t}function Tt(t){this._context=t}function jt(t){var e,n,i=t.length-1,r=new Array(i),o=new Array(i),a=new Array(i);for(r[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e<i-1;++e)r[e]=1,o[e]=4,a[e]=4*t[e]+2*t[e+1];for(r[i-1]=2,o[i-1]=7,a[i-1]=8*t[i-1]+t[i],e=1;e<i;++e)n=r[e]/o[e-1],o[e]-=n,a[e]-=n*a[e-1];for(r[i-1]=a[i-1]/o[i-1],e=i-2;e>=0;--e)r[e]=(a[e]-r[e+1])/o[e];for(o[i-1]=(t[i]+r[i-1])/2,e=0;e<i-1;++e)o[e]=2*t[e+1]-r[e+1];return[r,o]}function Pt(t,e){this._context=t,this._t=e}function zt(t,e){if((r=t.length)>1)for(var n,i,r,o=1,a=t[e[0]],s=a.length;o<r;++o)for(i=a,a=t[e[o]],n=0;n<s;++n)a[n][1]+=a[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function Ft(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function Lt(t,e){return t[e]}function Bt(t){for(var e,n=-1,i=0,r=t.length,o=-1/0;++n<r;)(e=+t[n][1])>o&&(o=e,i=n);return i}function Ht(t){for(var e,n=0,i=-1,r=t.length;++i<r;)(e=+t[i][1])&&(n+=e);return n}function $t(t){let e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unspecified",i=arguments.length>2?arguments[2]:void 0;const r={},o=t||{get:()=>{},has:()=>!1,default:()=>{}};function a(t,e){if(!t||"string"!=typeof t)throw new TypeError("Invalid argument: key must be a non-empty string");return!(t in r)&&(r[t]=e,!0)}function s(t){return r[t]||o.get(t)}function l(t){return!!r[t]||o.has(t)}function c(t){const e=r[t];return delete r[t],e}function u(){return Object.keys(r)}function h(){return Object.keys(r).map((t=>r[t]))}function d(t){return void 0!==t&&(e=t),e}function f(t,r){if(void 0!==r)return a(t,r);const o=s(t);return i&&void 0===o&&i.warn("".concat(t," does not exist in ").concat(n," registry")),o||s(e)}return e=o.default(),f.add=a,f.get=s,f.has=l,f.remove=c,f.getKeys=u,f.getValues=h,f.default=d,f.register=a,f}function Vt(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}function Wt(t){return(t=Vt(Math.abs(t)))?t[1]:NaN}Et.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Dt(this,this._t0,At(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Dt(this,At(this,n=qt(this,t,e)),n);break;default:Dt(this,this._t0,n=qt(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(Ot.prototype=Object.create(Et.prototype)).point=function(t,e){Et.prototype.point.call(this,e,t)},It.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,i,r,o){this._context.bezierCurveTo(e,t,i,n,o,r)}},Tt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var i=jt(t),r=jt(e),o=0,a=1;a<n;++o,++a)this._context.bezierCurveTo(i[0][o],r[0][o],i[1][o],r[1][o],t[a],e[a]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},Pt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var Ut,Yt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Xt(t){if(!(e=Yt.exec(t)))throw new Error("invalid format: "+t);var e;return new Kt({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Kt(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Gt(t,e){var n=Vt(t,e);if(!n)return t+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}Xt.prototype=Kt.prototype,Kt.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Zt={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Gt(100*t,e),r:Gt,s:function(t,e){var n=Vt(t,e);if(!n)return t+"";var i=n[0],r=n[1],o=r-(Ut=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,a=i.length;return o===a?i:o>a?i+new Array(o-a+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+Vt(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Jt(t){return t}var Qt,te,ee,ne=Array.prototype.map,ie=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function re(t){var e,n,i=void 0===t.grouping||void 0===t.thousands?Jt:(e=ne.call(t.grouping,Number),n=t.thousands+"",function(t,i){for(var r=t.length,o=[],a=0,s=e[0],l=0;r>0&&s>0&&(l+s+1>i&&(s=Math.max(1,i-l)),o.push(t.substring(r-=s,r+s)),!((l+=s+1)>i));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),r=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?Jt:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(ne.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=Xt(t)).fill,n=t.align,h=t.sign,d=t.symbol,f=t.zero,p=t.width,g=t.comma,m=t.precision,y=t.trim,v=t.type;"n"===v?(g=!0,v="g"):Zt[v]||(void 0===m&&(m=12),y=!0,v="g"),(f||"0"===e&&"="===n)&&(f=!0,e="0",n="=");var x="$"===d?r:"#"===d&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",b="$"===d?o:/[%p]/.test(v)?l:"",w=Zt[v],k=/[defgprs%]/.test(v);function _(t){var r,o,l,d=x,_=b;if("c"===v)_=w(t)+_,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:w(Math.abs(t),m),y&&(t=function(t){t:for(var e,n=t.length,i=1,r=-1;i<n;++i)switch(t[i]){case".":r=e=i;break;case"0":0===r&&(r=i),e=i;break;default:if(!+t[i])break t;r>0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),M&&0==+t&&"+"!==h&&(M=!1),d=(M?"("===h?h:c:"-"===h||"("===h?"":h)+d,_=("s"===v?ie[8+Ut/3]:"")+_+(M&&"("===h?")":""),k)for(r=-1,o=t.length;++r<o;)if(48>(l=t.charCodeAt(r))||l>57){_=(46===l?a+t.slice(r+1):t.slice(r))+_,t=t.slice(0,r);break}}g&&!f&&(t=i(t,1/0));var S=d.length+t.length+_.length,C=S<p?new Array(p-S+1).join(e):"";switch(g&&f&&(t=i(C+t,C.length?p-_.length:1/0),C=""),n){case"<":t=d+t+_+C;break;case"=":t=d+C+t+_;break;case"^":t=C.slice(0,S=C.length>>1)+d+t+_+C.slice(S);break;default:t=C+d+t+_}return s(t)}return m=void 0===m?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),_.toString=function(){return t+""},_}return{format:h,formatPrefix:function(t,e){var n=h(((t=Xt(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(Wt(e)/3))),r=Math.pow(10,-i),o=ie[8+i/3];return function(t){return n(r*t)+o}}}}!function(t){Qt=re(t),te=Qt.format,ee=Qt.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});const oe=new Date,ae=new Date;function se(t,e,n,i){function r(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return r.floor=e=>(t(e=new Date(+e)),e),r.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),r.round=t=>{const e=r(t),n=r.ceil(t);return t-e<n-t?e:n},r.offset=(t,n)=>(e(t=new Date(+t),null==n?1:Math.floor(n)),t),r.range=(n,i,o)=>{const a=[];if(n=r.ceil(n),o=null==o?1:Math.floor(o),!(n<i&&o>0))return a;let s;do{a.push(s=new Date(+n)),e(n,o),t(n)}while(s<n&&n<i);return a},r.filter=n=>se((e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),((t,i)=>{if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););})),n&&(r.count=(e,i)=>(oe.setTime(+e),ae.setTime(+i),t(oe),t(ae),Math.floor(n(oe,ae))),r.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?r.filter(i?e=>i(e)%t==0:e=>r.count(0,e)%t==0):r:null)),r}const le=6e4,ce=864e5,ue=6048e5,he=se((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*le)/ce),(t=>t.getDate()-1));he.range;const de=se((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/ce),(t=>t.getUTCDate()-1));de.range;function fe(t){return se((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*le)/ue))}se((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/ce),(t=>Math.floor(t/ce))).range;const pe=fe(0),ge=fe(1),me=fe(2),ye=fe(3),ve=fe(4),xe=fe(5),be=fe(6);function we(t){return se((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/ue))}pe.range,ge.range,me.range,ye.range,ve.range,xe.range,be.range;const ke=we(0),_e=we(1),Me=we(2),Se=we(3),Ce=we(4),Ne=we(5),Re=we(6);ke.range,_e.range,Me.range,Se.range,Ce.range,Ne.range,Re.range;const qe=se((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));qe.every=t=>isFinite(t=Math.floor(t))&&t>0?se((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,n)=>{e.setFullYear(e.getFullYear()+n*t)})):null,qe.range;const Ae=se((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function De(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Ee(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Oe(t){let e,n,i;function r(t,i,r=0,o=t.length){if(r<o){if(0!==e(i,i))return o;do{const e=r+o>>>1;n(t[e],i)<0?r=e+1:o=e}while(r<o)}return r}return 2!==t.length?(e=De,n=(e,n)=>De(t(e),n),i=(e,n)=>t(e)-n):(e=t===De||t===Ee?t:Ie,n=t,i=t),{left:r,center:function(t,e,n=0,o=t.length){const a=r(t,e,n,o-1);return a>n&&i(t[a-1],e)>-i(t[a],e)?a-1:a},right:function(t,i,r=0,o=t.length){if(r<o){if(0!==e(i,i))return o;do{const e=r+o>>>1;n(t[e],i)<=0?r=e+1:o=e}while(r<o)}return r}}}function Ie(){return 0}Ae.every=t=>isFinite(t=Math.floor(t))&&t>0?se((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null,Ae.range;const Te=Oe(De).right;Oe((function(t){return null===t?NaN:+t})).center;var je=Te;class Pe extends Map{constructor(t,e=Fe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(ze(this,t))}has(t){return super.has(ze(this,t))}set(t,e){return super.set(function({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):(t.set(i,n),n)}(this,t),e)}delete(t){return super.delete(function({_intern:t,_key:e},n){const i=e(n);t.has(i)&&(n=t.get(i),t.delete(i));return n}(this,t))}}function ze({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):n}function Fe(t){return null!==t&&"object"==typeof t?t.valueOf():t}const Le=Math.sqrt(50),Be=Math.sqrt(10),He=Math.sqrt(2);function $e(t,e,n){const i=(e-t)/Math.max(0,n),r=Math.floor(Math.log10(i)),o=i/Math.pow(10,r),a=o>=Le?10:o>=Be?5:o>=He?2:1;let s,l,c;return r<0?(c=Math.pow(10,-r)/a,s=Math.round(t*c),l=Math.round(e*c),s/c<t&&++s,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*a,s=Math.round(t/c),l=Math.round(e/c),s*c<t&&++s,l*c>e&&--l),l<s&&.5<=n&&n<2?$e(t,e,2*n):[s,l,c]}function Ve(t,e,n){return $e(t=+t,e=+e,n=+n)[2]}function We(t,e,n){t=+t,e=+e,n=(r=arguments.length)<2?(e=t,t=0,1):r<3?1:+n;for(var i=-1,r=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(r);++i<r;)o[i]=t+i*n;return o}function Ue(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Ye(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Xe(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function Ke(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,o=t.days,a=t.shortDays,s=t.months,l=t.shortMonths,c=nn(r),u=rn(r),h=nn(o),d=rn(o),f=nn(a),p=rn(a),g=nn(s),m=rn(s),y=nn(l),v=rn(l),x={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:Sn,e:Sn,f:An,g:Bn,G:$n,H:Cn,I:Nn,j:Rn,L:qn,m:Dn,M:En,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:di,s:fi,S:On,u:In,U:Tn,V:Pn,w:zn,W:Fn,x:null,X:null,y:Ln,Y:Hn,Z:Vn,"%":hi},b={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:Wn,e:Wn,f:Gn,g:si,G:ci,H:Un,I:Yn,j:Xn,L:Kn,m:Zn,M:Jn,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:di,s:fi,S:Qn,u:ti,U:ei,V:ii,w:ri,W:oi,x:null,X:null,y:ai,Y:li,Z:ui,"%":hi},w={a:function(t,e,n){var i=f.exec(e.slice(n));return i?(t.w=p.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(t,e,n){var i=h.exec(e.slice(n));return i?(t.w=d.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(t,e,n){var i=y.exec(e.slice(n));return i?(t.m=v.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(t,e,n){var i=g.exec(e.slice(n));return i?(t.m=m.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(t,n,i){return M(t,e,n,i)},d:gn,e:gn,f:wn,g:hn,G:un,H:yn,I:yn,j:mn,L:bn,m:pn,M:vn,p:function(t,e,n){var i=c.exec(e.slice(n));return i?(t.p=u.get(i[0].toLowerCase()),n+i[0].length):-1},q:fn,Q:_n,s:Mn,S:xn,u:an,U:sn,V:ln,w:on,W:cn,x:function(t,e,i){return M(t,n,e,i)},X:function(t,e,n){return M(t,i,e,n)},y:hn,Y:un,Z:dn,"%":kn};function k(t,e){return function(n){var i,r,o,a=[],s=-1,l=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===t.charCodeAt(s)&&(a.push(t.slice(l,s)),null!=(r=Ge[i=t.charAt(++s)])?i=t.charAt(++s):r="e"===i?" ":"0",(o=e[i])&&(i=o(n,r)),a.push(i),l=s+1);return a.push(t.slice(l,s)),a.join("")}}function _(t,e){return function(n){var i,r,o=Xe(1900,void 0,1);if(M(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(r=(i=Ye(Xe(o.y,0,1))).getUTCDay(),i=r>4||0===r?_e.ceil(i):_e(i),i=de.offset(i,7*(o.V-1)),o.y=i.getUTCFullYear(),o.m=i.getUTCMonth(),o.d=i.getUTCDate()+(o.w+6)%7):(r=(i=Ue(Xe(o.y,0,1))).getDay(),i=r>4||0===r?ge.ceil(i):ge(i),i=he.offset(i,7*(o.V-1)),o.y=i.getFullYear(),o.m=i.getMonth(),o.d=i.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),r="Z"in o?Ye(Xe(o.y,0,1)).getUTCDay():Ue(Xe(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(r+5)%7:o.w+7*o.U-(r+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Ye(o)):Ue(o)}}function M(t,e,n,i){for(var r,o,a=0,s=e.length,l=n.length;a<s;){if(i>=l)return-1;if(37===(r=e.charCodeAt(a++))){if(r=e.charAt(a++),!(o=w[r in Ge?e.charAt(a++):r])||(i=o(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return x.x=k(n,x),x.X=k(i,x),x.c=k(e,x),b.x=k(n,b),b.X=k(i,b),b.c=k(e,b),{format:function(t){var e=k(t+="",x);return e.toString=function(){return t},e},parse:function(t){var e=_(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=k(t+="",b);return e.toString=function(){return t},e},utcParse:function(t){var e=_(t+="",!0);return e.toString=function(){return t},e}}}var Ge={"-":"",_:" ",0:"0"},Ze=/^\s*\d+/,Je=/^%/,Qe=/[\\^$*+?|[\]().{}]/g;function tn(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",o=r.length;return i+(o<n?new Array(n-o+1).join(e)+r:r)}function en(t){return t.replace(Qe,"\\$&")}function nn(t){return new RegExp("^(?:"+t.map(en).join("|")+")","i")}function rn(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}function on(t,e,n){var i=Ze.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function an(t,e,n){var i=Ze.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function sn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function ln(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function cn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function un(t,e,n){var i=Ze.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function hn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function dn(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function fn(t,e,n){var i=Ze.exec(e.slice(n,n+1));return i?(t.q=3*i[0]-3,n+i[0].length):-1}function pn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function gn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function mn(t,e,n){var i=Ze.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function yn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function vn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function xn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function bn(t,e,n){var i=Ze.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function wn(t,e,n){var i=Ze.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function kn(t,e,n){var i=Je.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function _n(t,e,n){var i=Ze.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function Mn(t,e,n){var i=Ze.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function Sn(t,e){return tn(t.getDate(),e,2)}function Cn(t,e){return tn(t.getHours(),e,2)}function Nn(t,e){return tn(t.getHours()%12||12,e,2)}function Rn(t,e){return tn(1+he.count(qe(t),t),e,3)}function qn(t,e){return tn(t.getMilliseconds(),e,3)}function An(t,e){return qn(t,e)+"000"}function Dn(t,e){return tn(t.getMonth()+1,e,2)}function En(t,e){return tn(t.getMinutes(),e,2)}function On(t,e){return tn(t.getSeconds(),e,2)}function In(t){var e=t.getDay();return 0===e?7:e}function Tn(t,e){return tn(pe.count(qe(t)-1,t),e,2)}function jn(t){var e=t.getDay();return e>=4||0===e?ve(t):ve.ceil(t)}function Pn(t,e){return t=jn(t),tn(ve.count(qe(t),t)+(4===qe(t).getDay()),e,2)}function zn(t){return t.getDay()}function Fn(t,e){return tn(ge.count(qe(t)-1,t),e,2)}function Ln(t,e){return tn(t.getFullYear()%100,e,2)}function Bn(t,e){return tn((t=jn(t)).getFullYear()%100,e,2)}function Hn(t,e){return tn(t.getFullYear()%1e4,e,4)}function $n(t,e){var n=t.getDay();return tn((t=n>=4||0===n?ve(t):ve.ceil(t)).getFullYear()%1e4,e,4)}function Vn(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+tn(e/60|0,"0",2)+tn(e%60,"0",2)}function Wn(t,e){return tn(t.getUTCDate(),e,2)}function Un(t,e){return tn(t.getUTCHours(),e,2)}function Yn(t,e){return tn(t.getUTCHours()%12||12,e,2)}function Xn(t,e){return tn(1+de.count(Ae(t),t),e,3)}function Kn(t,e){return tn(t.getUTCMilliseconds(),e,3)}function Gn(t,e){return Kn(t,e)+"000"}function Zn(t,e){return tn(t.getUTCMonth()+1,e,2)}function Jn(t,e){return tn(t.getUTCMinutes(),e,2)}function Qn(t,e){return tn(t.getUTCSeconds(),e,2)}function ti(t){var e=t.getUTCDay();return 0===e?7:e}function ei(t,e){return tn(ke.count(Ae(t)-1,t),e,2)}function ni(t){var e=t.getUTCDay();return e>=4||0===e?Ce(t):Ce.ceil(t)}function ii(t,e){return t=ni(t),tn(Ce.count(Ae(t),t)+(4===Ae(t).getUTCDay()),e,2)}function ri(t){return t.getUTCDay()}function oi(t,e){return tn(_e.count(Ae(t)-1,t),e,2)}function ai(t,e){return tn(t.getUTCFullYear()%100,e,2)}function si(t,e){return tn((t=ni(t)).getUTCFullYear()%100,e,2)}function li(t,e){return tn(t.getUTCFullYear()%1e4,e,4)}function ci(t,e){var n=t.getUTCDay();return tn((t=n>=4||0===n?Ce(t):Ce.ceil(t)).getUTCFullYear()%1e4,e,4)}function ui(){return"+0000"}function hi(){return"%"}function di(t){return+t}function fi(t){return Math.floor(+t/1e3)}const pi=$t();pi("d3-number",(function(t,e,n){let i,r;function o(t){return r(t)}function a(){o.locale({decimal:n||".",thousands:e||",",grouping:[3],currency:["$",""]})}return o.locale=function(e){return i=re(e),r=i.format(t),this},a(),o.format=function(t,r,o,s){return(o||s)&&(e=o,n=s,a()),i.format(t)(r)},o.pattern=function(e){return e&&(t=e,r=i.format(e)),t},o})),pi("d3-time",(function(t){let e=Ke({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),n=e.format(t);function i(t){return n(t)}return i.format=function(t,n){return e.format(t)(n)},i.locale=function(){return e=Ke(...arguments),n=e.format(t),this},i.parse=function(t,n){return e.parse(t)(n)},i.parsePattern=function(t){return e.parse(t)},i}));const gi={id:t=>"".concat(t.source,"/").concat(t.key||t.title),key:t=>String(t.key||t.title),tags:t=>t.tags,min:t=>t.min,max:t=>t.max,type:t=>t.type,title:t=>String(t.title),values:t=>t.values,value:t=>t,label:t=>t,formatter:t=>(t=>{if("function"==typeof t.formatter)return t.formatter();const e=t.formatter||{};return pi(e.type||"d3-number")(e.format||"")})(t)};function mi(t){let{id:e=gi.id,key:n=gi.key,min:i=gi.min,max:r=gi.max,type:o=gi.type,tags:a=gi.tags,title:s=gi.title,values:l=gi.values,value:c=gi.value,label:u=gi.label,formatter:h=gi.formatter}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const d={id:()=>e(t),key:()=>n(t),raw:()=>t,tags:()=>a(t),type:()=>o(t),min:()=>i(t),max:()=>r(t),title:()=>s(t),items:()=>l(t),formatter:()=>h(t),value:c,label:u};return d}function yi(t,e){let{cache:n}=e;if("number"==typeof t)return n.fields[t];for(let e=0;e<n.fields.length;e++)if(n.fields[e].key()===t)return n.fields[e];for(let e=0;e<n.fields.length;e++)if(n.fields[e].title()===t)return n.fields[e];return null}const vi=t=>t.filter((t=>"number"==typeof t&&!isNaN(t))),xi=t=>t.reduce(((t,e)=>t+e),0),bi={first:t=>t[0],last:t=>t[t.length-1],min:t=>{const e=vi(t);return e.length?Math.min.apply(null,e):NaN},max:t=>{const e=vi(t);return e.length?Math.max.apply(null,e):NaN},sum:t=>{const e=vi(t);return e.length?e.reduce(((t,e)=>t+e),0):NaN},avg:t=>{const e=vi(t),n=e.length;return n?xi(e)/n:NaN}};function wi(t,e,n,i){const r={},o=i.field||(void 0!==t.field?e.field(t.field):null);return Object.keys(n).forEach((a=>{const s=n[a],l=r[a]={};-1!==["number","string","boolean"].indexOf(typeof s)?(l.type="primitive",l.value=s):"function"==typeof s?(l.type="function",l.value=s,l.label=s,l.field=o):"object"==typeof s&&(s.fields?l.fields=s.fields.map((n=>wi(t,e,{main:n},i).main)):void 0!==s.field?(l.type="field",l.field=e.field(s.field),l.value=l.field.value,l.label=l.field.label):o&&(l.value=o.value,l.label=o.label,l.field=o),"function"==typeof s.filter&&(l.filter=s.filter),void 0!==s.value&&(l.value=s.value),void 0!==s.label&&(l.label=s.label),"function"==typeof s.reduce?l.reduce=s.reduce:s.reduce?l.reduce=bi[s.reduce]:l.field&&l.field.reduce&&(l.reduce="string"==typeof l.field.reduce?bi[l.field.reduce]:l.field.reduce),"function"==typeof s.reduceLabel?l.reduceLabel=s.reduceLabel:s.reduceLabel?l.reduceLabel=bi[s.reduceLabel]:l.field&&l.field.reduceLabel&&(l.reduceLabel="string"==typeof l.field.reduceLabel?bi[l.field.reduceLabel]:l.field.reduceLabel))})),r}function ki(t,e){const{main:n}=wi(t,e,{main:{value:t.value,label:t.label,reduce:t.reduce,filter:t.filter}},{});return{props:wi(t,e,t.props||{},n),main:n}}function _i(t,e,n,i){const r=Array(t.length),o=Array(t.length);let a;for(let e=0;e<t.length;e++)a=i?t[e][i]:t[e],r[e]=a.value,o[e]=a.label;const s=e.reduce,l=e.reduceLabel,c=s?s(r):r,u={value:c,label:l?l(o,c):n?n(c):String(c)};return i&&t[0][i].source?(u.source=t[0][i].source,u):!i&&t[0].source?(u.source=t[0].source,u):u}function Mi(t,e){let{main:n,propsArr:i,props:r}=e,o=[];const a=n.field.formatter(),s={};return i.forEach((t=>{s[t]=r[t].field?r[t].field.formatter():t=>t})),o.push(...t.map((t=>{const e=_i(t.items,n,a);return i.forEach((n=>{e[n]=_i(t.items,r[n],s[n],n)})),e}))),o}function Si(t){let{cfg:e,itemData:n,obj:i,target:r,tracker:o,trackType:a}=t;const s="function"===a?e.trackBy(n):n[e.trackBy];let l=o[s];l||(l=o[s]={items:[],id:s},r.push(l)),l.items.push(i)}function Ci(t){if(t.length<1e4)return Math.max(...t);let e=-1/0;const n=t.length;for(let i=0;i<n;i++)e<t[i]&&(e=t[i]);return e}function Ni(t){if(t.length<1e4)return Math.min(...t);let e=1/0;const n=t.length;for(let i=0;i<n;i++)e>t[i]&&(e=t[i]);return e}const Ri={diverging:function(t,e){if((s=t.length)>0)for(var n,i,r,o,a,s,l=0,c=t[e[0]].length;l<c;++l)for(o=a=0,n=0;n<s;++n)(r=(i=t[e[n]][l])[1]-i[0])>=0?(i[0]=o,i[1]=o+=r):r<0?(i[1]=a,i[0]=a+=r):i[0]=o},none:zt,silhouette:function(t,e){if((n=t.length)>0){for(var n,i=0,r=t[e[0]],o=r.length;i<o;++i){for(var a=0,s=0;a<n;++a)s+=t[a][i][1]||0;r[i][1]+=r[i][0]=-s/2}zt(t,e)}},expand:function(t,e){if((i=t.length)>0){for(var n,i,r,o=0,a=t[0].length;o<a;++o){for(r=n=0;n<i;++n)r+=t[n][o][1]||0;if(r)for(n=0;n<i;++n)t[n][o][1]/=r}zt(t,e)}},wiggle:function(t,e){if((r=t.length)>0&&(i=(n=t[e[0]]).length)>0){for(var n,i,r,o=0,a=1;a<i;++a){for(var s=0,l=0,c=0;s<r;++s){for(var u=t[e[s]],h=u[a][1]||0,d=(h-(u[a-1][1]||0))/2,f=0;f<s;++f){var p=t[e[f]];d+=(p[a][1]||0)-(p[a-1][1]||0)}l+=h,c+=d*h}n[a-1][1]+=n[a-1][0]=o,l&&(o-=c/l)}n[a-1][1]+=n[a-1][0]=o,zt(t,e)}}},qi={ascending:function(t){var e=t.map(Ht);return Ft(t).sort((function(t,n){return e[t]-e[n]}))},insideout:function(t){var e,n,i=t.length,r=t.map(Ht),o=function(t){var e=t.map(Bt);return Ft(t).sort((function(t,n){return e[t]-e[n]}))}(t),a=0,s=0,l=[],c=[];for(e=0;e<i;++e)n=o[e],a<s?(a+=r[n],l.push(n)):(s+=r[n],c.push(n));return c.reverse().concat(l)},none:Ft,reverse:function(t){return Ft(t).reverse()}};function Ai(t,e,n){const i={},r=e.stackKey,o=e.value,a=e.startProp||"start",s=e.endProp||"end",l=e.offset||"none",c=e.order||"none",u=e.valueRef||"";let h=0,d={};for(let e=0;e<t.items.length;e++){let n=t.items[e],o=u?n[u]:null;if(o&&o.source){let t="".concat(o.source.key||"","/").concat(o.source.field);d[t]||(d[t]=o.source)}let a=r(n);i[a]=i[a]||{items:[]},i[a].items.push(n),h=Math.max(h,i[a].items.length)}const f=Array.apply(null,{length:h}).map(Number.call,Number),p=Object.keys(i).map((t=>i[t].items));let g=function(){var t=W([]),e=Ft,n=zt,i=Lt;function r(r){var o,a,s=t.apply(this,arguments),l=r.length,c=s.length,u=new Array(c);for(o=0;o<c;++o){for(var h,d=s[o],f=u[o]=new Array(l),p=0;p<l;++p)f[p]=h=[0,+i(r[p],d,p,r)],h.data=r[p];f.key=d}for(o=0,a=e(u);o<c;++o)u[a[o]].index=o;return n(u,a),u}return r.keys=function(e){return arguments.length?(t="function"==typeof e?e:W(bt.call(e)),r):t},r.value=function(t){return arguments.length?(i="function"==typeof t?t:W(+t),r):i},r.order=function(t){return arguments.length?(e=null==t?Ft:"function"==typeof t?t:W(bt.call(t)),r):e},r.offset=function(t){return arguments.length?(n=null==t?zt:t,r):n},r}().keys(f).value(((t,e)=>t[e]?o(t[e]):0)).order(qi[c]).offset(Ri[l])(p),m=[];for(let t=0;t<g.length;t++){let e=g[t];for(let t=0;t<e.length;t++){let n=e[t],i=e[t].data[e.key];i&&(i[a]={value:n[0]},i[s]={value:n[1]},m.push(n[0],n[1]))}}let y=Object.keys(d).map((t=>{let e=n(d[t].key);return e?e.field(d[t].field):null})).filter((t=>!!t));const v=mi({title:y.map((t=>t.title())).join(", "),min:Ni(m),max:Ci(m),type:"measure",formatter:y[0]?y[0].formatter:void 0});t.fields.push(v)}function Di(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i={};const r=n.logger;if(Array.isArray(t))i.items=t.map((t=>({value:t,label:String(t)})));else if(t){if("collection"in t)i=C({},e.collection(t.collection));else{const n=e.dataset?e.dataset(t.source):null;let o=t.value||(t=>t),a=t.label||(t=>t);if(t.groupBy||t.mapTo)r.warn('Deprecated "data" configuration',t),i.items=[];else if(t.hierarchy)i.root=n.hierarchy?n.hierarchy(t.hierarchy):null,i.fields=n.fields();else if(t.items)i.items=t.items.map((t=>({value:o(t),label:String(a(t))})));else if(t.extract){const r=Array.isArray(t.extract)?t.extract:[t.extract];i.items=[];const o=[];r.forEach((t=>{const r=t.source?e.dataset(t.source):n;r&&(i.items=[...i.items,...r.extract(t)],void 0!==t.field&&o.push(r.field(t.field)))})),o.length&&(i.fields=o),t.amend&&Array.isArray(t.amend)&&(i.items=[...i.items,...t.amend])}else if(void 0!==t.field&&n){const e=n.field(t.field);e&&(i.fields||(i.fields=[]),i.fields.push(e),"value"in t||(o=e.value||(t=>t),a=e.label||(t=>t),i.value=o),i.items=e.items().map((e=>({value:o(e),label:String(a(e)),source:{field:t.field}}))))}else t.fields&&t.fields.forEach((t=>{const r="object"==typeof t&&t.source?e.dataset(t.source):n;if(!r)return;let o;o="object"==typeof t&&void 0!==t.field?r.field(t.field):r.field(t),o&&(i.fields||(i.fields=[]),i.fields.push(o))}));i.items&&t.map&&(i.items=i.items.map(t.map))}t&&t.stack&&Ai(i,t.stack,e.dataset)}return t&&!Array.isArray(t)&&"function"==typeof t.filter&&i.items&&(i.items=i.items.filter(t.filter)),t&&!Array.isArray(t)&&"function"==typeof t.sort&&i.items&&(i.items=i.items.sort(t.sort)),i}function Ei(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Di;const r={};(t||[]).forEach((t=>{if(!t.key)throw new Error('Data collection is missing "key" property');if("object"==typeof t.data&&"collection"in t.data)throw new Error("Data config for collections may not reference other collections");r[t.key]=()=>i(t.data,e,n)}));const o=t=>{let e,n;if("string"==typeof t?e=t:"object"==typeof t&&(e=t.key,n=t),!(e in r))throw new Error("Unknown data collection: ".concat(e));"function"==typeof r[e]&&(r[e]=r[e]());let i=r[e];if(n&&n.fields&&n.fields.filter){let t=i.fields.filter(n.fields.filter);i.fields.length!==t.length&&(i=_(i,{fields:t}))}return i};return o}function Oi(t,e,n){let i,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Di;if(t.data){const i=r(t.data,e,n);if(i&&i.fields&&i.fields[0])return i.fields[0].formatter()}if(i=t.formatter?"".concat(t.formatter,"-").concat(t.type||"number"):t.type||"d3-number",n.formatter.has(i)){return n.formatter.get(i)(t.format||"")}throw new Error("Formatter of type '".concat(i,"' was not found"))}function Ii(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Oi;const r={};return{get(o){let a;return"string"==typeof o&&t[o]?a=o:"object"==typeof o&&"formatter"in o&&t[o.formatter]?a=o.formatter:"object"==typeof o&&"type"in o&&t[o.type]&&(a=o.type),a?(r[a]=r[a]||i(t[a],e,n),r[a]):i(o||{},e,n)},all(){return Object.keys(t).forEach(this.get),r}}}function Ti(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}const ji=Symbol("implicit");function Pi(){var t=new Pe,e=[],n=[],i=ji;function r(r){let o=t.get(r);if(void 0===o){if(i!==ji)return i;t.set(r,o=e.push(r)-1)}return n[o%n.length]}return r.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new Pe;for(const i of n)t.has(i)||t.set(i,e.push(i)-1);return r},r.range=function(t){return arguments.length?(n=Array.from(t),r):n.slice()},r.unknown=function(t){return arguments.length?(i=t,r):i},r.copy=function(){return Pi(e,n).unknown(i)},Ti.apply(r,arguments),r}function zi(){var t,e,n=Pi().unknown(void 0),i=n.domain,r=n.range,o=0,a=1,s=!1,l=0,c=0,u=.5;function h(){var n=i().length,h=a<o,d=h?a:o,f=h?o:a;t=(f-d)/Math.max(1,n-l+2*c),s&&(t=Math.floor(t)),d+=(f-d-t*(n-l))*u,e=t*(1-l),s&&(d=Math.round(d),e=Math.round(e));var p=We(n).map((function(e){return d+t*e}));return r(h?p.reverse():p)}return delete n.unknown,n.domain=function(t){return arguments.length?(i(t),h()):i()},n.range=function(t){return arguments.length?([o,a]=t,o=+o,a=+a,h()):[o,a]},n.rangeRound=function(t){return[o,a]=t,o=+o,a=+a,s=!0,h()},n.bandwidth=function(){return e},n.step=function(){return t},n.round=function(t){return arguments.length?(s=!!t,h()):s},n.padding=function(t){return arguments.length?(l=Math.min(1,c=+t),h()):l},n.paddingInner=function(t){return arguments.length?(l=Math.min(1,t),h()):l},n.paddingOuter=function(t){return arguments.length?(c=+t,h()):c},n.align=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),h()):u},n.copy=function(){return zi(i(),[o,a]).round(s).paddingInner(l).paddingOuter(c).align(u)},Ti.apply(h(),arguments)}function Fi(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Li(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Bi(){}var Hi=.7,$i=1/Hi,Vi="\\s*([+-]?\\d+)\\s*",Wi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ui="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Yi=/^#([0-9a-f]{3,8})$/,Xi=new RegExp(`^rgb\\(${Vi},${Vi},${Vi}\\)$`),Ki=new RegExp(`^rgb\\(${Ui},${Ui},${Ui}\\)$`),Gi=new RegExp(`^rgba\\(${Vi},${Vi},${Vi},${Wi}\\)$`),Zi=new RegExp(`^rgba\\(${Ui},${Ui},${Ui},${Wi}\\)$`),Ji=new RegExp(`^hsl\\(${Wi},${Ui},${Ui}\\)$`),Qi=new RegExp(`^hsla\\(${Wi},${Ui},${Ui},${Wi}\\)$`),tr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function er(){return this.rgb().formatHex()}function nr(){return this.rgb().formatRgb()}function ir(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Yi.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?rr(e):3===n?new lr(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?or(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?or(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Xi.exec(t))?new lr(e[1],e[2],e[3],1):(e=Ki.exec(t))?new lr(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Gi.exec(t))?or(e[1],e[2],e[3],e[4]):(e=Zi.exec(t))?or(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ji.exec(t))?pr(e[1],e[2]/100,e[3]/100,1):(e=Qi.exec(t))?pr(e[1],e[2]/100,e[3]/100,e[4]):tr.hasOwnProperty(t)?rr(tr[t]):"transparent"===t?new lr(NaN,NaN,NaN,0):null}function rr(t){return new lr(t>>16&255,t>>8&255,255&t,1)}function or(t,e,n,i){return i<=0&&(t=e=n=NaN),new lr(t,e,n,i)}function ar(t){return t instanceof Bi||(t=ir(t)),t?new lr((t=t.rgb()).r,t.g,t.b,t.opacity):new lr}function sr(t,e,n,i){return 1===arguments.length?ar(t):new lr(t,e,n,null==i?1:i)}function lr(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function cr(){return`#${fr(this.r)}${fr(this.g)}${fr(this.b)}`}function ur(){const t=hr(this.opacity);return`${1===t?"rgb(":"rgba("}${dr(this.r)}, ${dr(this.g)}, ${dr(this.b)}${1===t?")":`, ${t})`}`}function hr(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function dr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function fr(t){return((t=dr(t))<16?"0":"")+t.toString(16)}function pr(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new mr(t,e,n,i)}function gr(t){if(t instanceof mr)return new mr(t.h,t.s,t.l,t.opacity);if(t instanceof Bi||(t=ir(t)),!t)return new mr;if(t instanceof mr)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=e===o?(n-i)/s+6*(n<i):n===o?(i-e)/s+2:(e-n)/s+4,s/=l<.5?o+r:2-o-r,a*=60):s=l>0&&l<1?0:a,new mr(a,s,l,t.opacity)}function mr(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function yr(t){return(t=(t||0)%360)<0?t+360:t}function vr(t){return Math.max(0,Math.min(1,t||0))}function xr(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Fi(Bi,ir,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:er,formatHex:er,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return gr(this).formatHsl()},formatRgb:nr,toString:nr}),Fi(lr,sr,Li(Bi,{brighter(t){return t=null==t?$i:Math.pow($i,t),new lr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Hi:Math.pow(Hi,t),new lr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new lr(dr(this.r),dr(this.g),dr(this.b),hr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:cr,formatHex:cr,formatHex8:function(){return`#${fr(this.r)}${fr(this.g)}${fr(this.b)}${fr(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:ur,toString:ur})),Fi(mr,(function(t,e,n,i){return 1===arguments.length?gr(t):new mr(t,e,n,null==i?1:i)}),Li(Bi,{brighter(t){return t=null==t?$i:Math.pow($i,t),new mr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Hi:Math.pow(Hi,t),new mr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new lr(xr(t>=240?t-240:t+120,r,i),xr(t,r,i),xr(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new mr(yr(this.h),vr(this.s),vr(this.l),hr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=hr(this.opacity);return`${1===t?"hsl(":"hsla("}${yr(this.h)}, ${100*vr(this.s)}%, ${100*vr(this.l)}%${1===t?")":`, ${t})`}`}}));var br=t=>()=>t;function wr(t){return 1==(t=+t)?kr:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):br(isNaN(e)?n:e)}}function kr(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):br(isNaN(t)?e:t)}var _r=function t(e){var n=wr(e);function i(t,e){var i=n((t=sr(t)).r,(e=sr(e)).r),r=n(t.g,e.g),o=n(t.b,e.b),a=kr(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=r(e),t.b=o(e),t.opacity=a(e),t+""}}return i.gamma=t,i}(1);function Mr(t,e){e||(e=[]);var n,i=t?Math.min(e.length,t.length):0,r=e.slice();return function(o){for(n=0;n<i;++n)r[n]=t[n]*(1-o)+e[n]*o;return r}}function Sr(t,e){var n,i=e?e.length:0,r=t?Math.min(i,t.length):0,o=new Array(r),a=new Array(i);for(n=0;n<r;++n)o[n]=Er(t[n],e[n]);for(;n<i;++n)a[n]=e[n];return function(t){for(n=0;n<r;++n)a[n]=o[n](t);return a}}function Cr(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function Nr(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Rr(t,e){var n,i={},r={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?i[n]=Er(t[n],e[n]):r[n]=e[n];return function(t){for(n in i)r[n]=i[n](t);return r}}var qr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ar=new RegExp(qr.source,"g");function Dr(t,e){var n,i,r,o=qr.lastIndex=Ar.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=qr.exec(t))&&(i=Ar.exec(e));)(r=i.index)>o&&(r=e.slice(o,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:Nr(n,i)})),o=Ar.lastIndex;return o<e.length&&(r=e.slice(o),s[a]?s[a]+=r:s[++a]=r),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,i=0;i<e;++i)s[(n=l[i]).i]=n.x(t);return s.join("")})}function Er(t,e){var n,i=typeof e;return null==e||"boolean"===i?br(e):("number"===i?Nr:"string"===i?(n=ir(e))?(e=n,_r):Dr:e instanceof ir?_r:e instanceof Date?Cr:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?Mr:Array.isArray(e)?Sr:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Rr:Nr)(t,e)}function Or(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function Ir(t){return+t}var Tr=[0,1];function jr(t){return t}function Pr(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function zr(t,e,n){var i=t[0],r=t[1],o=e[0],a=e[1];return r<i?(i=Pr(r,i),o=n(a,o)):(i=Pr(i,r),o=n(o,a)),function(t){return o(i(t))}}function Fr(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),o=new Array(i),a=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<i;)r[a]=Pr(t[a],t[a+1]),o[a]=n(e[a],e[a+1]);return function(e){var n=je(t,e,1,i)-1;return o[n](r[n](e))}}function Lr(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Br(){var t,e,n,i,r,o,a=Tr,s=Tr,l=Er,c=jr;function u(){var t=Math.min(a.length,s.length);return c!==jr&&(c=function(t,e){var n;return t>e&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(a[0],a[t-1])),i=t>2?Fr:zr,r=o=null,h}function h(e){return null==e||isNaN(e=+e)?n:(r||(r=i(a.map(t),s,l)))(t(c(e)))}return h.invert=function(n){return c(e((o||(o=i(s,a.map(t),Nr)))(n)))},h.domain=function(t){return arguments.length?(a=Array.from(t,Ir),u()):a.slice()},h.range=function(t){return arguments.length?(s=Array.from(t),u()):s.slice()},h.rangeRound=function(t){return s=Array.from(t),l=Or,u()},h.clamp=function(t){return arguments.length?(c=!!t||jr,u()):c!==jr},h.interpolate=function(t){return arguments.length?(l=t,u()):l},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,i){return t=n,e=i,u()}}function Hr(){return Br()(jr,jr)}function $r(t,e,n,i){var r,o=function(t,e,n){n=+n;const i=(e=+e)<(t=+t),r=i?Ve(e,t,n):Ve(t,e,n);return(i?-1:1)*(r<0?1/-r:r)}(t,e,n);switch((i=Xt(null==i?",f":i)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=i.precision||isNaN(r=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Wt(e)/3)))-Wt(Math.abs(t)))}(o,a))||(i.precision=r),ee(i,a);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Wt(e)-Wt(t))+1}(o,Math.max(Math.abs(t),Math.abs(e))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=function(t){return Math.max(0,-Wt(Math.abs(t)))}(o))||(i.precision=r-2*("%"===i.type))}return te(i)}function Vr(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){if(!((n=+n)>0))return[];if((t=+t)==(e=+e))return[t];const i=e<t,[r,o,a]=i?$e(e,t,n):$e(t,e,n);if(!(o>=r))return[];const s=o-r+1,l=new Array(s);if(i)if(a<0)for(let t=0;t<s;++t)l[t]=(o-t)/-a;else for(let t=0;t<s;++t)l[t]=(o-t)*a;else if(a<0)for(let t=0;t<s;++t)l[t]=(r+t)/-a;else for(let t=0;t<s;++t)l[t]=(r+t)*a;return l}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var i=e();return $r(i[0],i[i.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var i,r,o=e(),a=0,s=o.length-1,l=o[a],c=o[s],u=10;for(c<l&&(r=l,l=c,c=r,r=a,a=s,s=r);u-- >0;){if((r=Ve(l,c,n))===i)return o[a]=l,o[s]=c,e(o);if(r>0)l=Math.floor(l/r)*r,c=Math.ceil(c/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,c=Math.floor(c*r)/r}i=r}return t},t}function Wr(){var t=Hr();return t.copy=function(){return Lr(t,Wr())},Ti.apply(t,arguments),Vr(t)}function Ur(){var t,e=[.5],n=[0,1],i=1;function r(r){return null!=r&&r<=r?n[je(e,r,0,i)]:t}return r.domain=function(t){return arguments.length?(e=Array.from(t),i=Math.min(e.length,n.length-1),r):e.slice()},r.range=function(t){return arguments.length?(n=Array.from(t),i=Math.min(e.length,n.length-1),r):n.slice()},r.invertExtent=function(t){var i=n.indexOf(t);return[e[i-1],e[i]]},r.unknown=function(e){return arguments.length?(t=e,r):t},r.copy=function(){return Ur().domain(e).range(n).unknown(t)},Ti.apply(r,arguments)}function Yr(t){return void 0===t?t=>t:e=>t(e)}function Xr(t){return Math.max(0,Math.min(1,t))}function Kr(t){return"object"==typeof t}function Gr(t,e,n){const i=Math.abs(e-n)/(t+1),r=[];for(let o=1;o<=t;o++){const t=o*i;r.push(e<n?e+t:e-t)}return r}function Zr(t,e,n){if(1===t.length)return t;const i=t.concat([]);for(let r=0;r<t.length;r++){let o=t[r],a=t[r+1];0===r&&o!==n.start()?(i.push(...Gr(e,o,a)),o-=a-o,a=t[r],i.push(...Gr(e,o,a))):r===t.length-1&&a!==n.end()?(a=o+(o-t[r-1]),i.push(...Gr(e,o,a))):i.push(...Gr(e,o,a))}return i.filter((t=>t>=n.min()&&t<=n.max()))}function Jr(t){let{distance:e,scale:n,minorCount:i=0,unitDivider:r=100,formatter:o}=t;const a=A(r)||A(e)?2:Math.max(e/r,2),s=Math.min(1e3,Math.round(a));let l=n.ticks(s);l.length<=1&&(l=n.ticks(s+1));const c=i>0?Zr(l,i,n):l;c.sort(((t,e)=>t-e));const u=c.map(Yr(o));return c.map(((t,e)=>{const i=n(t);return{position:i,start:i,end:i,label:u[e],value:t,isMinor:-1===l.indexOf(t)}}))}function Qr(t){let{distance:e,scale:n,minorCount:i=0,unitDivider:r=100,formatter:o}=t;const a=A(r)||A(e)?2:Math.max(e/r,2),s=Math.min(1e3,Math.round(a)),l=s>10?10:s;n.nice(l);const c=n.ticks(s),u=i>0?Zr(c,i,n):c;u.sort(((t,e)=>t-e));const h=u.map(Yr(o));return u.map(((t,e)=>{const i=n(t);return{position:i,start:i,end:i,label:h[e],value:t,isMinor:-1===c.indexOf(t)}}))}function to(t){let e,{settings:n,scale:i,distance:r,formatter:o=(t=>t)}=t;const a=n.minorTicks&&!A(n.minorTicks.count)?Math.min(100,n.minorTicks.count):0;if(Array.isArray(n.ticks.values)){e=function(t){let{values:e,scale:n,formatter:i=(t=>t)}=t;return e.sort(((t,e)=>(Kr(t)?t.value:t)-(Kr(e)?e.value:e))).filter(((t,e,i)=>{const r=Kr(t)?t.value:t;return r<=n.max()&&r>=n.min()&&i.indexOf(t)===e})).map((t=>{const e=Kr(t),r=e?t.value:t,o=n(r);return{position:o,value:r,label:e&&void 0!==t.label?t.label:i(r),isMinor:!!e&&!!t.isMinor,start:e&&!isNaN(t.start)?Xr(n(t.start)):o,end:e&&!isNaN(t.end)?Xr(n(t.end)):o}}))}({values:n.ticks.values.filter((t=>"object"==typeof t?!A(t.value):!A(t))),scale:i.copy(),formatter:o})}else if(A(n.ticks.count)){e=(n.ticks.tight?Qr:Jr)({distance:r,minorCount:a,unitDivider:n.ticks.distance,scale:i,formatter:o}),n.ticks.forceBounds&&function(t,e,n){const i=t.map((t=>t.position)),r=e.range();-1===i.indexOf(r[0])?t.splice(0,0,{position:r[0],start:r[0],end:r[0],label:n(e.start()),isMinor:!1,value:e.start()}):t[0]&&t[0].isMinor&&(t[0].isMinor=!1);const o=t[t.length-1];-1===i.indexOf(r[1])?t.push({position:r[1],start:r[1],end:r[1],label:n(e.end()),isMinor:!1,value:e.end()}):o&&o.isMinor&&(o.isMinor=!1)}(e,i,o)}else{e=function(t){let{count:e,minorCount:n,scale:i,formatter:r}=t;return i.ticks((e-1)*n+e).map(((t,e)=>{const o=i(t);return{position:o,start:o,end:o,label:r(t),isMinor:e%(n+1)!=0,value:t}}))}({count:Math.min(1e3,n.ticks.count),minorCount:a,scale:i.copy(),formatter:o})}return e}function eo(t){let{scale:e}=t;const n=e.domain(),i=e.data().items,r=e.labels?e.labels():n,o=e.bandwidth();return n.map(((t,n)=>{const a=e(t);return{position:a+o/2,label:"".concat(r[n]),data:i?i[n]:void 0,start:a,end:a+o}}))}function no(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i={};return Object.keys(e).forEach((r=>{const o=typeof t[r];i[r]="function"===o?t[r](n):"undefined"===o?e[r]:t[r]})),i}const io={min:NaN,max:NaN,expand:NaN,include:[],invert:!1},ro={tight:!1,forceBounds:!1,values:void 0,count:NaN,distance:100},oo={count:NaN};function ao(t,e){const n=+t.min,i=+t.max;let r=0,o=1;if(e&&e[0]){const n=e.map((t=>t.min())).filter((t=>!isNaN(t))),i=e.map((t=>t.max())).filter((t=>!isNaN(t)));if(r=n.length?Math.min(...n):Number.NaN,o=i.length?Math.max(...i):Number.NaN,isNaN(r)||isNaN(o))r=-1,o=1;else if(r===o&&0===r)r=-1,o=1;else if(r===o&&r)r-=Math.abs(.1*r),o+=Math.abs(.1*o);else if(!isNaN(t.expand)){const e=o-r;r-=e*t.expand,o+=e*t.expand}if(Array.isArray(t.include)){const e=t.include.filter((t=>!isNaN(t)));r=Math.min(...e,r),o=Math.max(...e,o)}}return{mini:isNaN(n)?r:n,maxi:isNaN(i)?o:i}}function so(t,e){t.instance||(t.instance=e.copy(),t.instance.domain([e.start(),e.end()]),t.instance.clamp(!0),t.instance.range(t.invert?[1,0]:[0,1]))}function lo(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=Wr(),r={instance:null,invert:!1},o={data:e,resources:n},a=no(t,io,o);let s;function l(t){return A(t)?NaN:i(t)}a.ticks=no(t.ticks,ro,o),a.minorTicks=no(t.minorTicks,oo,o),l.data=()=>e,l.invert=function(t){return i.invert(t)},l.rangeRound=function(t){return i.rangeRound(t),l},l.clamp=function(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return i.clamp(t),l},l.cachedTicks=function(){return s},l.clearTicksCache=function(){return s=void 0,this},l.ticks=function(t){return null!==t&&"object"==typeof t?(t.settings=t.settings||{},t.settings=_(!0,{},a,t.settings),t.scale=l,s=to(t),s):(s=i.ticks(t),s)},l.nice=function(t){return i.nice(t),l},l.tickFormat=function(t,e){return i.tickFormat(t,e)},l.interpolate=function(t){return i.interpolate(t),l},l.domain=function(t){return arguments.length?(i.domain(t),r.instance&&r.instance.domain([l.start(),l.end()]),l):i.domain()},l.range=function(t){return arguments.length?(i.range(t),l):i.range()},l.start=function(){return l.domain()[0]},l.end=function(){return l.domain()[this.domain().length-1]},l.min=function(){return Math.min(this.start(),this.end())},l.max=function(){return Math.max(this.start(),this.end())},l.classify=function(t){let e=(l.start()-l.end())/t,n=[l.end()],i=[],r=e/2;for(let o=0;o<t;o++){let t=n[n.length-1]||0,o=t+e,a=l(t+r);n.push(o,o),i.push(a,a)}return n.pop(),l.domain(n),l.range(i),l},l.copy=function(){const r=lo(t,e,n);return r.domain(l.domain()),r.range(l.range()),r.clamp(i.clamp()),r},l.norm=function(t){return so(r,l),r.instance(t)},l.normInvert=function(t){return so(r,l),r.instance.invert(t)};const{mini:c,maxi:u}=ao(a,e?e.fields:[]);return l.domain([c,u]),l.range(a.invert?[1,0]:[0,1]),r.invert=a.invert,l}const co={padding:0,paddingInner:NaN,paddingOuter:NaN,align:.5,invert:!1,maxPxStep:NaN,range:[0,1]};function uo(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i={data:e,resources:n},r=no(t,co,i),o=e.items||[],a={},s=[],l=[];function c(t,n){t.data=()=>e,t.datum=t=>o[a[t]],t.start=function(){return t.domain()[0]},t.end=function(){return t.domain()[t.domain().length-1]},t.labels=()=>l,t.ticks=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.scale=t,eo(e,n.trackBy)}}const u=zi();c(u,t),u.pxScale=function(e){const n=r.maxPxStep;if(isNaN(n))return u;const i=u.domain().length,o=Math.max(1,i-u.paddingInner()+2*u.paddingOuter());if(o*n>=e)return u;const a=u.copy();a.type=u.type,c(a,t);const s=o*n/e,l=(1-s)*u.align();return a.range(r.invert?[s+l,l]:[l,s+l]),a};const h="function"==typeof t.value?t.value:t=>t.datum.value,d="function"==typeof t.label?t.label:t=>t.datum.label;for(let t=0;t<o.length;t++){const e=_({datum:o[t]},i),n=h(e,t);-1===s.indexOf(n)&&(s.push(n),l.push(d(e,t)),a[n]=t)}return u.domain(s),u.range(r.invert?r.range.slice().reverse():r.range),u.padding(isNaN(r.padding)?0:r.padding),isNaN(r.paddingInner)||u.paddingInner(r.paddingInner),isNaN(r.paddingOuter)||u.paddingOuter(r.paddingOuter),u.align(isNaN(r.align)?.5:r.align),u}const ho={depth:0};function fo(t,e,n){return t.ancestors().map((t=>e(_({datum:t.data},n)))).reverse().slice(1).toString()}function po(t,e,n){const i=e.ticks.depth,r=e.value,o=e.label,a=[],s=[],l={},c=[];let u=0;if(!t)return{values:a,labels:s,items:l,ticks:c};t.eachAfter((t=>{if(t.depth>0){const e=fo(t,r,n),h=t.leaves()||[t],d=r(_({datum:t.data},n)),f=o(_({datum:t.data},n)),p=Array.isArray(t.children),g={key:e,count:h.length,value:d,label:f,leftEdge:fo(h[0],r,n),rightEdge:fo(h[Math.max(h.length-1,0)],r,n),node:t};p?(a.push("SPACER_".concat(u,"_SPACER")),u++):(a.push(e),s.push(f)),(i<=0&&!p||t.depth===i)&&c.push(g),l[e]=g}}));const h=t.height-1;return h>0&&a.splice(-h),{values:a,labels:s,items:l,ticks:c}}const go=t=>t.min(),mo=t=>t.max();function yo(t,e){const n=t&&!isNaN(t.min),i=t&&!isNaN(t.max);let r=n?+t.min:0,o=i?+t.max:1;if(e&&e.length){if(!n){const t=e.map(go).filter(q);r=t.length?Math.min(...t):r}if(!i){const t=e.map(mo).filter(q);o=t.length?Math.max(...t):o}}return[r,o]}const vo={domain:[],range:[],invert:!1,min:NaN,max:NaN};function xo(t,e,n){const i=t.length;if(2===i)return[e,n];const r=[],o=(n-e)/(i-1);r.push(e);for(let t=1;t<i-1;t++)r.push(e+o*t);return r.push(n),r}function bo(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=lo(t,e,n).clamp(!0).interpolate(_r),r=no(t,vo,{data:e,resources:n}),o=Array.isArray(r.domain)&&r.domain.length,a=Array.isArray(r.range)&&r.range.length,s=i;_(!0,s,i);const[l,c]=yo(r,e?e.fields:[]),u=o?r.domain.length:-1,h=n.theme?n.theme.palette("sequential",u>0?u:2):[],d=a?r.range:h;return s.range(r.invert?d.slice().reverse():d.slice()),s.domain(o?r.domain:xo(s.range(),l,c)),s}const wo={domain:[],range:[],invert:!1,min:NaN,max:NaN,nice:!1};function ko(t,e,n){const i=t.length;if(2===i)return[e+(n-e)/2];const r=[],o=(n-e)/i;for(let t=1;t<i;t++)r.push(e+o*t);return r}function _o(t){const e=[];for(let n=0;n<t.length-1;n++)e.push((t[n]+t[n+1])/2);return e}function Mo(t,e,n,i){n=t[0],i=t&&t.length>=2?t[t.length-1]:i;const r=bo().domain([n,i]).range(e);return[n,..._o(t),i].map((t=>r(t)))}function So(t,e,n){const i=2===t.length?10:Math.max(1,t.length),r=Wr().domain([e,n]).nice(i).ticks(i);if(!t||!t.length)return r;const o=Math.max(0,t.length-1);for(;r.length>o;)r[0]-e<=n-r[r.length-1]?r.shift():r.pop();return r}const Co={domain:[],range:[]};function No(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=Pi(),r={data:e,resources:n},o=no(t,Co,r),a="function"==typeof t.value?t.value:t=>t.datum.value,s="function"==typeof t.label?t.label:t=>t.datum.label,l=e.items||[],c={},u=[],h=[];for(let t=0;t<l.length;t++){const e=_({datum:l[t]},r),n=a(e,t);-1===u.indexOf(n)&&(u.push(n),h.push(s(e,t)),c[n]=t)}return i.data=()=>e,i.labels=()=>h,i.label=t=>h[u.indexOf(t)],i.datum=t=>l[c[t]],i.range(o.range),Array.isArray(o.domain)&&o.domain.length?i.domain(o.domain):i.domain(u),i}const Ro={domain:[],range:[],unknown:void 0},qo={domain:[],range:[],override:!1};const Ao=$t();function Do(t,e,n){let i=t.data;t.source&&(n.logger.warn("Deprecated: Scale data source configuration"),i={extract:[]},(Array.isArray(t.source)?t.source:[t.source]).forEach((t=>{i.extract.push({field:t})})));const r=Di(i,e,n);let o,a=t.type||function(t){return t.root?"h-band":t.fields&&t.fields[0]?-1!==t.fields.map((t=>"dimension"===t.type()?"band":"linear")).indexOf("linear")?"linear":"band":"linear"}(r);return"color"===a&&(a=r.fields&&r.fields[0]&&"dimension"===r.fields[0].type()?"categorical-color":"sequential-color"),n.scale.has(a)&&(o=n.scale.get(a),o=o(t,r,{theme:n.theme,logger:n.logger}),o.type=a),o}function Eo(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Do;const r={};return{get(o){let a;return"string"==typeof o&&t[o]?a=o:"object"==typeof o&&"scale"in o&&t[o.scale]&&(a=o.scale),a?(r[a]=r[a]||i(t[a],e,n),r[a]):i(o,e,n)},all(){return Object.keys(t).forEach(this.get),r}}}Ao("linear",lo),Ao("band",uo),Ao("h-band",(function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={data:n,resources:i},o=no(e,co,r);o.ticks=no(e.ticks,ho,r),o.value="function"==typeof e.value?e.value:t=>t.datum.value,o.label="function"==typeof e.label?e.label:t=>t.datum.value;let a=uo(o);const{values:s,labels:l,items:c,ticks:u}=po(n.root,o,r),h=function(t){const e=String(t),n=c[e];return a(n?o.invert?n.rightEdge:n.leftEdge:e)};_(!0,h,a),h.bandwidth=function(t){const e=c[String(t)],n=a.bandwidth();if(e&&!e.isLeaf){const t=h(e.leftEdge),i=h(e.rightEdge);return Math.abs(t-i)+n}return n},h.step=function(t){const e=c[String(t)],n=e?e.count:1;let i=a.step();return i*=n,i},h.data=()=>n,h.datum=t=>{const e=c[String(t)];return e?e.node.data:null},h.copy=()=>t(e,n,i),h.labels=()=>l,h.ticks=()=>u.map((t=>{const e=h(t.key),n=h.bandwidth(t.key);return{position:e+n/2,label:t.label,data:t.node.data,start:e,end:e+n}}));const d=a.pxScale;return h.pxScale=function(t){return a=d(t),h},h.domain(s),h})),Ao("sequential-color",bo),Ao("threshold-color",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=Ur(),r=no(t,wo,{data:e,resources:n}),o=Array.isArray(r.domain)&&r.domain.length,a=Array.isArray(r.range)&&r.range.length;function s(t){return A(t)?NaN:i(t)}Object.keys(i).forEach((t=>s[t]=i[t]));const l=e.fields,[c,u]=yo(r,l),h=o?r.domain.length:-1,d=n.theme?n.theme.palette("sequential",h>0?h:2):[];let f=a?r.range:d,p=[];return p=o?r.domain:r.nice?So(f,c,u):[c+(u-c)/2],f.length>p.length+1?p=ko(f,c,u):f.length<p.length+1&&(f=Mo(p,f,c,u)),s.data=()=>e,s.range(r.invert?f.slice().reverse():f),s.domain(p),s})),Ao("categorical-color",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=No(t,e,n),r=n.theme,o=no(t,Ro,{data:e,resources:n});let a;if(o.explicit=no(t.explicit,qo,{data:e,resources:n}),a=Array.isArray(o.range)&&0!==o.range.length?o.range.slice():r?r.palette("categorical",i.domain().length).slice():[],o.unknown)i.unknown(o.unknown);else if(r&&r.palette("unknown")){let t=r.palette("unknown");i.unknown(t[0])}if(Array.isArray(o.explicit.domain)&&o.explicit.domain.length){const t=i.domain().slice(),e=o.explicit.domain,n=Array.isArray(o.explicit.range)?o.explicit.range:[],r=Math.floor(t.length/a.length);for(let t=1;t<r+1;t*=2)a=a.concat(a);if(o.explicit.override)for(let i=0;i<e.length;i++){const r=t.indexOf(e[i]);r>-1&&(a[r]=n[i])}else{e.map(((e,i)=>[t.indexOf(e),e,n[i]])).sort(((t,e)=>t[0]-e[0])).forEach((e=>{const n=t.indexOf(e[1]);-1!==n&&a.splice(n,0,e[2])}))}a.length=t.length}return i.range(a),i}));var Oo={};function Io(){Io.init.call(this)}Oo.isObject=function(t){return"object"==typeof t&&null!==t},Oo.isNumber=function(t){return"number"==typeof t},Oo.isUndefined=function(t){return void 0===t},Oo.isFunction=function(t){return"function"==typeof t};var To=Io;Io.EventEmitter=Io,Io.prototype._events=void 0,Io.prototype._maxListeners=void 0,Io.defaultMaxListeners=10,Io.init=function(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0},Io.prototype.setMaxListeners=function(t){if(!Oo.isNumber(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},Io.prototype.emit=function(t){var e,n,i,r,o,a;if(this._events||(this._events={}),"error"===t&&!this._events.error)throw(e=arguments[1])instanceof Error?e:Error('Uncaught, unspecified "error" event.');if(n=this._events[t],Oo.isUndefined(n))return!1;if(Oo.isFunction(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,r=new Array(i-1),o=1;o<i;o++)r[o-1]=arguments[o];n.apply(this,r)}else if(Oo.isObject(n)){for(i=arguments.length,r=new Array(i-1),o=1;o<i;o++)r[o-1]=arguments[o];for(i=(a=n.slice()).length,o=0;o<i;o++)a[o].apply(this,r)}return!0},Io.prototype.addListener=function(t,e){var n;if(!Oo.isFunction(e))throw TypeError("listener must be a function");(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,Oo.isFunction(e.listener)?e.listener:e),this._events[t]?Oo.isObject(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,Oo.isObject(this._events[t])&&!this._events[t].warned)&&((n=Oo.isUndefined(this._maxListeners)?Io.defaultMaxListeners:this._maxListeners)&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,Oo.isFunction(console.error)&&console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),Oo.isFunction(console.trace)&&console.trace()));return this},Io.prototype.on=Io.prototype.addListener,Io.prototype.once=function(t,e){if(!Oo.isFunction(e))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(t,i),n||(n=!0,e.apply(this,arguments))}return i.listener=e,this.on(t,i),this},Io.prototype.removeListener=function(t,e){var n,i,r,o;if(!Oo.isFunction(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=(n=this._events[t]).length,i=-1,n===e||Oo.isFunction(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(Oo.isObject(n)){for(o=r;o-- >0;)if(n[o]===e||n[o].listener&&n[o].listener===e){i=o;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},Io.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],Oo.isFunction(n))this.removeListener(t,n);else if(Array.isArray(n))for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},Io.prototype.listeners=function(t){return this._events&&this._events[t]?Oo.isFunction(this._events[t])?[this._events[t]]:this._events[t].slice():[]},Io.listenerCount=function(t,e){return t._events&&t._events[e]?Oo.isFunction(t._events[e])?1:t._events[e].length:0};var jo={mixin:t=>(Object.keys(To.prototype).forEach((e=>{t[e]=To.prototype[e]})),To.init(t),t)};function Po(){let t=0,e=0,n=0,i=0;n=n||t;const r={move(t){this.moveTo(n+t)},moveTo(o){const a=Math.max(t,Math.min(e-i,o));n!==a&&(n=a,r.emit("update"))},update(o){let a=!1;({min:t=t,max:e=e}=o),void 0!==o.viewSize&&o.viewSize!==i&&(i=o.viewSize,a=!0);const s=Math.max(t,Math.min(e-i,n));n!==s&&(n=s,a=!0),a&&r.emit("update")},getState:()=>({min:t,max:e,start:n,viewSize:i})};return jo.mixin(r),r}function zo(t,e){const n=t.min||0,i=t.max||0,r=t.viewSize||0,o=e||Po();return o.update({min:n,max:i,viewSize:r}),o}function Fo(t,e){const n={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=zo(t[i],e?e[i]:null));return n}function Lo(t,e){return e[t]||(e[t]=Po()),e[t]}function Bo(t,e){return t<=e}function Ho(t,e){return t<e}function $o(t,e,n){let i=0;for(;i<t.length&&e>t[i];)++i;return t[i]===e&&n&&++i,i}function Vo(t,e,n,i){const r=t.length;for(let o=1;o<r;o+=2)if(n(t[o-1],e)&&i(e,t[o]))return!0;return!1}function Wo(){let t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=[];function r(){}return r.configure=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{includeMax:i=!0,includeMin:r=!0}=n;t=i?Bo:Ho,e=r?Bo:Ho},r.add=t=>{let{min:e,max:n}=t;const r=$o(i,e),o=$o(i,n,!0),a=[r,o-r];r%2==0&&a.push(e),o%2==0&&a.push(n);const s=i.join(",");i.splice(...a);return s!==i.join(",")},r.remove=t=>{let{min:e,max:n}=t;const r=$o(i,e),o=$o(i,n,!0),a=[r,o-r];r%2==1&&a.push(e),o%2==1&&a.push(n);const s=i.join(",");i.splice(...a);return s!==i.join(",")},r.set=t=>{const e=i.join(",");i=[],Array.isArray(t)?t.forEach(r.add):r.add(t);return e!==i.join(",")},r.clear=()=>{const t=i.length>0;return i=[],t},r.containsValue=n=>Vo(i,n,e,t),r.containsRange=t=>{let{min:e,max:n}=t;const r=$o(i,e,!0),o=$o(i,n);return r===o&&o%2==1},r.toggle=t=>r.containsRange(t)?r.remove(t):r.add(t),r.ranges=()=>{const t=[];for(let e=1;e<i.length;e+=2)t.push({min:i[e-1],max:i[e]});return t},r.configure(n),r}function Uo(){let t=[];function e(){}return e.add=e=>-1===t.indexOf(e)&&(t.push(e),!0),e.remove=e=>{const n=t.indexOf(e);return-1!==n&&(t.splice(n,1),!0)},e.contains=e=>-1!==t.indexOf(e),e.values=()=>t.slice(),e.clear=()=>t=[],e.toString=()=>t.join(";"),e}const Yo={key:void 0,includeMin:!0,includeMax:!0};function Xo(t){let{items:e,collection:n,vc:i}=t;const r={},o=[];let a,s;for(let t=0,o=e.length;t<o;t++){a=e[t].key,n[a]||(n[a]=i()),s=e[t].values||[e[t].value];for(let t=0;t<s.length;t++)n[a].add(s[t])&&(r[a]=r[a]||[],r[a].push(s[t]))}const l=Object.keys(r);for(let t=0,e=l.length;t<e;t++)a=l[t],o.push({id:a,values:r[a]});return o}function Ko(t){let{items:e,collection:n}=t;const i={},r=[];let o,a;for(let t=0,r=e.length;t<r;t++)if(o=e[t].key,n[o]){a=e[t].values||[e[t].value];for(let t=0;t<a.length;t++)n[o].remove(a[t])&&(i[o]=i[o]||[],i[o].push(a[t]))}const s=Object.keys(i);for(let t=0,e=s.length;t<e;t++)o=s[t],r.push({id:o,values:i[o]});return r}function Go(t){const e={};let n,i;for(let r=0,o=t.length;r<o;r++){n=t[r].key,i=t[r].values||[t[r].value],e[n]||(e[n]=[]);for(let t=0;t<i.length;t++){-1===e[n].indexOf(i[t])&&e[n].push(i[t])}}return e}function Zo(t){let{key:e,collection:n,obj:i,fn:r,value:o}=t;n[e]||(n[e]=r()),i[e]=i[e]||[],i[e].push(o),n[e].add(o)}function Jo(t){let{items:e,values:n,vc:i}=t;const r={},o={},a=[],s=[],l=Go(e);let c,u,h;const d=Object.keys(l);for(let t=0,e=d.length;t<e;t++){c=d[t],h=l[c];for(let t=0,e=h.length;t<e;t++)u=h[t],n[c]&&n[c].contains(u)?n[c]&&n[c].contains(u)&&(o[c]=o[c]||[],o[c].push(u),n[c].remove(u)):Zo({key:c,value:u,collection:n,obj:r,fn:i})}const f=Object.keys(r);for(let t=0,e=f.length;t<e;t++)c=f[t],a.push({id:c,values:r[c]});const p=Object.keys(o);for(let t=0,e=p.length;t<e;t++)c=p[t],s.push({id:c,values:o[c]});return[a,s]}function Qo(t,e){const n=[],i=Object.keys(t);let r,o;const a=t=>-1===e[r].indexOf(t);for(let s=0,l=i.length;s<l;s++)r=i[s],e[r]?(o=t[r].filter(a),o.length&&n.push({id:r,values:o})):n.push({id:r,values:t[r]});return n}function ta(t){let{items:e,vCollection:n,vc:i}=t;const r={},o=Go(e);let a,s=[],l=[];const c={},u=Object.keys(n);for(let t=0,e=u.length;t<e;t++)a=u[t],c[a]=n[a].values().slice(),delete n[a];const h=t=>{n[a]&&n[a].contains(t)||Zo({key:a,value:t,collection:n,obj:r,fn:i})},d=Object.keys(o);for(let t=0,e=d.length;t<e;t++)a=d[t],o[a].forEach(h);return l=Qo(c,r),s=Qo(r,c),[s,l]}function ea(t,e,n){const i=function(t,e){if(!Object.keys(e).length)return t;const n=t.length,i=Array(n);for(let r=0;r<n;r++)i[r]=t[r].key in e?_({},t[r],{key:e[t[r].key]}):t[r];return i}(e,n);return t&&t.length?t.reduce(((t,e)=>e(t)),i):i}function na(t){return t.replace(/(-[a-z])/g,(t=>t.toUpperCase().replace("-","")))}function ia(t){return t.replace(/([A-Z])/g,(t=>"-".concat(t.toLowerCase())))}function ra(t,e,n){let{ranges:i,interceptors:r,rc:o,aliases:a,rangeConfig:s}=n;const l=ea(r["".concat(e,"Ranges")],t,a);let c=!1;return l.forEach((t=>{const n=t.key;if(i[n]||(i[n]=o(s.sources[n]||s.default)),"set"===e)c=i[n][e](t.ranges||t.range)||c;else{const r=t.ranges||[t.range];for(let t=0;t<r.length;t++)c=i[n][e](r[t])||c}})),c}function oa(){let{vc:t=Uo,rc:e=Wo}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!1,i={},r={},o={},a={sources:{},default:_({},Yo)};const s={addValues:[],removeValues:[],toggleValues:[],setValues:[],addRanges:[],setRanges:[],removeRanges:[],toggleRanges:[]},l=()=>{const t={values:{},ranges:{}};return Object.keys(r).forEach((e=>{t.values[e]=r[e].values()})),Object.keys(i).forEach((e=>{t.ranges[e]=i[e].ranges()})),t},c={ls:[],clear(){this.ls.forEach((t=>t.clear()))},start(){this.ls.forEach((t=>t.start()))},end(){this.ls.forEach((t=>t.end()))},update(){const t=l();this.ls.forEach((e=>e._state(t)))},updateValues(){const t=l();this.ls.forEach((e=>e._state({values:t.values})))},updateRanges(){const t=l();this.ls.forEach((e=>e._state({ranges:t.ranges})))}},u={configure:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Array.isArray(t.ranges)&&t.ranges.length&&(a={sources:{},default:_({},Yo)},t.ranges.forEach((t=>{const e={};Object.keys(Yo).filter((t=>"key"!==t)).forEach((n=>{e[n]=void 0!==t[n]?t[n]:Yo[n]})),void 0!==t.key?a.sources[t.key]=e:a.default=e})),Object.keys(i).forEach((t=>i[t].configure(a.sources[t]||a.default))),u.emit("update",[],[]))},link:t=>{if(u===t)throw new Error("Can't link to self");c.ls.push(t),t._state(l())},_state:t=>{if(!t)return l();if(t.values){const e=[];Object.keys(t.values).forEach((n=>{r[n]&&t.values[n].join(";")===r[n].toString()||e.push({key:n,values:t.values[n]})})),Object.keys(r).forEach((n=>{t.values[n]||e.push({key:n,values:[]})})),e.length&&u.setValues(e)}if(t.ranges){const e=[];Object.keys(t.ranges).forEach((n=>{i[n]&&t.ranges[n].join(";")===i[n].toString()||e.push({key:n,ranges:t.ranges[n]})})),Object.keys(i).forEach((n=>{t.ranges[n]||e.push({key:n,ranges:[]})})),e.length&&u.setRanges(e)}},start:function(){if(!n){n=!0;for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];u.emit("start",...e),c.start()}},end:function(){if(n){n=!1,i={},r={};for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];u.emit("end",...e),c.end()}},isActive:()=>n,clear:()=>{const t=u.brushes().filter((t=>"value"===t.type&&t.brush.values().length)).map((t=>({id:t.id,values:t.brush.values()}))),e=Object.keys(i).length>0||t.length;i={},r={},e&&(u.emit("update",[],t),c.clear())},brushes:()=>{let t=[];return t=t.concat(Object.keys(i).map((t=>({type:"range",id:t,brush:i[t]})))),t=t.concat(Object.keys(r).map((t=>({type:"value",id:t,brush:r[t]})))),t},addValue:(t,e)=>{u.addValues([{key:t,value:e}])},addValues:e=>{const i=ea(s.addValues,e,o),a=Xo({vc:t,collection:r,items:i});u.emit("add-values",i),a.length&&(n||(n=!0,u.emit("start")),u.emit("update",a,[]),c.updateValues())},setValues:e=>{const i=ea(s.setValues,e,o),a=ta({items:i,vCollection:r,vc:t});u.emit("set-values",i),(a[0].length>0||a[1].length>0)&&(n||(n=!0,u.emit("start")),u.emit("update",a[0],a[1]),c.updateValues())},removeValue:(t,e)=>{u.removeValues([{key:t,value:e}])},removeValues:t=>{const e=ea(s.removeValues,t,o),n=Ko({collection:r,items:e});u.emit("remove-values",e),n.length&&(u.emit("update",[],n),c.updateValues())},addAndRemoveValues:(e,i)=>{const a=ea(s.addValues,e,o),l=ea(s.removeValues,i,o),h=Xo({vc:t,collection:r,items:a}),d=Ko({collection:r,items:l});u.emit("add-values",a),u.emit("remove-values",l),(h.length||d.length)&&(n||(n=!0,u.emit("start")),u.emit("update",h,d),c.updateValues())},toggleValue:(t,e)=>{u.toggleValues([{key:t,value:e}])},toggleValues:e=>{const i=ea(s.toggleValues,e,o),a=Jo({items:i,values:r,vc:t});u.emit("toggle-values",i),(a[0].length>0||a[1].length>0)&&(n||(n=!0,u.emit("start")),u.emit("update",a[0],a[1]),c.updateValues())},containsValue:(t,e)=>{let n=o[t]||t;return!!r[n]&&r[n].contains(e)},addRange:(t,e)=>{u.addRanges([{key:t,range:e}])},addRanges:t=>{ra(t,"add",{ranges:i,rc:e,interceptors:s,aliases:o,rangeConfig:a})&&(n||(n=!0,u.emit("start")),u.emit("update",[],[]),c.updateRanges())},removeRange:(t,e)=>{u.removeRanges([{key:t,range:e}])},removeRanges:t=>{ra(t,"remove",{ranges:i,rc:e,interceptors:s,aliases:o,rangeConfig:a})&&(n||(n=!0,u.emit("start")),u.emit("update",[],[]),c.updateRanges())},setRange:(t,e)=>{u.setRanges([{key:t,range:e}])},setRanges:t=>{ra(t,"set",{ranges:i,rc:e,interceptors:s,aliases:o,rangeConfig:a})&&(n||(n=!0,u.emit("start")),u.emit("update",[],[]),c.updateRanges())},toggleRange:(t,e)=>{u.toggleRanges([{key:t,range:e}])},toggleRanges:t=>{ra(t,"toggle",{ranges:i,rc:e,interceptors:s,aliases:o,rangeConfig:a})&&(n||(n=!0,u.emit("start")),u.emit("update",[],[]),c.updateRanges())},containsRangeValue:(t,e)=>{let n=o[t]||t;return!!i[n]&&i[n].containsValue(e)},containsRange:(t,e)=>{let n=o[t]||t;return!!i[n]&&i[n].containsRange(e)},containsMappedData:(t,e,n)=>{let a=[];const s=Object.keys(t);let l,c,u,h;for(let e=0,n=s.length;e<n;e++){if(l=s[e],"value"===l)c=t,a[e]={key:"",i:e,bool:!1};else{if("source"===l)continue;c=t[l],a[e]={key:l,i:e,bool:!1}}u=c.source&&c.source.field,void 0!==u&&(void 0!==c.source.key&&(u="".concat(c.source.key,"/").concat(u)),u in o&&(u=o[u]),h=c.value,i[u]?a[e].bool=Array.isArray(h)?i[u].containsRange({min:h[0],max:h[1]}):i[u].containsValue(h):r[u]&&r[u].contains(h)&&(a[e].bool=!0))}return e?(a=a.filter((t=>-1!==e.indexOf(t.key))),"and"===n?!!a.length&&!a.some((t=>!1===t.bool)):"xor"===n?!!a.length&&a.some((t=>t.bool))&&a.some((t=>!1===t.bool)):a.some((t=>t.bool))):a.some((t=>t.bool))},intercept:(t,e)=>{const n=na(t);s[n]&&s[n].push(e)},removeInterceptor:(t,e)=>{const n=na(t);if(!s[n])return;const i=s[n].indexOf(e);-1!==i&&s[n].splice(i,1)},removeAllInterceptors:t=>{const e=[];if(t){const n=na(t);s[n]&&s[n].length&&e.push({name:t,handlers:s[n]})}else Object.keys(s).forEach((t=>{s[t].length&&e.push({name:ia(t),handlers:s[t]})}));e.forEach((t=>{t.handlers.slice().forEach((e=>u.removeInterceptor(t.name,e)))}))},addKeyAlias:(t,e)=>{o[t]=e},removeKeyAlias:t=>{delete o[t]}};return jo.mixin(u),u}function aa(t){return t*t*t}function sa(t){return--t*t*t+1}function la(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}function ca(t,e){return t.data?t.data.value:"text"===t.type?t.text:e}function ua(t,e,n,i){let r,{old:o,current:a}=t,{renderer:s}=e,l=[],c={nodes:[],ips:[]},u={nodes:[],ips:[]},h={nodes:[],ips:[]},d=[],f=null;const p=n.trackBy||ca,g={start(){let t={};if(o.forEach(((e,n)=>{let i=p(e,n);t[i]=e})),a.forEach(((e,n)=>{let i=p(e,n);if(t[i]){if("path"===e.type&&e.points&&e.points.length>0&&"trend"!==e.data.source.key){const n=function(t,e){const n=t.points.filter((t=>!t.dummy)),i=e.points.filter((t=>!t.dummy)),r=i.map((t=>t.data.major.value)),o=n.filter((t=>r.includes(t.data.major.value))).map((t=>t.data.major.value));return{old:n.filter((t=>o.includes(t.data.major.value))),current:i.filter((t=>o.includes(t.data.major.value)))}}(t[i],e);h.ips.push(Rr(_({},t[i],{points:n.old}),_({},e,{points:n.current}))),l.push(_({},t[i],{commonPoints:n.old}))}else h.ips.push(Rr(t[i],e)),l.push(t[i]);h.nodes.push(e),t[i]=!1}else c.nodes.push(e),c.ips.push(Rr(_({},e,{r:.001,opacity:0}),e))})),Object.keys(t).forEach((e=>{t[e]&&(u.nodes.push(t[e]),u.ips.push(Rr(t[e],_({},t[e],{r:1e-4,opacity:0}))))})),d.push({name:"exiting",easing:aa,duration:200,tweens:u.ips,nodes:[...l]}),d.push({name:"updating",easing:la,duration:400,tweens:h.ips,nodes:[]}),d.push({name:"entering",easing:sa,duration:200,tweens:c.ips,nodes:[...h.nodes]}),n.isMainComponent){var e;const t=null===(e=n.isMainComponent)||void 0===e?void 0:e.filterFn,r=t?l.filter(t).length:l.length,{isInit:o,shouldBeRemoved:a}=i.getValue("animations.updatingStageMeta");!1===o?(i.setValue("animations.updatingStageMeta.shouldBeRemoved",0===r),i.setValue("animations.updatingStageMeta.isInit",!0)):i.setValue("animations.updatingStageMeta.shouldBeRemoved",a&&0===r)}d.length&&(f=s.getScene(a),d[0].started=Date.now(),"undefined"!=typeof window&&(r=window.requestAnimationFrame(g.tick)))},tick(){let t=d[0];t||g.stop(),t.started||(t.started=Date.now());let e=(Date.now()-t.started)/t.duration,n=[],o=t.tweens.map((n=>n(t.easing(Math.min(1,e)))));if(n.push(...o),n.push(...t.nodes),s.render(n),e>=1){d.shift();const{isInit:t,shouldBeRemoved:e}=i.getValue("animations.updatingStageMeta");d.length?"updating"===d[0].name&&e&&d.shift():(!0===t&&i.setValue("animations.updatingStageMeta.isInit",!1),g.stop())}r&&(r=window.requestAnimationFrame(g.tick))},stop(){r&&(window.cancelAnimationFrame(r),r=!1)},inProgress:()=>!!r,get targetScene(){return f}};return g}$t();const ha={fontFamily:"Arial",fontSize:"13px",color:"#595959",backgroundColor:"#ffffff",stroke:"#000000",strokeWidth:0,$fill:"#333333"},da=/^\$/;function fa(t){const e=typeof t;return"object"!==e&&"function"!==e&&"undefined"!==e}function pa(t,e,n){const i=t[e];i&&i.scale&&i.scale.pxScale?i.scale=i.scale.pxScale(n):i&&i.pxScale&&(t[e]=i.pxScale(n))}function ga(t,e){return t.pxScale?t.pxScale(e):t}const ma={normalizeSettings:function(t,e,n){const i=_({},t),r=_({},e);return Object.keys(i).forEach((t=>{r[t]={};const o=i[t],a=typeof o;if("function"==typeof o)r[t].fn=o;else if(fa(o)){let n=e[t];"string"==typeof n&&da.test(n)&&(n=ha[n]);const i=typeof n;r[t]="undefined"===i||i===a?o:n}else o&&"object"==typeof o&&("function"==typeof o.fn&&(r[t].fn=o.fn),void 0!==o.scale&&(r[t].scale=n.scale(o.scale)),"string"==typeof o.ref&&(r[t].ref=o.ref))})),Object.keys(e).forEach((t=>{if(t in i)return;const n=e[t];"string"===typeof n&&da.test(n)?r[t]=ha[n]:r[t]=n})),r},resolveForItem:function(t,e,n){const i={},r=Object.keys(e),o=r.length,a=t.datum,s=t.datum;for(let l=0;l<o;l++){const o=r[l],c=e[o],u="object"==typeof s&&void 0!==c,h=u&&"string"==typeof c.ref,d=u&&o in s,f=h?s[c.ref]:d?s[o]:a;fa(c)?i[o]=c:u&&c.fn?(c.scale&&(t.scale=c.scale),i[o]=c.fn.call(null,t,n)):u&&c.scale&&f?(i[o]=c.scale(f.value),c.scale.bandwidth&&(i[o]+=c.scale.bandwidth()/2)):h&&f?i[o]=f.value:c.fn?i[o]=c.fn.call(null,t,n):i[o]=c}return i},updateScaleSize:pa};function ya(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ma,n={};function i(i){let{data:r,settings:o,defaults:a={},scaled:s}=i;const l=n.norm=e.normalizeSettings(o,a,t.chart),c={scale:t.chart.scale,formatter:t.chart.formatter};s&&Object.keys(s).forEach((t=>{l[t]&&e.updateScaleSize(l,t,s[t])}));const u=[];if(!r||!Array.isArray(r.items)){const t={data:r,resources:c};let i=e.resolveForItem(t,n.norm,-1);return{settings:n.norm,item:i}}{let t;for(let i=0,o=r.items.length;i<o;i++){t={datum:r.items[i],data:r,resources:c};let o=e.resolveForItem(t,n.norm,i);o.data=r.items[i],u.push(o)}}return{settings:n.norm,items:u}}return{resolve:i}}function va(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return t.reduce(((t,e)=>Array.isArray(e.children)?(t.push(...va(e.children)),t):(t.push(e),t)),[])}function xa(t,e){let{context:n,data:i,style:r,filter:o,mode:a}=e;const s=t.chart.brush(n),l=i,c=r.active||{},u=r.inactive||{},h=[];Object.keys(c).forEach((t=>{h.push(t)})),Object.keys(u).forEach((t=>{-1===h.indexOf(t)&&h.push(t)}));const d=[];let f=!1;const p=()=>{let e=va(t.nodes);return"function"==typeof o&&(e=e.filter(o)),e},g=()=>{const t=p(),e=t.length;let n,i=!1;const r="function"==typeof l?l({brush:s}):l;for(let i=0;i<e;i++){if(n=t[i].data,!n)continue;t[i].__style||(t[i].__style={},h.forEach((e=>{t[i].__style[e]=t[i][e]})));const e=s.containsMappedData(n,r,a),o=d.indexOf(t[i]);let l=!1;e&&-1===o?(d.push(t[i]),l=!0):e||-1===o||(d.splice(o,1),l=!0),t[i].needToUpdate=l||f,t[i].isActive=e}for(let r=0;r<e;r++)if(n=t[r].data,n){if(t[r].needToUpdate){const e=_({},t[r],t[r].__style),n=t[r].isActive;h.forEach((i=>{t[r][i]=n&&i in c?"function"==typeof c[i]?c[i].call(null,e,d):c[i]:!n&&i in u?"function"==typeof u[i]?u[i].call(null,e,d):u[i]:t[r].__style[i]})),i=!0}delete t[r].needToUpdate}return f=!1,i},m=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{suppressRender:!1};const{suppressRender:n}=e,i=p(),r=i.length;for(let t=0;t<r;t++)i[t].data&&(i[t].__style=i[t].__style||{},h.forEach((e=>{i[t].__style[e]=i[t][e],e in u&&(i[t][e]="function"==typeof u[e]?u[e].call(null,i[t]):u[e])})));f=!0,d.length=0,n||t.renderer.render(t.nodes)},y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{suppressRender:!1};const{suppressRender:n}=e,i=p(),r=i.length;for(let t=0;t<r;t++)i[t].__style&&(Object.keys(i[t].__style).forEach((e=>{i[t][e]=i[t].__style[e]})),i[t].__style=void 0);d.length=0,n||t.renderer.render(t.nodes)},v=()=>{if(g()){const e="function"==typeof t.config.sortNodes?t.config.sortNodes(t):t.nodes;"function"==typeof t.config.customRender?t.config.customRender({render:t.renderer.render,nodes:e}):t.renderer.render(e)}};return s.on("start",m),s.on("end",y),s.on("update",v),{isActive:()=>s.isActive(),update:()=>{d.length=0,f=!0,g()},cleanUp:function(){s.removeListener("start",m),s.removeListener("end",y),s.removeListener("update",v)}}}function ba(t){let{nodes:e,action:n,chart:i,trigger:r}=t;const o=[];for(let t=0;t<e.length;t++){let n=e[t].data;null!==n&&o.push(n)}!function(t){let{dataPoints:e,action:n,chart:i,trigger:r}=t;if(!r)return;const o=r.data||[""];let a={items:[],actionFn:"toggleRanges"},s={items:[],actionFn:"toggleValues"};-1!==["add","remove","set","toggle"].indexOf(n)&&(a.actionFn="".concat(n,"Ranges"),s.actionFn="".concat(n,"Values"));for(let t=0;t<e.length;t++){const n=e[t];n&&o.forEach((t=>{let e=n&&!t?n:n[t];if(e){let t={key:e.source.field};void 0!==e.source.key&&(t.key="".concat(e.source.key,"/").concat(e.source.field)),Array.isArray(e.value)?(t.range={min:e.value[0],max:e.value[1]},a.items.push(t)):(t.value=e.value,s.items.push(t))}}))}r.contexts.forEach((t=>{a.items.length?i.brush(t)[a.actionFn](a.items):i.brush(t)[s.actionFn](s.items)}))}({dataPoints:o,action:n,chart:i,trigger:r})}function wa(t){let{collisions:e,t:n,config:i,action:r}=t,o=[],a=!1;e.length>0&&(o=e,a=!0,"stop"===n.propagation&&(o=[e[e.length-1]]));return ba({nodes:o.map((t=>t.node)),action:r,chart:i.chart,data:i.data,trigger:n}),a}function ka(t,e,n){const i=n.element().getBoundingClientRect();let r=R(t)?function(t,e){return 1!==t.changedTouches.length?null:{x:t.changedTouches[0].clientX-e.left,y:t.changedTouches[0].clientY-e.top}}(t,i):function(t,e){return{x:t.clientX-e.left,y:t.clientY-e.top}}(t,i);return null===r||r.x<0||r.y<0||r.x>i.width||r.y>i.height?[]:(e.touchRadius>0&&R(t)?r={cx:r.x,cy:r.y,r:e.touchRadius}:e.mouseRadius>0&&!R(t)&&(r={cx:r.x,cy:r.y,r:e.mouseRadius}),n.itemsAt(r))}function _a(t,e,n){return t?"function"==typeof t?t(e):t:n}function Ma(t){let{e:e,t:n,config:i}=t;return wa({collisions:ka(e,n,i.renderer),t:n,config:i,action:_a(n.action,e,"toggle")})}function Sa(t){let{e:e,t:n,config:i}=t;return wa({collisions:ka(e,n,i.renderer),t:n,config:i,action:_a(n.action,e,"set")})}const Ca={fill:"fill",stroke:"stroke",opacity:"opacity",strokeWidth:"stroke-width",strokeLinejoin:"stroke-linejoin",fontFamily:"font-family",fontSize:"font-size",fontWeight:"font-weight",baseline:"dominant-baseline",dominantBaseline:"dominant-baseline",anchor:"text-anchor",textAnchor:"text-anchor",maxWidth:"maxWidth",transform:"transform",strokeDasharray:"stroke-dasharray",id:"id"};function Na(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n="";for(let e=0;e<t.length;e++){const i=t[e];n+=0===e?"M".concat(i.x," ").concat(i.y):"L".concat(i.x," ").concat(i.y),n+=" "}return e&&(n+="Z"),n}function Ra(t,e,n,i){const r=n/2,o=t-i/2,a=e-i/2,s=t-r,l=e-r;return[{x:o,y:a},{x:o,y:l},{x:o+i,y:l},{x:o+i,y:a},{x:s+n,y:a},{x:s+n,y:a+i},{x:o+i,y:a+i},{x:o+i,y:l+n},{x:o,y:l+n},{x:o,y:a+i},{x:s,y:a+i},{x:s,y:a}]}function qa(t){return-t/180*Math.PI}function Aa(t){return function(t){let e=(.5*(Math.floor(t/Math.PI*2)+2)+.25)*Math.PI,n=Math.cos(Math.abs(e-t))*Math.sqrt(2),i=n*Math.cos(t),r=n*Math.sin(t);return{x1:i<0?1:0,y1:r<0?1:0,x2:i>=0?i:i+1,y2:r>=0?r:r+1}}(qa(t))}function Da(t,e){return{x:t.x+e.x,y:t.y+e.y}}function Ea(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Oa(t,e){return{x:t.x*e,y:t.y*e}}function Ia(t,e){return t.x-e.x}function Ta(t,e){return t.y-e.y}function ja(t,e){return Ia(t,e)**2+Ta(t,e)**2}function Pa(t,e){return Math.sqrt(ja(t,e))}function za(t,e){return t.x*e.x+t.y*e.y}function Fa(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};const i=Math.cos(e),r=Math.sin(e),o=Ea(t,n),a={x:i*o.x-r*o.y,y:r*o.x+i*o.y};return Da(a,n)}const La={up:0,down:180,left:90,right:-90};function Ba(t){let{x:e,y:n,size:i}=t;const r=i/2;return{type:"rect",x:e-r,y:n-r,width:i,height:i}}const Ha=$t();function $a(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.keys(e).forEach((n=>{void 0!==Ca[n]&&"transform"!==n&&(t[n]=e[n])}))}Ha.add("circle",(function(t){return{type:"circle",fill:"black",cx:t.x,cy:t.y,r:t.size/2}})),Ha.add("diamond",(function(t){const e=t.size,n=t.x-e/2,i=t.y-e/2;return{type:"path",fill:"black",d:Na([{x:n,y:i+e/2},{x:n+e/2,y:i},{x:n+e,y:i+e/2},{x:n+e/2,y:i+e},{x:n,y:i+e/2}])}})),Ha.add("saltire",(function(t){const e=qa(45),n=t.size/2,i=isNaN(t.width)?n/2:t.width,r=Math.min(i,n);let o=t.size;const a=Math.sin(Math.asin(-e))*(r/2);o+=2*(n/Math.sin(-e)-n),o-=2*a;const s={x:t.x,y:t.y};return{type:"path",fill:"black",d:Na(Ra(t.x,t.y,o,r).map((t=>Fa(t,e,s))))}})),Ha.add("square",(function(t){const e=t.size;return{type:"rect",fill:"black",x:t.x-e/2,y:t.y-e/2,width:e,height:e}})),Ha.add("triangle",(function(t){const e=t.size,n={x:t.x,y:t.y},i=La[t.direction]||0,r=e/2,o=t.x-r,a=t.y-r;let s=[{x:o,y:a+e},{x:o+r,y:a},{x:o+e,y:a+e},{x:o,y:a+e}];const l=qa(i);return s=s.map((t=>Fa(t,l,n))),{type:"path",fill:"black",d:Na(s)}})),Ha.add("line",(function(t){const e="vertical"===t.direction,n=t.size/2,i=t.x,r=t.y;return{type:"line",stroke:"black",strokeWidth:1,x1:i-(e?0:n),y1:r-(e?n:0),x2:i+(e?0:n),y2:r+(e?n:0),collider:Ba(t)}})),Ha.add("star",(function(t){const e=t.size,n=[],i=e/2,r=t.points||5,o=Math.min(t.innerRadius||e/2,e)/2,a=isNaN(t.startAngle)?90:t.startAngle,s=360/r;for(let e=1;e<=r;e++){const r=s*e+a,l=qa(r),c=qa(r+s/2),u=Math.sin(l),h=Math.cos(l),d=Math.sin(c),f=Math.cos(c);n.push({x:t.x+h*i,y:t.y+u*i}),n.push({x:t.x+f*o,y:t.y+d*o})}return{type:"path",fill:"black",d:Na(n)}})),Ha.add("n-polygon",(function(t){const e=[],n=t.size/2,i=Math.max(isNaN(t.sides)?6:t.sides,3),r=360/i,o=isNaN(t.startAngle)?0:t.startAngle;for(let a=1;a<=i;a++){const i=qa(r*a+o),s=Math.sin(i),l=Math.cos(i);e.push({x:t.x+l*n,y:t.y+s*n})}return{type:"path",fill:"black",d:Na(e)}})),Ha.add("cross",(function(t){const e=t.x,n=t.y,i=t.size/2,r=isNaN(t.width)?i/2:t.width,o=Math.min(r,i);return{type:"path",fill:"black",d:Na(Ra(e,n,t.size,o))}})),Ha.add("bar",(function(t){const e={x:t.x,y:t.y},n="vertical"===t.direction,i=t.size/2,r=i/2/2;let o=[{x:e.x-i,y:e.y+r},{x:e.x-i,y:e.y-r},{x:e.x+i,y:e.y-r},{x:e.x+i,y:e.y+r}];if(n){const t=qa(90);o=o.map((n=>Fa(n,t,e)))}const a=I(o);return a.type="rect",a.fill="black",a})),Ha.add("rect",(function(t){const{x:e,y:n,size:i}=t,r=void 0===t.width?i:t.width,o=void 0===t.height?i:t.height;return{type:"rect",fill:"black",x:e-r/2,y:n-o/2,width:r,height:o}}));const Va=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ha;return function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=t.get(e.type);if(n){const t=n(e);return $a(t,e),void 0!==e.data&&(t.data=e.data),t}return n}};function Wa(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{dock:n="center",displayOrder:i=0,prioOrder:r=0,preferredSize:o=0,minimumLayoutMode:a,show:s=!0}=t;n=n||"center";const l={computePreferredSize(t){let{inner:n,outer:i,children:r}=t;return"function"==typeof o?o({inner:n,outer:i,children:r,dock:this.dock()},e):o},dock(t){return void 0!==t?(n=t,this):"function"==typeof n?n(e):n},displayOrder(t){return void 0!==t?(i=t,this):"function"==typeof i?i(e):i},prioOrder(t){return void 0!==t?(r=t,this):"function"==typeof r?r(e):r},minimumLayoutMode(t){return void 0!==t?(a=t,this):"function"==typeof a?a(e):a},show(t){return void 0!==t?(s=t,this):"function"==typeof s?s(e):s}};return l}function Ua(t,e,n){const{require:i=[]}=e,r=e.mediator||{},{settings:o,formatter:a,scale:s,data:l,renderer:c,chart:u,dockConfig:h,mediator:d,instance:f,rect:p,style:g,registries:m,resolver:y,update:v,_DO_NOT_USE_getInfo:x,symbol:b,isVisible:w}=n;t.emit=()=>{},w&&(t.isVisible=w),Object.defineProperty(t,"settings",{get:o}),Object.defineProperty(t,"data",{get:l}),Object.defineProperty(t,"formatter",{get:a}),Object.defineProperty(t,"scale",{get:s}),Object.defineProperty(t,"mediator",{get:d}),Object.defineProperty(t,"style",{get:g}),Object.defineProperty(t,"registries",{get:m}),p&&Object.defineProperty(t,"rect",{get:p}),x&&(t._DO_NOT_USE_getInfo=x),Object.keys(e).forEach((n=>{var i;i=n,["on","preferredSize","created","beforeMount","mounted","resize","beforeUpdate","updated","beforeRender","render","beforeUnmount","beforeDestroy","destroyed","defaultSettings","data","settings","formatter","scale","chart","dockConfig","mediator","style","resolver","registries","_DO_NOT_USE_getInfo","symbol","isVisible"].some((t=>t===i))||("function"==typeof e[n]?t[n]=e[n].bind(t):t[n]=e[n])})),i.forEach((e=>{"renderer"===e?Object.defineProperty(t,"renderer",{get:c}):"chart"===e?Object.defineProperty(t,"chart",{get:u}):"dockConfig"===e?Object.defineProperty(t,"dockConfig",{get:h}):"instance"===e?Object.defineProperty(t,"instance",{get:f}):"update"===e&&v?Object.defineProperty(t,"update",{get:v}):"resolver"===e?Object.defineProperty(t,"resolver",{get:y}):"symbol"===e&&Object.defineProperty(t,"symbol",{get:b})})),Object.keys(r).forEach((e=>{t.mediator.on(e,r[e].bind(t))}))}function Ya(t,e,n){const i=e=>t[e]?(n.warn("Deprecation Warning the ".concat(e," property should be moved into layout: {} property")),t[e]):t.layout?t.layout[e]:void 0,r={};return r.displayOrder=i("displayOrder"),r.dock=i("dock"),r.prioOrder=i("prioOrder"),r.minimumLayoutMode=i("minimumLayoutMode"),t.layout=t.layout||{},t.layout.displayOrder=void 0!==r.displayOrder?r.displayOrder:t.layout.displayOrder,t.layout.prioOrder=void 0!==r.prioOrder?r.prioOrder:t.layout.prioOrder,t.layout.dock=r.dock||t.layout.dock,t.layout.minimumLayoutMode=r.minimumLayoutMode||t.layout.minimumLayoutMode,r.show=t.show,r.preferredSize=e,r}function Xa(t,e,n){Object.keys(n.on||{}).forEach((i=>{t.eventListeners=t.eventListeners||[];const r=n.on[i].bind(t);t.eventListeners.push({event:i,listener:r}),e.on(i,r)})),t.emit=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return e.emit(t,...i)}}function Ka(t,e){t.eventListeners&&(t.eventListeners.forEach((t=>{let{event:n,listener:i}=t;e.removeListener(n,i)})),t.eventListeners.length=0),t.emit=()=>{}}function Ga(t){const e=_(!0,{},t);return{getAll:()=>e,getValue:(t,n)=>function(t,e,n){if(void 0===t||void 0===e)return n;const i=e.split(".");let r=t;for(let t=0;t<i.length;++t){const e=i[t];if(void 0===r[e])return n;r=r[e]}return r}(e,t,n),setValue:(t,n)=>function(t,e,n){if(void 0===t||void 0===e)return;const i=e.split("."),r=i[i.length-1];let o=t;for(let t=0;t<i.length-1;++t){const e=i[t];void 0===o[e]&&(o[e]=Number.isNaN(+i[t+1])?{}:[]),o=o[e]}void 0!==n?o[r]=n:delete o[r]}(e,t,n)}}function Za(t,e,n){return Da(function(t,e){const n=za(t,e)/za(e,e)||1;return{x:e.x*n,y:e.y*n}}(Ea(n,t),Ea(e,t)),t)}function Ja(t,e,n){return Pa(t,n)+Pa(e,n)-Pa(t,e)<1e-12}function Qa(t,e){return t.x>=e.x&&t.x+t.width<=e.x+e.width&&t.y>=e.y&&t.y+t.height<=e.y+e.height}function ts(t){return t.x1===t.x2&&t.y1===t.y2}function es(t){return t.width<=0||t.height<=0}function ns(t){return t.r<=0}function is(t){return t.edges.length<=2}function rs(t,e){let n=!1;for(let i=0,r=e.edges.length;i<r;i++)if(n=hs(t,T(e.edges[i])),!0===n)return!0;return!1}function os(t,e){let n=!1;const{numPolygons:i,polygons:r}=e;for(let e=0;e<i;e++){if(n=bs(t,r[e]),!0===n)return!0}return!1}function as(t,e){if(ns(t))return!1;return ja({x:t.cx,y:t.cy},e)<=t.r**2}function ss(t,e){if(es(e)||ns(t))return!1;const n=e.width/2,i=e.height/2,r=e.x+n,o=e.y+i,a=t.r,s=t.cx,l=t.cy,c=Math.abs(s-r),u=Math.abs(l-o);if(c>n+a||u>i+a)return!1;if(c<=n||u<=i)return!0;return(c-n)**2+(u-i)**2<=a**2}function ls(t,e){if(ns(t)||ts(e))return!1;const[n,i]=E(e);if(as(t,n)||as(t,i))return!0;const r={x:t.cx,y:t.cy},o=Za(n,i,r);return ja(o,r)<=t.r**2&&Ja(n,i,o)}function cs(t,e){if(is(e)||ns(t))return!1;if(us(e,{x:t.cx,y:t.cy}))return!0;const n=e.edges.length;for(let i=0;i<n;i++){if(ls(t,T(e.edges[i])))return!0}return!1}function us(t,e){if(is(t)||!gs(t.boundingRect(),e))return!1;const{x:n,y:i}=e,r=t.vertices;let o,a,s,l,c;for(o=!1,l=-1,a=r.length,s=a-1;++l<a;s=l){if(r[l].x===n&&r[l].y===i)return!0;if(r[l].y===r[s].y&&r[l].y===i&&(n-r[l].x)*(n-r[s].x)<=0)return!0;if(r[l].y<i&&i<=r[s].y||r[s].y<i&&i<=r[l].y){if(c=(r[s].x-r[l].x)*(i-r[l].y)/(r[s].y-r[l].y)+r[l].x,n===c)return!0;n<c&&(o=!o)}}return o}function hs(t,e){if(is(t))return!1;for(let n=0,i=t.edges.length;n<i;n++){if(ys(e,T(t.edges[n])))return!0}const[n,i]=E(e);return us(t,n)||us(t,i)}function ds(t,e){if(is(t))return!1;for(let n=0,i=t.edges.length;n<i;n++){if(ms(e,T(t.edges[n])))return!0}const[n,i,r,o]=O(e);return us(t,n)||us(t,i)||us(t,r)||us(t,o)}function fs(t,e){return!es(t)&&!es(e)&&(t.x<=e.x+e.width&&e.x<=t.x+t.width&&t.y<=e.y+e.height&&e.y<=t.y+t.height)}function ps(t,e){if(es(t)||es(e))return!1;return[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}].every((e=>gs(t,e)))}function gs(t,e){return!es(t)&&(e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height)}function ms(t,e){if(ts(e)||es(t))return!1;const[n,i]=E(e);if(gs(t,n)||gs(t,i))return!0;const r=O(t);let o=r.length;for(let t=0;t<o;t++){if(ys(T([r[t],r[3!==t?t+1:0]]),e))return!0}return!1}function ys(t,e){const[n,i]=E(t),[r,o]=E(e),a=Ia(i,n),s=Ta(i,n),l=Ia(o,r),c=Ta(o,r),u=Ia(n,r),h=Ta(n,r);let d=c*a-l*s;const f=l*h-c*u,p=a*h-s*u;let g,m;if(0===a&&0===s)return!1;if(0===l&&0===c)return!1;if(0===d){if(0===f&&0===p){if(0===a){if(0===s)return n.x===i.x&&n.y===i.y;g=Ta(r,n)/s,m=Ta(o,n)/s}else g=(r.x-n.x)/a,m=(o.x-n.x)/a;return!(g<0&&m<0||g>1&&m>1)}return!1}const y=f/d;return d=p/d,y>=0&&y<=1&&d>=0&&d<=1}function vs(t,e){if(ts(t))return!1;const[n,i]=E(t);return Ja(n,i,e)}function xs(t,e){const n=t.boundingRect(),i=e.boundingRect();return!!fs(n,i)&&(ps(n,i)?rs(t,e):rs(e,t))}function bs(t,e){const n=t.boundingRect(),i=e.boundingRect();return!!fs(n,i)&&(ps(i,n)?function(t,e){let n=!1;const{numPolygons:i,polygons:r}=t;for(let t=0;t<i;t++)if(n=xs(e,r[t]),!0===n)return!0;return!1}(t,e):function(t,e){let n=!1;for(let i=0,r=e.edges.length;i<r;i++)if(n=_s(t,T(e.edges[i])),!0===n)return!0;return!1}(t,e))}function ws(t,e){if(ns(t))return!1;if(ks(e,{x:t.cx,y:t.cy}))return!0;const{numPolygons:n,polygons:i}=e;for(let e=0;e<n;e++){const n=i[e],r=n.edges.length;for(let e=0;e<r;e++){if(ls(t,T(n.edges[e])))return!0}}return!1}function ks(t,e){if(!gs(t.boundingRect(),e))return!1;const{x:n,y:i}=e,r=t.numPolygons;let o,a,s,l,c,u,h=!1;for(a=0;a<r;a++)for(o=t.vertices[a],c=-1,s=o.length,l=s-1;++c<s;l=c){if(o[c].x===n&&o[c].y===i)return!0;if(o[c].y===o[l].y&&o[c].y===i&&(n-o[c].x)*(n-o[l].x)<=0)return!0;if(o[c].y<i&&i<=o[l].y||o[l].y<i&&i<=o[c].y){if(u=(o[l].x-o[c].x)*(i-o[c].y)/(o[l].y-o[c].y)+o[c].x,n===u)return!0;n<u&&(h=!h)}}return h}function _s(t,e){const[n,i]=E(e);if(ks(t,n)||ks(t,i))return!0;const{numPolygons:r,polygons:o}=t;for(let t=0;t<r;t++){const n=o[t];for(let t=0,i=n.edges.length;t<i;t++){if(ys(e,T(n.edges[t])))return!0}}return!1}function Ms(t,e){const[n,i,r,o]=O(e);if(ks(t,n)||ks(t,i)||ks(t,r)||ks(t,o))return!0;const{numPolygons:a,polygons:s}=t;for(let t=0;t<a;t++){const n=s[t];for(let t=0,i=n.edges.length;t<i;t++){if(ms(e,T(n.edges[t])))return!0}}return!1}const Ss=/^\$/,Cs="@extend";function Ns(t){throw new Error('Cyclical reference for "'.concat(t,'"'))}function Rs(t,e,n){if("string"==typeof t){let i=e[t];return-1!==n.indexOf(t)&&Ns(t),Ss.test(i)?(n.push(t),Rs(i,e,n)):i}let i=t;const r=_(!0,{},e,t),o={};if(t[Cs]){const o=t[Cs];-1!==n.indexOf(o)&&Ns(o);let a=n.slice();a.push(o),i=_(!0,{},Rs(r[o],e,a),t)}return Object.keys(i).forEach((t=>{let e=n.slice();if(t===Cs||Ss.test(t))return;o[t]=i[t];let a=o[t];Ss.test(a)&&a in r?(-1!==n.indexOf(a)&&Ns(a),e.push(a),a=r[a],"object"==typeof a||Ss.test(a)&&a in r?o[t]=Rs(a,r,e):o[t]=a):"object"==typeof a&&(o[t]=Rs(a,r,e))})),o}function qs(t,e){return Rs(t,e,[])}function As(t){t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.floor(t.width),t.height=Math.floor(t.height)}function Ds(t,e){const n={x:0,y:0,width:0,height:0},i={x:0,y:0,width:0,height:0};return n.width=t.width||0,n.height=t.height||0,void 0!==e.size&&(n.width=isNaN(e.size.width)?n.width:e.size.width,n.height=isNaN(e.size.height)?n.height:e.size.height),void 0!==e.logicalSize?(i.width=isNaN(e.logicalSize.width)?n.width:e.logicalSize.width,i.height=isNaN(e.logicalSize.height)?n.height:e.logicalSize.height,i.align=isNaN(e.logicalSize.align)?.5:Math.min(Math.max(e.logicalSize.align,0),1),i.preserveAspectRatio=e.logicalSize.preserveAspectRatio):(i.width=n.width,i.height=n.height,i.preserveAspectRatio=!1),As(i),As(n),{logicalContainerRect:i,containerRect:n}}function Es(t){const e={center:{minWidthRatio:.5,minHeightRatio:.5,minWidth:0,minHeight:0}};return _(!0,e,t),e.center.minWidthRatio=Math.min(Math.max(e.center.minWidthRatio,0),1),e.center.minHeightRatio=Math.min(Math.max(e.center.minHeightRatio,0),1),e.center.minWidth=Math.max(e.center.minWidth,0),e.center.minHeight=Math.max(e.center.minHeight,0),e}function Os(t,e,n,i,r){return{x:isNaN(t)?0:t,y:isNaN(t)?0:e,width:isNaN(t)?0:n,height:isNaN(t)?0:i,margin:isNaN(r)?0:r}}function Is(t,e,n){if(void 0===t.cachedSize){const i=t.config.dock();let r,o=t.comp.preferredSize({inner:e,outer:n,dock:i});isNaN(o)?o&&!isNaN(o.size)&&(o.width=o.size,o.height=o.size):o={width:o,height:o},r="top"===i||"bottom"===i?o.height:"right"===i||"left"===i?o.width:Math.max(o.width,o.height),t.cachedSize=Math.ceil(r),t.edgeBleed=o.edgeBleed||0}return t.cachedSize}function Ts(t,e){switch(e.config.dock()){case"top":t.y+=e.cachedSize,t.height-=e.cachedSize;break;case"bottom":t.height-=e.cachedSize;break;case"left":t.x+=e.cachedSize,t.width-=e.cachedSize;break;case"right":t.width-=e.cachedSize}}function js(t,e){const n=e.edgeBleed;n&&(t.left=Math.max(t.left,n.left||0),t.right=Math.max(t.right,n.right||0),t.top=Math.max(t.top,n.top||0),t.bottom=Math.max(t.bottom,n.bottom||0))}function Ps(t,e,n){e.x<n.left&&(e.width-=n.left-e.x,e.x=n.left);const i=t.width-(e.x+e.width);i<n.right&&(e.width-=n.right-i),e.y<n.top&&(e.height-=n.top-e.y,e.y=n.top);const r=t.height-(e.y+e.height);r<n.bottom&&(e.height-=n.bottom-r)}function zs(t,e,n,i,r){const o=_({},e),a=_({},n);Ts(o,i),js(a,i),Ps(t,o,a);return!!function(t,e,n){const i=Math.min(n.center.minWidth,t.width)||Math.max(t.width*n.center.minWidthRatio,1),r=Math.min(n.center.minHeight,t.height)||Math.max(t.height*n.center.minHeightRatio,1);return e.width>=i&&e.height>=r}(t,o,r)&&(Ts(e,i),js(n,i),!0)}function Fs(t){let{layoutRect:e,visible:n,hidden:i,settings:r}=t;const o=Os(e.x,e.y,e.width,e.height),a={left:0,right:0,top:0,bottom:0},s=n.slice();s.sort(((t,e)=>t.config.prioOrder()-e.config.prioOrder()));for(let t=0;t<s.length;++t){const n=s[t];Is(n,o,e),zs(e,o,a,n,r)||(i.push(s.splice(t,1)[0]),--t)}!function(t,e){if(0!==e.length)for(let n=0;n<t.length;++n){let i=t[n];i.referencedDocks.length&&i.referencedDocks.every((t=>e.some((e=>e.key===t))))&&e.push(t.splice(n,1)[0])}}(n,i);const l=n.filter((t=>-1!==s.indexOf(t)));return n.length=0,n.push(...l),Ps(e,o,a),o}function Ls(t){return{x:t.margin.left+t.x*t.scaleRatio.x,y:t.margin.top+t.y*t.scaleRatio.y,width:t.width*t.scaleRatio.x,height:t.height*t.scaleRatio.y}}function Bs(t){return I([].concat(...t.map(O)))}function Hs(t){let{visible:e,layoutRect:n,reducedRect:i,containerRect:r,translation:o}=t;const a=Os(i.x,i.y,i.width,i.height),s=Os(i.x,i.y,i.width,i.height),l={},c=e.slice(),u=c.slice().sort(((t,e)=>t.config.displayOrder()-e.config.displayOrder()));return e.sort(((t,e)=>{if(t.referencedDocks.length>0&&e.referencedDocks.length>0)return 0;if(e.referencedDocks.length>0)return-1;if(t.referencedDocks.length>0)return 1;const n=t.config.displayOrder()-e.config.displayOrder();return 0===n?c.indexOf(t)-c.indexOf(e):n})).forEach((t=>{let e={},c={};switch(t.config.dock()){case"top":e.height=c.height=t.cachedSize,e.width=n.width,c.width=a.width,e.x=n.x,c.x=a.x,e.y=c.y=a.y-t.cachedSize,a.y-=t.cachedSize,a.height+=t.cachedSize;break;case"bottom":e.x=n.x,c.x=a.x,e.y=c.y=a.y+a.height,e.width=n.width,c.width=a.width,e.height=c.height=t.cachedSize,a.height+=t.cachedSize;break;case"left":e.x=c.x=s.x-t.cachedSize,e.y=n.y,c.y=s.y,e.width=c.width=t.cachedSize,e.height=n.height,c.height=s.height,s.x-=t.cachedSize,s.width+=t.cachedSize;break;case"right":e.x=c.x=s.x+s.width,e.y=n.y,c.y=s.y,e.width=c.width=t.cachedSize,e.height=n.height,c.height=s.height,s.width+=t.cachedSize;break;case"center":e.x=c.x=i.x,e.y=c.y=i.y,e.width=c.width=i.width,e.height=c.height=i.height;break;default:if(t.referencedDocks.length>0){const n=t.referencedDocks.map((t=>l[t])).filter((t=>!!t));n.length>0&&(e=Bs(n.map((t=>t.outerRect))),c=Bs(n.map((t=>t.r))))}}t.key&&(l[t.key]={r:c,outerRect:e}),function(t,e,n,i){const r={x:i.width/n.width,y:i.height/n.height},o={left:0,top:0};if(n.preserveAspectRatio){const t=r.x<r.y,e=Math.min(r.x,r.y);r.x=e,r.y=e;const a=t?"height":"width",s=(i[a]-n[a]*r.x)*n.align;o.left=t?0:s,o.top=t?s:0}t.scaleRatio=r,t.margin=o,e.scaleRatio=r,e.margin=o,n.scaleRatio=r,n.margin=o}(c,e,n,r),c.edgeBleed=t.edgeBleed,c.computed=Ls(c),e.edgeBleed=t.edgeBleed,e.computed=Ls(e),c.x+=o.x,c.y+=o.y,e.x+=o.x,e.y+=o.y,t.comp.resize(c,e),t.cachedSize=void 0,t.edgeBleed=void 0})),u}function $s(t,e,n){const i=t.layoutModes||{},r=e.minimumLayoutMode();let o=e.show();return o&&"object"==typeof r?o=i[r.width]&&i[r.height]&&n.width>=i[r.width].width&&n.height>=i[r.height].height:o&&void 0!==r&&(o=i[r]&&n.width>=i[r].width&&n.height>=i[r].height),o}function Vs(t){if(!t.resize||"function"!=typeof t.resize)throw new Error("Component is missing resize function");if(!t.dockConfig&&!t.preferredSize)throw new Error("Component is missing preferredSize function")}function Ws(t,e,n){const i=[],r=[];for(let o=0;o<t.length;++o){const a=t[o];Vs(a);let s=a.dockConfig;const l=a.key,c=s.dock(),u=/@/.test(c)?c.split(",").map((t=>t.replace(/^\s*@/,""))):[];$s(e,s,n)?i.push({comp:a,key:l,config:s,referencedDocks:u}):r.push({comp:a,key:l,config:s,referencedDocks:u})}return[i,r]}const Us=(t,e)=>{for(let n=0;n<t.length;n++){const i=t[n];if(i.hasKey&&i.key===e)return t[n]}return null},Ys=t=>null==t?void 0:t.map((t=>{const e=t.instance.dockConfig();return{preferredSize:n=>e.computePreferredSize(C(C({},n),{},{children:Ys(t.children)}))}})),Xs=(t,e)=>({visible:[],hidden:e,ordered:[]}),Ks=t=>(e,n)=>{var i;const r=n.map(((t,e)=>{const n=t.instance.dockConfig();return{index:e,key:t.key,dockConfig:n,resize:t.instance.resize,preferredSize:e=>n.computePreferredSize(C(C({},e),{},{children:Ys(t.children)}))}})),o=t=>n[t.index],{visible:a=r,hidden:s=[],ordered:l=a}=null!==(i=t(e,r))&&void 0!==i?i:{};return{visible:a.map(o),hidden:s.map(o),ordered:l.map(o)}},Gs=t=>{const e=function(t){let e=Es(t);return{layout:function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t||isNaN(t.x)||isNaN(t.y)||isNaN(t.width)||isNaN(t.height))throw new Error("Invalid rect");if(!n.length)return{visible:[],hidden:[],ordered:[]};const{logicalContainerRect:i,containerRect:r}=Ds(t,e),[o,a]=Ws(n,e,i),s=Hs({visible:o,layoutRect:i,reducedRect:Fs({layoutRect:i,visible:o,hidden:a,settings:e}),containerRect:r,translation:{x:t.x,y:t.y}});return a.forEach((t=>{t.comp.visible=!1;const e=Os();t.comp.resize(e,e)})),{visible:o.map((t=>t.comp)),hidden:a.map((t=>t.comp)),ordered:s.map((t=>t.comp))}},settings:function(t){e=Es(t)}}}(t);return Ks(((t,n)=>e.layout(t,n)))},Zs=t=>"function"==typeof t?Ks(t):Gs(t);function Js(t,e,n){const i=e.left-n.left,r=e.top-n.top,o=j(t),a=_(!0,{},t);switch(o){case"circle":a.cx+=i,a.cy+=r;break;case"polygon":for(let t=0,e=a.vertices.length;t<e;t++){const e=a.vertices[t];e.x+=i,e.y+=r}break;case"geopolygon":for(let t=0;t<a.vertices.length;t++){const e=a.vertices[t];for(let t=0,n=e.length;t<n;t++){const n=e[t];n.x+=i,n.y+=r}}break;case"line":a.x1+=i,a.y1+=r,a.x2+=i,a.y2+=r;break;case"point":case"rect":a.x+=i,a.y+=r}return a}function Qs(t,e){const n=[];let i=0;e.forEach((t=>{n.push(i),i++;const e=t.instance.def.additionalElements&&t.instance.def.additionalElements();e&&(i+=e.length)})),e.forEach(((e,i)=>((t,e,n)=>{const i=e.instance.renderer().element();if(isNaN(n)||!i||!t||!t.children)return;const r=t.children[Math.max(0,n)];if(i===r)return;const o=e.instance.def.additionalElements&&e.instance.def.additionalElements().filter(Boolean);t.insertBefore&&void 0!==r?(t.insertBefore(i,r),o&&o.forEach((e=>{t.insertBefore(e,i)}))):(o&&o.forEach((e=>{t.appendChild(e,i)})),t.appendChild(i))})(t,e,n[i])))}function tl(t,e){let{element:n,data:i=[],settings:r={},on:o={}}=t;const a=e.registries,s=e.logger,l=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={},n=t;const i=t=>{t.forEach((t=>{const n=Array.isArray(t.colors[0])?t.colors:[t.colors];e[t.key]={colors:n,sizes:n.map((t=>t?t.length:0))}}))},r=(t,n)=>{const i=e[t];if(!i)return[];const r=i.sizes;for(let t=0;t<r.length;t++)if(n<=r[t])return i.colors[t];return i.colors[r.length-1]},o={palette:(t,e)=>r(t,e),setPalettes:i,style:t=>qs(t,n),setStyle:e=>{n=_({},t,e)}};return i(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]),o}(e.style,e.palettes),c=[],u=_({},t),h=function(){const t={};return jo.mixin(t),t}();let d=[],f=null,p=null,g=null,m=[],y=()=>{},v=()=>{};const x={};let b=!1;const w=function(t){let{createComponent:e}=t;const n={};let i=[],r=[];const o=t=>{const n=e(t);return n&&(i.push(n),t.components&&(n.children=t.components.map((t=>o(t))).filter((t=>!!t)))),n},a=t=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)},s=(t,e)=>{for(let n=t.length-1;n>=0;n--){const i=t[n],r=e.find((t=>i.hasKey&&i.key===t.key));r?i.children&&r.components&&s(i.children,r.components):(t.splice(n,1),a(i),i.children&&s(i.children,[]),i.instance.destroy())}},l=t=>{let{compList:e,data:n,excludeFromUpdate:i,formatters:r,scales:a,settingsList:s}=t;return s.map((t=>{const s=Us(e,t.key);return i.indexOf(t.key)>-1?(delete s.updateWith,s):s?(t.rendererSettings&&"function"==typeof s.instance.renderer().settings&&s.instance.renderer().settings(t.rendererSettings),t.rendererSettings&&"function"==typeof t.rendererSettings.transform&&t.rendererSettings.transform()?(s.applyTransform=!0,s):(s.updateWith={formatters:r,scales:a,data:n,settings:t},t.components&&(s.children=l({compList:s.children||[],data:n,excludeFromUpdate:i,formatters:r,scales:a,settingsList:t.components})),s)):o(t)})).filter((t=>!!t))},c=t=>{let{components:e,hidden:n,layoutFn:i,ordered:r,rect:o,visible:a}=t;const{visible:s,hidden:l,ordered:u}=i(o,e);a.push(...s),n.push(...l),r.push(...u),s.forEach((t=>{if(t.children){var e,i;const o=Zs(null!==(e=null===(i=t.settings)||void 0===i?void 0:i.strategy)&&void 0!==e?e:{});c({components:t.children,hidden:n,layoutFn:o,ordered:r,rect:t.instance.getRect(),visible:a})}})),l.forEach((t=>{t.children&&c({components:t.children,hidden:n,layoutFn:Xs,ordered:r,rect:null,visible:a})}))};return n.destroy=()=>{i.forEach((t=>t.instance.destroy())),i=[],r=[]},n.findComponentByKey=t=>Us(i,t),n.forEach=t=>{i.forEach(t)},n.layout=t=>{let{layoutSettings:e,rect:n}=t;const i=[],o=[],a=[],s=Zs(e);return c({components:r,hidden:o,layoutFn:s,ordered:a,rect:n,visible:i}),{visible:i,hidden:o,ordered:a}},n.set=t=>{let{components:e}=t;r=e.map((t=>o(t))).filter((t=>!!t))},n.update=t=>{let{components:e,data:n,excludeFromUpdate:i,formatters:o,scales:a}=t;s(r,e),r=l({compList:r,data:n,excludeFromUpdate:i,formatters:o,scales:a,settingsList:e})},n}({createComponent:t=>{if(!a.component.has(t.type))return s.warn("Unknown component: ".concat(t.type)),!1;return{instance:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{defaultSettings:n={},_DO_NOT_USE_getInfo:i=(()=>({}))}=t,{chart:r,container:o,mediator:a,registries:s,theme:l,renderer:c}=e,u=jo.mixin({});let h,d,f,p,g,m=e.settings||{},y=_(!0,{},n,m),v=[],x=ya({chart:r}),b=!1;const w={nodes:[],chart:r,config:y.brush||{},renderer:null},k={tap:[],over:[]},M=[],S={},N=_({},m);function R(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(){const r=void 0!==t[e],o=void 0!==m[e];let a;for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return r&&("function"==typeof t[e]?a=t[e].call(S,...l):i&&(a=t[e])),o&&("function"==typeof m[e]?a=m[e].call(N,...l):i&&(a=m[e])),r||o||(a=n.call(S,...l)),a}}const q=R("preferredSize",(()=>0),!0),A=R("resize",(t=>{let{inner:e}=t;return e})),D=R("created"),E=R("beforeMount"),O=R("mounted"),I=R("beforeUnmount"),T=R("beforeUpdate"),j=R("updated"),P=R("beforeRender"),z=R("beforeDestroy"),F=R("destroyed"),L=t.render,B=()=>{y.brush&&(y.brush.consume||[]).forEach((t=>{t.context&&t.style&&M.push(xa(w,t))}))},H=()=>{y.brush&&(y.brush.trigger||[]).forEach((t=>{"over"===t.on?k.over.push(t):k.tap.push(t)}))};Object.defineProperty(w,"data",{get:()=>v});const $=y.renderer||t.renderer,V=$?c||s.renderer($)():c||s.renderer()();"function"==typeof V.settings&&V.settings(y.rendererSettings),w.renderer=V;const W={resources:r.logger?{logger:r.logger()}:{}};let U=Wa(Ya(y,q,r.logger()),W);const Y=t=>{t.key=y.key,t.element=V.element()},X=()=>{};X.dockConfig=()=>U,X.set=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.settings&&(m=t.settings,y=_(!0,{},n,t.settings),U=Wa(Ya(y,q,r.logger()),W),w.config=y.brush||{}),y.scale&&(h=r.scale(y.scale)),y.data){const{rendererSettings:t}=y,e="function"==typeof(null==t?void 0:t.progressive)&&t.progressive(),n=Di(y.data,{dataset:r.dataset,collection:r.dataCollection},{logger:r.logger()},r.dataCollection);e?e.isFirst?(v=n,v.items&&(v.items=[...n.items])):v.items&&(v.items=[...v.items,...n.items||[]]):v=n}else v=h?h.data():[];"string"==typeof y.formatter||"object"==typeof y.formatter?d=r.formatter(y.formatter):h&&h.data().fields&&(d=h.data().fields[0].formatter()),g=l.style(y.style||{})},X.resize=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=A({inner:t,outer:e});p=n?V.size(n):V.size(t),N.rect=_(!0,{computedPhysical:p.computedPhysical,computedOuter:e.computed||e,computedInner:t.computed||t},t),p=_(!0,{computedOuter:e.computed||e,computedInner:t.computed||t},p)},X.getRect=()=>N.rect;const K=()=>{const t=V.renderArgs?V.renderArgs.slice(0):[],{rendererSettings:e}=y;let n=v;const i="function"==typeof(null==e?void 0:e.progressive)&&e.progressive();return v.items&&i&&(n=C(C({},v),{},{items:v.items.slice(i.start,i.end)})),t.push({data:n}),t};let G,Z,J;function Q(t){const{rendererSettings:e}=y,n="function"==typeof(null==e?void 0:e.progressive)&&e.progressive();n?n.isFirst?w.nodes=[...t||[]]:w.nodes&&(w.nodes=[...w.nodes,...t||[]]):w.nodes=t}X.beforeMount=E,X.beforeRender=()=>{P({size:p})},X.render=()=>{const t=L.call(S,...K());Q(t),V.render(t),G=t,Z=N.rect.computed},X.hide=()=>{X.unmount(),V.size({x:0,y:0,width:0,height:0}),V.clear()},X.beforeUpdate=()=>{T({settings:y,data:v})},X.update=()=>{J&&J.stop();const{rendererSettings:t,brush:e,animations:n}=y;if("function"==typeof(null==t?void 0:t.transform)&&t.transform())return V.render(),void(G=null);const i=L.call(S,...K());Q(i),M.forEach((t=>t.cleanUp())),M.length=0,k.tap=[],k.over=[],e&&(B(),H()),M.forEach((t=>{t.isActive()&&t.update()})),G&&n&&("function"==typeof n.enabled?n.enabled():n.enabled)?(n.compensateForLayoutChanges&&n.compensateForLayoutChanges({currentNodes:G,currentRect:N.rect.computed,previousRect:Z}),J=ua({old:G,current:i},{renderer:V},n,r.storage),J.start()):V.render(i),G=i,Z=N.rect.computed,V.setKey&&"string"==typeof m.key&&V.setKey(m.key)},X.updated=j,X.destroy=()=>{X.unmount(),z(f),V.destroy(),F(),f=null};const tt=t=>{w.nodes=t,M.forEach((t=>{t.isActive()&&t.update()})),V.render(t)};return Ua(S,t,{settings:()=>y,data:()=>v,scale:()=>h,formatter:()=>d,renderer:()=>V,chart:()=>r,dockConfig:()=>U,mediator:()=>a,instance:()=>N,rect:()=>N.rect,style:()=>g,update:()=>tt,registries:()=>s,resolver:()=>x,symbol:()=>Va(s.symbol)}),Ua(N,m,{settings:()=>y,data:()=>v,scale:()=>h,formatter:()=>d,renderer:()=>V,chart:()=>r,dockConfig:()=>U,mediator:()=>a,style:()=>g,_DO_NOT_USE_getInfo:i.bind(S),isVisible:()=>b}),X.getBrushedShapes=function(t,e,n){const i=[];if(y.brush&&y.brush.consume){const o=r.brush(t),a=V.findShapes("*");y.brush.consume.filter((e=>e.context===t)).forEach((t=>{for(let r=0;r<a.length;r++){const s=a[r];s.data&&o.containsMappedData(s.data,n||t.data,e)&&(Y(s),i.push(s),a.splice(r,1),r--)}}))}return i},X.findShapes=t=>{var e;const n=(null!==(e=J)&&void 0!==e&&e.inProgress()?J.targetScene:V).findShapes(t);for(let t=0,e=n.length;t<e;t++)Y(n[t]);return n},X.shapesAt=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=V.itemsAt(t);let i;i=e&&"stop"===e.propagation&&n.length>0?[n.pop().node]:n.map((t=>t.node));for(let t=0,e=i.length;t<e;t++)Y(i[t]);return i},X.brushFromShapes=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.contexts=Array.isArray(e.contexts)?e.contexts:[];ba({nodes:t,action:e.action||"toggle",trigger:e,chart:r,data:w.data})},X.mount=()=>{f=V.element&&V.element()?f:V.appendTo(o),V.setKey&&"string"==typeof m.key&&V.setKey(m.key),y.brush&&(B(),H()),Xa(N,u,m),Xa(S,u,t),b=!0},X.mounted=()=>O(f),X.unmount=()=>{[N,S].forEach((t=>{Ka(t,u)})),k.tap=[],k.over=[],M.forEach((t=>{t.cleanUp()})),M.length=0,I(),b=!1},X.onBrushTap=t=>{k.tap.forEach((e=>{Ma({e:t,t:e,config:w})&&"stop"===e.globalPropagation&&r.toggleBrushing(!0)}))},X.onBrushOver=t=>{k.over.forEach((e=>{Sa({e:t,t:e,config:w})&&"stop"===e.globalPropagation&&r.toggleBrushing(!0)}))},X.def=S,X.ctx=N,X.renderer=()=>V,X.set({settings:m}),D(),X}(a.component(t.type),{settings:t,chart:u,mediator:h,registries:a,theme:l,container:n}),settings:_(!0,{},t),key:t.key,hasKey:void 0!==t.key}}});function k(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};return function(){const i="function"==typeof t[e];let r;for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return r=i?t[e].call(u,...a):n.call(u,...a),r}}const M=()=>{let t;r.dockLayout?(s.warn('Deprecation Warning: "dockLayout" property should be renamed to "strategy"'),t=r.dockLayout):t=r.strategy;const e=function(t){if("function"==typeof t.getBoundingClientRect){const{width:e,height:n}=t.getBoundingClientRect();return{x:0,y:0,width:e,height:n}}return{x:0,y:0,width:0,height:0}}(n);return w.layout({layoutSettings:t,rect:e})},S=k("created"),N=k("beforeMount"),q=k("mounted"),A=k("beforeUpdate"),D=k("updated"),E=k("beforeRender"),O=k("beforeDestroy"),I=k("destroyed"),T=function(t,e){let{partialData:n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{formatters:i={},scales:r={},scroll:o={}}=e;y=z(t,{logger:s,types:a.data}),n||Object.keys(x).forEach((t=>x[t].clear())),e.palettes&&l.setPalettes(e.palettes),e.style&&l.setStyle(e.style),v=Ei(e.collections,{dataset:y},{logger:s});const c={theme:l,logger:s};f=Eo(r,{dataset:y,collection:v},C(C({},c),{},{scale:a.scale})),p=Ii(i,{dataset:y,collection:v},C(C({},c),{},{formatter:a.formatter})),g=Fo(o,g)};function j(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e={},i=t.filter((t=>!!t.key)).map((t=>t.key));m.forEach((t=>{t.key&&-1!==i.indexOf(t.key)?e[t.key]=t:t.destroy()})),m=t.map((t=>{const i=t.key&&e[t.key]?e[t.key]:a.interaction(t.type)(u,h,n);return i.set(t),i}))}const P=t=>{const e=n.getBoundingClientRect(),i="clientX"in t?t.clientX:t.x,r="clientY"in t?t.clientY:t.y,o={x:i-e.left,y:r-e.top},a=[];return d.forEach((t=>{const e=t.instance.getRect();gs(e.computedPhysical?e.computedPhysical:{x:e.margin.left+e.x*e.scaleRatio.x,y:e.margin.top+e.y*e.scaleRatio.y,width:e.width*e.scaleRatio.x,height:e.height*e.scaleRatio.y},o)&&a.push(t)})),a},F=()=>{if(c.length||!n)return;Object.keys(o).forEach((t=>{const e=o[t].bind(u);n.addEventListener(t,e),c.push({key:t,listener:e})}));const t={},e=e=>{e.touches?(t.x=e.touches[0].clientX,t.y=e.touches[0].clientY,t.multiTouch=e.touches.length>1):(t.x=e.clientX,t.y=e.clientY,t.multiTouch=!1),t.time=Date.now(),t.comps=P(t)},i=e=>{const n=t.comps||P(e);if(!n.every((t=>t.instance.def.disableTriggers))&&("touchend"===e.type&&e.preventDefault(),function(t,e){const n=R(t),i=n?t.changedTouches[0]:t,r=Date.now()-e.time,o=isNaN(e.x)?0:Math.abs(i.clientX-e.x),a=isNaN(e.y)?0:Math.abs(i.clientY-e.y);return(0===t.button||n)&&!e.multiTouch&&o<=12&&a<=12&&r<=300}(e,t)))for(let t=n.length-1;t>=0;t--){if(n[t].instance.onBrushTap(e),b){b=!1;break}}},r=[];r.push({key:"mousedown",listener:e}),r.push({key:"mouseup",listener:i}),function(t){return"ontouchstart"in t&&"ontouchend"in t||navigator.maxTouchPoints>1}(n)&&(r.push({key:"touchstart",listener:e}),r.push({key:"touchend",listener:i})),r.push({key:"mousemove",listener:t=>{const e=P(t);for(let n=e.length-1;n>=0;n--){if(e[n].instance.onBrushOver(t),b){b=!1;break}}}}),r.forEach((t=>{n.addEventListener(t.key,t.listener),c.push(t)}))},L=()=>{c.forEach((t=>{let{key:e,listener:i}=t;return n.removeEventListener(e,i)})),c.length=0},B=()=>{n.innerHTML="",(()=>{const{components:t=[]}=r;E(),T(i,r),w.set({components:t});const{visible:e,hidden:o,ordered:a}=M();d=e,o.forEach((t=>{t.instance.hide(),t.visible=!1})),e.forEach((t=>t.instance.beforeMount())),e.forEach((t=>t.instance.mount())),e.forEach((t=>t.instance.beforeRender())),e.forEach((t=>t.instance.render())),e.forEach((t=>t.instance.mounted())),e.forEach((t=>{t.visible=!0})),Qs(n,a)})(),F(),j(r.interactions)};return u.layoutComponents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{excludeFromUpdate:e=[]}=t;t.data&&(i=t.data),t.settings&&(r=t.settings,j(t.settings.interactions)),A(),T(i,r);const{formatters:n,scales:o,components:a=[]}=r;w.update({components:a,data:i,excludeFromUpdate:e,formatters:n,scales:o}),w.forEach((t=>{t.updateWith&&t.instance.set(t.updateWith)})),w.forEach((t=>{t.updateWith&&t.instance.beforeUpdate()})),M()},u.update=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{partialData:e,excludeFromUpdate:o=[]}=t;let a;t.data&&(i=t.data),t.settings&&(r=t.settings,j(t.settings.interactions)),A(),T(i,r,{partialData:e});const{formatters:s,scales:l,components:c=[]}=r;w.update({components:c,data:i,excludeFromUpdate:o,formatters:s,scales:l}),w.forEach((t=>{t.updateWith&&t.instance.set(t.updateWith)})),w.forEach((t=>{t.updateWith&&t.instance.beforeUpdate()}));const u=[],h=[];let f;if(e)w.forEach((t=>{(t.updateWith||t.applyTransform)&&t.visible&&u.push(t)})),f=u;else{const{visible:t,hidden:e,ordered:n}=M();d=t,f=t,a=n,t.forEach((t=>{t.updateWith&&t.visible?u.push(t):h.push(t)})),e.forEach((t=>{t.instance.hide(),t.visible=!1,delete t.updateWith,t.applyTransform=!1}))}h.forEach((t=>t.instance.beforeMount())),h.forEach((t=>t.instance.mount())),f.forEach((t=>t.instance.beforeRender())),f.forEach((t=>{(t.updateWith||t.applyTransform)&&t.visible?t.instance.update():t.instance.render()})),e||Qs(n,a),h.forEach((t=>t.instance.mounted())),u.forEach((t=>t.instance.updated())),d.forEach((t=>{delete t.updateWith,t.visible=!0,t.applyTransform=!1})),D()},u.destroy=()=>{O(),w.destroy(),L(),j(),delete u.update,delete u.destroy,I()},u.getAffectedShapes=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"and",n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,r=[];return d.filter((t=>null==i||t.key===i)).forEach((i=>{const o=i.instance.getBrushedShapes(t,e,n);r=[...r,...o]})),r},u.findShapes=t=>{let e=[];return d.forEach((n=>{const i=n.instance.findShapes(t);e=[...e,...i]})),e},u.componentsFromPoint=t=>P(t).map((t=>t.instance.ctx)),u.shapesAt=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=[];const r=n.getBoundingClientRect();let o=d;if(Array.isArray(e.components)&&e.components.length>0){const t=e.components.map((t=>t.key));o=d.filter((e=>-1!==t.indexOf(e.key))).map((n=>({instance:n.instance,opts:e.components[t.indexOf(n.key)]})))}for(let n=o.length-1;n>=0;n--){const a=o[n],s=Js(t,r,a.instance.renderer().element().getBoundingClientRect()),l=a.instance.shapesAt(s,a.opts),c=l.length>0&&"stop"===e.propagation;if(i=[...i,...l],i.length>0&&c)return i}return i},u.brushFromShapes=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{components:[]};for(let n=0;n<e.components.length;n++){const i=e.components[n].key;d.filter((t=>i===t.key)).forEach((i=>{let r=t.filter((t=>t.key===i.key));i.instance.brushFromShapes(r,e.components[n])}))}},u.scroll=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";return Lo(t,g)},u.dataset=t=>y(t),u.dataCollection=t=>v(t),u.scales=function(){return f.all()},u.formatters=function(){return p.all()},u.brush=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";return x[t]||(x[t]=oa()),x[t]},u.scale=function(t){return f.get(t)},u.formatter=function(t){return p.get(t)},u.toggleBrushing=function(t){b=void 0!==t?t:!b},u.component=t=>{const e=w.findComponentByKey(t);return null==e?void 0:e.instance.ctx},u.logger=()=>s,u.theme=()=>l,u.storage=Ga({animations:{updatingStageMeta:{isInit:!1,shouldBeRemoved:!1}}}),Object.defineProperty(u,"interactions",{get:()=>({instances:m,on(){F(),m.forEach((t=>t.on()))},off(){L(),m.forEach((t=>t.off()))}})}),S(),n&&(N(),B(),q(n),u.element=n),u}const el=t=>{let e=$t(t);return e.prio=t=>t?e.default(t[0]):[e.default()],e.types=()=>e.getKeys(),e};var nl=$t();function il(t,e,n){let{key:i}=n;const r={value:"function"==typeof t.value?t.value(e):void 0!==t.value?t.value:e};return r.label="function"==typeof t.label?t.label(e):void 0!==t.label?String(t.label):String(r.value),t.field&&(r.source={key:i,field:t.field.key()}),r}function rl(t,e){const n=Array.isArray(t)?t:[t];let i=[];return n.forEach((t=>{if(void 0!==t.field){const n=e.field(t.field),r=e.key();if(!n)throw Error("Field '".concat(t.field,"' not found"));const{props:o,main:a}=ki(t,e),s=Object.keys(o),l=!!t.trackBy,c=typeof t.trackBy,u={},h=[],d=n.items(),f=[];for(let e=0;e<d.length;e++){const n=d[e];if(a.filter&&!a.filter(n))continue;const i=il(a,n,{key:r});s.forEach((t=>{const a=o[t];let s=a.field?a.field.items()[e]:n;i[t]=il(a,s,{key:r})})),l&&Si({cfg:t,itemData:n,obj:i,target:h,tracker:u,trackType:c}),f.push(i)}i=l?[...i,...Mi(h,{main:a,propsArr:s,props:o})]:[...i,...f]}})),i}const ol=t=>t.filter((t=>"number"==typeof t&&!isNaN(t)));const al=t=>{let{key:e,data:n,cache:i,config:r}=t;if(!n)return;let o=n;"string"==typeof o&&(o=(t=>{let{data:e,config:n}=t;const i=e.split("\n"),r=i[0],o=i[1];let a=",";if(n&&n.parse&&n.parse.delimiter)a=n.parse.delimiter;else if(r){const t=[/,/,/\t/,/;/];for(let e=0;e<t.length;e++){const n=t[e];if(r&&o){if(n.test(r)&&n.test(o)&&r.split(n).length===o.split(n).length){a=n;break}}else n.test(r)&&(a=n)}}return i.map((t=>t.split(a)))})({data:n,config:r})),Array.isArray(o)&&function(t){let e,{source:n,data:i,cache:r,config:o}=t,a=i;const s=o&&o.parse;Array.isArray(i[0])?s&&!1===s.headers?e=i[0].map(((t,e)=>e)):(e=i[0],a=i.slice(1)):e=Object.keys(i[0]);const l=!!s&&"function"==typeof s.row&&s.row;let c,u=e;u=s&&"function"==typeof s.fields?s.fields(u.slice()):e.map((t=>({key:t,title:t}))),Array.isArray(i[0])?c=u.map((()=>[])):(c={},u.forEach((t=>{c[t.key]=[]})));for(let t=0;t<a.length;t++){const e=l?l(a[t],t,u):a[t];if(e)if(Array.isArray(e))for(let t=0;t<u.length;t++)c[t].push(e[t]);else for(let t=0;t<u.length;t++)c[u[t].key].push(e[u[t].key])}const h=Array.isArray(c)?t=>c[t]:t=>c[u[t].key];for(let t=0;t<u.length;t++){const e=h(t),i=ol(e),o=i.length>0,a=o?"measure":"dimension",s=o?Math.min(...i):NaN,l=o?Math.max(...i):NaN;r.fields.push(mi(_({source:n,key:t,title:u[t].title,values:e,min:s,max:l,type:a},u[t]),{value:u[t].value,label:u[t].label}))}}({data:o,cache:i,source:e,config:r})};function sl(){let{key:t,data:e,config:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const i={fields:[]},r={key:()=>t,raw:()=>e,field:t=>yi(t,{cache:i,matrix:e}),fields:()=>i.fields.slice(),extract:t=>rl(t,r),hierarchy:()=>null};return al({key:t,data:e,config:n,cache:i}),r}sl.util={normalizeConfig:ki,collect:Mi,track:Si};const ll=$t();ll.default("matrix"),ll("matrix",sl),ll("default",sl);const cl=$t();function ul(t,e,n){return Math.max(t,Math.min(e,n))}function hl(t){let{item:e,value:n,boxCenter:i,rendWidth:r,rendHeight:o,flipXY:a,symbol:s}=t,l="x",c="y",u=r,h=o,d=n<.5?90:-90;return a&&(l="y",c="x",u=o,h=r,d=n<.5?180:0),s(_({},e.oob,{[l]:i*u,[c]:Math.max(e.oob.size/2,Math.min(n*h,h-e.oob.size/2)),startAngle:d}))}function dl(t){let{item:e,boxWidth:n,boxPadding:i,rendWidth:r,rendHeight:o,flipXY:a}=t,s="x",l="y",c="width",u="height",h=r,d=o;a&&(s="y",l="x",c="height",u="width",h=o,d=r);const{actualDiff:f,actualLow:p}=function(t){let{start:e,end:n,minPx:i=.1,maxPx:r=1}=t;const o=Math.max(e,n),a=Math.min(e,n),s=ul(-.1,1.2,o),l=ul(-.1,1.2,a),c=s*r-l*r,u=Math.max(i,c),h=(u-c)/2;return{actualDiff:u,startModifier:h,actualLow:l*r-h}}({start:e.start,end:e.end,minPx:e.box.minHeightPx,maxPx:d});return _({},e.box,{type:"rect",[s]:(i+e.major)*h,[l]:p,[u]:f,[c]:n*h,data:e.data||{},collider:{type:null}})}function fl(t){let{item:e,from:n,to:i,boxCenter:r,rendWidth:o,rendHeight:a,flipXY:s}=t,l="x1",c="y1",u="x2",h="y2",d=o,f=a;return s&&(l="y1",c="x1",u="y2",h="x2",d=a,f=o),_({},e.line,{type:"line",[h]:Math.floor(n*f),[l]:r*d,[c]:Math.floor(i*f),[u]:r*d,data:e.data||{},collider:{type:null}})}function pl(t){let{item:e,key:n,position:i,width:r,boxCenter:o,rendWidth:a,rendHeight:s,flipXY:l}=t,c="x1",u="y1",h="x2",d="y2",f=a,p=s;l&&(c="y1",u="x1",h="y2",d="x2",f=s,p=a);const g=r/2;return _({type:"line"},e[n],{[u]:Math.floor(i*p),[c]:(o-g)*f,[d]:Math.floor(i*p),[h]:(o+g)*f,r:g*f,cx:o*f,cy:i*p,width:r*f,data:e.data||{},collider:{type:null}})}function gl(t,e,n){const{width:i,maxWidthPx:r,minWidthPx:o}=e.box,a=t>=0?1:-1;let s=Math.min(a*t*i,isNaN(r)?n:r/n);return s=isNaN(o)?s:Math.max(o/n,s),s*a}cl("native",(function(t,e,n){let i,r,o={chart:t,mediator:e,element:n},a=[],s=!0;function l(){"function"==typeof i.enable&&(i.enable=i.enable.bind(o)()),i.enable&&Object.keys(i.events).forEach((t=>{const e=i.events[t].bind(o);n.addEventListener(t,e),a.push({key:t,listener:e})}))}function c(){a.forEach((t=>{let{key:e,listener:i}=t;n.removeEventListener(e,i)})),a=[]}return{get key(){return r},set(t){!function(t){r=t.key,i=t,i.events=i.events||[],void 0===i.enable&&(i.enable=!0)}(t),c(),s&&l()},off(){s=!1,c()},on(){s=!0,0===a.length&&l()},destroy(){c(),o=null,i=null}}}));const ml={oob:{show:!0,type:"n-polygon",fill:"#999",stroke:"#000",strokeWidth:0,size:10,sides:3,startAngle:-90},box:{show:!0,fill:"#fff",stroke:"#000",strokeWidth:1,strokeLinejoin:"miter",width:1,maxWidthPx:void 0,minWidthPx:1,minHeightPx:1},line:{show:!0,stroke:"#000",strokeWidth:1},median:{show:!0,stroke:"#000",strokeWidth:1},whisker:{show:!0,stroke:"#000",strokeWidth:1,fill:"",type:"line",width:1}},yl=Object.keys(ml),vl={require:["chart","resolver","symbol"],defaultSettings:{settings:{},data:{},style:{box:"$shape",line:"$shape-guide",whisker:"$shape-guide",median:"$shape-guide--inverted"}},created(){this.state={}},render(t){let{data:e}=t;const{width:n,height:i}=this.rect,r="horizontal"===this.settings.settings.orientation,{style:o,resolver:a,symbol:s}=this,l=yl.filter((t=>!this.settings.settings[t]||!1!==this.settings.settings[t].show)),c={};l.forEach((t=>c[t]=ml[t]));const u=function(t){let{keys:e,data:n,defaultSettings:i,style:r,settings:o,width:a,height:s,resolver:l}=t;const c=_(!0,{},i||{},r||{}),u={major:"horizontal"===o.orientation?s:a,minor:"horizontal"===o.orientation?a:s},h=o.major;let d;d="object"==typeof h&&"object"==typeof h.ref&&void 0!==h.ref.start&&void 0!==h.ref.end?l.resolve({data:n,defaults:{start:0,end:1},scaled:u,settings:_(!0,{},{binStart:{scale:o.major.scale,ref:o.major.ref.start},binEnd:{scale:o.major.scale,ref:o.major.ref.end}})}):"object"==typeof h&&void 0!==h.binStart&&void 0!==h.binEnd?l.resolve({data:n,defaults:{start:0,end:1},scaled:u,settings:_(!0,{},{binStart:{scale:o.major.scale,ref:"binStart"},binEnd:{scale:o.major.scale,ref:"binEnd"}},o.major)}):l.resolve({data:n,scaled:u,defaults:{major:.5},settings:{major:o.major}});const f=o.minor||{},p={};["start","end","min","max","med"].forEach((t=>{(f[t]||n.items&&n.items.length&&n.items[0][t])&&(p[t]={scale:f.scale,ref:t})}));let g,m={major:d,minor:l.resolve({data:n,defaults:{start:0,end:1},scaled:u,settings:_(!0,{},p,f)})};for(let t=0,i=e.length;t<i;t++)o[g]&&!1===o[g].show||(g=e[t],m[g]=l.resolve({data:n,defaults:c[g],settings:o[g],scaled:u}));return m}({keys:l,data:e,defaultSettings:c,style:o,settings:this.settings.settings,width:n,height:i,resolver:a}),{settings:h,items:d}=u;return function(t){let{width:e,height:n,flipXY:i,resolved:r,keys:o,symbol:a}=t;const s=[],l=r.major.items;if(!l.length)return s;const c=e,u=n,h=i?n:e,d=r.major.settings,f=["start","end","min","max","med"].filter((t=>void 0!==r.minor.settings[t])),p=f.length,g=o.filter((t=>"oob"!==t));let m,y,v,x,b,w,k,M,S;const C=o?o.length:0,N=g?g.length:0,R={box:function(){v.box&&q(v.start)&&q(v.end)&&m.push(dl({item:v,boxWidth:x,boxPadding:b,rendWidth:c,rendHeight:u,flipXY:i}))},line:function(){q(v.min)&&q(v.start)&&m.push(fl({item:v,from:v.min,to:v.start,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i})),q(v.max)&&q(v.end)&&m.push(fl({item:v,from:v.max,to:v.end,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i}))},median:function(){v.median&&q(v.med)&&m.push(pl({item:v,key:"median",position:v.med,width:x,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i}))},whisker:function(){if(v.whisker){const t=x*v.whisker.width;q(v.min)&&m.push(pl({item:v,key:"whisker",position:v.min,width:t,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i})),q(v.max)&&m.push(pl({item:v,key:"whisker",position:v.max,width:t,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i}))}}};function A(){let t,e=-Number.MAX_VALUE,n=Number.MAX_VALUE;for(let i=0;i<p;i++)t=v[f[i]],q(t)&&(e<t&&(e=t),n>t&&(n=t));k=e<0&&e!==-Number.MAX_VALUE,M=n>1&&n!==Number.MAX_VALUE,S=k||M}for(let t=0,e=l.length;t<e;t++){m=[],y=null;const e=l[t],n=e.data;let f=null,p=null;void 0!==d.binStart?(f=e.binStart,p=e.binEnd,y=d.binStart.scale):(y=d.major.scale,f=y?e.major:0);let q=0;y?y.bandwidth?(q=y.bandwidth(),f-=q/2):q=p-f:q=1,v=_({},{major:f,majorEnd:p},r.minor.items[t]);for(let e=0;e<C;e++)v[o[e]]=r[o[e]].items[t];if(x=gl(q,v,h),b=(q-x)/2,w=b+v.major+x/2,A(),S)v.oob&&(k?m.push(hl({item:v,value:0,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i,symbol:a})):M&&m.push(hl({item:v,value:1,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i,symbol:a})));else for(let t=0;t<N;t++)v[g[t]]&&!1===v[g[t]].show||R[g[t]]();const D={type:"container",data:n,collider:{type:"bounds"},children:m};s.push(D)}return s}({items:d,settings:h,width:n,height:i,flipXY:r,resolved:u,keys:l,symbol:s})}};const xl={shape:"saltire",width:2,size:.5,fill:"#333",stroke:"#333",strokeWidth:0},bl=/px$/,wl={shape:"circle",label:"",fill:"#333",stroke:"#ccc",strokeDasharray:"",strokeWidth:0,strokeLinejoin:"miter",opacity:1,x:.5,y:.5,size:1,show:!0},kl={maxPx:1e4,minPx:1,maxRelExtent:.1,minRelExtent:.01,maxRelDiscrete:1,minRelDiscrete:.1};function _l(t,e){return t&&"function"==typeof t.bandwidth?{isBandwidth:!0,value:Math.max(1,t.bandwidth()*e)}:{isBandwidth:!1,value:Math.max(1,e)}}function Ml(t,e,n,i){let{width:r,height:o}=e;return t.filter((t=>!1!==t.show&&!isNaN(t.x+t.y))).map((t=>{let e=t,a=bl.test(t.size)?parseInt(t.size,10):n.min+e.size*(n.max-n.min);A(a)&&(e=xl,a=n.min+e.size*(n.max-n.min));const[s,l]=function(t){let e=wl.shape,n={};return"object"==typeof t.shape&&"string"==typeof t.shape.type?(e=t.shape.type,n=t.shape):"string"==typeof t.shape&&(e=t.shape),[e,n]}(e),c=C(C({},l),{},{type:s,label:t.label,x:t.x*r,y:t.y*o,fill:e.fill,size:Math.min(n.maxGlobal,Math.max(n.minGlobal,a)),stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.strokeDasharray,opacity:e.opacity});e===t.errorShape&&(c.width=e.width);const u=i(c);return u.data=t.data,u}))}const Sl={require:["chart","resolver","symbol"],defaultSettings:{settings:{},data:{},animations:{enabled:!1,trackBy:t=>t.data.value},style:{item:"$shape"}},render(t){let{data:e}=t;const n=this.resolver.resolve({data:e,defaults:_({},wl,this.style.item),settings:this.settings.settings,scaled:{x:this.rect.width,y:this.rect.height}}),{width:i,height:r}=this.rect,o=_({},kl,this.settings.settings.sizeLimits),a=n.items,s=function(t,e,n,i,r){const o=_l(t?t.scale:void 0,n),a=_l(e?e.scale:void 0,i);let s=Math.min(o.value*r[o.isBandwidth?"maxRelDiscrete":"maxRelExtent"],a.value*r[a.isBandwidth?"maxRelDiscrete":"maxRelExtent"]),l=Math.min(o.value*r[o.isBandwidth?"minRelDiscrete":"minRelExtent"],a.value*r[a.isBandwidth?"minRelDiscrete":"minRelExtent"]);return{min:Math.max(1,Math.floor(l)),max:Math.max(1,Math.floor(s)),maxGlobal:r.maxPx,minGlobal:r.minPx}}(n.settings.x,n.settings.y,i,r,o);return Ml(a,this.rect,s,this.settings.shapeFn||this.symbol)}};Math.PI;const Cl={label:"",arc:1,show:!0,fill:"#333",stroke:"#ccc",strokeWidth:1,strokeLinejoin:"round",opacity:1,innerRadius:0,outerRadius:.8,cornerRadius:0,offset:0};function Nl(t,e,n,i){let{x:r,y:o,width:a,height:s}=e;const l=dt(),c={x:r+a/2,y:o+s/2},u=Math.min(a,s)/2,h=Math.min(a,s)/2,d=h/100;return t.map(((t,e)=>{const r=n[e];r.type="path";const o=h*r.outerRadius,a=u*r.innerRadius,s=d*r.cornerRadius;l.innerRadius(a),l.outerRadius(o),l.cornerRadius(s),r.arcDatum=t;const f=l.centroid(t),p=r.offset?function(t,e,n,i){let[r,o]=t;const a=Math.sqrt(r*r+o*o);r/=a,o/=a;const s=n-i;return{x:r*e*s,y:o*e*s}}(f,r.offset,o,a):{x:0,y:0};return r.transform="translate(".concat(p.x,", ").concat(p.y,") translate(").concat(c.x,", ").concat(c.y,")"),r.desc={share:t.value/i,slice:{start:t.startAngle,end:t.endAngle,innerRadius:a,outerRadius:o,cornerRadius:s,offset:{x:c.x+p.x,y:c.y+p.y}}},r}))}function Rl(t,e){return t.slice&&"arc"in t.slice?e.arc:e.data.value}const ql={require:["chart","resolver"],defaultSettings:{settings:{startAngle:0,endAngle:2*Math.PI,padAngle:0,slice:{}},style:{slice:"$shape"},data:{}},render(t){let{data:e}=t;const n=[],i=[],r=this.settings.settings,{items:o}=this.resolver.resolve({data:e,defaults:_({},Cl,this.style.slice),settings:r.slice});let a=0;for(let t=0,e=o.length;t<e;t++){const e=Rl(r,o[t]);e>0&&o[t].outerRadius>=o[t].innerRadius&&(n.push(e),i.push(o[t]),a+=e)}const s=function(){var t=xt,e=vt,n=null,i=W(0),r=W(nt),o=W(0);function a(a){var s,l,c,u,h,d=a.length,f=0,p=new Array(d),g=new Array(d),m=+i.apply(this,arguments),y=Math.min(nt,Math.max(-nt,r.apply(this,arguments)-m)),v=Math.min(Math.abs(y)/d,o.apply(this,arguments)),x=v*(y<0?-1:1);for(s=0;s<d;++s)(h=g[p[s]=s]=+t(a[s],s,a))>0&&(f+=h);for(null!=e?p.sort((function(t,n){return e(g[t],g[n])})):null!=n&&p.sort((function(t,e){return n(a[t],a[e])})),s=0,c=f?(y-d*x)/f:0;s<d;++s,m=u)l=p[s],u=m+((h=g[l])>0?h*c:0)+x,g[l]={data:a[l],index:s,value:h,startAngle:m,endAngle:u,padAngle:v};return g}return a.value=function(e){return arguments.length?(t="function"==typeof e?e:W(+e),a):t},a.sortValues=function(t){return arguments.length?(e=t,n=null,a):e},a.sort=function(t){return arguments.length?(n=t,e=null,a):n},a.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:W(+t),a):i},a.endAngle=function(t){return arguments.length?(r="function"==typeof t?t:W(+t),a):r},a.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:W(+t),a):o},a}().sortValues(null);s.startAngle(r.startAngle),s.endAngle(r.endAngle),s.padAngle(r.padAngle);return Nl(s(n),_({},this.rect,{x:0,y:0}),i,a)}};const Al=function(t){function e(e){if(t[e.type]&&t[e.type].condition(e)){const n=t[e.type],i=void 0===n.conditionAppend||n.conditionAppend(e);n.items.forEach((t=>{const n=Math.round(e[t.key]),r=e[t.key]-n;e[t.key]=n,i&&"append"===t.type&&(r>0?e[t.key]+=.5:e[t.key]-=.5)}))}}return void 0===t&&((t={}).line={append:["x1","x2","y1","y2"],round:[],condition:t=>t.x1===t.x2||t.y1===t.y2,conditionAppend:t=>t.strokeWidth%2!=0},t.rect={append:["x","y"],round:["width","height"],condition:()=>!0,conditionAppend:t=>t.strokeWidth%2!=0}),Object.keys(t).forEach((e=>{const n=t[e];n.items=[],n.append.forEach((t=>{n.items.push({key:t,type:"append"})})),n.round.forEach((t=>{n.items.push({key:t,type:"round"})}))})),e.multiple=t=>t.forEach((t=>e(t))),e}();class Dl{constructor(){this.reset(),this.push(...arguments)}static evaluateKey(t,e){if(e){const e=t.substring(0,1),n=t.substring(1);if("x"===e)return"y".concat(n);if("y"===e)return"x".concat(n);if("cx"===t)return"cy";if("cy"===t)return"cx";if("width"===t)return"height";if("height"===t)return"width"}return t}transposeCoordinate(t,e,n){if("number"==typeof e&&isFinite(e)){const i=t.substring(0,1);if("x"===i||"cx"===t)return e*this.width;if("width"===t)return e*this.width;if("r"===t)return e*(n?this.height:this.width);if("y"===i||"cy"===t)return e*this.height;if("height"===t)return e*this.height}return e}push(){return this.storage.push(...arguments),this}processItem(t){let e={};const n=void 0!==t.flipXY?t.flipXY:this.flipXY,i=void 0!==t.crisp?t.crisp:this.crisp;if(t.fn&&"function"==typeof t.fn){let i=n?this.height:this.width,r=n?this.width:this.height;t=t.fn({width:i,height:r,flipXY:n});const o=Object.keys(t);for(let i=0,r=o.length;i<r;i++){let r=o[i];e[Dl.evaluateKey(r,n)]=t[r]}}else{const i=Object.keys(t);for(let r=0,o=i.length;r<o;r++){let o=i[r];const a=Dl.evaluateKey(o,n),s=this.transposeCoordinate(a,t[o],n);e[a]=s}}return i&&Al(e),e}output(){let t=[];for(let e=0,n=this.storage.length;e<n;e++){let n=this.processItem(this.storage[e]);t.push(n)}return t}reset(){this.storage=[],this.flipXY=!1,this.crisp=!1,this.width=0,this.height=0}}function El(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Dl(...e)}function Ol(t,e){return t&&e?t.cachedTicks&&t.cachedTicks()||t.ticks({distance:e}):[]}const Il={created(){},require:["chart","renderer","resolver"],defaultSettings:{layout:{displayOrder:0},style:{ticks:"$guide-line",minorTicks:"$guide-line--minor"}},beforeRender(){this.blueprint=El(),this.blueprint.width=this.rect.width,this.blueprint.height=this.rect.height,this.blueprint.x=this.rect.x,this.blueprint.y=this.rect.y,this.blueprint.crisp=!0},render(){if(this.x=this.settings.x?this.chart.scale(this.settings.x):null,this.y=this.settings.y?this.chart.scale(this.settings.y):null,pa(this,"x",this.rect.width),pa(this,"y",this.rect.height),!this.x&&!this.y)return[];this.settings.ticks=_({show:!0},this.style.ticks,this.settings.ticks||{}),this.settings.minorTicks=_({show:!1},this.style.minorTicks,this.settings.minorTicks||{}),this.lines={x:[],y:[]},this.lines.x=Ol(this.x,this.rect.width),this.lines.y=Ol(this.y,this.rect.height),this.lines.y=this.lines.y.map((t=>_(t,{flipXY:!0})));let t=t=>{let{dir:e,isMinor:n}=t,i=this.lines[e].filter((t=>!!t.isMinor===n)),r=n?this.settings.minorTicks:this.settings.ticks;this.resolver.resolve({settings:r,data:{items:i,dir:e}}).items.forEach((t=>{let n=t.data;var i,r;t.show&&this.blueprint.push({type:"line",x1:n.position,y1:0,x2:n.position,y2:1,stroke:t.stroke||"black",strokeWidth:void 0!==t.strokeWidth?t.strokeWidth:1,strokeDasharray:void 0!==t.strokeDasharray?t.strokeDasharray:void 0,flipXY:n.flipXY||!1,value:null!==(i=n.value)&&void 0!==i?i:null===(r=n.data)||void 0===r?void 0:r.value,dir:e})}))};return t({dir:"x",isMinor:!1}),t({dir:"x",isMinor:!0}),t({dir:"y",isMinor:!1}),t({dir:"y",isMinor:!0}),this.blueprint.output()}};function Tl(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"bottom";if(n*=.8,"left"===i||"right"===i){let r="right"===i;return"\n M ".concat(t," ").concat(e-n,"\n A ").concat(1.25*n," ").concat(1.25*n,", 0, 1, ").concat(r?0:1,", ").concat(t," ").concat(e+n,"\n L ").concat(r?t+n:t-n," ").concat(e," Z\n ")}let r="bottom"===i;return"\n M ".concat(t-n," ").concat(e,"\n A ").concat(1.25*n," ").concat(1.25*n,", 0, 1, ").concat(r?1:0,", ").concat(t+n," ").concat(e,"\n L ").concat(t," ").concat(r?e+n:e-n," Z\n ")}function jl(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"bottom";if(n*=.75,"left"===i||"right"===i){let r="right"===i;return"\n M ".concat(t+=r?1.5*n:-1.5*n," ").concat(e-n,"\n L ").concat(t," ").concat(e+n,"\n L ").concat(r?t+n:t-n," ").concat(e," Z\n ")}let r="bottom"===i;return e+=r?1.5*n:-1.5*n,"\n M ".concat(t-n," ").concat(e,"\n L ").concat(t+n," ").concat(e,"\n L ").concat(t," ").concat(r?e+n:e-n," Z\n ")}function Pl(t){if(void 0===t)return 0;if("number"==typeof t&&isFinite(t))return t;if("string"==typeof t)switch(t){case"center":case"middle":return.5;case"bottom":case"right":return 1;case"top":case"left":default:return 0}return 0}function zl(t){const e={value:t.value};return t.label&&(e.label=t.label.text),e}function Fl(t){return void 0!==("function"==typeof t.value?t.value():t.value)}function Ll(t,e){const n=t.min();if(n===t.max()){const i=function(t){const e=t.range();return 2===(null==e?void 0:e.length)&&e[0]>e[1]}(t);if(e<n)return i?2:-1;if(e>n)return i?-1:2}return t(e)}const Bl={require:["chart","renderer"],defaultSettings:{layout:{displayOrder:0},style:{oob:{show:!0,width:10,fill:"#1A1A1A",stroke:"transparent",strokeWidth:0,opacity:1,text:{fontFamily:"Arial",stroke:"transparent",fill:"#fff",strokeWidth:0,opacity:1},triangle:{fill:"#4D4D4D",stroke:"transparent",strokeWidth:0,opacity:1},padding:{x:28,y:5}},line:{stroke:"#000"},label:{strokeWidth:0}}},preferredSize:()=>30,beforeRender(){this.blueprint=El(),this.blueprint.width=this.rect.width,this.blueprint.height=this.rect.height,this.blueprint.x=this.rect.x,this.blueprint.y=this.rect.y,this.blueprint.crisp=!0},render(){let t=this.settings;if(this.lines={x:[],y:[]},this.lines.x=t.lines&&t.lines.x||[],this.lines.y=t.lines&&t.lines.y||[],0===this.lines.x.length&&0===this.lines.y.length)return[];const e={x0:[],x1:[],y0:[],y1:[]};this.lines.x=this.lines.x.filter(Fl).map((t=>{if("function"==typeof t.value&&(t.value=t.value()),t.scale){let e=this.chart.scale(t.scale);const n=Ll(e,t.value);return _(t,{scale:e,position:n})}return _(t,{position:t.value})})),this.lines.y=this.lines.y.filter(Fl).map((t=>{if("function"==typeof t.value&&(t.value=t.value()),t.scale){let e=this.chart.scale(t.scale);const n=Ll(e,t.value);return _(t,{scale:e,position:n,flipXY:!0})}return _(t,{position:t.value,flipXY:!0})})),this.lines.x=this.lines.x.filter((t=>!(t.position<0||t.position>1)||(e["x".concat(t.position>1?1:0)].push(zl(t)),!1))),this.lines.y=this.lines.y.filter((t=>!(t.position<0||t.position>1)||(e["y".concat(t.position>1?1:0)].push(zl(t)),!1)));let n=[];return[...this.lines.x,...this.lines.y].forEach((e=>{(!0===e.show||void 0===e.show)&&function(t){let{chart:e,blueprint:n,renderer:i,p:r,settings:o,items:a}=t,s=!0,l=!1,c=!1,u=!1,h=!1,d=_(!0,{},o.style.line,r.line||{});if(l=n.processItem({type:"line",x1:r.position,y1:0,x2:r.position,y2:1,stroke:d.stroke||"black",strokeWidth:d.strokeWidth||1,strokeDasharray:d.strokeDasharray,flipXY:r.flipXY||!1,value:r.valueInfo?r.valueInfo.id:r.value}),r.label){const t=_(!0,{fill:"#000",fontFamily:"Arial",fontSize:"12px",opacity:1,maxWidth:1,maxWidthPx:9999,padding:5,background:{fill:"#fff",stroke:"transparent",strokeWidth:0,opacity:.5}},o.style.label||{},{fill:d.stroke},r.label);let l,f={width:0,height:0},p="";if("string"==typeof r.formatter)l=e.formatter(r.formatter);else if("object"==typeof r.formatter)l=e.formatter(r.formatter);else if(void 0!==r.scale&&r.scale.data){const t=r.scale.data()&&r.scale.data().fields;l=t&&t[0]?t[0].formatter():null}!1!==r.label.showValue&&(l?p=" (".concat(l(r.value),")"):r.scale&&(p=" (".concat(r.value,")"))),p&&(f=i.measureText({text:p,fontFamily:t.fontFamily,fontSize:t.fontSize}));let g=i.measureText({text:t.text||"",fontFamily:t.fontFamily,fontSize:t.fontSize}),m={width:g.width+f.width,height:Math.max(g.height,f.height)},y=t.padding,v=Pl(r.flipXY?t.vAlign:t.align),x=Pl(r.flipXY?t.align:t.vAlign),b=Math.min(1+m.width+2*y,t.maxWidth*n.width,t.maxWidthPx),w=m.height+2*y,k=r.flipXY?w:b,M=r.flipXY?b:w;if(c=n.processItem({fn:e=>{let{width:i,height:o}=e,a=r.position*i-(r.flipXY?w:b)*(1-v);return a=r.flipXY?a:Math.max(a,0),{type:"rect",x:a,y:Math.max(Math.abs(x*o-M*x),0),width:r.flipXY?k:Math.min(k,n.width-a),height:M,stroke:t.background.stroke,strokeWidth:t.background.strokeWidth,fill:t.background.fill,opacity:t.background.opacity}},flipXY:r.flipXY||!1}),c.x<-1||c.x+c.width>n.width+1||c.y<-1||c.y+c.height>n.height+1)c=void 0;else{u={type:"text",text:t.text||"",fill:t.fill,opacity:t.opacity,fontFamily:t.fontFamily,fontSize:t.fontSize,x:c.x+y,y:c.y+c.height/2+m.height/3,maxWidth:c.width-2*y-f.width,anchor:"start"},p&&(h={type:"text",text:p||"",fill:t.fill,opacity:t.opacity,fontFamily:t.fontFamily,fontSize:t.fontSize,x:u.x+3+(c.width-(f.width+2*y)),y:u.y});for(let t=0,e=a.length;t<e;t++){let e=a[t];"rect"===e.type?fs(c,e)&&(s=!1):"line"===e.type&&r.flipXY===e.flipXY&&ms(c,e)&&(s=!1)}}}a.push(l),s&&c&&u&&(a.push(c,u),h&&a.push(h))}({chart:this.chart,blueprint:this.blueprint,renderer:this.renderer,p:e,settings:t,items:n})})),t.style.oob.show&&function(t){let{blueprint:e,oob:n,settings:i,items:r}=t;const o=Object.keys(n);let a=i.style.oob||{};for(let t=0,i=o.length;t<i;t++){const i=o[t],s=n[i];if(s.length>0){let t=i.charAt(1),n="y"===i.charAt(0),o=a.padding.x+a.width,l=a.padding.y+a.width,c="bottom";c=n?"1"===t?"bottom":"top":"1"===t?"right":"left";let u=e.processItem({fn:e=>{let{width:i,height:r}=e,u=t*i+("1"===t?-o:o),h=n?l:r-l;return"arc"===a.type?{type:"path",d:Tl(n?h:u,n?u:h,a.width,c),x:u,y:h,stroke:a.stroke,fill:a.fill,strokeWidth:a.strokeWidth||0}:{type:"circle",cx:u,cy:h,r:a.width,stroke:a.stroke,fill:a.fill,strokeWidth:a.strokeWidth||0,opacity:a.opacity,data:s}},flipXY:n}),h=u.cx||u.x,d=u.cy||u.y,f={type:"text",text:s.length||"",x:h-.4*a.width,y:d+.4*a.width,fontFamily:a.text.fontFamily,fontSize:"".concat(1.3*a.width,"px"),stroke:a.text.stroke,fill:a.text.fill,strokeWidth:a.text.strokeWidth||0,opacity:a.text.opacity},p={type:"path",d:jl(h,d,a.width,c),x:h,y:d,stroke:a.triangle.stroke,fill:a.triangle.fill,strokeWidth:a.triangle.strokeWidth||0,opacity:a.triangle.opacity};r.push(u,f,p)}}}({blueprint:this.blueprint,oob:e,settings:t,items:n}),n}};function Hl(t){const e={type:"line",x1:0,x2:0,y1:0,y2:0,collider:{type:null}};return"top"===t.align||"bottom"===t.align?(e.x1=t.innerRect.x-t.outerRect.x,e.x2=e.x1+t.innerRect.width,e.y1=e.y2="top"===t.align?t.innerRect.height-t.padding:t.padding):(e.x1=e.x2="left"===t.align?t.innerRect.width-t.padding:t.padding,e.y1=t.innerRect.y-t.outerRect.y,e.y2=e.y1+t.innerRect.height),function(t,e){_(t,e.style)}(e,t),e}function $l(t){return"string"==typeof t||"number"==typeof t?t:"-"}function Vl(t,e,n){n.layered||!n.stepSize?function(t,e){e.collider={type:"polygon",vertices:[{x:e.boundingRect.x,y:e.boundingRect.y},{x:e.boundingRect.x+e.boundingRect.width,y:e.boundingRect.y},{x:e.boundingRect.x+e.boundingRect.width,y:e.boundingRect.y+e.boundingRect.height},{x:e.boundingRect.x,y:e.boundingRect.y+e.boundingRect.height}]}}(0,e):n.tilted?function(t,e,n){const i=n.angle*(Math.PI/180),r=Math.max(n.stepSize/2,e.boundingRect.height/2),o="start"===e.anchor,a="end"===e.anchor&&i<0,s="start"===e.anchor&&i>=0,l=e.boundingRect.y+(s||a?e.boundingRect.height:0),c=[{x:e.x-r,y:l},{x:e.x+r,y:l}].map((t=>Fa(t,i,{x:e.x,y:e.y}))),u={x:o?e.boundingRect.x+e.boundingRect.width+10:e.boundingRect.x-10,y:e.boundingRect.y+e.boundingRect.height},h={x:o?e.boundingRect.x+e.boundingRect.width+10:e.boundingRect.x-10,y:e.boundingRect.y},d=i>=0?[u,h]:[h,u];c.push(...d),e.collider={type:"polygon",vertices:c}}(0,e,n):function(t,e,n){if("bottom"===n.align||"top"===n.align){const i=t.position*n.innerRect.width+(n.innerRect.x-n.outerRect.x-n.stepSize/2);e.collider={type:"rect",x:i,y:0,width:i<0?n.stepSize+i:n.stepSize,height:n.innerRect.height}}else{const i=t.position*n.innerRect.height+(n.innerRect.y-n.outerRect.y-n.stepSize/2);e.collider={type:"rect",x:0,y:i,width:n.innerRect.width,height:i<0?n.stepSize+i:n.stepSize}}const i=e.collider;i.x=Math.max(i.x,0),i.y=Math.max(i.y,0);const r=i.x+i.width-(n.outerRect.x+n.outerRect.width);i.width=r>0?i.width-r:i.width;const o=i.y+i.height-(n.outerRect.y+n.outerRect.height);i.height=o>0?i.height-o:i.height}(t,e,n)}function Wl(t,e){const n=isNaN(t.style.align)?.5:Math.min(Math.max(t.style.align,0),1);let i=0;if(t.tilted)i=t.stepSize*n;else{const r=e?t.textRect.height:t.textRect.width;i=Math.max(0,t.stepSize-r)*n}return i}function Ul(t,e){var n,i;const r={type:"text",text:$l(t.label),x:0,y:0,maxWidth:e.maxWidth,maxHeight:e.maxHeight,tickValue:null!==(n=t.value)&&void 0!==n?n:null===(i=t.data)||void 0===i?void 0:i.value};return"top"===e.align||"bottom"===e.align?(r.x=t.start*e.innerRect.width+(e.innerRect.x-e.outerRect.x)+Wl(e,!1),r.y="top"===e.align?e.innerRect.height:0,r.anchor=e.stepSize?"start":"middle",r.x+=isNaN(e.style.offset)?0:+e.style.offset):(r.y=t.start*e.innerRect.height+(e.innerRect.y-e.outerRect.y)+Wl(e,!0),r.x="left"===e.align?e.innerRect.width:0,r.anchor="left"===e.align?"end":"start",r.baseline=e.stepSize?"text-before-edge":"central",r.y+=isNaN(e.style.offset)?0:+e.style.offset),function(t,e){["fill","fontSize","fontFamily"].forEach((n=>{t[n]=e.style[n]}))}(r,e),function(t,e){if(!e.tilted&&!e.stepSize)if("top"===e.align||"bottom"===e.align){const n=0,i=e.outerRect.width,r=Math.min(e.maxWidth/2,e.textRect.width/2),o=t.x-r,a=t.x+r;o<n?(t.anchor="start",t.x=e.innerRect.x-e.outerRect.x):a>i&&(t.anchor="end",t.x=e.innerRect.width+e.innerRect.x)}else{const n=0,i=e.outerRect.height,r=e.maxHeight/2,o=t.y-r,a=t.y+r;o<n?(t.y=e.innerRect.y-e.outerRect.y,t.baseline="text-before-edge"):a>i&&(t.y=e.innerRect.height+(e.innerRect.y-e.outerRect.y),t.baseline="text-after-edge")}}(r,e),function(t,e){"top"===e.align?t.y-=e.padding:"bottom"===e.align?t.y+=e.padding+e.maxHeight:"left"===e.align?t.x-=e.padding:"right"===e.align&&(t.x+=e.padding)}(r,e),function(t,e){if(e.tilted){const n=-e.angle,i=n*(Math.PI/180);"bottom"===e.align?(t.x-=e.maxHeight*Math.sin(i)/2,t.y-=e.maxHeight,t.y+=e.maxHeight*Math.cos(i)/2):t.x-=e.maxHeight*Math.sin(i)/3,t.transform="rotate(".concat(n,", ").concat(t.x,", ").concat(t.y,")"),t.anchor="bottom"===e.align==e.angle<0?"start":"end";const r=Math.cos(i)*e.maxWidth;if("bottom"===e.align==e.angle<0){const n=e.outerRect.width-e.paddingEnd;t.x+r>n&&(t.maxWidth=(n-t.x-10)/Math.cos(i))}else{const n=e.paddingEnd;t.x-r<n&&(t.maxWidth=(t.x-n-10)/Math.cos(i))}}}(r,e),function(t,e){t.boundingRect=e.textBounds(t)}(r,e),Vl(t,r,e),r}function Yl(t,e){const n={type:"line",x1:0,x2:0,y1:0,y2:0,collider:{type:null},tickValue:t.value};return"top"===e.align||"bottom"===e.align?(n.x1=n.x2=t.position*e.innerRect.width+(e.innerRect.x-e.outerRect.x),n.y1="top"===e.align?e.innerRect.height:0,n.y2="top"===e.align?n.y1-e.tickSize:n.y1+e.tickSize):(n.y1=n.y2=t.position*e.innerRect.height+(e.innerRect.y-e.outerRect.y),n.x1="left"===e.align?e.innerRect.width:0,n.x2="left"===e.align?n.x1-e.tickSize:n.x1+e.tickSize),function(t,e){_(t,e.style)}(n,e),function(t,e){"top"===e.align?(t.y1-=e.padding,t.y2-=e.padding):"bottom"===e.align?(t.y1+=e.padding,t.y2+=e.padding):"left"===e.align?(t.x1-=e.padding,t.x2-=e.padding):"right"===e.align&&(t.x1+=e.padding,t.x2+=e.padding)}(n,e),function(t,e){const n=t.strokeWidth/2;t.x1===e.innerRect.width?(t.x1-=n,t.x2-=n):0===t.x1?(t.x1+=n,t.x2+=n):t.y1===e.innerRect.height?(t.y1-=n,t.y2-=n):0===t.y1&&(t.y1+=n,t.y2+=n)}(n,e),n}function Xl(t){return!t.isMinor&&t.position>=0&&t.position<=1}function Kl(t){let{rect:e,state:n,majorTicks:i,measure:r,horizontal:o}=t;return o?function(t){let{majorTicks:e,measureText:n,rect:i,state:r}=t;const o="layered"===r.labels.activeMode?2:1,a=i.width,s=e.map((t=>t.label)).map((t=>"".concat(t.slice(0,1)).concat(t.length>1?"…":""))).map(n).map((t=>t.width));for(let t=0;t<e.length;++t){const n=e[t];if(o*a*Math.abs(n.start-n.end)<s[t])return!0}return!1}({majorTicks:i,measureText:r,rect:e,state:n}):function(t){let{majorTicks:e,measureText:n,rect:i}=t;const r=i.height,o=n("M").height;return!(e.length<2)&&r*Math.abs(e[0].position-e[1].position)<o}({majorTicks:i,measureText:r,rect:e,state:n})}function Gl(t){let{value:e,maxValue:n,minValue:i,range:r,modifier:o}=t;return isNaN(r)||isNaN(o)||(e=r*o),e>n&&(e=n),e<i&&(e=i),e}function Zl(t){let{isDiscrete:e,rect:n,formatter:i,measureText:r,scale:o,settings:a,state:s}=t,l=0;const c={left:0,top:0,right:0,bottom:0},{maxLengthPx:u,minLengthPx:h}=a.labels;if(a.labels.show){const t=a.align,d="top"===t||"bottom"===t,f=d?n.inner.width:n.inner.height,p=o.ticks({settings:a,distance:f,formatter:i}).filter(Xl),g=t=>{const e=r({text:t,fontSize:a.labels.fontSize,fontFamily:a.labels.fontFamily});return e.width=Gl({value:e.width,maxValue:u,minValue:h}),e};if(e&&d&&"auto"===a.labels.mode&&(!function(t){let{majorTicks:e,measure:n,rect:i,state:r,settings:o}=t;const a=o.labels.maxGlyphCount,s="layered"===r.labels.activeMode?2:1,l=o.labels.tiltThreshold?o.labels.tiltThreshold:.7,c=n("…").width,u=i.width;let h=0,d=0;if(isNaN(a))for(let t=0;t<e.length;t++){const i=e[t],r=i.label,o=n(r).width*(r.length>1?l:1);if(d=s*u*Math.abs(i.start-i.end),o+c>d)return!0}else if(d=s*u*e.reduce(((t,e)=>Math.min(Math.abs(e.start-e.end),t)),1/0),h=n("M").width*l*a,h+c>d)return!0;return!1}({majorTicks:p,measure:g,rect:n.inner,state:s,settings:a})?s.labels.activeMode="horizontal":s.labels.activeMode="tilted"),!a.labels.filterOverlapping&&"tilted"!==s.labels.activeMode&&Kl({rect:n.inner,state:s,majorTicks:p,measure:g,horizontal:d})){return{size:Math.max(n.outer.width,n.outer.height),isToLarge:!0}}let m,y;if("tilted"===s.labels.activeMode){const t=Math.abs(a.labels.tiltAngle)*(Math.PI/180);m=e=>Gl({value:e.width,maxValue:u,minValue:h})*Math.sin(t)+e.height*Math.cos(t)}else m=d?t=>t.height:t=>Gl({value:t.width,maxValue:u,minValue:h});if(d&&"tilted"!==s.labels.activeMode)y=["M"];else if(isNaN(a.labels.maxGlyphCount))y=p.map((t=>t.label));else{let t="";for(let e=0;e<a.labels.maxGlyphCount;e++)t+="M";y=[t]}const v=y.map(g),x=v.map(m),b=Math.max(...x,0);if(l+=b,l+=a.labels.margin,"layered"===s.labels.activeMode&&(l*=2),"tilted"===s.labels.activeMode){const t="bottom"===a.align==a.labels.tiltAngle>=0,e=Math.abs(a.labels.tiltAngle)*(Math.PI/180),i=(b-g("M").height*Math.cos(e))/Math.sin(e),r=t=>Math.min(i,t.width)*Math.cos(e)+t.height,o=(e,i)=>{const r=p[i]?p[i].position:0;return t?e-r*n.inner.width:e-(1-r)*n.inner.width},s=Math.min(a.labels.maxEdgeBleed,Math.max(...v.map(r).map(o),0))+a.paddingEnd;if(c[t?"left":"right"]=s,!a.labels.filterOverlapping&&function(t){let{majorTicks:e,measureText:n,rect:i,bleedSize:r,angle:o}=t;if(e.length<2)return!1;if(0===o)return!0;const a=Math.abs(o),s=1/(Math.min(i.outer.width-r,i.inner.width)*Math.abs(e[0].position-e[1].position));return n("M").height>Math.sin(a*(Math.PI/180))/s}({majorTicks:p,measureText:g,rect:n,bleedSize:s,angle:a.labels.tiltAngle})){return{size:Math.max(n.outer.width,n.outer.height),isToLarge:!0}}}}return{size:l,edgeBleed:c}}const Jl=(t,e,n)=>t.width*Math.abs(e.position-n.position);function Ql(t){let{layered:e,major:n,innerRect:i,outerRect:r,tick:o,index:a}=t;const s=e?2:1,l=n[a-s],c=n[a+s],u=l?Jl(i,o,l)/2-2:1/0,h=c?Jl(i,o,c)/2-2:1/0;return n.length<2?i.width:l?c?2*Math.min(u,h):(t=>{let{innerRect:e,outerRect:n,tick:i,prevWidth:r}=t;const o=e.x-n.x,a=n.width-e.width-o,s=e.width-e.width*i.position+a,l=2*Math.min(r,s),c=1===i.position?e.width/2-2:0;return Math.max(r,l,c)})({innerRect:i,outerRect:r,tick:o,prevWidth:u}):(t=>{let{innerRect:e,outerRect:n,tick:i,nextWidth:r}=t;const o=e.x-n.x,a=e.width*i.position+o,s=2*Math.min(r,a),l=0===i.position?e.width/2-2:0;return Math.max(r,s,l)})({innerRect:i,outerRect:r,tick:o,nextWidth:h})}function tc(t){let e=0;return e+=t.paddingStart,e+=t.line.show?t.line.strokeWidth/2:0,e+=t.ticks.show?t.ticks.margin:0,e}function ec(t){let e=0;return e+=t.ticks.show?t.ticks.tickSize:0,e+=tc(t)+t.labels.margin,e}function nc(t,e){return t.map((t=>Yl(t,e)))}function ic(t,e){return e?Math.abs(e.end-e.start):t.bandwidth()}function rc(t){let{textMetrics:e,settings:n,innerRect:i,scale:r,tilted:o,layered:a,tick:s}=t;const l=e.height,c=ic(r,s),u={width:0,height:l};if("left"===n.align||"right"===n.align)u.width=i.width-ec(n)-n.paddingEnd;else if(a)u.width=c*i.width*2;else if(o){const t=Math.abs(n.labels.tiltAngle)*(Math.PI/180);u.width=(i.height-ec(n)-n.paddingEnd-l*Math.cos(t))/Math.sin(t)}else u.width=c*i.width;return u.width=Gl({value:u.width,maxValue:n.labels.maxLengthPx,minValue:n.labels.minLengthPx}),u}function oc(t){let{textMetrics:e,settings:n,innerRect:i,outerRect:r,tilted:o,layered:a,tick:s,index:l,major:c}=t;const u=e.height,h={width:0,height:u};if("left"===n.align||"right"===n.align)h.width=i.width-ec(n)-n.paddingEnd;else if(o){const t=Math.abs(n.labels.tiltAngle)*(Math.PI/180);h.width=(i.height-ec(n)-n.paddingEnd-u*Math.cos(t))/Math.sin(t)}else h.width=Ql({layered:a,major:c,innerRect:i,outerRect:r,tick:s,index:l});return h.width=Gl({value:h.width,maxValue:n.labels.maxLengthPx,minValue:n.labels.minLengthPx}),h}function ac(t){let e;function n(){return e=oc,n}function i(){return e=rc,i}function r(t){let{settings:n,scale:i,innerRect:r,outerRect:o,measureText:a,ticks:s,state:l,textBounds:c}=t;const u=[],h=function(t){return t.filter((t=>!t.isMinor))}(s),d=function(t){return t.filter((t=>t.isMinor))}(s),f={innerRect:r,align:n.align,outerRect:o},p="tilted"===l.labels.activeMode,g="layered"===l.labels.activeMode;let m;if(n.line.show&&(f.style=n.line,f.padding=n.paddingStart,u.push(Hl(f))),n.ticks.show&&(f.style=n.ticks,f.tickSize=n.ticks.tickSize,f.padding=tc(n),m=nc(h,f)),n.labels.show){const t=ec(n);f.style=n.labels,f.padding=t,f.tilted=p,f.layered=g,f.angle=n.labels.tiltAngle,f.paddingEnd=n.paddingEnd,f.textBounds=c;const l=(t,l)=>{f.textRect=function(t){let{style:e,measureText:n,tick:i}=t;return n({text:i.label,fontSize:e.fontSize,fontFamily:e.fontFamily})}({tick:t,measureText:a,style:f.style});const c=e({textMetrics:f.textRect,settings:n,innerRect:r,outerRect:o,scale:i,tilted:p,layered:g,tick:t,major:h,index:l});f.maxWidth=c.width,f.maxHeight=c.height,f.stepSize=function(t){let{innerRect:e,scale:n,settings:i,tick:r}=t;return("top"===i.align||"bottom"===i.align?e.width:e.height)*ic(n,r)}({innerRect:r,scale:i,ticks:s,settings:n,tick:t})};let d=[];d=!g||"top"!==n.align&&"bottom"!==n.align?function(t,e,n){return t.map(((t,i)=>{n(t,i);const r=Ul(t,e);return r.data=t.data,r}))}(h,f,l):function(t,e,n,i){const r=e.padding,o=ec(n);return t.map(((t,a)=>{i(t,a);const s=o+e.maxHeight+n.labels.margin;e.layer=a%2,e.padding=a%2==0?r:s;const l=Ul(t,e);return l.data=t.data,l}))}(h,f,n,l),n.labels.filterOverlapping&&function(t,e,n){let i=(e,n)=>fs(P(1,t[e].boundingRect),P(1,t[n].boundingRect));if(n&&n.tilted){const e=Math.abs(n.angle);i=(n,i)=>{const r=1/Math.abs(t[n].x-t[i].x),o=Math.sin(e*(Math.PI/180))/r;return t[n].boundingRect.height>o}}for(let n=0;n<=t.length-1;n++)for(let r=n+1;r<=Math.min(n+5,n+(t.length-1));r++)t[n]&&t[r]&&i(n,r)&&(r===t.length-1?(t.splice(n,1),e&&e.splice(n,1)):(t.splice(r,1),e&&e.splice(r,1)),r--,n--)}(d,m,f),u.push(...d)}return n.minorTicks&&n.minorTicks.show&&d.length>0&&(f.style=n.minorTicks,f.tickSize=n.minorTicks.tickSize,f.padding=function(t){return t.line.strokeWidth+t.minorTicks.margin}(n),u.push(...nc(d,f))),m&&u.push(...m),u}return n.build=r,i.build=r,t?i():n()}const sc={labels:{show:!0,tiltAngle:40,tiltThreshold:.7,maxEdgeBleed:1/0,margin:4,maxLengthPx:150,minLengthPx:0,mode:"auto",maxGlyphCount:NaN,align:.5,offset:0,filterOverlapping:!1},ticks:{show:!1,margin:0,tickSize:4},line:{show:!1},paddingStart:0,paddingEnd:10,align:"auto"},lc={labels:{show:!0,margin:4,maxLengthPx:150,minLengthPx:0,align:.5,offset:0,filterOverlapping:!0},ticks:{show:!0,margin:0,tickSize:8},minorTicks:{show:!1,tickSize:3,margin:0},line:{show:!0},paddingStart:0,paddingEnd:10,align:"auto"};const cc={require:["chart","renderer","dockConfig"],defaultSettings:{layout:{displayOrder:0,prioOrder:0},settings:{},style:{labels:"$label",ticks:"$guide-line",minorTicks:"$guide-line--minor",line:"$guide-line"}},created(){this.state={isDiscrete:!!this.scale.bandwidth,isHorizontal:!1,labels:{activeMode:"horizontal"},ticks:[],innerRect:{width:0,height:0,x:0,y:0},outerRect:{width:0,height:0,x:0,y:0},defaultDock:void 0,concreteNodeBuilder:void 0,settings:void 0},this.state.isDiscrete?this.state.defaultDock="bottom":this.state.defaultDock="left",this.setState(this.settings)},setState(){this.state.isDiscrete=!!this.scale.bandwidth,this.state.settings=function(t){let{state:e,style:n,settings:i}=t;const r=_(!0,{},e.isDiscrete?sc:lc,n),o=_(!0,{},r,i.settings),a=i.layout.dock||e.defaultDock;o.dock=a,o.align=function(t,e){const n=["top","bottom"],i=["left","right"];return-1!==n.indexOf(t)&&-1===i.indexOf(e)||-1!==i.indexOf(t)&&-1===n.indexOf(e)?t:e}(i.settings.align,a),o.labels.tiltAngle=Math.max(-90,Math.min(o.labels.tiltAngle,90));const{paddingStart:s,paddingEnd:l}=o;return o.paddingStart="function"==typeof s?s.call(null):s,o.paddingEnd="function"==typeof l?l.call(null):l,o}(this),this.state.concreteNodeBuilder=ac(this.state.isDiscrete),this.dockConfig.dock(this.state.settings.dock),this.state.isHorizontal="top"===this.state.settings.align||"bottom"===this.state.settings.align,this.state.labels.activeMode=function(t,e,n){const i=e.labels.mode;return n&&t.isHorizontal?"auto"===i?t.labels.activeMode:-1!==["layered","tilted"].indexOf(e.labels.mode)&&-1!==["top","bottom"].indexOf(e.dock)?i:"horizontal":"horizontal"}(this.state,this.state.settings,this.state.isDiscrete)},preferredSize(t){const{formatter:e,state:n,scale:i}=this,r=this.state.isHorizontal?t.inner.width:t.inner.height;this.state.pxScale=ga(i,r);return function(t){let{isDiscrete:e,rect:n,formatter:i,measureText:r,scale:o,settings:a,state:s}=t,l=0;const{size:c,edgeBleed:u,isToLarge:h}=Zl({isDiscrete:e,rect:n,formatter:i,measureText:r,scale:o,settings:a,state:s});if(l+=c,h)return{size:l};if(a.ticks.show&&(l+=a.ticks.margin,l+=a.ticks.tickSize),a.minorTicks&&a.minorTicks.show){const t=a.minorTicks.margin+a.minorTicks.tickSize;t>l&&(l=t)}if(a.line.show){const t=a.line.strokeWidth/2;l+=t,u[function(t){switch(t){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left";default:return t}}(a.align)]=Math.ceil(t)}return l+=a.paddingStart,l+=a.paddingEnd,{size:l,edgeBleed:u}}({isDiscrete:this.state.isDiscrete,rect:{inner:t.inner,outer:t.outer},formatter:e,measureText:this.renderer.measureText,scale:this.state.pxScale,settings:this.state.settings,state:n})},beforeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{settings:e}=t;this.setState(e)},resize(t){const{inner:e,outer:n}=t,i=_({},e,function(t){let{align:e,inner:n}=t;return"left"===e?{x:n.width+n.x}:"right"===e||"bottom"===e?n:{y:n.y+n.height}}({align:this.state.settings.align,inner:e})),r=n||i;return _(this.state.innerRect,i),_(this.state.outerRect,r),n},beforeRender(){const{scale:t,formatter:e}=this,n=this.state.isHorizontal?this.state.innerRect.width:this.state.innerRect.height;this.state.pxScale=ga(t,n),this.state.ticks=this.state.pxScale.ticks({distance:n,formatter:e}).filter((t=>t.position>=0&&t.position<=1))},render(){const{state:t}=this,e=[];return e.push(...this.state.concreteNodeBuilder.build({settings:this.state.settings,scale:this.state.pxScale,innerRect:this.state.innerRect,outerRect:this.state.outerRect,measureText:this.renderer.measureText,textBounds:this.renderer.textBounds,ticks:this.state.ticks,state:t})),Al.multiple(e),e}};const uc={render:()=>[]};function hc(t,e,n){let i="";if("function"==typeof t)i=t();else if("string"==typeof t)i=t;else if(n){i=(n.data().fields||[]).map((t=>t.title())).join(e)}return i}function dc(t,e){let n="middle";return"left"===t?"top"===e?n="end":"bottom"===e&&(n="start"):"right"===t?"top"===e?n="start":"bottom"===e&&(n="end"):"left"===e?n="start":"right"===e&&(n="end"),n}const fc={require:["renderer","chart"],defaultSettings:{layout:{dock:"bottom",displayOrder:0,prioOrder:0},settings:{paddingStart:5,paddingEnd:5,paddingLeft:0,paddingRight:0,anchor:"center",join:", ",maxLengthPx:NaN},style:{text:"$title"}},created(){this.definitionSettings=this.settings.settings;const t=this.settings.text,e=this.definitionSettings.join;this.title=hc(t,e,this.scale)},preferredSize(){return this.renderer.measureText({text:this.title,fontSize:this.style.text.fontSize,fontFamily:this.style.text.fontFamily}).height+this.definitionSettings.paddingStart+this.definitionSettings.paddingEnd},render(){const{title:t,definitionSettings:e,rect:n}=this,i=[];return i.push(function(t){let{title:e,definitionSettings:n,dock:i,rect:r,measureText:o,style:a}=t;const s={type:"text",text:e,x:0,y:0,dx:0,dy:0,anchor:dc(i,n.anchor),baseline:"alphabetical",stroke:"transparent",strokeWidth:0,fontWeight:"normal"};_(s,a.text);const l=o(s);if("top"===i||"bottom"===i){let t=r.width/2;"left"===n.anchor?t=n.paddingLeft||0:"right"===n.anchor&&(t=r.width-(n.paddingRight||0)),s.x=t,s.y="top"===i?r.height-n.paddingStart:n.paddingStart+l.height,s.dy="top"===i?-l.height/6:-l.height/3,s.maxWidth=.8*r.width}else{let t=r.height/2;"top"===n.anchor?t=n.paddingStart:"bottom"===n.anchor&&(t=r.height-n.paddingStart),s.y=t,s.x="left"===i?r.width-n.paddingStart:n.paddingStart,s.dx="left"===i?-l.height/3:l.height/3;const e="left"===i?270:90;s.transform="rotate(".concat(e,", ").concat(s.x+s.dx,", ").concat(s.y+s.dy,")"),s.maxWidth=.8*r.height}return isNaN(n.maxLengthPx)||(s.maxWidth=Math.min(s.maxWidth,n.maxLengthPx)),s}({title:t,dock:this.settings.layout.dock,definitionSettings:e,rect:n,measureText:this.renderer.measureText,style:this.style})),i},beforeUpdate(t){t.settings&&(_(this.settings,t.settings),this.definitionSettings=t.settings.settings);const e=this.settings.text,n=this.definitionSettings.join;this.title=hc(e,n,this.scale)}};function pc(t,e){const n=t.settings.layout.dock,i=t.settings.settings.invert,r="top"===n||"bottom"===n,o=r?"width":"height",a=t.rect[o],s=t.chart.scroll(t.settings.scroll);let l;{let t=e[r?"x":"y"];i&&(t=a-t);const n=s.getState();l={startOffset:t,startScroll:n.start,swipe:!1};const o=t/a*(n.max-n.min)+n.min;o<n.start?l.startScroll=o:o>n.start+n.viewSize&&(l.startScroll=o-n.viewSize)}return{update:t=>{let e=t[r?"x":"y"];if(i&&(e=a-e),!l.swipe){if(Math.abs(l.startOffset-e)<=1)return;l.swipe=!0}const n=s.getState(),o=(e-l.startOffset)/a*(n.max-n.min),c=l.startScroll+o;s.moveTo(c)},end:t=>{let e=t[r?"x":"y"];i&&(e=a-e);const n=s.getState();if(l.swipe){const t=(e-l.startOffset)/a*(n.max-n.min),i=l.startScroll+t;s.moveTo(i)}else{const t=e/a*(n.max-n.min)+n.min-n.viewSize/2;s.moveTo(t)}}}}function gc(t,e){const n=e.element().getBoundingClientRect();return{x:t.center.x-n.left,y:t.center.y-n.top}}const mc={require:["chart","renderer"],on:{panStart(t){const e=gc(t,this.renderer),n={x:e.x-t.deltaX,y:e.y-t.deltaY};this.currentMove=pc(this,n),this.currentMove.update(e)},panMove(t){if(!this.currentMove)return;const e=gc(t,this.renderer);this.currentMove.update(e)},panEnd(t){if(!this.currentMove)return;const e=gc(t,this.renderer);this.currentMove.end(e),this.currentMove=null},panCancel(){this.currentMove=null},tap(t){const e=gc(t,this.renderer);pc(this,e).end(e)}},defaultSettings:{settings:{backgroundColor:"#eee",thumbColor:"#ccc",width:16}},preferredSize:function(t){const e=this.chart.scroll(this.settings.scroll).getState();if(e.viewSize>=e.max-e.min){return Math.max(t.width,t.height)}return this.settings.settings.width},render:function(t){const e=this.settings.layout.dock,n=this.settings.settings.invert,i="top"===e||"bottom"===e,r=i?"width":"height",o=this.rect[r],a=this.chart.scroll(this.settings.scroll).getState();let s=o*(a.start-a.min)/(a.max-a.min);const l=o*a.viewSize/(a.max-a.min);return n&&(s=o-s-l),t("div",{style:{position:"relative",width:"100%",height:"100%",background:this.settings.settings.backgroundColor,pointerEvents:"auto"}},[].concat(t("div",{class:"scroller",style:{position:"absolute",[i?"left":"top"]:"".concat(s,"px"),[i?"top":"left"]:"25%",[i?"height":"width"]:"50%",[r]:"".concat(Math.max(1,l),"px"),background:this.settings.settings.thumbColor}})))},renderer:"dom"};function yc(t){let{h:e,isVertical:n,value:i,pos:r,align:o,borderHit:a,state:s,idx:l}=t;const c="end"!==o,u=c?{left:"0",top:"0"}:{right:"0",bottom:"0"};let h=0,d="100%",f="100%";return s.targetRect&&"start"===s.settings.bubbles.align?(d="".concat(s.targetRect.x+s.targetRect.width,"px"),f="".concat(s.targetRect.y+s.targetRect.height,"px")):s.targetRect&&"end"===s.settings.bubbles.align&&(h=n?s.targetRect.x:s.targetRect.y,d="".concat(s.rect.width-h,"px"),f="".concat(s.rect.height-h,"px")),c||(r-=a),e("div",{onmouseover(t){t.srcElement.children[0].style.backgroundColor="#000",t.srcElement.children[0].style[n?"height":"width"]="2px"},onmouseout(t){t.srcElement.children[0].style.backgroundColor=s.style.line.stroke,t.srcElement.children[0].style[n?"height":"width"]="1px"},"data-value":i,"data-key":[s.key,"edge",l].join("-"),style:{cursor:n?"ns-resize":"ew-resize",position:"absolute",left:"".concat(n?h:r,"px"),top:"".concat(n?r:h,"px"),height:n?"".concat(a,"px"):f,width:n?d:"".concat(a,"px"),pointerEvents:"auto"}},[e("div",{style:_({backgroundColor:s.style.line.stroke,position:"absolute",height:n?"".concat(1,"px"):"100%",width:n?"100%":"".concat(1,"px"),pointerEvents:"none"},u)})])}function vc(t){let{h:e,isVertical:n,label:i,otherValue:r,rangeIdx:o,idx:a,pos:s,align:l,state:c,value:u}=t;const h="end"!==l,d="outside"===c.settings.bubbles.placement;let f,p="none";n?(f=h?"left":"right",d&&(p=h?"translate(-100%, 0px)":"translate(100%, 0px)")):(f=h?"top":"bottom",d&&(p=h?"translate(0px, -100%)":"translate(0px, 100%)"));let g=c.edit&&c.edit.rangeIdx===o&&c.edit.bubbleIdx===a;const m={position:"relative",borderRadius:"".concat(c.style.bubble.borderRadius,"px"),border:"".concat(c.style.bubble.strokeWidth,"px solid ").concat(c.style.bubble.stroke),backgroundColor:c.style.bubble.fill,color:c.style.bubble.color,fontFamily:c.style.bubble.fontFamily,fontSize:c.style.bubble.fontSize,padding:"4px 8px",textAlign:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"150px",minWidth:"50px",minHeight:"1em",pointerEvents:"auto",transform:n?"translate(0,-50%)":"translate(-50%,0)",cursor:n?"ns-resize":"ew-resize"};let y=c.style.bubble.stroke;const v=g?e("input",{type:"text",value:u,style:C(C({},m),{},{textAlign:"start",textOverflow:"",fontSize:"13px"}),onkeyup(t){if("Enter"===t.key){t.preventDefault(),t.stopPropagation();const e=parseFloat(t.target.value);isNaN(e)?(y="rgba(230, 78, 78, 0.6)",t.target.style.border="".concat(c.style.bubble.strokeWidth,"px solid ").concat(y)):c.onEditConfirmed(o,e,r)}else"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),c.onEditCanceled())}}):e("div",{"data-key":[c.key,"bubble",o,a].join("-"),"data-other-value":r,"data-idx":o,"data-bidx":a,style:m},[i]);return e("div",{style:{position:"absolute",[f]:"0",[n?"top":"left"]:"".concat(s,"px"),transform:p}},[v])}function xc(t){let{h:e,isVertical:n,top:i,height:r,color:o,on:a,opacity:s}=t;return e("div",_({style:{backgroundColor:o,opacity:s,position:"absolute",left:n?0:"".concat(i,"px"),top:n?"".concat(i,"px"):0,height:n?"".concat(r,"px"):"100%",width:n?"100%":"".concat(r,"px"),pointerEvents:"auto"}},a),[])}function bc(t){let{borderHit:e,els:n,isVertical:i,state:r,vStart:o,vEnd:a,idx:s}=t,l=0;r.targetRect&&(l=i?r.targetRect.y:r.targetRect.x);const c=!!r.scale,u=c?r.scale.norm(o)*r.size:o,h=c?r.scale.norm(a)*r.size:a,d=Math.abs(u-h),f=Math.min(u,h)+l,p=f+d;if(r.targetRect){const t=r.targetFillRect||r.targetRect,e=i?t.height:t.width,s=c?r.scale.norm(o)*e:o,l=c?r.scale.norm(a)*e:a,u=Math.abs(s-l),h=Math.min(s,l),d={h:r.h,isVertical:i,top:h,height:u,color:r.style.target.fill,opacity:r.style.target.opacity};r.style.target.opacity<.8&&(d.on={onmouseover(t){t.srcElement.style.opacity=r.style.target.opacity+.1},onmouseout(t){t.srcElement.style.opacity=r.style.target.opacity}}),n.push(r.h("div",{style:{position:"absolute",left:"".concat(t.x,"px"),top:"".concat(t.y,"px"),height:"".concat(t.height,"px"),width:"".concat(t.width,"px")}},[xc(d)]))}const g=u<h?o:a,m=u<h?a:o,[y,v]=c?r.scale.domain():[Math.min(o,a),Math.max(o,a)],x=g+1e-5>=y&&g-1e-5<=v,b=m-1e-5<=v&&m+1e-5>=y;x&&n.push(yc({h:r.h,isVertical:i,borderHit:e,value:g,pos:f,align:"start",state:r,idx:s})),b&&n.push(yc({h:r.h,isVertical:i,borderHit:e,value:m,pos:p,align:"end",state:r,idx:s}));const w=r.settings.bubbles;if(w&&w.show){const t={fontSize:w.fontSize,fontFamily:w.fontFamily,color:w.fill},e=[o,a];x&&n.push(vc({h:r.h,isVertical:i,align:w.align,style:t,rangeIdx:s,idx:0,otherValue:m,value:g,label:"".concat(r.format(g,e)),pos:f,state:r})),b&&n.push(vc({h:r.h,isVertical:i,align:w.align,style:t,rangeIdx:s,idx:1,otherValue:g,value:m,label:"".concat(r.format(m,e)),pos:p,state:r}))}}function wc(t){const e=t.active.limitHigh-t.active.end,n=t.active.limitLow-t.active.start;let i=t.current-t.start;return i=i<0?Math.max(i,n):Math.min(i,e),i}function kc(t){let e=[];const n=0===t.direction;if(Array.isArray(t.ranges)&&t.ranges.forEach(((i,r)=>{t.active&&r===t.active.idx||bc({borderHit:5,els:e,isVertical:n,state:t,vStart:Math.min(i.min,i.max),vEnd:Math.max(i.min,i.max),idx:r})})),t.active){let i=t.start,r=t.current;if(-1!==t.active.idx)if("foo"===t.active.mode)i=Math.min(t.active.start,t.active.end),r=Math.max(t.active.start,t.active.end);else if("modify"===t.active.mode)i=Math.min(t.start,t.current),r=Math.max(t.start,t.current);else{const e=wc(t);i=t.active.start+e,r=t.active.end+e}bc({borderHit:5,els:e,isVertical:n,state:t,vStart:i,vEnd:r,idx:t.active.idx})}return e}function _c(t){return{min:t.scale.min(),max:t.scale.max()}}function Mc(t){return{min:0,max:t.direction?t.rect.width:t.rect.height}}function Sc(t,e,n){let i,r,o=t.ranges,a=-1;for(i=0;i<o.length;i++){if(o[i].min<=e&&e<=o[i].max){a=i,n.min=i?o[i-1].max:n.min,n.max=i+1<o.length?o[i+1].min:n.max;break}if(e<o[i].min){n.max=o[i].min,n.min=i?o[i-1].max:n.min;break}}-1===a&&o.length&&i>=o.length&&(n.min=o[o.length-1].max),-1!==a&&(r={idx:a,start:o[a].min,end:o[a].max,limitLow:n.min,limitHigh:n.max,mode:"foo"}),t.active=r}function Cc(t){t.renderer.render(kc(t))}function Nc(t,e){if(!e||!e.isActive())return[];const n=t.scale.data(),i=(n&&n.fields||[]).map((t=>t.id())),r=e.brushes().filter((t=>"range"===t.type&&-1!==i.indexOf(t.id)))[0];return r?r.brush.ranges():[]}function Rc(t,e){let n,i=1/0;const r=e.domain(),o=e.bandwidth()/2;for(let a=0;a<r.length;++a){const s=Math.abs(t-o-e(r[a]));s<i&&(i=s,n=r[a])}return n}function qc(t,e){return Math.min(...t)<=Math.max(...e)&&Math.max(...t)>=Math.min(...e)}function Ac(t){return I(t.reduce(((t,e)=>(t.push(...O(e.bounds)),t)),[]))}const Dc={require:["chart","settings","renderer"],defaultSettings:{settings:{bubbles:{show:!0,align:"start"}},style:{bubble:"$label-overlay",line:"$shape-guide--inverted",target:"$selection-area-target"}},renderer:"dom",on:{rangeStart(t){this.start(t)},rangeMove(t){this.move(t)},rangeEnd(t){this.end(t)},rangeClear(t){this.clear(t)},bubbleStart(t){this.bubbleStart(t)}},created(){this.state={key:this.settings.key||"brush-range"}},beforeRender(t){this.state.rect=t.size.computedInner},renderRanges(){this.state.started||(this.state.ranges=Nc(this.state,this.state.brushInstance),this.state.active=null,Cc(this.state))},render(t){const e=this.settings.settings;this.state.direction="vertical"===e.direction?0:1;const n=this.renderer.element().getBoundingClientRect(),i=this.state.rect[0===this.state.direction?"height":"width"];let r=ga(this.chart.scale(e.scale),i);const o=function(t){const e={targetRect:null,targetFillRect:null,scale:null,size:null},n=t.settings.settings,i=n.target&&(n.target.components||(n.target.component?[n.target.component]:[])).map((e=>t.chart.component(e))).filter((t=>!!t&&!!t.rect)),r=n.target&&n.target.selector?t.chart.findShapes(n.target.selector):[],o=n.target&&n.target.fillSelector?t.chart.findShapes(n.target.fillSelector):[];if(r.length>0){const i=Ac(r);if(e.size=i[0===t.state.direction?"height":"width"],e.scale=ga(t.chart.scale(n.scale),e.size),e.targetRect=i,o.length>0){const t=Ac(o);e.targetFillRect=t}}else if(i&&i.length>0){const n=i.slice(1).reduce(((t,e)=>({x0:Math.min(t.x0,e.rect.computedInner.x),y0:Math.min(t.y0,e.rect.computedInner.y),x1:Math.max(t.x1,e.rect.computedInner.x+e.rect.computedInner.width),y1:Math.max(t.y1,e.rect.computedInner.y+e.rect.computedInner.height)})),{x0:i[0].rect.computedInner.x,y0:i[0].rect.computedInner.y,x1:i[0].rect.computedInner.x+i[0].rect.computedInner.width,y1:i[0].rect.computedInner.y+i[0].rect.computedInner.height});e.targetRect={x:n.x0-t.state.rect.x,y:n.y0-t.state.rect.y,width:n.x1-n.x0,height:n.y1-n.y0}}return e}(this);if(r=o.scale?o.scale:r,this.state.targetRect=o.targetRect,this.state.targetFillRect=o.targetFillRect,this.state.size=null===o.size?i:o.size,this.state.settings=e,this.state.style=this.style,this.state.offset=n,this.state.brush="object"==typeof e.brush?e.brush.context:e.brush,this.state.brushInstance=this.chart.brush(this.state.brush),this.state.renderer=this.renderer,this.state.multi=!!e.multiple,this.state.h=t,this.state.onEditConfirmed=(t,e,n)=>{this.state.edit=null,function(t,e,n,i){let r=t.ranges.map((t=>({min:t.min,max:t.max})));const o=t.scale.min(),a=t.scale.max();r[e]={min:Math.max(o,Math.min(n,i)),max:Math.min(a,Math.max(n,i))},t.ranges[e]=C({},r[e]);const s=t.scale.data();s&&s.fields&&s.fields.forEach((e=>{t.fauxBrushInstance||t.brushInstance.setRange(e.id(),r)}))}(this.state,t,e,n),this.emit("bubbleEnd"),Cc(this.state)},this.state.onEditCanceled=()=>{this.state.edit=null,Cc(this.state)},this.state.cssCoord={offset:0===this.state.direction?"top":"left",coord:0===this.state.direction?"y":"x",pos:0===this.state.direction?"deltaY":"deltaX"},this.state.format="function"==typeof e.bubbles.label&&((t,n)=>e.bubbles.label.call(void 0,{datum:t,data:n,scale:r,resources:{scale:this.chart.scale,formatter:this.chart.formatter}})),{}.hasOwnProperty.call(r,"norm")){this.state.editable=!0,this.state.observeBrush="object"==typeof e.brush&&e.brush.observe,this.state.fauxBrushInstance=null,this.state.findValues=null,this.state.scale=r;const t=this.state.scale.data();!this.state.format&&t&&t.fields&&t.fields[0]&&(this.state.format=t.fields[0].formatter())}else this.state.editable=!1,this.state.scale=lo(),this.state.scale.data=r.data,this.state.format||(this.state.format=(t,e)=>qc(r.range(),e)?function(t,e){const n=e.ticks(),i=e.domain().indexOf(Rc(t,e));return-1!==i?n[i].label:"-"}(t,r):"-"),this.state.fauxBrushInstance=oa(),this.state.findValues=t=>function(t,e){const n=e.domain(),i=e.range(),r=[];return t.forEach((t=>{if(!qc(i,[t.min,t.max]))return;const o=n.indexOf(Rc(t.min,e)),a=n.indexOf(Rc(t.max,e));r.push.apply(r,n.slice(Math.min(o,a),Math.max(o,a)+1))})),r}(t,r);return this.state.ranges=Nc(this.state,this.state.brushInstance),this.state.observeBrush||this.state.sourcedFromThisComponent?[kc(this.state)]:[]},mounted(){this.state.observeBrush&&this.state.brushInstance&&this.state.brushInstance.on("update",this.renderRanges)},beforeDestroy(){this.state.observeBrush&&this.state.brushInstance&&this.state.brushInstance.removeListener("update",this.renderRanges)},start(t){!function(t){let{state:e,e:n,renderer:i,ranges:r,targetSize:o}=t;if(e.started)return;e.edit=null;const a=n.center.x-n.deltaX,s=n.center.y-n.deltaY;let l=document.elementFromPoint(a,s);i.element().contains(l)||(l=null);const c={started:!0};e.offset=_({},i.element().getBoundingClientRect());const u=a-e.offset.left,h=s-e.offset.top;e.offset.left+=e.targetRect?e.targetRect.x:0,e.offset.top+=e.targetRect?e.targetRect.y:0,e.ranges=r(e,e.fauxBrushInstance||e.brushInstance);const d=n.center[e.cssCoord.coord]-n[e.cssCoord.pos]-e.offset[e.cssCoord.offset],f=n.center[e.cssCoord.coord]-e.offset[e.cssCoord.offset];c.current=e.scale.normInvert(f/e.size),c.start=e.scale.normInvert(d/e.size);let p=e.ranges;const g=_c(e);let m,y,v=-1;if(l&&l.hasAttribute("data-idx"))v=parseInt(l.getAttribute("data-idx"),10),g.min=v>0?p[v-1].max:g.min,g.max=v+1<p.length?p[v+1].min:g.max;else{for(m=0;m<p.length;m++){if(p[m].min<=c.start&&c.start<=p[m].max){v=m,g.min=m?p[m-1].max:g.min,g.max=m+1<p.length?p[m+1].min:g.max;break}if(c.start<p[m].min){g.max=p[m].min,g.min=m?p[m-1].max:g.min;break}}-1===v&&p.length&&m>=p.length&&(g.min=p[p.length-1].max)}if(-1!==v||e.multi||(c.ranges=[],g.min=e.scale.min(),g.max=e.scale.max()),-1!==v)if(y={idx:v,start:p[v].min,end:p[v].max,limitLow:g.min,limitHigh:g.max,mode:"move"},l&&l.hasAttribute("data-other-value"))c.start=parseFloat(l.getAttribute("data-other-value")),y.mode="modify";else{let t=e.scale.norm(y.start)*e.size,n=e.scale.norm(y.end)*e.size;Math.abs(d-t)<=o?(c.start=y.end,y.mode="modify"):Math.abs(d-n)<=o&&(c.start=y.start,y.mode="modify")}else y={idx:-1,start:c.start,end:c.current,limitLow:g.min,limitHigh:g.max,mode:"current"};c.active=y,"modify"!==y.mode&&e.targetRect&&!gs(e.targetRect,{x:u,y:h})||Object.keys(c).forEach((t=>e[t]=c[t]))}({e:t,state:this.state,renderer:this.renderer,ranges:Nc,targetSize:5})},end(){this.state.started&&(!function(t,e){t.started=!1,t.ranges=e(t,t.fauxBrushInstance||t.brushInstance);const n=_c(t);Sc(t,t.current,n)}(this.state,Nc),Cc(this.state),this.state.sourcedFromThisComponent=!0,this.state.active=null)},move(t){this.state.started&&(!function(t,e){const n=(e.center[t.cssCoord.coord]-t.offset[t.cssCoord.offset])/t.size,i=t.scale.normInvert(n);t.current=Math.max(Math.min(i,t.active.limitHigh),t.active.limitLow)}(this.state,t),function(t){let e=t.ranges.map((t=>({min:t.min,max:t.max})));if(-1!==t.active.idx)if("modify"===t.active.mode)e[t.active.idx].min=Math.min(t.start,t.current),e[t.active.idx].max=Math.max(t.start,t.current);else{const n=wc(t);e[t.active.idx].min+=n,e[t.active.idx].max+=n}else e.push({min:Math.min(t.start,t.current),max:Math.max(t.start,t.current)});const n=t.scale.data();n&&n.fields&&n.fields.forEach((n=>{if(t.fauxBrushInstance){let i=Nc(t,t.fauxBrushInstance),r=t.findValues(i),o=t.findValues(e),a=o.filter((t=>-1===r.indexOf(t))),s=r.filter((t=>-1===o.indexOf(t))),l=a.map((t=>({key:n.id(),value:t}))),c=s.map((t=>({key:n.id(),value:t})));t.brushInstance.addAndRemoveValues(l,c),t.fauxBrushInstance.setRange(n.id(),e)}else t.brushInstance.setRange(n.id(),e)}))}(this.state),Cc(this.state))},clear(){this.state.fauxBrushInstance&&this.state.fauxBrushInstance.clear(),this.state.renderer.render([]),this.state.started=!1,this.state.active=null,this.state.sourcedFromThisComponent=!1},bubbleStart(t){if(!this.state.editable)return;const e=t.srcEvent||t,n=e.target,i={rangeIdx:parseInt(n.getAttribute("data-idx"),10),bubbleIdx:parseInt(n.getAttribute("data-bidx"),10)};if(isNaN(i.rangeIdx)||JSON.stringify(i)===JSON.stringify(this.state.edit))return;this.state.edit=i,e.stopPropagation(),e.stopImmediatePropagation(),e.preventDefault();const r=n.parentNode;Cc(this.state);const o=r.querySelector("input");o.focus(),o.select()}};function Ec(t){t.renderer.render(kc(t))}function Oc(t){return t.rc.ranges()}function Ic(t,e){const n={x:t.direction?e.min+t.rect.x:t.rect.x,y:t.direction?t.rect.y:e.min+t.rect.y,width:t.direction?e.max-e.min:t.rect.width+t.rect.x,height:t.direction?t.rect.height+t.rect.y:e.max-e.min};return t.chart.shapesAt(n,t.settings.brush)}const Tc={require:["chart","settings","renderer"],defaultSettings:{settings:{bubbles:{show:!0,align:"start"}},style:{bubble:"$label-overlay",line:"$shape-guide--inverted",target:"$selection-area-target"}},renderer:"dom",on:{areaStart(t){this.start(t)},areaMove(t){this.move(t)},areaEnd(t){this.end(t)},areaClear(t){this.clear(t)}},created(){this.state={key:this.settings.key||"brush-area-dir"}},render(t){this.state.rect=this.rect;const e=this.settings.settings,n="vertical"===e.direction?0:1,i=this.state.rect[0===n?"height":"width"],r=this.renderer.element().getBoundingClientRect(),o=(e.target?e.target.components||[e.target.component]:[]).map((t=>this.chart.component(t))).filter((t=>!!t&&!!t.rect)),a=o[0]?o.slice(1).reduce(((t,e)=>({x0:Math.min(t.x0,e.rect.x),y0:Math.min(t.y0,e.rect.y),x1:Math.max(t.x1,e.rect.x+e.rect.width),y1:Math.max(t.y1,e.rect.y+e.rect.height)})),{x0:o[0].rect.x,y0:o[0].rect.y,x1:o[0].rect.x+o[0].rect.width,y1:o[0].rect.y+o[0].rect.height}):null;return this.state.targetRect=a?{x:a.x0-this.rect.x,y:a.y0-this.rect.y,width:a.x1-a.x0,height:a.y1-a.y0}:null,this.state.style=this.style,this.state.chart=this.chart,this.state.direction=n,this.state.settings=e,this.state.offset=r,this.state.rc=Wo(),this.state.renderer=this.renderer,this.state.multi=!!e.multiple,this.state.h=t,this.state.size=i,this.state.cssCoord={offset:0===this.state.direction?"top":"left",coord:0===this.state.direction?"y":"x",pos:0===this.state.direction?"deltaY":"deltaX",area:0===this.state.direction?"height":"width"},this.state.format=function(t,e){return function(t,e,n){const i=Math.min(...n),r=Math.max(...n),o={x:t.direction?i+t.rect.x:t.rect.x,y:t.direction?t.rect.y:i+t.rect.y,width:t.direction?r-i:t.rect.width+t.rect.x,height:t.direction?t.rect.height+t.rect.y:r-i},a=t.chart.shapesAt(o,t.settings.brush);if(0===a.length)return"-";const s=a.reduce(((n,r)=>{const o=n.bounds,a=r.bounds;return e===i?o[t.cssCoord.coord]<=a[t.cssCoord.coord]?n:r:o[t.cssCoord.coord]+o[t.cssCoord.area]>=a[t.cssCoord.coord]+a[t.cssCoord.area]?n:r})),l=t.settings.brush.components.reduce(((t,e)=>t.key===s.key?t:e));return"function"==typeof t.settings.bubbles.label?t.settings.bubbles.label(s.data):Array.isArray(l.data)&&l.data.length?s.data[l.data[0]].label:s.data&&s.data.label?s.data.label:"-"}(this,t,e)},[]},start(t){!function(t){let{state:e,e:n,renderer:i,ranges:r,targetSize:o}=t;if(e.started)return;const a=n.center.x-n.deltaX,s=n.center.y-n.deltaY;let l=document.elementFromPoint(a,s);i.element().contains(l)||(l=null);const c={started:!0};e.offset=i.element().getBoundingClientRect(),e.ranges=r(e);const u=a-e.offset.left,h=s-e.offset.top,d=n.center[e.cssCoord.coord]-n[e.cssCoord.pos]-e.offset[e.cssCoord.offset],f=n.center[e.cssCoord.coord]-e.offset[e.cssCoord.offset];let p=f,g=d;c.start=d,c.current=f;let m=e.ranges;const y=Mc(e);let v,x,b=-1;if(l&&l.hasAttribute("data-idx"))b=parseInt(l.getAttribute("data-idx"),10),y.min=b>0?m[b-1].max:y.min,y.max=b+1<m.length?m[b+1].min:y.max;else{for(v=0;v<m.length;v++){if(m[v].min<=g&&g<=m[v].max){b=v,y.min=v?m[v-1].max:y.min,y.max=v+1<m.length?m[v+1].min:y.max;break}if(g<m[v].min){y.max=m[v].min,y.min=v?m[v-1].max:y.min;break}}-1===b&&m.length&&v>=m.length&&(y.min=m[m.length-1].max)}if(-1!==b||e.multi||(c.ranges=[],y.min=0,y.max=e.direction?e.rect.width:e.rect.height),-1!==b)if(x={idx:b,start:m[b].min,end:m[b].max,limitLow:y.min,limitHigh:y.max,mode:"move"},l&&l.hasAttribute("data-other-value"))c.start=parseFloat(l.getAttribute("data-other-value")),x.mode="modify";else{let t=x.start,e=x.end;Math.abs(d-t)<=o?(c.start=x.end,x.mode="modify"):Math.abs(d-e)<=o&&(c.start=x.start,x.mode="modify")}else x={idx:-1,start:g,end:p,limitLow:y.min,limitHigh:y.max,mode:"current"};c.active=x,"modify"!==x.mode&&e.targetRect&&!gs(e.targetRect,{x:u,y:h})||Object.keys(c).forEach((t=>e[t]=c[t]))}({e:t,state:this.state,renderer:this.renderer,ranges:Oc,targetSize:5})},end(){this.state.started&&(!function(t,e){t.started=!1,t.ranges=e(t);const n=Mc(t);Sc(t,t.current,n)}(this.state,Oc),Ec(this.state))},move(t){this.state.started&&(!function(t,e){const n=e.center[t.cssCoord.coord]-t.offset[t.cssCoord.offset];t.current=Math.max(Math.min(n,t.active.limitHigh),t.active.limitLow)}(this.state,t),function(t){const e=t.ranges.map((t=>({min:t.min,max:t.max})));if(-1!==t.active.idx)if("modify"===t.active.mode)e[t.active.idx].min=Math.min(t.start,t.current),e[t.active.idx].max=Math.max(t.start,t.current);else{const n=wc(t);e[t.active.idx].min=t.active.start+n,e[t.active.idx].max=t.active.end+n}else e.push({min:Math.min(t.start,t.current),max:Math.max(t.start,t.current)});t.rc.set(e);let n=[];e.forEach((e=>{n=[...n,...Ic(t,e)]})),function(t,e){t.chart.brushFromShapes(e,t.settings.brush)}(t,n)}(this.state),Ec(this.state))},clear(){this.state.rc&&this.state.rc.clear(),this.state.renderer.render([])}};function jc(t){const e="vertical"===t.direction,n=t.rect[e?"height":"width"],i=t.rect[e?"width":"height"];return function(t){const e=t.brush;if(!e||!e.isActive())return[];const n=t.scale.data(),i=(n&&n.fields||[]).map((t=>t.id())),r=e.brushes().filter((t=>"range"===t.type&&-1!==i.indexOf(t.id)))[0];return r?r.brush.ranges():[]}(t).map((r=>{const o=t.scale(r.min)*n,a=t.scale(r.max)*n,s=Math.min(o,a),l=Math.abs(o-a);return{type:"rect",fill:t.fill,opacity:t.opacity,x:e?0:s,width:e?i:l,y:e?s:0,height:e?l:i}}))}function Pc(t,e,n,i){function r(){!function(t){t.renderer.render(jc(t))}(t)}function o(){!function(t){t.renderer.render(jc(t))}(t)}function a(){!function(t){t.renderer.render(jc(t))}(t)}t.brush=e,e&&(e.on("start",r),e.on("update",o),e.on("end",a),t.start=r,t.update=o,t.end=a,t.brush=e,t.scale=n,t.renderer=i)}function zc(t){t.brush&&(t.brush.removeListener("start",t.start),t.brush.removeListener("update",t.update),t.brush.removeListener("end",t.end)),t.start=void 0,t.update=void 0,t.end=void 0,t.brush=void 0,t.scale=void 0,t.renderer=void 0}const Fc={require:["chart","settings","renderer"],defaultSettings:{settings:{}},preferredSize:()=>50,created(){this.state={}},render(){const t=this.settings.settings,e=this.chart.brush(t.brush),n=t.direction||"horizontal",i="horizontal"===n?this.rect.width:this.rect.height,r=ga(this.chart.scale(t.scale),i);return zc(this.state),Pc(this.state,e,r,this.renderer),this.state.rect=this.rect,this.state.fill=t.fill||"#ccc",this.state.opacity=void 0!==t.opacity?t.opacity:1,this.state.direction=n,jc(this.state)},beforeDestroy(){zc(this.state)}};function Lc(t,e){const n=e.center.x,i=e.center.y;return{x:n-t.left,y:i-t.top}}function Bc(t,e,n){return ja(t,e.points[0])<n.settings.snapIndicator.threshold**2}function Hc(t,e){null==t.path.d?t.path.d="M".concat(e.x," ").concat(e.y," "):t.path.d+="L".concat(e.x," ").concat(e.y," "),t.points.push(e)}function $c(t){let{state:e,start:n=null,end:i=null}=t;null!==n&&(e.snapIndicator.x1=n.x,e.snapIndicator.y1=n.y),null!==i&&(e.snapIndicator.x2=i.x,e.snapIndicator.y2=i.y)}function Vc(t,e){t.snapIndicator.visible=e}const Wc={require:["chart","renderer","settings"],defaultSettings:{layout:{displayOrder:0},settings:{brush:{components:[]},snapIndicator:{threshold:75,strokeDasharray:"5, 5",stroke:"black",strokeWidth:2,opacity:.5},lasso:{fill:"transparent",stroke:"black",strokeWidth:2,opacity:.7,strokeDasharray:"20, 10"},startPoint:{r:10,fill:"green",stroke:"black",strokeWidth:1,opacity:1}}},on:{lassoStart(t){this.start(t)},lassoEnd(t){this.end(t)},lassoMove(t){this.move(t)},lassoCancel(){this.cancel()}},created(){this.state={points:[],active:!1,path:null,snapIndicator:null,startPoint:null,rendererBounds:null,componentDelta:null,brushConfig:null,lineBrushShape:{x1:0,y1:0,x2:0,y2:0}}},start(t){var e;this.state.active=!0,this.state.path={visible:!0,type:"path",d:null,fill:(e=this.settings.settings.lasso).fill,stroke:e.stroke,strokeWidth:e.strokeWidth,opacity:e.opacity,strokeDasharray:e.strokeDasharray,collider:{type:null}},this.state.snapIndicator=function(t){return{visible:!1,type:"line",x1:0,y1:0,x2:0,y2:0,strokeDasharray:t.strokeDasharray,stroke:t.stroke,strokeWidth:t.strokeWidth,opacity:t.opacity,collider:{type:null}}}(this.settings.settings.snapIndicator),this.state.startPoint=function(t){return{visible:!0,type:"circle",cx:0,cy:0,r:t.r,fill:t.fill,opacity:t.opacity,stroke:t.stroke,strokeWidth:t.strokeWidth,collider:{type:null}}}(this.settings.settings.startPoint),this.state.rendererBounds=this.renderer.element().getBoundingClientRect(),this.state.componentDelta=function(t,e){const n=t.element.getBoundingClientRect();return{x:e.left-n.left,y:e.top-n.top}}(this.chart,this.state.rendererBounds),this.state.brushConfig=function(t){return t.settings.brush.components.map((t=>({key:t.key,contexts:t.contexts||["lassoBrush"],data:t.data||[""],action:t.action||"add"})))}(this.settings);const n=Lc(this.state.rendererBounds,t);Hc(this.state,n),$c({state:this.state,start:n}),function(t,e){t.startPoint.cx=e.x,t.startPoint.cy=e.y}(this.state,n)},move(t){if(!this.state.active)return;const e=Lc(this.state.rendererBounds,t);Bc(e,this.state,this.settings)?Vc(this.state,!0):Vc(this.state,!1),Hc(this.state,e),$c({state:this.state,end:e}),function(t,e){const n=[t.startPoint,t.path,t.snapIndicator].filter((t=>t.visible));e.render(n)}(this.state,this.renderer),function(t,e){if(t.active){const n=t.points[t.points.length-2],i=t.points[t.points.length-1];t.lineBrushShape.x1=n.x+t.componentDelta.x,t.lineBrushShape.y1=n.y+t.componentDelta.y,t.lineBrushShape.x2=i.x+t.componentDelta.x,t.lineBrushShape.y2=i.y+t.componentDelta.y;const r=e.shapesAt(t.lineBrushShape,{components:t.brushConfig});e.brushFromShapes(r,{components:t.brushConfig})}}(this.state,this.chart)},end(t){if(!this.state.active)return;Vc(this.state,!1);Bc(Lc(this.state.rendererBounds,t),this.state,this.settings)&&function(t,e){if(t.active){const n=t.componentDelta.x,i=t.componentDelta.y,r=t.points.map((t=>({x:t.x+n,y:t.y+i}))),o=e.shapesAt({vertices:r},{components:t.brushConfig});e.brushFromShapes(o,{components:t.brushConfig})}}(this.state,this.chart),this.state={points:[],active:!1,path:null,snapIndicator:null,startPoint:null,rendererBounds:null,componentDelta:null,brushConfig:null,lineBrushShape:{x1:0,y1:0,x2:0,y2:0}},this.renderer.render([])},cancel(){var t,e;this.state.active&&(t=this.state,e=this.chart,t.brushConfig.forEach((t=>{t.contexts.forEach((t=>{e.brush(t).end()}))})),this.state={points:[],active:!1,path:null,snapIndicator:null,startPoint:null,rendererBounds:null,componentDelta:null,brushConfig:null,lineBrushShape:{x1:0,y1:0,x2:0,y2:0}},this.renderer.render([]))},render(){}};function Uc(t,e,n,i,r){let o,a=0,s=e.length-1;for(;a<s;){let l=Math.floor((a+s)/2);o=r(e[l]),o[n]+o[i]<t[n]?a=l+1:s=l}return a}function Yc(t){let{orientation:e,targetNodes:n,labels:i,container:r}=t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Uc;const a=[],s="v"===e?"x":"y",l="v"===e?"width":"height",c=t=>t.textBounds,u=t=>t.node.localBounds;return(t,e)=>{const{textBounds:h,node:d}=i[e];if(h[s]<r[s]||h[s]+h[l]>r[s]+r[l])return!1;for(let t=o(h,a,s,l,c);t<a.length;t++)if(fs(h,a[t].textBounds))return!1;const f=o(h,n,s,l,u),p=h[s]+h[l];for(let t=f;t<n.length;t++){const e=n[t].node;if(p<e.localBounds[s])break;if(fs(h,e.localBounds)&&d!==e)return!1}return a.push(i[e]),!0}}const Xc=4;function Kc(t,e){return{node:t,data:t.data,scale:e.scale,formatter:e.formatter,dataset:e.dataset}}function Gc(t){const e=typeof t;return("string"===e||"number"===e)&&""!==t}function Zc(t){return C(C({type:"rect",rx:2,ry:2,fill:t.backgroundColor},t.backgroundBounds),{},{data:"".concat(t.data," ").concat(t.text),rotation:t.transform&&t.transform.match(/rotate/gi)?"rotated":"horizontal"})}function Jc(t,e,n){return n?t.width>=e.height:t.width>=e.width}function Qc(t,e,n){return n?t.height>=e.width:t.height>=e.height}function tu(t,e,n,i,r){let o,a;return"v"===t?(o=i||r||Jc(e,n,!0),a=Qc(e,n,!i)):(o=Jc(e,n),a=r||Qc(e,n,!1)),o&&a}function eu(t,e,n,i){return t+.5*e+(i-.5)*(e-n)-.5*n}function nu(t,e,n){const i={type:"text",text:e,maxWidth:n.rotate?t.height:t.width,x:0,y:t.y,dx:0,dy:0,fill:n.fill,anchor:n.rotate?"end":"start",baseline:"central",fontSize:"".concat(n.fontSize,"px"),fontFamily:n.fontFamily},r=n.textMetrics;if(!n.overflow&&!function(t,e,n){return Jc(t,e,n.rotate)&&Qc(t,e,n.rotate)}(t,r,n))return!1;const o=.5*r.height;return n.rotate?(i.x=eu(t.x,t.width,r.height,n.align)+o,i.y=eu(t.y,t.height,r.width,n.justify),i.transform="rotate(-90, ".concat(i.x+i.dx,", ").concat(i.y+i.dy,")")):(i.x=eu(t.x,t.width,r.width,n.align),i.y=eu(t.y,t.height,r.height,n.justify)+o),i}function iu(t){let{bar:e,view:n,direction:i,position:r,padding:o=Xc}=t;const a={};if(_(a,e),r&&"inside"!==r)if("up"===i||"down"===i){const t=Math.max(0,Math.min(e.y,n.height)),o=Math.max(0,Math.min(e.y+e.height,n.height));"outside"===r&&"up"===i||"opposite"===r&&"down"===i?(a.y=0,a.height=t):("outside"===r&&"down"===i||"opposite"===r&&"up"===i)&&(a.y=o,a.height=n.height-o)}else{const t=Math.max(0,Math.min(e.x,n.width)),o=Math.max(0,Math.min(e.x+e.width,n.width));"outside"===r&&"left"===i||"opposite"===r&&"right"===i?(a.x=0,a.width=t):("outside"===r&&"right"===i||"opposite"===r&&"left"===i)&&(a.x=o,a.width=n.width-o)}else;return function(t,e){const n=Math.max(0,Math.min(t.y,e.height)),i=Math.max(0,Math.min(t.y+t.height,e.height)),r=Math.max(0,Math.min(t.x,e.width)),o=Math.max(0,Math.min(t.x+t.width,e.width));t.x=r,t.width=o-r,t.y=n,t.height=i-n}(a,n),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{top:n=Xc,bottom:i=Xc,left:r=Xc,right:o=Xc}=e;t.x+=r,t.width-=r+o,t.y+=n,t.height-=n+i}(a,o),a}function ru(t){let e,n,i,r,o,{direction:a,fitsHorizontally:s,measured:l,node:c,orientation:u,placementSettings:h,rect:d}=t,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:iu;const p=[],g="h"===u?"width":"height";for(o=0;o<h.length;o++)if(i=h[o],r=f({bar:c.localBounds,view:d,direction:a,position:i.position,padding:i.padding}),p.push(r),e=!o||r[g]>e[g]?r:e,tu(u,r,l,s,i.overflow)){n=r;break}return n||(n=e,o=p.indexOf(n)),i=h[o],{bounds:n,placement:i}}function ou(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const{top:o=Xc,bottom:a=Xc,left:s=Xc,right:l=Xc}=r,c=t.x+t.dx,u=t.y+t.dy,h=n?Math.min(e.width,i.height):Math.min(e.height,i.width),d=n?Math.min(e.height,i.height):Math.min(e.width,i.width),f=.5*e.height,p=1e-9,g=n?c-f:c,m=n?u:u-f,y={x:g-s-p,y:m-o-p,width:d+(s+l)-p,height:h+(o+a)-p};return y}function au(t){let{chart:e,targetNodes:n,rect:i,fitsHorizontally:r,collectiveOrientation:o}=t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ru,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:nu,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Yc;const c=[],u={container:i,targetNodes:n,labels:[],orientation:o};let h,d,f,p,g,m,y,v,x,b,w,k,_,M;for(let t=0,l=n.length;t<l;t++){m=null,d=n[t],f=d.node,_=Kc(f,e),x=d.direction,M="left"===x||"right"===x?"h":"v";for(let e=0;e<d.texts.length;e++){if(p=d.texts[e],!Gc(p))continue;b=d.labelSettings[e],v=d.measurements[e],k=b.placements;const n=a({direction:x,fitsHorizontally:r,lblStngs:b,measured:v,node:f,orientation:M,placements:k,placementSettings:d.placementSettings[e],rect:i});if(m=n.bounds,w=n.placement,m&&w){g=w.justify;const e="function"==typeof b.linkData?b.linkData(_,t):void 0,n="function"==typeof w.overflow?w.overflow(_,t):w.overflow;"up"===x&&(g=1-g),"opposite"===w.position&&(g=1-g),"left"===x&&(g=1-g);const i=!("h"===o||r);if(h=s(m,p,{justify:"h"===M?w.align:g,align:"h"===M?g:w.align,fontSize:b.fontSize,fontFamily:b.fontFamily,textMetrics:v,rotate:i,overflow:!!n}),h){const n=ou(h,v,i,m,w.padding);y="function"==typeof w.fill?w.fill(C(C({},_),{},{textBounds:n}),t):w.fill,h.fill=y,void 0!==e&&(h.data=e),"object"==typeof w.background&&(h.backgroundColor="function"==typeof w.background.fill?w.background.fill(C(C({},_),{},{textBounds:n}),t):w.background.fill,void 0!==h.backgroundColor&&(h.backgroundBounds=ou(h,v,i,m,w.background.padding))),c.push(h),u.labels.push({node:f,textBounds:n})}}}}const S=c.filter(l(u)),N=S.filter((t=>void 0!==t.backgroundBounds)).map(Zc);return[...N,...S]}function su(t){let{nodes:e,rect:n,chart:i,labelSettings:r,placementSettings:o,settings:a,renderer:s}=t;const l={},c=[];let u,h,d,f,p,g,m,y=!0,v=!1;for(let t=0;t<e.length;t++){if(h=e[t],f=h.localBounds,!fs(f,n))continue;let x=Kc(h,i);u={node:h,texts:[],measurements:[],labelSettings:[],placementSettings:[]};for(let e=0;e<r.length;e++)g=r[e],d="function"==typeof g.label?g.label(x,t):void 0,Gc(d)&&(m="function"==typeof a.direction?a.direction(x,t):a.direction||"up",v=v||"left"===m||"right"===m,l.fontFamily=g.fontFamily,l.fontSize="".concat(g.fontSize,"px"),l.text=d,p=s.measureText(l),u.measurements.push(p),u.texts.push(d),u.labelSettings.push(g),u.placementSettings.push(o[e]),u.direction=m,y=y&&p.width<=f.width-2*Xc);c.push(u)}return{targetNodes:c,fitsHorizontally:y,hasHorizontalDirection:v}}function lu(t){let{orientation:e="auto",defaultOrientation:n="h"}=t;switch(e.toLocaleLowerCase()){case"vertical":return"v";case"horizontal":return"h";default:return n}}function cu(t){const e=2*Math.PI;return(t%e+e)%e}function uu(t,e){t.x+=e,t.width-=2*e,t.y+=e,t.height-=2*e}function hu(t){return{x:t.x,y:t.y-t.height/2,width:t.width,height:t.height}}function du(t,e,n){let{x:i,y:r}=e;if(i*i+r*r>t*t)return null;let o=Math.sin(n),a=Math.cos(n),s=i*a-r*o,l=t*t-s*s;if(l<0)return null;let c=Math.sqrt(l);return{x:s*a+o*c,y:-s*o+a*c}}function fu(t){let e,n,{radius:i,size:r,angle:o}=t,{width:a,height:s}=r,l={x:a/2,y:s/2};switch(Math.floor(o/(Math.PI/2))){case 0:if(e=du(i,l,o),!e)return null;e.y*=-1,n={x:-a,y:0};break;case 1:if(e=du(i,l,Math.PI-o),!e)return null;n={x:-a,y:-s};break;case 2:if(e=du(i,l,o-Math.PI),!e)return null;e.x*=-1,n={x:0,y:-s};break;case 3:if(e=du(i,l,2*Math.PI-o),!e)return null;e.x*=-1,e.y*=-1,n={x:0,y:0};break;default:throw new Error("invalid angle")}return{x:e.x+n.x,y:e.y+n.y,width:a,height:s}}function pu(t){let{slice:e,measured:n,padding:i}=t,{start:r,end:o,innerRadius:a,outerRadius:s}=e,l=s-a-2*i,c=o-r;if(c<Math.PI){let t=(n.height/2+i)/Math.tan(c/2);t>a&&(l=s-t-2*i)}if(l<0||l<n.minReqWidth)return null;const u=cu((r+o)/2);let h=s-i,d={x:Math.sin(u)*h,y:-Math.cos(u)*h,width:l,height:n.height};return u<Math.PI?(d.angle=u-Math.PI/2,d.anchor="end"):(d.angle=u+Math.PI/2,d.anchor="start"),d}function gu(t){let{context:e,node:n,bounds:i}=t;let{start:r,end:o}=n.desc.slice;const a=cu((r+o)/2);switch(Math.floor(a/(Math.PI/2))){case 0:e.q1maxY=i.y-2,void 0===e.q2minY&&(e.q2minY=i.y+i.height+2);break;case 1:e.q2minY=i.y+i.height+2;break;case 2:e.q3minY=i.y+i.height+2;break;case 3:e.q4maxY=i.y-2,void 0===e.q3minY&&(e.q3minY=i.y+i.height+2)}}function mu(t,e){return{node:t,data:t.data,scale:e.scale,formatter:e.formatter,dataset:e.dataset}}function yu(t,e,n){const i={type:"text",text:e,maxWidth:t.width,x:t.x,y:t.y+("top"===t.baseline?t.height/2:0),fill:n.fill,anchor:t.anchor||"start",baseline:"middle",fontSize:"".concat(n.fontSize,"px"),fontFamily:n.fontFamily};if(!isNaN(t.angle)){let e=t.angle*(360/(2*Math.PI));i.transform="rotate(".concat(e,", ").concat(i.x,", ").concat(i.y,")")}return i}function vu(t){let e,n,{slice:i,direction:r,position:o,padding:a,measured:s,view:l,context:c,store:u}=t,{start:h,end:d,innerRadius:f,offset:p}=i;switch(o){case"into":e="rotate"===r?pu({slice:i,measured:s,padding:a}):function(t){let{slice:e,padding:n,measured:i}=t,{start:r,end:o,innerRadius:a,outerRadius:s}=e;const l=cu((r+o)/2);let c=fu({radius:s,size:{width:i.width+2*n+1,height:i.height+2*n},angle:l});return c?(c.baseline="top",ms(c,{x1:0,y1:0,x2:Math.sin(r)*s,y2:-Math.cos(r)*s})||ms(c,{x1:0,y1:0,x2:Math.sin(o)*s,y2:-Math.cos(o)*s})||ss({cx:0,cy:0,r:a},c)?null:(uu(c,n),c)):null}({slice:i,measured:s,padding:a});break;case"inside":n={start:h,end:d,innerRadius:0,outerRadius:f},e="rotate"===r?pu({slice:n,measured:s,padding:a}):function(t){let{slice:e,padding:n,measured:i,store:r}=t;const{start:o,end:a,outerRadius:s}=e,l=cu((o+a)/2);let c=fu({radius:s,size:{width:i.width+2*n+1,height:i.height+2*n},angle:l});return c?(c.baseline="top",uu(c,n),r.insideLabelBounds.some((t=>fs(t,c)))?null:(r.insideLabelBounds.push({x:c.x-4,y:c.y,width:c.width+8,height:c.height}),c)):null}({slice:n,measured:s,padding:a,store:u});break;case"outside":e="rotate"===r?function(t){let{slice:e,measured:n,padding:i,view:r}=t,{start:o,end:a,outerRadius:s,offset:l}=e,c=s+i,u=a-o;if(u<Math.PI&&(n.height/2+i)/Math.tan(u/2)>c)return null;const h=cu((o+a)/2);let d=Math.sin(h)*c,f=-Math.cos(h)*c,p=n.width+1,g=h%Math.PI;if(g>Math.PI/2&&(g=Math.PI-g),Math.cos(g)>.001){let t=f<0?r.y:r.y+r.height,e=Math.abs(t-l.y)/Math.cos(g)-Math.tan(g)*(n.height/2)-2*i-s;e<p&&(p=e)}if(Math.sin(g)>.001){let t=d<0?r.x:r.x+r.width,e=Math.abs(t-l.x)/Math.sin(g)-n.height/2/Math.tan(g)-2*i-s;e<p&&(p=e)}if(p<=0||p<n.minReqWidth)return null;let m={x:d,y:f,width:p,height:n.height};return h<Math.PI?(m.angle=h-Math.PI/2,m.anchor="start"):(m.angle=h+Math.PI/2,m.anchor="end"),m}({slice:i,measured:s,padding:a,view:l}):function(t){let{slice:e,measured:n,padding:i,view:r,context:o}=t,{start:a,end:s,outerRadius:l,offset:c}=e;const u=cu((a+s)/2);if(function(t,e,n){switch(e){case 0:return t.q1maxY<0;case 1:return t.q2minY>n.height;case 2:return t.q3minY>n.height;case 3:return t.q4maxY<0;default:return!0}}(o,Math.floor(u/(Math.PI/2)),r))return null;let h=l+i+n.height/2,d=Math.sin(u)*h,f=-Math.cos(u)*h,p=n.width+1;if(u<Math.PI){let t=Math.abs(r.x+r.width-(d+c.x));t<p&&(p=t)}else{let t=Math.abs(r.x-(d+c.x));t<p&&(p=t)}if(p<n.minReqWidth)return null;let g={x:d,y:f,width:p,height:n.height};return u<Math.PI?g.anchor="start":g.anchor="end",g}({slice:i,measured:s,padding:a,view:l,context:c});break;default:throw new Error("not implemented")}return e&&(e.x+=p.x,e.y+=p.y,"outside"===o&&"rotate"!==r&&function(t,e,n){const{start:i,end:r,offset:o,outerRadius:a}=n,s=cu((i+r)/2);switch(Math.floor(s/(Math.PI/2))){case 0:if(void 0!==e.q1maxY){let n=Math.min(t.y,e.q1maxY-t.height),i=t.y-n;if(t.y=n,i>1){let e=a+2;t.line={type:"line",x1:t.x-2,y1:t.y+2,x2:o.x+Math.sin(s)*e,y2:o.y-Math.cos(s)*e,strokeWidth:1}}}break;case 1:if(void 0!==e.q2minY){let n=Math.max(t.y,e.q2minY),i=n-t.y;if(t.y=n,i>1){let e=a+2;t.line={type:"line",x1:t.x-2,y1:t.y-2,x2:o.x+Math.sin(s)*e,y2:o.y-Math.cos(s)*e,strokeWidth:1}}}break;case 2:if(void 0!==e.q3minY){let n=Math.max(t.y,e.q3minY),i=n-t.y;if(t.y=n,i>1){let e=a+2;t.line={type:"line",x1:t.x+2,y1:t.y-2,x2:o.x+Math.sin(s)*e,y2:o.y-Math.cos(s)*e,strokeWidth:1}}}break;case 3:if(void 0!==e.q4maxY){let n=Math.min(t.y,e.q4maxY-t.height),i=t.y-n;if(t.y=n,i>1){let e=a+2;t.line={type:"line",x1:t.x+2,y1:t.y+2,x2:o.x+Math.sin(s)*e,y2:o.y-Math.cos(s)*e,strokeWidth:1}}}}}(e,c,i)),e}function xu(t){let{context:e,direction:n,measured:i,node:r,placementSettings:o,rect:a,store:s}=t,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vu;for(let t=0;t<o.length;t++){let c=o[t],u=l({context:e,slice:r.desc.slice,view:a,direction:n,position:c.position,measured:i,padding:c.padding,store:s});if(u)return{bounds:u,placement:c}}return{bounds:null,placement:null}}function bu(t){const e=[],n=[],i=[],r=[];for(let o=0;o<t.length;++o){const{start:a,end:s}=t[o].desc.slice,l=cu((a+s)/2);switch(Math.floor(l/(Math.PI/2))){case 0:e.push(t[o]);break;case 1:n.push(t[o]);break;case 2:i.push(t[o]);break;case 3:r.push(t[o])}}const o=(t,e)=>cu((t.desc.slice.start+t.desc.slice.end)/2)-cu((e.desc.slice.start+e.desc.slice.end)/2),a=(t,e)=>o(e,t);return e.sort(a),n.sort(o),i.sort(a),r.sort(o),e.concat(n,r,i)}function wu(t,e,n){const i=e.fontFamily,r="".concat(e.fontSize,"px"),o=n.measureText({text:t,fontFamily:i,fontSize:r});return o.minReqWidth=Math.min(o.width,n.measureText({text:"".concat(t[0],"…"),fontFamily:i,fontSize:r}).width),o}const ku=/\n+|\r+|\r\n/,_u=/\s/,Mu=/[a-zA-Z\u00C0-\u00F6\u00F8-\u00FF\u00AD]/;function Su(t){return"string"==typeof t?-1!==t.search(ku):-1!==String(t).search(ku)}function Cu(t){return-1!==t.search(_u)}function Nu(t){return-1!==t.search(Mu)}function Ru(t,e,n,i,r){return i.some((i=>i(t,e,n)))?1:r.some((i=>i(t,e,n)))?0:2}function qu(t){""===t[0]&&t.shift(),""===t[t.length-1]&&t.pop()}function Au(t,e,n){return Math.max(e,Math.min(n,t))}function Du(){let{string:t,separator:e="",reverse:n=!1,measureText:i=(t=>({width:t.length,height:1})),mandatoryBreakIdentifiers:r=[Su],noBreakAllowedIdentifiers:o=[],suppressIdentifier:a=[Cu,Su,t=>""===t],hyphenationIdentifiers:s=[Nu]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const l=String(t).split(e);qu(l);const c=l.length,u=n?t=>t>=0:t=>t<c;let h=n?c:-1;function d(t){const e=Au(t,0,c-1),n=l[e],u=i(n),h=Ru(n,e,l,r,o);return{index:e,value:n,breakOpportunity:h,suppress:a.some((t=>t(n,e,l))),hyphenation:s.some((t=>t(n,e,l))),width:u.width,height:u.height,done:!1}}function f(t){return isNaN(t)?n?h--:h++:h=Au(t,0,c-1),u(h)?d(h):{done:!0}}return{next:f,peek:d,length:c}}const Eu="…",Ou=/^\s*\d+(\.\d+)?px\s*$/i;function Iu(t){return"string"===typeof t&&Ou.test(t)}function Tu(t){const e=t["font-size"]||t.fontSize;return Iu(e)?parseFloat(e)*Math.max(isNaN(t.lineHeight)?1.2:t.lineHeight,0):19.2}function ju(t){const e=t.maxHeight,n=Math.max(t.maxLines,1)||1/0;if(isNaN(e))return n;const i=Tu(t);return Math.max(1,Math.min(Math.floor(e/i),n))}function Pu(t,e){return{lines:[],line:"",width:0,maxLines:ju(t),maxWidth:t.maxWidth,hyphens:{enabled:"auto"===t.hyphens,char:"‐",metrics:e("‐")}}}function zu(t){t.lines.push(t.line),t.line="",t.width=0}function Fu(t,e){t.line+=e.value,t.width+=e.width}function Lu(t,e,n){if(e.width>t.maxWidth)return e;const i=e.index;for(let r=1;r<5;r++){const o=n.peek(e.index-1);if(!e.hyphenation||!o.hyphenation||0===e.index)return e;if(t.width+t.hyphens.metrics.width<=t.maxWidth)return t.line+=t.hyphens.char,e;if(1===t.line.length)return e;e=n.next(i-r),t.line=t.line.slice(0,-1),t.width-=e.width}return e}function Bu(t,e,n){const i=Du({string:e.value,measureText:n});for(;t.lines.length<t.maxLines;){let e=i.next();if(e.done)break;t.width+e.width>t.maxWidth&&2===e.breakOpportunity&&t.line.length>0?(e=t.hyphens.enabled?Lu(t,e,i):e,zu(t),Fu(t,e)):Fu(t,e)}}function Hu(t,e){const n=Du({string:t.text,separator:"",measureText:e,noBreakAllowedIdentifiers:[(t,e)=>0===e]}),i=Pu(t,e);let r=!0;for(;i.lines.length<i.maxLines;){let t=n.next();if(t.done){zu(i),r=!1;break}1===t.breakOpportunity?zu(i):i.width+t.width>i.maxWidth&&2===t.breakOpportunity?t.suppress?i.width+=t.width:(t=i.hyphens.enabled?Lu(i,t,n):t,zu(i),Fu(i,t)):Fu(i,t)}return{lines:i.lines,reduced:r}}function $u(t,e){const n=Du({string:t.text,separator:/(\s|-|\u2010)/,measureText:e}),i=Pu(t,e);let r=!0;for(;i.lines.length<i.maxLines;){let t=n.next();if(t.done){zu(i),r=!1;break}1===t.breakOpportunity?zu(i):i.width+t.width>i.maxWidth&&2===t.breakOpportunity?t.suppress?zu(i):t.width>i.maxWidth?Bu(i,t,e):(zu(i),Fu(i,t)):Fu(i,t)}return{lines:i.lines,reduced:r}}function Vu(t){return{"break-all":Hu,"break-word":$u}[t.wordBreak]}function Wu(t){return e=>{const n=e.node;if(function(t){return"text"===t.type&&!t._lineBreak}(n)){const i=Vu(n);if(!i)return;const r=t(n);if(r.width>n.maxWidth||Su(n.text)){const o=(Tu(n)-r.height)/2,a=i(n,function(t,e){return n=>e({text:n,fontSize:t.fontSize,fontFamily:t.fontFamily})}(n,t));e.node=function(t,e,n,i){const r={type:"container",children:[]};void 0!==e.id&&(r.id=e.id);let o=0;return t.lines.forEach(((a,s)=>{const l=_({},e);l.text=a,l._lineBreak=!0,o+=n,t.reduced&&s===t.lines.length-1?l.text+=Eu:delete l.maxWidth,l.dy=isNaN(l.dy)?o:l.dy+o,o+=i,o+=n,r.children.push(l)})),r}(a,n,o,r.height)}}}}function Uu(t,e){let{text:n,"font-size":i,"font-family":r,maxWidth:o}=t;if(n="string"==typeof n?n:"".concat(n),void 0===o)return n;let a=e({text:n,fontSize:i,fontFamily:r}).width;if(a<=o)return n;let s=0,l=n.length-1;for(;s<=l;){let t=Math.floor((s+l)/2);a=e({text:n.substr(0,t)+Eu,fontSize:i,fontFamily:r}).width,a<=o?s=t+1:l=t-1}return n.substr(0,l)+Eu}function Yu(t){const e=t.baseline||t["dominant-baseline"];let n=0;const i=parseInt(t.fontSize||t["font-size"],10)||0;switch(e){case"hanging":n=.75*i;break;case"text-before-edge":n=.85*i;break;case"middle":n=.25*i;break;case"central":n=.35*i;break;case"mathemetical":n=i/2;break;case"text-after-edge":case"ideographic":n=.2*-i;break;default:n=0}return n}const Xu={},Ku={},Gu={fontSize:void 0,fontFamily:void 0};let Zu;function Ju(t,e,n){const i=t+e+n;return"number"!=typeof Ku[i]&&(Zu=Zu||document.createElement("canvas").getContext("2d"),function(t,e){Gu.fontSize===t&&Gu.fontFamily===e||(Zu.font=t+" "+e,Gu.fontSize=t,Gu.fontFamily=e)}(e,n),Ku[i]=Zu.measureText(t).width),Ku[i]}function Qu(t){return"number"!=typeof Xu[t]&&(Xu[t]=function(t){if(Iu(t)){const e=parseFloat(t);return e+4*Math.ceil((e+1e-12)/24)}return 16}(t)),Xu[t]}function th(t){let{text:e,fontSize:n,fontFamily:i}=t;return{width:Ju(e,n,i),height:Qu(n)}}function eh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:th;const n=t["font-size"]||t.fontSize,i=t["font-family"]||t.fontFamily,r=e({text:t.text,fontFamily:i,fontSize:n}),o=Math.min(t.maxWidth||r.width,r.width),a=t.x||0,s=t.y||0,l=t.dx||0,c=(t.dy||0)+Yu(t),u={x:0,y:s+c-.75*r.height,width:o,height:r.height},h=t["text-anchor"]||t.anchor;return u.x="middle"===h?a+l-o/2:"end"===h?a+l-o:a+l,u}function nh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:th;const n=Vu(t),i=t["font-size"]||t.fontSize,r=t["font-family"]||t.fontFamily,o=e({text:t.text,fontFamily:r,fontSize:i});if(n&&(o.width>t.maxWidth||Su(t.text))){const o=n(t,(t=>e({text:t,fontFamily:r,fontSize:i}))),a=_({},t);let s=0,l="";for(let t=0,n=o.lines.length;t<n;t++){let a=o.lines[t];a+=t===n-1&&o.reduced?Eu:"";const c=e({text:a,fontSize:i,fontFamily:r}).width;c>=s&&(s=c,l=a)}a.text=l;const c=eh(a,e);return c.height=Tu(t)*o.lines.length,c}return eh(t,e)}const ih=.9;function rh(t,e){return{node:t,data:t.data,scale:e.scale,formatter:e.formatter,dataset:e.dataset}}function oh(t,e,n){const i={type:"text",text:e,maxWidth:t.width,x:0,y:t.y,dx:0,dy:0,fill:n.fill,anchor:"start",baseline:"alphabetical",fontSize:"".concat(n.fontSize,"px"),fontFamily:n.fontFamily},r=n.textMetrics;if(t.width<n.fontSize)return!1;const o=Math.max(0,t.width-r.width);return i.x=t.x+n.align*o,i.y=t.y+r.height/1.2,i}function ah(t){let{cx:e,cy:n,r:i}=t;return{type:"circle",bounds:{cx:e,cy:n,r:i}}}function sh(t){return t.desc&&t.desc.slice?function(t){let{start:e,end:n,innerRadius:i,outerRadius:r,offset:o}=t;if(Math.abs(e+2*Math.PI-n)>1e-12)return{type:null,bounds:null};let a=0!==i?i:r;return ah({cx:o.x,cy:o.y,r:a})}(t.desc.slice):"circle"===t.type?ah(t.attrs):"rect"===t.type?{type:"rect",bounds:t.bounds}:{type:null,bounds:null}}var lh={bar:function(t){let{settings:e,chart:n,nodes:i,rect:r,renderer:o,style:a}=t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:au;const l=_({fontSize:12,fontFamily:"Arial",align:.5,justify:0,fill:"#333"},a.label);l.fontSize=parseInt(l.fontSize,10);const c=e.labels.map((t=>_({},l,e,t))),u=e.labels.map((t=>t.placements.map((n=>_({},l,e,t,n))))),{fitsHorizontally:h,hasHorizontalDirection:d,targetNodes:f}=su({nodes:i,chart:n,renderer:o,settings:e,rect:r,labelSettings:c,placementSettings:u}),p=lu({orientation:e.orientation,defaultOrientation:d?"h":"v"}),g="h"===p?"y":"x",m="h"===p?"height":"width";return f.sort(((t,e)=>t.node.localBounds[g]+t.node.localBounds[m]-(e.node.localBounds[g]+e.node.localBounds[m]))),s({chart:n,targetNodes:f,stngs:e,rect:r,fitsHorizontally:h,collectiveOrientation:p})},slice:function(t){let{settings:e,chart:n,nodes:i,rect:r,renderer:o,style:a}=t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xu,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:yu;const c=_({fontSize:12,fontFamily:"Arial",fill:"#333",padding:4,position:"into"},a.label);c.fontSize=parseInt(c.fontSize,10);const u=e.labels.map((t=>_({},c,e,t))),h=e.labels.map((t=>t.placements.map((n=>_({},c,e,t,n))))),d=[],f={insideLabelBounds:[]};i=bu(i);const p={};for(let t=0,e=i.length;t<e;t++){const e=i[t],a=mu(e,n);for(let n=0;n<u.length;n++){const i=u[n],c="function"==typeof i.label?i.label(a,t):"";if(!c)continue;const g="function"==typeof i.direction?i.direction(a,t):i.direction||"horizontal",m="function"==typeof i.linkData?i.linkData(a,t):void 0,y=wu(c,i,o),v=s({context:p,direction:g,lblStngs:i,measured:y,node:e,placementSettings:h[n],rect:r,store:f}),x=v.bounds,b=v.placement;if(x&&b){if("outside"===b.position&&"rotate"!==g){gu({context:p,node:e,bounds:x});if(!Qa(hu(x),r))continue}const n="function"==typeof b.fill?b.fill(a,t):b.fill,o=l(x,c,{fill:n,fontSize:i.fontSize,fontFamily:i.fontFamily,textMetrics:y});o&&(void 0!==m&&(o.data=m),d.push(o),x.line&&(x.line.stroke=n,d.push(x.line)))}}}return d},rows:function(t){let{settings:e,chart:n,nodes:i,renderer:r,style:o}=t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oh;const s=_({fontSize:12,fontFamily:"Arial",fill:"#333",padding:4,align:.5,justify:.5},o.label);s.fontSize=parseInt(s.fontSize,10);const l=_({},s,e),c=e.labels.map((t=>_({},l,t))),u={},h=[];for(let t=0,e=i.length;t<e;t++){let e=i[t],o=rh(e,n),{type:s,bounds:d}=sh(e);if(!d)continue;let f,p=0,g=[],m=[],y="circle"===s?2*d.r*ih:d.height;for(p+=l.padding,f=0;f<c.length;f++){let e=c[f],n="function"==typeof e.label?e.label(o,t):"";u.fontFamily=e.fontFamily,u.fontSize="".concat(e.fontSize,"px"),u.text=n;let i=r.measureText(u);if(p+=i.height+e.padding,p>y)break;m.push(n),g.push(i)}const v=f,x=Math.max(0,y-p);let b;for(b="circle"===s?d.cy-d.r*ih:d.y,b+=l.justify*x+l.padding,f=0;f<v;f++){let e,n=c[f];if("circle"===s){let t=Math.max(Math.abs(b-d.cy),Math.abs(b+g[f].height-d.cy)),n=Math.sqrt(d.r*d.r-t*t);e={x:d.cx-n+l.padding,y:b,width:2*n-2*l.padding,height:g[f].height}}else e={x:d.x+l.padding,y:b,width:d.width-2*l.padding,height:g[f].height};b+=g[f].height+l.padding;let i="function"==typeof n.fill?n.fill(o,t):n.fill;const u="function"==typeof n.linkData?n.linkData(o,t):void 0;let p=a(e,m[f],{fill:i,align:n.align,fontSize:n.fontSize,fontFamily:n.fontFamily,textMetrics:g[f]});if(p){if(p.text&&p.text!==Eu){const t=Uu(p,r.measureText);if(Eu===t)continue;p.ellipsed=t}void 0!==u&&(p.data=u),h.push(p)}}}return h}};const ch={require:["chart","renderer","settings"],defaultSettings:{settings:{},style:{label:"$label"}},render(){const t=this.settings.settings,e=[];return(t.sources||[]).forEach((t=>{t.strategy&&lh[t.strategy.type]&&t.component&&e.push(...function(t,e){let{chart:n,source:i,rect:r,renderer:o,style:a}=t;if(!n.component(i.component))return[];const s=n.findShapes(i.selector).filter((t=>t.key===i.component));return e({chart:n,settings:i.strategy.settings,nodes:s,rect:{x:0,y:0,width:r.width,height:r.height},renderer:o,style:a})}({chart:this.chart,rect:this.rect,renderer:this.renderer,source:t,style:this.style},lh[t.strategy.type]))})),e}};const uh={layout:{size:1,direction:"ltr",scrollOffset:0},item:{show:!0,justify:.5,align:.5,label:{fontSize:"12px",fontFamily:"Arial",fill:"#595959",wordBreak:"none",maxLines:2,maxWidth:136,lineHeight:1.2},shape:{type:"square",size:12}},title:{show:!0,text:void 0,anchor:"start",fontSize:"16px",fontFamily:"Arial",fill:"#595959",wordBreak:"none",maxLines:2,maxWidth:156,lineHeight:1.25},navigation:{button:{class:void 0,content:void 0,tabIndex:void 0},disabled:!1}};function hh(t){let{x:e=0,y:n,item:i,globalMetrics:r,createSymbol:o,direction:a="ltr"}=t,s=i.label.displayObject,l=i.label.bounds,c=i.symbol.meta;const u="rtl"===a;let h={x:u?e+r.maxLabelBounds.width:e+r.maxSymbolSize+r.spacing,y:n,width:r.maxLabelBounds.width,height:Math.max(r.maxSymbolSize,r.maxLabelBounds.height)},d=function(t,e,n){const i=Math.max(0,t.width-e),r=Math.max(0,t.height-e);return{x:t.x+e/2+n.align*i,y:t.y+e/2+n.justify*r}}({x:u?e+r.maxLabelBounds.width+r.spacing:e,y:n,width:r.maxSymbolSize,height:h.height},c.size,{align:void 0===c.align?.5:c.align,justify:void 0===c.justify?.5:c.justify});const f=o(_({},c,d));return delete f.collider,s.anchor=u?"end":"start",function(t,e,n){const i=n.textMetrics;if(t.height<i.height)return!1;const r=Math.max(0,t.width-i.width);e.baseline="text-before-edge";const o=Math.max(0,t.height-i.height);e.x=t.x+n.align*r,e.y=t.y+n.justify*o+.175*parseInt(e.fontSize,10)}(h,s,{textMetrics:l,fontSize:parseInt(s.fontSize,10),align:0,justify:.5}),{item:{type:"container",data:i.label.displayObject.data,children:[f,s],collider:{type:"rect",x:e,y:n,width:r.maxItemBounds.width,height:r.maxItemBounds.height}},metrics:h}}function dh(t,e){const n=t.items.length,i=Math.ceil(n/e),r="horizontal"===t.layout.orientation?"width":"height",o="width"===r?"horizontal":"vertical";return t.globalMetrics.maxItemBounds[r]*i+(i-1)*t.layout.margin[o]}function fh(t,e){let n,i,r,o,{onScroll:a=(()=>{})}=e,s=null,l=0;const c={itemize:e=>{n=function(t,e){let n,i,{resolved:r,dock:o}=t,a=[],s=r.items.items,l=r.symbols.items,c=r.labels.items,u=0,h=0,d=0;for(let t=0;t<s.length;t++){if(!1===s[t].show)continue;const r=void 0!==c[t].text?c[t].text:c[t].data.label||"";n=_({},c[t],{type:"text",fontSize:"".concat(parseInt(c[t].fontSize,10),"px"),text:r,title:r}),i={symbol:{meta:l[t]},label:{displayObject:n,bounds:e.textBounds(n)}},a.push(i),u=Math.max(l[t].size,u),h=Math.max(i.label.bounds.width,h),d=Math.max(i.label.bounds.height,d)}return{items:a,globalMetrics:{spacing:8,maxSymbolSize:u,maxItemBounds:{height:Math.max(u,d),width:u+8+h},maxLabelBounds:{width:h,height:d}},layout:{margin:{vertical:void 0!==r.layout.item.vertical?r.layout.item.vertical:4,horizontal:void 0!==r.layout.item.horizontal?r.layout.item.horizontal:4},mode:r.layout.item.mode,size:r.layout.item.size,orientation:"top"===o||"bottom"===o?"horizontal":"vertical",direction:r.layout.item.direction,scrollOffset:r.layout.item.scrollOffset}}}(e,t.renderer),s=isNaN(n.layout.scrollOffset)?s:n.layout.scrollOffset},getItemsToRender:e=>{r=e.viewRect,l=c.getContentOverflow(r);const a=c.extent();s=Math.max(0,Math.min(s,l)),o=_({},r);const u="horizontal"===c.orientation()?"x":"y";return o[u]-=s,o["x"===u?"width":"height"]=a,function(t,e,n){let{viewRect:i}=t,{itemized:r,create:o=hh,parallels:a,createSymbol:s}=n;const l=r.layout.direction,c=r.globalMetrics,u=r.items,h="horizontal"===r.layout.orientation;let d=0;const f=[],p=c.maxItemBounds.height,g=c.maxItemBounds.width,m=r.layout.margin.vertical+p,y=r.layout.margin.horizontal+g;let v=e.x,x=e.y,b=i.x-e.x;for(let t=0;t<u.length;t++){let n=o({y:x,x:"rtl"===l?i.x+b+i.width-g-(v-e.x):v,item:u[t],globalMetrics:c,direction:l,createSymbol:s});if((h&&v>=i.x-g||!h&&x>=i.y-p)&&f.push(n.item),d++,d>=a?(d=0,h?(v+=y,x=e.y):(x+=m,v=e.x)):h?x+=m:v+=y,!h&&x>i.y+i.height)break;if(h&&v>i.x+i.width)break}return f}(e,o,{itemized:n,parallels:i,createSymbol:t.symbol})},parallelize:(t,e)=>(i=function(t,e,n){const i=n.items.length,r="horizontal"===n.layout.orientation?"width":"height",o="width"===r?"horizontal":"vertical",a=n.globalMetrics.maxItemBounds[r]*i+(i-1)*n.layout.margin[o];let s=Math.ceil(a/t);if(null!=e){const t="horizontal"===n.layout.orientation?"height":"width",i="width"===t?"horizontal":"vertical",r=n.layout.margin[i]||4,o=Math.floor((e+r)/(r+n.globalMetrics.maxItemBounds[t]));s=Math.min(s,o)}const l=isNaN(n.layout.size)?1:n.layout.size;return Math.max(1,Math.min(s,l))}(t,e,n),i),hasContentOverflow:()=>{const t="horizontal"===n.layout.orientation?"width":"height";return dh(n,i)>r[t]},getContentOverflow:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r;const e="horizontal"===n.layout.orientation?"width":"height";return Math.max(0,dh(n,i)-t[e])},getNextSize:()=>{const t="horizontal"===n.layout.orientation?"width":"height",e="width"===t?"horizontal":"vertical";return n.globalMetrics.maxItemBounds[t]+n.layout.margin[e]},getPrevSize:()=>{const t="horizontal"===n.layout.orientation?"width":"height",e="width"===t?"horizontal":"vertical";return n.globalMetrics.maxItemBounds[t]+n.layout.margin[e]},hasNext:()=>"horizontal"===c.orientation()?r.x+r.width<o.x+o.width:r.y+r.height<o.y+o.height,hasPrev:()=>"horizontal"===c.orientation()?o.x<r.x:o.y<r.y,next:()=>{c.scroll(-c.getNextSize())},prev:()=>{c.scroll(c.getPrevSize())},scroll:t=>{const e=Math.max(0,Math.min(l,s-t));e!==s&&(s=e,a())},offset:()=>s,orientation:()=>n.layout.orientation,direction:()=>n.layout.direction,extent:()=>dh(n,i),spread:()=>function(t,e){const n=e,i="horizontal"===t.layout.orientation?"height":"width",r="width"===i?"horizontal":"vertical";return t.globalMetrics.maxItemBounds[i]*n+(n-1)*t.layout.margin[r]}(n,i)};return c}function ph(t){return Object.keys(t).filter((e=>t[e])).join(" ")}const gh={up:"▲",right:"▶",down:"▼",left:"◀"};function mh(t,e){let{size:n,isActive:i,direction:r,nav:o,attrs:a}=e,s={},l="";const c=a;o&&o.button&&("function"==typeof o.button.class?s=o.button.class({direction:r}):o.button.class&&(s=o.button.class),"function"==typeof o.button.content&&(l=o.button.content(t,{direction:r})),void 0!==o.button.tabIndex&&(c.tabindex=o.button.tabIndex));const u={width:"".concat(n,"px"),minWidth:"".concat(n,"px"),height:"".concat(n,"px")};return Object.keys(s).length||(u.border="0",u.background="none"),(!i||o&&o.disabled)&&(c.disabled="disabled"),t("button",_({class:ph(s),style:u},c),[l||t("span",{style:{pointerEvents:"none"}},[gh[r]])])}function yh(t){let e;const n={itemize:t=>{e=function(t){let{dock:e,navigation:n}=t;return{layout:{orientation:"top"===e||"bottom"===e?"vertical":"horizontal"},navigation:n}}(t)},render:i=>function(t,e,n,i){let{rect:r,itemRenderer:o}=e;if(!t||!t.renderArgs)return;t.size(r);const a=t.renderArgs[0],s="vertical"===n.layout.orientation,l="rtl"===o.direction(),c=o.hasNext(),u=o.hasPrev();if(!u&&!c)return void t.render([]);const h=s?["right","left"]:["down","up"];l&&s&&h.reverse();const d=[a("div",{style:{position:"relative",display:"flex","flex-direction":s?"column":"row","justify-content":"center",height:"100%",pointerEvents:"auto"},dir:l&&!s?"rtl":"ltr"},[mh(a,{size:32,isActive:c,direction:h[0],attrs:{"data-action":"next","data-component-key":i.settings.key},nav:n.navigation}),mh(a,{size:32,isActive:u,direction:h[1],attrs:{"data-action":"prev","data-component-key":i.settings.key},nav:n.navigation})])];t.render(d)}(n.renderer,i,e,t),extent:()=>32,spread:()=>64};return n}function vh(t){let e;const n={itemize:n=>{e=function(t,e){let{resolved:n}=t;if(!1===n.title.item.show)return null;const i=_({},n.title.item,{type:"text"});if("rtl"===n.layout.item.direction&&(i.anchor&&"start"!==i.anchor?"end"===i.anchor&&(i.anchor="start"):i.anchor="end"),void 0===n.title.settings.text){const t=e.scale.data().fields;i.text=t&&t[0]?t[0].title():""}return{displayObject:i,bounds:e.renderer.textBounds(i)}}(n,t)},render:t=>{!function(t,e,n){let{rect:i}=t;if(!e)return;const r=[];if(e.size(i),n){const t={start:0,end:i.width,middle:i.width/2};r.push(_({},n.displayObject,{x:t[n.displayObject.anchor]||0,y:0,baseline:"text-before-edge",title:n.displayObject.text}))}e.render(r)}(t,n.renderer,e)},spread:()=>e?e.bounds.height:0,extent:()=>e?e.bounds.width:0};return n}function xh(t,e,n,i){let r,o,a,{itemRenderer:s,navigationRenderer:l,titleRenderer:c,isPreliminary:u=!1}=i,h=0;const d={x:e.spacing,y:e.spacing,width:t.width-2*e.spacing,height:t.height-2*e.spacing};if(r={x:d.x,y:d.y,width:d.width,height:c.spread()},"horizontal"===n){r={x:d.x,y:d.y,width:c.extent(),height:c.spread()};const t=d.width-r.width-(r.width?e.spacing:0),n=d.height;s.parallelize(t,u?void 0:n);const i=s.extent()>t?l.extent():0,f=s.spread(),p=i?l.spread():0;o={x:r.x+r.width+(r.width?e.spacing:0),y:d.y+Math.max(0,(p-f)/2),width:d.width-i-r.width-(i?e.spacing:0)-(r.width?e.spacing:0),height:n},a={x:o.x+o.width+(i?e.spacing:0),y:d.y,width:i,height:d.height},r.y=o.y;"rtl"===s.direction()&&(a.x=d.x,o.x=a.x+a.width+(a.width?e.spacing:0),r.x=o.x+o.width+(r.width?e.spacing:0)),h=Math.max(r.height,p,s.spread())}else{const t=d.height-r.height-(r.height?e.spacing:0),n=d.width;s.parallelize(t,u?void 0:n);const i=s.extent()>t?l.extent():0;a={x:d.x,y:d.y+d.height-i,width:d.width,height:i},o={x:d.x,y:r.y+r.height+(r.height?e.spacing:0),width:d.width,height:d.height-r.height-(r.height?e.spacing:0)-a.height-(a.height?e.spacing:0)},h=Math.max(c.extent(),i?l.spread():0,s.spread())}return o=_({},t,{x:t.x+o.x,y:t.y+o.y,width:o.width,height:o.height}),a.x+=t.x,a.y+=t.y,r.x+=t.x,r.y+=t.y,{title:_({},t,r),content:_({},t,o),navigation:_({},t,a),orientation:n,preferredSize:h}}function bh(t){t.state.resolved=function(t){const e=t.scale.domain();let n={items:[]};const i=t.settings.layout.dock;if("threshold-color"===t.scale.type){const r=t.scale.data().fields[0];let o=t=>String(t);t.settings.formatter?o=t.chart.formatter(t.settings.formatter):r&&(o=r.formatter());for(let t=0;t<e.length-1;t++){const i={value:e[t],label:"".concat(o(e[t])," - < ").concat(o(e[t+1]))};r&&(i.source={field:r.id()}),n.items.push(i)}"vertical"==("top"===i||"bottom"===i?"horizontal":"vertical")&&n.items.reverse()}else{const i=t.scale.labels?t.scale.labels():null;n.items=e.map(((e,n)=>{const r=t.scale.datum?_({},t.scale.datum(e)):{value:e};return r.value=e,t.scale.label?r.label=t.scale.label(e):i&&(r.label=i[n]),r}))}const r=t.resolver.resolve({data:{fields:t.scale.data().fields},defaults:_(!0,{},uh.title,t.style.title),settings:t.settings.settings.title}),o=t.resolver.resolve({data:{fields:t.scale.data().fields},defaults:uh.layout,settings:t.settings.settings.layout}),a=t.resolver.resolve({data:n,defaults:_(!0,{},uh.item.label,t.style.item.label),settings:(t.settings.settings.item||{}).label}),s=_(!0,{},(t.settings.settings.item||{}).shape);void 0===s.fill&&t.settings.scale&&(s.fill={scale:t.settings.scale});const l=t.resolver.resolve({data:n,defaults:_(!0,{},uh.item.shape,t.style.item.shape),settings:s}),c=t.resolver.resolve({data:n,defaults:_(!0,{},{show:uh.item.show}),settings:{show:(t.settings.settings.item||{}).show}});function u(t,n){let i=t.data.value,r=e[n+1];t.data.value=[i,r]}"threshold-color"===t.scale.type&&("vertical"==("top"===i||"bottom"===i?"horizontal":"vertical")?(c.items.reverse().forEach(u),c.items.reverse()):c.items.forEach(u));return{title:r,labels:a,symbols:l,items:c,layout:o}}(t),t.titleRenderer.itemize({resolved:t.state.resolved,dock:t.settings.layout.dock||"center"}),t.itemRenderer.itemize({resolved:t.state.resolved,dock:t.settings.layout.dock||"center"}),t.navigationRenderer.itemize({resolved:t.state.resolved,dock:t.settings.layout.dock||"center",navigation:t.settings.settings.navigation}),t.state.display={spacing:8}}function wh(t){const{rect:e,settings:n,state:i,itemRenderer:r,navigationRenderer:o,titleRenderer:a}=t,s=n.layout.dock,l="top"===s||"bottom"===s?"horizontal":"vertical",c=xh(e,i.display,l,{itemRenderer:r,navigationRenderer:o,titleRenderer:a});t.renderer.size(c.content);let u=r.getItemsToRender({viewRect:_({},c.content,{x:0,y:0})});return o.render({rect:c.navigation,itemRenderer:r}),a.render({rect:c.title}),t.state.views={layout:c},u}const kh={require:["chart","settings","renderer","update","resolver","registries","symbol"],defaultSettings:{settings:{},style:{item:{label:"$label",shape:"$shape"},title:"$title"}},mounted(t){t&&t.parentNode&&(this.navigationRenderer.renderer.appendTo(t.parentNode),this.titleRenderer.renderer.appendTo(t.parentNode),t.parentNode.insertBefore(this.navigationRenderer.renderer.element(),t),t.parentNode.insertBefore(this.titleRenderer.renderer.element(),t)),this.navigationRenderer.render({rect:this.state.views.layout.navigation,itemRenderer:this.itemRenderer}),this.titleRenderer.render({rect:this.state.views.layout.title})},beforeUnmount(){this.navigationRenderer.renderer.clear(),this.titleRenderer.renderer.clear()},on:{panstart(){if(this.state.interaction.started)return;this.itemRenderer.getContentOverflow()&&(this.state.interaction.started=!0,this.state.interaction.delta=0)},panmove(t){if(!this.state.interaction.started)return;const e="horizontal"===this.itemRenderer.orientation()?("rtl"===this.itemRenderer.direction()?-1:1)*t.deltaX:t.deltaY;this.itemRenderer.scroll(e-this.state.interaction.delta),this.state.interaction.delta=e},panend(){this.state.interaction.started=!1},scroll(t){this.itemRenderer.scroll(-t)},next(){this.itemRenderer.next()},prev(){this.itemRenderer.prev()}},created(){this.state={interaction:{}},this.onScroll=()=>{const t=wh(this);this.update(t)},this.itemRenderer=fh(this,{onScroll:this.onScroll}),this.navigationRenderer=yh(this),this.titleRenderer=vh(this),this.navigationRenderer.renderer=this.registries.renderer("dom")(),this.titleRenderer.renderer=this.registries.renderer(this.settings.renderer)(),bh(this)},preferredSize(t){return function(t,e){let n=0;const i=t.settings.layout.dock||"center",r="top"===i||"bottom"===i?"horizontal":"vertical",o=t.state.display,a=xh(e.inner,o,r,{itemRenderer:t.itemRenderer,navigationRenderer:t.navigationRenderer,titleRenderer:t.titleRenderer,isPreliminary:!0});return n+=o.spacing,n+=a.preferredSize,n+=o.spacing,n}(this,t)},beforeUpdate(){bh(this)},render(){return wh(this)},beforeDestroy(){this.navigationRenderer.renderer.destroy(),this.titleRenderer.renderer.destroy()},additionalElements(){return[this.titleRenderer.renderer.element(),this.navigationRenderer.renderer.element()]},_DO_NOT_USE_getInfo(){return{offset:this.itemRenderer.offset()}}};function _h(t,e){let n=0;const i=t.state.isVertical?"justify":"align",r=t.state.isVertical?"y":"x",o=t.state.isVertical?"height":"width",a=t.state.isVertical?"requiredHeight":"requiredWidth";n=t.state.rect[o]-t.state.legend.length()-t.state.title[a](),n*=Math.min(1,Math.max(t.stgns[i],0)),e[r]+=n}function Mh(t,e,n){const i=n[t];return"object"==typeof i?-1!==i.valid.indexOf(e)?e:i.default:n.default}function Sh(t){return Mh(t.layout.dock,t.settings.title.anchor,{left:{valid:["top"],default:"top"},right:{valid:["top"],default:"top"},top:{valid:["left","right"],default:"left"},bottom:{valid:["left","right"],default:"left"},default:"top"})}function Ch(t,e){const n={x:0,y:0,width:0,height:0},i=t.stgns.padding;return n.x=i.left,n.y=i.top,n.width=e.width-i.left-i.right,n.height=e.height-i.top-i.bottom,n}function Nh(t){const e="top"!==t.settings.layout.dock&&"bottom"!==t.settings.layout.dock,n=t.stgns.title,i=t.chart.scale(t.stgns.fill),r=t.chart.scale(t.stgns.major),o=function(t,e){const n=e.domain();let i=n,r=t.stgns.tick.label;return!r&&t.formatter?r=t.formatter:!r&&e.data().fields&&(r=e.data().fields[0].formatter()),"function"==typeof r&&(i=n.map(r).map(String)),n.map(((n,r)=>{const o=i[r];return{value:n,label:o,pos:e.norm(parseFloat(n,10)),textMetrics:t.renderer.measureText({text:o,fontSize:t.stgns.tick.fontSize,fontFamily:t.stgns.tick.fontFamily})}}))}(t,r),a=function(t){return Mh(t.layout.dock,t.settings.tick.anchor,{left:{valid:["left","right"],default:"left"},right:{valid:["left","right"],default:"right"},top:{valid:["top","bottom"],default:"top"},bottom:{valid:["top","bottom"],default:"bottom"},default:"right"})}(t.settings);if(void 0===n.text){const t=r.data().fields;n.text=t&&t[0]?t[0].title():""}const s=t.renderer.measureText({text:n.text,fontSize:n.fontSize,fontFamily:n.fontFamily}),l=t.renderer.textBounds({text:n.text,fontSize:n.fontSize,fontFamily:n.fontFamily,maxLines:n.maxLines,maxWidth:n.maxLengthPx,wordBreak:n.wordBreak,hyphens:n.hyphens,lineHeight:n.lineHeight}),c={isVertical:e,nodes:[],title:{anchor:Sh(t.settings),textMetrics:s,textBounds:l,requiredWidth:()=>{if(!n.show)return 0;let t=l.width,i=n.maxLengthPx;return e||(t+=n.padding,i+=n.padding),Math.min(t,i,c.rect.width)},requiredHeight:()=>{if(!n.show)return 0;let t=l.height;return e&&(t+=n.padding),Math.min(t,c.rect.height)}},ticks:{values:o,anchor:a,length:Math.min(Math.max(...o.map((t=>t.textMetrics.width))),t.stgns.tick.maxLengthPx),requiredHeight:()=>"top"===a?Math.max(...c.ticks.values.map((t=>t.textMetrics.height)))+t.stgns.tick.padding:0,height:Math.max(...o.map((t=>t.textMetrics.height)))},legend:{fillScale:i,majorScale:r,length:()=>{const n=e?"height":"width",i=e?"requiredHeight":"requiredWidth",r=Math.min(c.rect[n],c.rect[n]*t.stgns.length)-c.title[i]();return Math.max(0,Math.min(r,t.stgns.maxLengthPx))}}};return c}const Rh={require:["chart","settings","renderer"],defaultSettings:{layout:{displayOrder:0,dock:"right"},settings:{size:15,length:.5,maxLengthPx:250,align:.5,justify:0,padding:{left:5,right:5,top:5,bottom:5},tick:{label:null,fill:"#595959",fontSize:"12px",fontFamily:"Arial",maxLengthPx:100,anchor:null,padding:5},title:{show:!0,text:void 0,fill:"#595959",fontSize:"12px",fontFamily:"Arial",maxLengthPx:100,padding:5,maxLines:2,wordBreak:"none",lineHeight:1.2,hyphens:"auto",anchor:null}}},preferredSize(t){const e=this.state;e.rect=Ch(this,t.inner);let n=this.stgns.size;const i=e.isVertical?this.stgns.padding.left+this.stgns.padding.right:this.stgns.padding.top+this.stgns.padding.bottom;n+=i;const r=Math.max(t.inner.width,t.inner.height);if("left"===e.ticks.anchor||"right"===e.ticks.anchor){if(e.ticks.values.reduce(((t,e)=>t+e.textMetrics.height),0)>this.state.legend.length())return r;n+=e.ticks.length}else{if(e.ticks.length>this.state.legend.length())return r;n+=Math.max(...e.ticks.values.map((t=>t.textMetrics.height)))}return n+=this.stgns.tick.padding,this.stgns.title.show&&(n="left"===e.title.anchor||"right"===e.title.anchor?Math.max(e.title.textBounds.height+i,n):Math.max(n,e.title.requiredWidth()+i)),this.state.preferredSize=n,n},created(){this.stgns=this.settings.settings,this.state=Nh(this)},beforeUpdate(t){this.stgns=t.settings.settings,this.state=Nh(this)},beforeRender(t){if(this.state.nodes=[],this.state.rect=Ch(this,t.size),this.stgns.title.show){const t=function(t){const e=t.state,n=t.stgns,i="left"===e.ticks.anchor,r="top"===e.ticks.anchor;let o=e.rect.x,a=e.rect.y,s="start";"left"===e.title.anchor?(o+=e.title.requiredWidth()-n.title.padding,a+=e.title.textMetrics.height,a+=r?e.rect.height-e.title.textBounds.height:0,s="end"):"right"===e.title.anchor?(o+=e.legend.length(),o+=n.title.padding,a+=e.title.textMetrics.height,a+=r?e.rect.height-e.title.textBounds.height:0):"top"===e.title.anchor&&(o+=i?e.rect.width:0,a+=e.title.textMetrics.height,s=i?"end":"start");const l={tag:"legend-title",type:"text",x:o,y:Math.min(a,e.rect.y+e.rect.height),text:n.title.text,fill:n.title.fill,fontSize:n.title.fontSize,fontFamily:n.title.fontFamily,maxWidth:n.title.maxLengthPx,maxLines:n.title.maxLines,wordBreak:n.title.wordBreak,hyphens:n.title.hyphens,lineHeight:n.title.lineHeight,anchor:s,title:n.title.text};return _h(t,l),l}(this);this.state.nodes.push(t)}const e=function(t,e){const n=t.state,i=t.stgns,r=n.rect;let o=r.x,a=r.y,s=n.isVertical?i.size:n.legend.length(),l=n.isVertical?n.legend.length():i.size;"left"===n.ticks.anchor?o+=n.rect.width-i.size:"top"===n.ticks.anchor&&(a+=n.rect.height-i.size),"top"===n.title.anchor?a+=n.title.requiredHeight():"left"===n.title.anchor&&(o+=n.title.requiredWidth());const c={type:"rect",x:o,y:a,width:s,height:l,fill:{type:"gradient",stops:e,degree:n.isVertical?90:180}};return _h(t,c),c}(this,function(t){const e=t.state.legend.fillScale,n=t.state.legend.majorScale;return e.domain().map((t=>({type:"stop",color:e(t),offset:Math.min(1,Math.max(0,n.norm(t)))}))).sort(((t,e)=>t.offset-e.offset))}(this)),n={id:"legend-seq-target",type:"container",children:[e,function(t,e){const n=t.state,i=t.stgns;let r="start";const o={type:"rect",x:e.x,y:e.y,width:n.isVertical?0:e.width,height:n.isVertical?e.height:0,fill:"transparent"};return{type:"container",id:"legend-seq-ticks",children:[...n.ticks.values.map((a=>{let s=0,l=0,c=0,u="alphabetical";return n.isVertical?(l=e.y+e.height*a.pos,u=0===a.pos?"text-before-edge":"text-after-edge"):s=e.x+e.width*a.pos,"right"===n.ticks.anchor?(s=e.x+i.size+i.tick.padding,o.x=e.x+e.width):"left"===n.ticks.anchor?(s=e.x-i.tick.padding,r="end"):"top"===n.ticks.anchor?(l=e.y-i.tick.padding,c-=.25*a.textMetrics.height,r=0===a.pos?"start":"end"):"bottom"===n.ticks.anchor&&(l=e.y+e.height+i.tick.padding,c=.8*a.textMetrics.height,r=0===a.pos?"start":"end",o.y=e.y+e.height),{type:"text",x:s,y:l,dx:0,dy:c,text:a.label,fontSize:i.tick.fontSize,fontFamily:i.tick.fontFamily,fill:i.tick.fill,maxWidth:n.isVertical?i.tick.maxLengthPx:Math.min(i.tick.maxLengthPx,n.legend.length()/2),anchor:r,textBoundsFn:t.renderer.textBounds,title:a.label,baseline:u}})),o]}}(this,e)]};this.state.nodes.push(n)},render(){return this.state.nodes}};const qh={coordinates:{minor:.5,major:.5,layerId:0,defined:!0},connect:!1,orientation:"horizontal",layers:{curve:"linear",show:!0,sort:void 0,line:{stroke:"#ccc",strokeWidth:1,strokeLinejoin:"miter",strokeDasharray:void 0,opacity:1,show:!0,showMinor0:!0},area:{fill:"#ccc",opacity:.8,show:!0}}};function Ah(t,e){let{generatorType:n,item:i,data:r,major:o,minor:a,layerObj:s,stngs:l}=e,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const u={type:"path",points:t,generatorType:n,major:o,minor:a,layerObj:s,stngs:l,opacity:i.opacity,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeLinejoin:i.strokeLinejoin,fill:c||i.fill,data:r};return i.strokeDasharray&&(u.strokeDasharray=i.strokeDasharray),u}function Dh(t){const{metaLayers:e,coordinates:n,layers:i,lines:r,areas:o}=function(t){let{data:e,stngs:n,rect:i,resolver:r,style:o,domain:a}=t;const{width:s,height:l}=i,c=r.resolve({data:e,defaults:qh.coordinates,settings:n.coordinates||{},scaled:{major:"vertical"===n.orientation?l:s,minor:"vertical"===n.orientation?s:l}}),u=!n.connect&&a.length>2&&("function"==typeof n.coordinates.layerId||"object"==typeof n.coordinates.layerId),h={};let d=0;for(let t=0;t<c.items.length;t++){let e=c.items[t],n=e.layerId;if(u){const t=h[n]?h[n].items[h[n].items.length-1]:null,i=t?a.indexOf(t.data.major?t.data.major.value:t.data.value):null;t&&a.indexOf(e.data.major?e.data.major.value:e.data.value)-1!==i&&h[n].items.push({dummy:!0})}h[n]=h[n]||{order:d++,id:n,items:[],dataItems:[],consumableData:{}},h[n].dataItems.push(e.data),h[n].items.push(e)}const f=Object.keys(h).map((t=>(h[t].consumableData=C({points:h[t].dataItems},h[t].dataItems[0]),h[t]))),p={items:f.map((t=>t.consumableData))},g=n.layers||{};return{coordinates:c,metaLayers:f,layers:r.resolve({data:p,defaults:{curve:qh.layers.curve,show:qh.layers.show},settings:{curve:g.curve,show:g.show}}),lines:r.resolve({data:p,defaults:_({},qh.layers.line,o.line),settings:g.line}),areas:r.resolve({data:p,defaults:_({},qh.layers.area,o.area),settings:g.area})}}(t),a=[];return e.forEach(((e,s)=>{const l=i.items[s];if(!1===l.show)return;l.datum=l.data,l.data=[],l.id=e.id;const c=[],u=[];let h,d;for(let i=0;i<e.items.length;i++){if(h=e.items[i],d=h.data,!h.dummy){if(isNaN(h.major))continue;t.missingMinor0&&(h.minor0=n.settings.minor.scale?n.settings.minor.scale(d.minor0?d.minor0.value:0):0),isNaN(h.minor)||c.push(h.minor),l.data.push(h.data)}u.push(h)}const f=c.sort(((t,e)=>t-e))[Math.floor((c.length-1)/2)];a.push({layerObj:l,lineObj:r.items[s],areaObj:o.items[s],median:f,points:u,consumableData:e.consumableData})})),a}const Eh={require:["chart","resolver"],defaultSettings:{style:{area:"$shape",line:"$shape-outline"}},created(){},render(t){let{data:e}=t;const{width:n,height:i}=this.rect;this.stngs=this.settings.settings||{};const r=!this.stngs.coordinates||void 0===this.stngs.coordinates.minor0,o=Dh({data:e,stngs:this.stngs,rect:this.rect,resolver:this.resolver,style:this.style,missingMinor0:r,domain:this.stngs.coordinates&&this.stngs.coordinates.major&&this.stngs.coordinates.major.scale?this.chart.scale(this.stngs.coordinates.major.scale).domain():[]});if(this.stngs.layers&&this.stngs.layers.sort){const t=o.map((t=>({id:t.layerObj.id,data:t.layerObj.data}))).sort(this.stngs.layers.sort).map((t=>t.id));o.sort(((e,n)=>t.indexOf(e.layerObj.id)-t.indexOf(n.layerObj.id)))}else o.sort(((t,e)=>t.median-e.median));return function(t,e){let{width:n,height:i,missingMinor0:r,stngs:o}=e;const a=[],s=o.layers||{};return t.forEach((t=>{const{lineObj:e,layerObj:l,areaObj:c,points:u}=t;let h={size:i,p:"y"},d={size:n,p:"x"};if("vertical"===o.orientation){const t=_(!0,{},d);d=_(!0,{},h),h=_(!0,{},t)}s.area&&!1!==c.show&&a.push(Ah(u,{data:t.consumableData,item:c,generatorType:"area",major:d,minor:h,layerObj:l,stngs:o})),e&&!1!==e.show&&(a.push(Ah(u,{data:t.consumableData,item:e,generatorType:"line".concat(h.p.toUpperCase(),"1"),major:d,minor:h,layerObj:l,stngs:o},"none")),!r&&s.area&&!1!==c.show&&!1!==e.showMinor0&&a.push(Ah(u,{data:t.consumableData,item:e,generatorType:"line".concat(h.p.toUpperCase(),"0"),major:d,minor:h,layerObj:l,stngs:o},"none")))})),a}(o,{width:n,height:i,missingMinor0:r,stngs:this.stngs})}};function Oh(t,e){let n,i,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"object"==typeof e.center?(n=e.center.x,i=e.center.y):(n=e.clientX,i=e.clientY);const o=n-t.state.boundingRect.left,a=i-t.state.boundingRect.top;return{x:r?Math.max(0,Math.min(o,t.rect.width)):o,y:r?Math.max(0,Math.min(a,t.rect.height)):a}}function Ih(t,e){return{x:e.x+t.rect.x,y:e.y+t.rect.y}}function Th(t,e){const n=Math.min(t.x,e.x),i=Math.min(t.y,e.y);return{x:n,y:i,width:Math.max(t.x,e.x)-n,height:Math.max(t.y,e.y)-i}}const jh={require:["chart","renderer"],defaultSettings:{layout:{displayOrder:99},settings:{brush:{components:[]}},style:{area:"$selection-area-target"}},on:{areaStart(t){this.start(t)},areaMove(t){this.move(t)},areaEnd(t){this.end(t)},areaCancel(){this.cancel()}},created(){this.state={start:{x:0,y:0},end:{x:0,y:0},active:!1}},preferredSize:()=>0,render(){},start(t){this.state.boundingRect=this.renderer.element().getBoundingClientRect();const e=Oh(this,t,!1);gs({x:0,y:0,width:this.rect.width,height:this.rect.height},e)&&(this.state.brushConfig=function(t){return t.settings.brush.components.map((t=>({key:t.key,contexts:t.contexts,data:t.data,action:t.action||"set"})))}(this.settings),this.state.start=Oh(this,t),this.state.active=!0)},move(t){var e;this.state.active&&(this.state.end=Oh(this,t),function(t){if(t.state.active){const e=Ih(t,t.state.start),n=Ih(t,t.state.end),i=t.chart.shapesAt(Th(e,n),{components:t.state.brushConfig});t.chart.brushFromShapes(i,{components:t.state.brushConfig})}}(this),(e=this).renderer.render([_({type:"rect"},Th(e.state.start,e.state.end),e.style.area)]))},end(){this.state.active&&(this.state={start:{x:0,y:0},end:{x:0,y:0},active:!1},this.renderer.render([]))},cancel(){var t,e;this.state.active&&(t=this.state,e=this.chart,t.brushConfig.forEach((t=>{Array.isArray(t.contexts)&&t.contexts.forEach((t=>{e.brush(t).end()}))})),this.state={start:{x:0,y:0},end:{x:0,y:0},active:!1},this.renderer.render([]))}};function Ph(t,e,n){let{renderer:i,style:r,props:o,h:a}=n;const s=function(t,e){return{tooltip:"function"==typeof t.tooltipClass?t.tooltipClass({dock:e.dock}):t.tooltipClass,content:"function"==typeof t.contentClass?t.contentClass({dock:e.dock}):t.contentClass,arrow:"function"==typeof t.arrowClass?t.arrowClass({dock:e.dock}):t.arrowClass}}(o,e),l=function(t,e,n,i){return i.content({h:t,style:n,data:e})}(a,t,r,o),c=a("div",{dir:o.direction,class:ph(_({"pic-tooltip":!0},s.tooltip)),style:_({position:"relative",display:"inline-block"},e.computedTooltipStyle)},a("div",{style:r.content,class:ph(_({"pic-tooltip-content":!0},s.content))},l),a("div",{class:ph(_({"pic-tooltip-arrow":!0},s.arrow)),style:_({},r.arrow,r["arrow-".concat(e.dock)],e.computedArrowStyle)}));return i.render(c),i.element().children[0]}function zh(t){let{defaultDuration:e,defaultDelay:n}=t,i=null,r=null,o=!1;const a=function(){const t=function(){},e={pending:[],debounced:[],active:[],cancelled:[],rejected:[],fulfilled:[]};let n;return t.set=t=>{n=t,e[n].forEach((e=>e(t)))},t.on=(t,n)=>{Array.isArray(t)?t.forEach((t=>e[t].push(n))):e[t].push(n)},t.destroy=()=>{Object.keys(e).forEach((t=>{e[t].length=0}))},t}(),s=function(){},l=()=>{i=null,r=null,o=!1,a.set("fulfilled")};return s.invoke=function(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n;i&&(clearTimeout(i),a.set("debounced")),a.set("pending"),i=setTimeout((()=>{t(),o=!0,i=null,a.set("active")}),c),s>0&&(r&&clearTimeout(r),r=setTimeout(l,s+Math.max(c,0)))},s.clear=()=>{o?a.set("cancelled"):i&&(clearTimeout(i),a.set("rejected")),r&&clearTimeout(r),i=null,r=null,o=!1},s.on=(t,e)=>{a.on(t,e)},s.destroy=()=>{s.clear(),a.destroy()},s}function Fh(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return{left:"translate(-100%,-50%) translateX(".concat(-t,"px)"),right:"translate(".concat(t,"px, -50%)"),top:"translate(-50%, -100%) translateY(".concat(-t,"px)"),bottom:"translate(-50%, ".concat(t,"px)")}}function Lh(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{left:{x:-t-n,y:-e/2},right:{x:n,y:-e/2},top:{x:-t/2,y:-e-n},bottom:{x:-t/2,y:n}}}function Bh(t){return{left:{left:"100%",top:"calc(50% - ".concat(t,"px)"),borderWidth:"".concat(t,"px")},right:{left:"".concat(2*-t,"px"),top:"calc(50% - ".concat(t,"px)"),borderWidth:"".concat(t,"px")},top:{left:"calc(50% - ".concat(t,"px)"),top:"100%",borderWidth:"".concat(t,"px")},bottom:{left:"calc(50% - ".concat(t,"px)"),top:"".concat(2*-t,"px"),borderWidth:"".concat(t,"px")}}}function Hh(t,e,n,i,r,o){const a=e+o.x,s=n+o.y,l=r;return!(a<0||s<0)&&!(a+i>t.width||s+l>t.height)}function $h(t){let{area:e,vx:n,vy:i,width:r,height:o,offset:a}=t;const s=n+a.x,l=i+a.y,c=r,u=o;let h=s<0?-s:0,d=l<0?-l:0;return h+=s+c>e.width?-(s+c-e.width):0,d+=l+u>e.height?-(l+u-e.height):0,{x:h,y:d}}function Vh(t){let{options:e,pointer:n,width:i,height:r,dockOrder:o,x:a,y:s}=t;const{targetBounds:l}=n,c=Fh(e.offset),u=c[e.dock];if(u)return{computedTooltipStyle:{left:"".concat(a,"px"),top:"".concat(s,"px"),transform:u},computedArrowStyle:Bh(e.offset)[e.dock],dock:e.dock};const h={width:"target"===e.area?l.width:window.innerWidth,height:"target"===e.area?l.height:window.innerHeight},d=Lh(i,r,e.offset),f=[],p="target"===e.area?a:l.left+a,g="target"===e.area?s:l.top+s;for(let t=0;t<o.length;t+=1){const n=o[t],l=$h({area:h,vx:p,vy:g,width:i,height:r,offset:d[n]}),u={left:"".concat(a,"px"),top:"".concat(s,"px"),transform:c[n]},m=Bh(e.offset)[n];0!==l.x&&(u.width="".concat(i-20-Math.abs(l.x),"px"),"top"!==n&&"bottom"!==n||(u.left="".concat(a+l.x,"px"),m.left="calc(50% ".concat(l.x>0?"-":"+"," ").concat(Math.abs(l.x),"px)")));const y={computedTooltipStyle:u,computedArrowStyle:m,dock:n,rect:{width:i,height:r}};if(0===l.x&&0===l.y)return y;y.offset=l,f.push(y)}return f.sort(((t,e)=>Math.abs(t.offset.x)-Math.abs(e.offset.x))),f[0]}function Wh(t,e,n){const i=t.key?n.component(t.key):n.componentsFromPoint({x:e.clientX,y:e.clientY})[0];if(!i)return{x:0,y:0,width:0,height:0,scaleRatio:{x:1,y:1}};const r=i.rect;return _({scaleRatio:r.scaleRatio},r.computedInner)}const Uh={bounds:function(t){let{resources:e,nodes:n,pointer:i,width:r,height:o,options:a}=t;const{targetBounds:s}=i,{x:l,y:c,width:u,height:h}=e.getNodeBoundsRelativeToTarget(n[0]),d={left:{x:l,y:c+h/2},right:{x:l+u,y:c+h/2},top:{x:l+u/2,y:c},bottom:{x:l+u/2,y:c+h}},f=Fh(a.offset),p=f[a.dock];if(p)return{computedTooltipStyle:{left:"".concat(d[a.dock].x,"px"),top:"".concat(d[a.dock].y,"px"),transform:p},computedArrowStyle:Bh(a.offset)[a.dock],dock:a.dock};const g={width:"target"===a.area?s.width:window.innerWidth,height:"target"===a.area?s.height:window.innerHeight},m=Lh(r,o,a.offset),y=["top","left","right","bottom"];for(let t=0;t<y.length;t+=1){const e=y[t];if(Hh(g,"target"===a.area?d[e].x:s.left+d[e].x,"target"===a.area?d[e].y:s.top+d[e].y,r,o,m[e]))return{computedTooltipStyle:{left:"".concat(d[e].x,"px"),top:"".concat(d[e].y,"px"),transform:f[e]},computedArrowStyle:Bh(a.offset)[e],dock:e}}return{computedTooltipStyle:{left:"".concat(d.top.x,"px"),top:"".concat(d.top.y,"px"),transform:f.top},computedArrowStyle:Bh(a.offset).top,dock:"top"}},pointer:function(t){let{options:e,pointer:n,width:i,height:r}=t;const{x:o,y:a}=n;return Vh({x:o,y:a,pointer:n,width:i,height:r,options:e,dockOrder:["top","left","right","bottom"]})},slice:function(t){let{options:e,pointer:n,width:i,height:r,nodes:o,resources:a}=t;const s=o[0],{dx:l,dy:c}=n,u=a.getComponentBoundsFromNode(s),h=l+u.x+u.width/2,d=c+u.y+u.height/2,{start:f,end:p,outerRadius:g}=s.desc.slice,m=(f+p)/2-Math.PI/2,y=2*Math.PI,v=(m%y+y)%y;let x=["top","left","right","bottom"];return"auto"===e.dock&&(x=v<=Math.PI/4||v>=7*Math.PI/4?["right","top","bottom","left"]:v<=3*Math.PI/4?["bottom","left","right","top"]:v<=5*Math.PI/4?["left","top","bottom","right"]:["top","left","right","bottom"]),Vh({x:h+g*u.scaleRatio.x*Math.cos(v),y:d+g*u.scaleRatio.y*Math.sin(v),pointer:n,width:i,height:r,options:e,dockOrder:x})}};function Yh(t,e){let{width:n,height:i}=t,{chart:r,state:o,props:a}=e;const s={resources:{formatter:r.formatter,scale:r.scale,component:r.component,getComponentBoundsFromNode:t=>Wh(t,o.pointer,r),getNodeBoundsRelativeToTarget:t=>function(t,e,n){const i=Wh(t,e,n),r=t.bounds;return{x:i.x+e.dx+r.x,y:i.y+e.dy+r.y,width:r.width,height:r.height}}(t,o.pointer,r)},nodes:o.activeNodes,pointer:o.pointer,width:n,height:i},l=typeof a.placement;if("object"===l&&"function"==typeof a.placement.fn)return a.placement.fn(s);let c={type:"pointer",offset:8,dock:"auto",area:"viewport"};"function"===l&&(c=_(c,a.placement(s))),"object"===l&&Uh[a.placement.type]?c=_(c,a.placement):"string"===l&&Uh[a.placement]&&(c=_(c,{type:a.placement})),s.options=c;const u=Uh[c.type](s);let{x:h,y:d,width:f,height:p}=s.resources.getComponentBoundsFromNode(s.nodes[0]);return h+=s.pointer.dx,f+=h,d+=s.pointer.dy,p+=d,u.computedTooltipStyle.left="".concat(Math.min(Math.max(0,h,parseFloat(u.computedTooltipStyle.left)),f),"px"),u.computedTooltipStyle.top="".concat(Math.min(Math.max(0,d,parseFloat(u.computedTooltipStyle.top)),p),"px"),u}let Xh;function Kh(){Xh=null}const Gh={require:["chart","renderer"],defaultSettings:{settings:{duration:8e3,delay:500,filter:t=>t.filter((t=>t.data&&void 0!==t.data.value)),extract:t=>t.node.data.value,content:t=>{let{h:e,data:n}=t;return n.map((t=>e("div",{},t)))},isEqual:(t,e)=>t.length&&t.length===e.length&&t.every(((t,n)=>e[n]&&JSON.stringify(t.data)===JSON.stringify(e[n].data))),placement:{type:"pointer",dock:"auto",offset:8,area:"viewport"},tooltipClass:{},contentClass:{},arrowClass:{},direction:"ltr",appendTo:void 0,beforeShow:void 0,afterShow:void 0,beforeHide:void 0,onHide:void 0,afterHide:void 0},style:{tooltip:{},content:{backgroundColor:"$gray-25",color:"$font-color--inverted",fontFamily:"$font-family",fontSize:"$font-size",lineHeight:"$line-height",borderRadius:"4px",padding:"8px",opacity:.9},arrow:{position:"absolute",width:"0px",height:"0px",borderStyle:"solid",color:"$gray-25",opacity:.9},"arrow-bottom":{borderTopColor:"transparent",borderLeftColor:"transparent",borderRightColor:"transparent"},"arrow-top":{borderBottomColor:"transparent",borderLeftColor:"transparent",borderRightColor:"transparent"},"arrow-right":{borderTopColor:"transparent",borderLeftColor:"transparent",borderBottomColor:"transparent"},"arrow-left":{borderTopColor:"transparent",borderBottomColor:"transparent",borderRightColor:"transparent"}}},renderer:"dom",on:{hide(){this.hide()},show(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.show(t,e)},prevent(t){this.prevent(t)}},hide(){this.dispatcher.clear(),this.state.activeNodes=[],this.state.pointer={}},show(t){let e,{nodes:n,duration:i,delay:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!this.state.prevent&&this.state.targetElement&&(this.state.pointer=function(t,e){let{chart:n,state:i}=e,r=0,o=0;t.center?(r+=t.center.x,o+=t.center.y):(r+=t.clientX,o+=t.clientY);const a=n.element.getBoundingClientRect(),s=i.targetElement.getBoundingClientRect(),l=r,c=o,u=a.left-s.left,h=a.top-s.top,d=r-a.left,f=o-a.top;return r-=s.left,o-=s.top,{x:r,y:o,dx:u,dy:h,cx:d,cy:f,clientX:l,clientY:c,targetBounds:s,chartBounds:a}}(t,this),e=Array.isArray(n)?this.props.filter(n):this.props.filter(this.chart.shapesAt({x:this.state.pointer.cx,y:this.state.pointer.cy})),this.props.isEqual(this.state.activeNodes,e)||(this.dispatcher.clear(),this.state.activeNodes=e,this.state.activeNodes.length&&this.dispatcher.invoke((()=>this.invokeRenderer(this.state.activeNodes)),i,r)))},prevent(t){this.state.prevent=!!t},init(t){this.state={activeNodes:[],pointer:{},targetElement:null,prevent:!1},this.props=t.settings,this.dispatcher=zh({defaultDuration:this.props.duration,defaultDelay:this.props.delay});const e=this.dispatcher.clear;this.dispatcher.on("pending",(()=>{!function(t){Xh&&Xh!==t&&Xh()}(e),Xh=e,"function"==typeof this.props.beforeShow&&this.props.beforeShow.call(void 0,{resources:{formatter:this.chart.formatter,scale:this.chart.scale}})})),this.dispatcher.on(["cancelled","fulfilled"],(()=>{const t={resources:{formatter:this.chart.formatter,scale:this.chart.scale}};"function"==typeof this.props.beforeHide&&this.props.beforeHide.call(void 0,_({element:this.state.tooltipElm},t)),"function"==typeof this.props.onHide?this.props.onHide.call(void 0,_({element:this.state.tooltipElm},t)):this.renderer.clear([]),"function"==typeof this.props.afterHide&&this.props.afterHide.call(void 0,t),Xh===e&&(Xh=null),this.state.tooltipElm=void 0})),this.dispatcher.on("active",(()=>{"function"==typeof this.props.afterShow&&this.props.afterShow.call(void 0,{element:this.state.tooltipElm,resources:{formatter:this.chart.formatter,scale:this.chart.scale}})}))},created(){this.init(this.settings)},beforeUpdate(t){let{settings:e}=t;this.dispatcher&&(this.dispatcher.destroy(),Kh()),this.init(e)},render(t){return this.h=t,[]},beforeDestroy(){this.dispatcher.destroy(),Kh()},appendTo(){if(this.props.appendTo){this.state.targetElement="function"==typeof this.props.appendTo?this.props.appendTo({resources:{formatter:this.chart.formatter,scale:this.chart.scale}}):this.props.appendTo;const{width:t,height:e}=this.state.targetElement.getBoundingClientRect();this.renderer.destroy(),this.renderer.size({width:t,height:e}),this.renderer.appendTo(this.state.targetElement)}else this.state.targetElement=this.renderer.element()},mounted(){this.appendTo()},updated(){this.appendTo()},invokeRenderer(t){const e=function(t,e){let{chart:n,scale:i,props:r,h:o}=e;const a={resources:{dataset:n.dataset,scale:n.scale,formatter:n.formatter},scale:i,h:o},s=[];return t.forEach((t=>{if("function"==typeof r.extract){const e=_({node:t},a);s.push(r.extract(e))}})),s}(t,this),n=Yh(Ph(e,{style:{left:"0px",top:"0px",visibility:"hidden"}},this).getBoundingClientRect(),this);this.state.tooltipElm=Ph(e,n,this)}};const Zh={require:["renderer","chart"],defaultSettings:{settings:{target:"",selector:"*",fill:"rgba(0, 255, 0, 0.1)",stroke:"lime",opacity:1,useOuterRect:!1}},on:{update(){this.draw()}},draw(){const t=this.chart.findShapes(this.props.selector).filter((t=>t.key===this.props.target)).filter((t=>t.collider)).map((t=>t.collider));t.forEach((t=>{t.fill=this.props.fill,t.stroke=this.props.stroke,t.opacity=this.props.opacity,t.collider={type:null}})),this.renderer.render(t)},created(){this.props=this.settings.settings},resize(t){let{outer:e,inner:n}=t;return this.props.useOuterRect?e:n},render(){},mounted(){this.draw()},updated(){this.props=this.settings.settings,this.draw()}},Jh=2*Math.PI;function Qh(t,e,n,i){return Math.abs(t.x+n.x-(e.x+e.x))+Math.abs(t.y+n.y-(e.y+e.y))+Math.abs(e.x+i.x-(n.x+n.x))+Math.abs(e.y+i.y-(n.y+n.y))}function td(t,e){return{x:.5*(t.x+e.x),y:.5*(t.y+e.y)}}function ed(t,e,n,i,r){const o=1-t;return o**3*e+3*o**2*t*n+3*o*t**2*i+t**3*r}function nd(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:8;if(o<1||Qh(t,e,n,i)<=10)return r[r.length-1]!==t&&r.push(t),r.push(i),r;const a=.5,s=td(t,e),l=td(e,n),c=td(n,i),u={x:ed(a,t.x,e.x,n.x,i.x),y:ed(a,t.y,e.y,n.y,i.y)},h=td(s,l),d=td(l,c);return nd(t,s,h,u,r,o-1),nd(u,d,c,i,r,o-1),r}function id(t,e,n){const{cp1:i,cp2:r}=function(t,e,n){return{cp1:{x:t.x+2/3*(e.x-t.x),y:t.y+2/3*(e.y-t.y)},cp2:{x:n.x+2/3*(e.x-n.x),y:n.y+2/3*(e.y-n.y)}}}(t,e,n);return nd(t,i,r,n)}function rd(t,e,n){const i=[],r=!!t[4],o=!!t[5],a=t[3];let s,l,c,u,h=t[6],d=t[7],f=t[1],p=t[2];if("a"===t[0]&&(h+=e,d+=n),e===d&&n===d)return i;if(!f||!p)return i.push({x:h,y:d}),i;({cx:s,cy:l,rx:f,ry:p,sweepAngle:c,startAngle:u}=function(t,e,n,i,r,o,a,s,l){let c,u,h,d,f,p;const g=qa(n%360),m=Math.cos(g),y=Math.sin(g),v=(s-o)/2,x=(l-a)/2,b=m*v+y*x,w=m*x-y*v;p=b**2/(t=Math.abs(t))**2+w**2/(e=Math.abs(e))**2,p>1&&(p=Math.sqrt(p),t*=p,e*=p);const k=t*w,_=e*b,M=k**2+_**2,S=(t*e)**2-M;let C=Math.sqrt(Math.max(S/M,0));i===r&&(C=-C);const N=C*(k/e),R=C*(-_/t);d=m*N-y*R+(s+o)/2,f=y*N+m*R+(l+a)/2;const q=(b-N)/t,A=(w-R)/e,D=(-b-N)/t,E=(-w-R)/e;return c=Math.atan2(A,q),c+=c<0?Jh:0,u=Math.atan2(E,D),u+=u<0?Jh:0,h=u-c,!r&&c<u?h-=Jh:r&&u<c&&(h+=Jh),h%=Jh,{startAngle:c,sweepAngle:h,cx:d,cy:f,rx:t,ry:e}}(f,p,a,r,o,h,d,e,n));const g=Math.abs(c*Math.sqrt((f**2+p**2)/2)),m=Math.ceil(g/10),y=c/m;for(let t=1;t<=m;t++){const e=(u+y*t)%Jh,n=Math.cos(e),r=Math.sin(e);i.push({x:s+n*f+-r*n,y:l+r*p+n*r})}return i}function od(t){const e=p.parsePath(t),n=[],i=[];let r=0,o=0,a=null,s=null,l=null,c=null;for(let t=0;t<e.length;++t){const u=e[t],h=u[0];switch("S"!==h&&"s"!==h&&"C"!==h&&"c"!==h&&(a=null,s=null),"T"!==h&&"t"!==h&&"Q"!==h&&"q"!==h&&(l=null,c=null),h){case"m":i.length&&n.push(i.splice(0));case"l":r+=u[1],o+=u[2],i.push({x:r,y:o});break;case"M":i.length&&n.push(i.splice(0));case"L":r=u[1],o=u[2],i.push({x:r,y:o});break;case"H":r=u[1],i.push({x:r,y:o});break;case"h":r+=u[1],i.push({x:r,y:o});break;case"V":o=u[1],i.push({x:r,y:o});break;case"v":o+=u[1],i.push({x:r,y:o});break;case"a":i.push(...rd(u,r,o)),r+=u[6],o+=u[7];break;case"A":i.push(...rd(u,r,o)),r=u[6],o=u[7];break;case"c":i.push(...nd({x:r,y:o},{x:u[1]+r,y:u[2]+o},{x:u[3]+r,y:u[4]+o},{x:u[5]+r,y:u[6]+o})),a=u[3]+r,s=u[4]+o,r+=u[5],o+=u[6];break;case"C":i.push(...nd({x:r,y:o},{x:u[1],y:u[2]},{x:u[3],y:u[4]},{x:u[5],y:u[6]})),a=u[3],s=u[4],r=u[5],o=u[6];break;case"s":null!==a&&null!==a||(a=r,s=o),i.push(...nd({x:r,y:o},{x:2*r-a,y:2*o-s},{x:u[1]+r,y:u[2]+o},{x:u[3]+r,y:u[4]+o})),a=u[1]+r,s=u[2]+o,r+=u[3],o+=u[4];break;case"S":null!==a&&null!==a||(a=r,s=o),i.push(...nd({x:r,y:o},{x:2*r-a,y:2*o-s},{x:u[1],y:u[2]},{x:u[3],y:u[4]})),a=u[1],s=u[2],r=u[3],o=u[4];break;case"Q":i.push(...id({x:r,y:o},{x:u[1],y:u[2]},{x:u[3],y:u[4]})),l=u[1],c=u[2],r=u[3],o=u[4];break;case"q":i.push(...id({x:r,y:o},{x:u[1]+r,y:u[2]+o},{x:u[3]+r,y:u[4]+o})),l=u[1]+r,c=u[2]+o,r+=u[3],o+=u[4];break;case"T":null!==l&&null!==l||(l=r,c=o),l=2*r-l,c=2*o-c,i.push(...id({x:r,y:o},{x:l,y:c},{x:u[1],y:u[2]})),r=u[1],o=u[2];break;case"t":null!==l&&null!==l||(l=r,c=o),l=2*r-l,c=2*o-c,i.push(...id({x:r,y:o},{x:l,y:c},{x:u[1]+r,y:u[2]+o})),r+=u[1],o+=u[2];break;case"z":case"Z":i.length&&i.push({x:i[0].x,y:i[0].y})}}return function(t){for(let e=0;e<t.length-1;e++){const n=t[e],i=t[e+1];Math.abs(n.x-i.x)<1e-12&&Math.abs(n.y-i.y)<1e-12&&(t.splice(e,1),e--)}}(i),n.push(i.splice(0)),n}const ad={require:["renderer","chart"],defaultSettings:{settings:{target:"",fill:"transparent",stroke:"lime",opacity:1,radius:2,useOuterRect:!1}},on:{update(){this.draw()}},draw(){const t=this.chart.findShapes("path").filter((t=>t.key===this.props.target)),e=[];t.forEach((t=>{od(t.attrs.d).forEach((t=>{t.forEach((t=>{e.push({type:"circle",cx:t.x,cy:t.y,r:this.props.radius,fill:this.props.fill,stroke:this.props.stroke,opacity:this.props.opacity,collider:{type:null}})}))}))})),this.renderer.render(e)},created(){this.props=this.settings.settings},resize(t){let{outer:e,inner:n}=t;return this.props.useOuterRect?e:n},render(){},mounted(){this.draw()},updated(){this.props=this.settings.settings,this.draw()}};var sd=[function(t){t.component("box",vl),t.component("box-marker",vl)},function(t){t.component("point",Sl),t.component("point-marker",Sl)},function(t){t.component("pie",ql)},function(t){t.component("grid-line",Il)},function(t){t.component("ref-line",Bl)},function(t){t.component("axis",cc)},function(t){t.component("container",uc)},function(t){t.component("text",fc)},function(t){t.component("scrollbar",mc)},function(t){t.component("brush-range",Dc),t.component("brush-area-dir",Tc)},function(t){t.component("range",Fc)},function(t){t.component("brush-lasso",Wc)},function(t){t.component("labels",ch)},function(t){t.component("legend-cat",kh)},function(t){t.component("legend-seq",Rh)},function(t){t.component("line",Eh)},function(t){t.component("brush-area",jh)},function(t){t.component("tooltip",Gh)},function(t){t.component("debug-collider",Zh)},function(t){t.component("debug-path-to-points",ad)}];class ld{constructor(t){this._parent=null,this._children=[],this._ancestors=null,this.type=t,this.data=null}detach(){return this._parent&&this._parent.removeChild(this),this}get parent(){return this._parent}get isBranch(){return this._children&&this._children.length}get children(){return this._children}get ancestors(){return this._ancestors||(this._ancestors=[],this.parent&&this._ancestors.push(this.parent,...this.parent.ancestors)),this._ancestors}get descendants(){let t=[];const e=this.children.length;let n,i;for(n=0;n<e;n++)i=this.children[n],t.push(i),i.children.length&&(t=[...t,...i.descendants]);return t}equals(t){const e=this.children,n=t.children;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(!e[t].equals(n[t]))return!1;return!0}toJSON(){return{type:this.type,children:this.children.map((t=>t.toJSON()))}}}class cd{constructor(){let{x:t=0,y:e=0,width:n=0,height:i=0,minWidth:r=0,minHeight:o=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({x:t,y:e,width:n,height:i,minWidth:r,minHeight:o})}set(){let{x:t=0,y:e=0,width:n=0,height:i=0,minWidth:r=0,minHeight:o=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="rect",n>=0?(this.x=t,this.width=Math.max(n,r)):(this.x=t+Math.min(n,-r),this.width=-Math.min(n,-r)),i>=0?(this.y=e,this.height=Math.max(i,o)):(this.y=e+Math.min(i,-o),this.height=-Math.min(i,-o))}containsPoint(t){return gs(this,t)}intersectsLine(t){return ms(this,T(t))}intersectsRect(t){return fs(this,I(t))}intersectsCircle(t){return ss(t,this)}intersectsPolygon(t){return ds(t,this)}intersectsGeoPolygon(t){return Ms(t,this)}points(){return[{x:this.x,y:this.y},{x:this.x+this.width,y:this.y},{x:this.x+this.width,y:this.y+this.height},{x:this.x,y:this.y+this.height}]}}class ud{constructor(){let{cx:t=0,cy:e=0,r:n=0,minRadius:i=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({cx:t,cy:e,r:n,minRadius:i})}set(){let{cx:t=0,cy:e=0,r:n=0,minRadius:i=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="circle",this.cx=t,this.cy=e,this.r=Math.max(n,i),this.vector={x:this.cx,y:this.cy}}containsPoint(t){return as(this,t)}intersectsLine(t){return ls(this,T(t))}intersectsRect(t){return ss(this,I(t))}intersectsCircle(t){return n=t,!ns(e=this)&&!ns(n)&&(e.cx-n.cx)**2+(e.cy-n.cy)**2<=(e.r+n.r)**2;var e,n}intersectsPolygon(t){return cs(this,t)}intersectsGeoPolygon(t){return ws(this,t)}points(){return[{x:this.cx,y:this.cy}]}}class hd{constructor(){let{x1:t=0,y1:e=0,x2:n=0,y2:i=0,tolerance:r=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({x1:t,y1:e,x2:n,y2:i,tolerance:r})}set(){let{x1:t=0,y1:e=0,x2:n=0,y2:i=0,tolerance:r=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="line",this.x1=t,this.y1=e,this.x2=n,this.y2=i,this.tolerance=Math.max(0,Math.round(r)),this.vectors=this.points(),this.zeroSize=t===n&&e===i}containsPoint(t){if(this.tolerance>0){return ls({cx:t.x,cy:t.y,r:this.tolerance},this)}return vs(this,t)}intersectsLine(t){return ys(this,T(t))}intersectsRect(t){return ms(I(t),this)}intersectsCircle(t){return ls(t,this)}intersectsPolygon(t){return hs(t,this)}intersectsGeoPolygon(t){return _s(t,this)}points(){return[{x:this.x1,y:this.y1},{x:this.x2,y:this.y2}]}}class dd{constructor(){let{vertices:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({vertices:t})}set(){let{vertices:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.type="polygon",this.vertices=t.slice(),this.edges=[],function(t){for(let e=0;e<t.length-1;e++){const n=t[e],i=t[e+1];n.x===i.x&&n.y===i.y&&(t.splice(e,1),e--)}}(this.vertices),!(this.vertices.length<=2)){!function(t){const e=t[0],n=t[t.length-1];e.x===n.x&&e.y===n.y||t.push(e)}(this.vertices),this.xMin=NaN,this.yMin=NaN,this.xMax=NaN,this.yMax=NaN;for(let t=0;t<this.vertices.length;t++)t<this.vertices.length-1&&this.edges.push([this.vertices[t],this.vertices[t+1]]),this.xMin=isNaN(this.xMin)?this.vertices[t].x:Math.min(this.xMin,this.vertices[t].x),this.xMax=isNaN(this.xMax)?this.vertices[t].x:Math.max(this.xMax,this.vertices[t].x),this.yMin=isNaN(this.yMin)?this.vertices[t].y:Math.min(this.yMin,this.vertices[t].y),this.yMax=isNaN(this.yMax)?this.vertices[t].y:Math.max(this.yMax,this.vertices[t].y);this._bounds=null,this._boundingRect=null}}containsPoint(t){return us(this,t)}intersectsCircle(t){return cs(t,this)}intersectsLine(t){return hs(this,T(t))}intersectsRect(t){return ds(this,I(t))}intersectsPolygon(t){return xs(this,t)}intersectsGeoPolygon(t){return bs(t,this)}points(){return this.vertices}bounds(){return this._bounds||(this._bounds=[{x:this.xMin,y:this.yMin},{x:this.xMax,y:this.yMin},{x:this.xMax,y:this.yMax},{x:this.xMin,y:this.yMax}]),this._bounds}boundingRect(){return this._boundingRect||(this._boundingRect={x:this.xMin,y:this.yMin,width:this.xMax-this.xMin,height:this.yMax-this.yMin}),this._boundingRect}}function fd(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new dd(...e)}function pd(t){const e=t[0],n=t[t.length-1];e.x===n.x&&e.y===n.y||t.push(e)}function gd(t){for(let e=0;e<t.length-1;e++){const n=t[e],i=t[e+1];n.x===i.x&&n.y===i.y&&(t.splice(e,1),e--)}}class md{constructor(){let{vertices:t=[[]]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({vertices:t})}set(){let{vertices:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="geopolygon",this.vertices=t.slice(),this.numPolygons=this.vertices.length,this.polygons=[],this.xMin=NaN,this.yMin=NaN,this.xMax=NaN,this.yMax=NaN;for(let t=0;t<this.numPolygons;t++)gd(this.vertices[t]),this.vertices[t].length>2&&pd(this.vertices[t]),this.polygons[t]=fd({vertices:this.vertices[t]}),this.xMin=isNaN(this.xMin)?this.polygons[t].xMin:Math.min(this.xMin,this.polygons[t].xMin),this.xMax=isNaN(this.xMax)?this.polygons[t].xMax:Math.max(this.xMax,this.polygons[t].xMax),this.yMin=isNaN(this.yMin)?this.polygons[t].yMin:Math.min(this.yMin,this.polygons[t].yMin),this.yMax=isNaN(this.yMax)?this.polygons[t].yMax:Math.max(this.yMax,this.polygons[t].yMax);this._bounds=null,this._boundingRect=null}containsPoint(t){return ks(this,t)}intersectsCircle(t){return ws(t,this)}intersectsLine(t){return _s(this,T(t))}intersectsRect(t){return Ms(this,I(t))}intersectsPolygon(t){return bs(this,t)}intersectsGeoPolygon(t){return function(t,e){const n=t.boundingRect(),i=e.boundingRect();return!!fs(n,i)&&(ps(i,n)?os(e,t):os(t,e))}(this,t)}points(){return this.vertices}bounds(){return this._bounds||(this._bounds=[{x:this.xMin,y:this.yMin},{x:this.xMax,y:this.yMin},{x:this.xMax,y:this.yMax},{x:this.xMin,y:this.yMax}]),this._bounds}boundingRect(){return this._boundingRect||(this._boundingRect={x:this.xMin,y:this.yMin,width:this.xMax-this.xMin,height:this.yMax-this.yMin}),this._boundingRect}}function yd(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new md(...e)}class vd{constructor(){let{points:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({points:t})}set(){let{points:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.type="polyline",this.segments=[],this._points=t.slice(),this._points.length>1)for(let t=0,i=this._points.length-1;t<i;t++)e=this._points[t],n=this._points[t+1],(e.x!==n.x||e.y!==n.y)&&this.segments.push({x1:this._points[t].x,y1:this._points[t].y,x2:this._points[t+1].x,y2:this._points[t+1].y});var e,n}containsPoint(t){return this.segments.some((e=>vs(e,t)))}intersectsCircle(t){return this.segments.some((e=>ls(t,e)))}intersectsLine(t){const e=T(t);return this.segments.some((t=>ys(t,e)))}intersectsRect(t){const e=I(t);return this.segments.some((t=>ms(e,t)))}intersectsPolygon(t){return this.segments.some((e=>hs(t,e)))}intersectsGeoPolygon(t){return this.segments.some((e=>_s(t,e)))}points(){return this._points}}const xd=$t();function bd(t,e){return xd.get(t)(e)}xd.add("rect",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new cd(...e)})),xd.add("circle",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new ud(...e)})),xd.add("line",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new hd(...e)})),xd.add("polygon",fd),xd.add("geopolygon",yd),xd.add("polyline",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new vd(...e)}));class wd{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.set(t)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.geometries=[],t.forEach((t=>{const e=bd(t.type,t);e&&this.geometries.push(e)}))}containsPoint(t){return this.geometries.some((e=>e.containsPoint(t)))}intersectsLine(t){return this.geometries.some((e=>e.intersectsLine(t)))}intersectsRect(t){return this.geometries.some((e=>e.intersectsRect(t)))}intersectsCircle(t){return this.geometries.some((e=>e.intersectsCircle(t)))}intersectsPolygon(t){return this.geometries.some((e=>e.intersectsPolygon(t)))}intersectsGeoPolygon(t){return this.geometries.some((e=>e.intersectsGeoPolygon(t)))}}class kd{constructor(){this._elements=[[1,0,0],[0,1,0],[0,0,1]],this._stack=[]}clone(){return(new kd).multiply(this)}set(t){return this._elements=t,this}save(){return this._stack.push(this.elements),this}restore(){return this._stack.length&&(this._elements=this._stack.pop()),this}add(t){let e,n;for(e=0;e<this._elements.length;e++)for(n=0;n<this._elements[e].length;n++)this._elements[e][n]+=t;return this}translate(t,e){return this.multiply([[1,0,t],[0,1,e],[0,0,1]]),this}rotate(t){let e=Math.cos(-t),n=Math.sin(-t);return this.multiply([[e,n,0],[-n,e,0],[0,0,1]]),this}multiply(t){let e,n,i,r;if(t instanceof kd&&(t=t._elements),Array.isArray(t)){for(i=[[0,0,0],[0,0,0],[0,0,0]],e=0;e<this._elements.length;e++)for(n=0;n<this._elements[e].length;n++)for(r=0;r<3;r++)i[e][n]+=this._elements[e][r]*t[r][n];this._elements=i}else for(e=0;e<this._elements.length;e++)for(n=0;n<this._elements[e].length;n++)this._elements[e][n]*=t;return this}scale(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return this.multiply([[t,0,0],[0,e,0],[0,0,1]]),this}transform(t,e,n,i,r,o){return this.multiply([[t,n,r],[e,i,o],[0,0,1]]),this}determinant(){let t=this._elements[0][0],e=this._elements[0][1],n=this._elements[0][2],i=this._elements[1][0],r=this._elements[1][1],o=this._elements[1][2],a=this._elements[2][0],s=this._elements[2][1],l=this._elements[2][2],c=0;return c=t*r*l+e*o*a+n*i*s-n*r*a-e*i*l-t*o*s,c}invert(){let t=this.determinant(),e=this._elements[0][0],n=this._elements[0][1],i=this._elements[0][2],r=this._elements[1][0],o=this._elements[1][1],a=this._elements[1][2],s=this._elements[2][0],l=this._elements[2][1],c=this._elements[2][2];return this._elements=[[o*c-a*l,i*l-n*c,n*a-i*o],[a*s-r*c,e*c-i*s,i*r-e*a],[r*l-o*s,s*n-e*l,e*o-n*r]],this.multiply(1/t),this}transpose(){const t=Object.create(this._elements);return this._elements=[[t[0][0],t[1][0],t[2][0]],[t[0][1],t[1][1],t[2][1]],[t[0][2],t[1][2],t[2][2]]],this}identity(){return this._elements=[[1,0,0],[0,1,0],[0,0,1]],this}toString(){return"".concat(this._elements.map((t=>t.join("\t"))).join("\n"))}isIdentity(){const t=this._elements;return 1===t[0][0]&&0===t[0][1]&&0===t[0][2]&&0===t[1][0]&&1===t[1][1]&&0===t[1][2]&&0===t[2][0]&&0===t[2][1]&&1===t[2][2]}transformPoint(t){let e,n,i=[t.x,t.y,1],r=this._elements,o=[0,0,0];for(e=0;e<this._elements.length;e++)for(n=0;n<this._elements[e].length;n++)o[e]+=i[n]*r[e][n];return{x:o[0],y:o[1]}}transformPoints(t){let e,n,i,r,o,a=this._elements,s=[];for(r=0;r<t.length;r++){for(e=[t[r].x,t[r].y,1],o=[0,0,0],n=0;n<this._elements.length;n++)for(i=0;i<this._elements[n].length;i++)o[n]+=e[i]*a[n][i];s.push({x:o[0],y:o[1]})}return s}get elements(){const t=this._elements;return[[t[0][0],t[0][1],t[0][2]],[t[1][0],t[1][1],t[1][2]],[t[2][0],t[2][1],t[2][2]]]}}const _d=/(translate|scale|rotate|matrix)\(([0-9,.eE+-\s]+)(?:,|\s?)+\)/g;function Md(t,e){const n=e.args[0]*(Math.PI/180);if(e.args.length>2){const i=e.args[1],r=e.args[2];t.translate(i,r),t.rotate(n),t.translate(-i,-r)}else 1===e.args.length&&t.rotate(n)}function Sd(t,e){const n=e.args[0],i=isNaN(e.args[1])?e.args[0]:e.args[1];t.scale(n,i)}function Cd(t,e){const n=e.args[0],i=isNaN(e.args[1])?0:e.args[1];t.translate(n,i)}function Nd(t,e){e.args.length>=6&&t.transform(...e.args)}function Rd(t,e){const n=function(t){let e,n=[];for(;null!==(e=_d.exec(t));){const t=e[2].trim(),i=-1===t.indexOf(",")?t.split(" "):t.split(",");n.push({cmd:e[1],args:i.filter((t=>t.trim().length>0)).map((t=>Number(t)))})}return n}(t);let i;for(let t=0,r=n.length;t<r;t++)i=n[t],"rotate"===i.cmd?Md(e,i):"scale"===i.cmd?Sd(e,i):"matrix"===i.cmd?Nd(e,i):"translate"===i.cmd&&Cd(e,i)}const qd={type:/^\w[\w-]+/,attr:/^\[\w(?:[\w\._-]+)?(?:[!]?=['\"][\w\s*#_-]*['\"])?\]/,universal:/^(\*)/,tag:/^\.(\w+)/},Ad={type:(t,e)=>e.filter((e=>{const n=e.type;return!!n&&n.toLowerCase()===t.toLowerCase()})),attr:(t,e,n,i)=>i.filter((i=>{const r=i.attrs[t];if(!e)return void 0!==r;if(void 0===r)return!1;switch(e){case"=":return n===String(r);case"!=":return n!==String(r);default:return!1}})),universal:t=>t,tag:(t,e)=>e.filter((e=>{const n=e.tag;return!!n&&-1!==n.trim().split(/\s+/).indexOf(t.replace(".",""))}))};function Dd(t,e){if(!e||!e.length||!t||"function"!=typeof Ad[t.type])return[];switch(t.type){case"type":return Ad[t.type](t.value,e);case"attr":return Ad[t.type](t.attribute,t.operator,t.attributeValue,e);case"universal":return Ad[t.type](e);case"tag":return Ad[t.type](t.value,e);default:return[]}}var Ed={find:function(t,e){const n=[],i=[];let r,o;if(e.isBranch){let a;r=function(t){const e=[];let n,i,r,o;return t.split(/\s*,\s*/).forEach((t=>{t=t.trim(),n=[];const a=e=>{r=t.match(qd[e]),r&&(o=!0,t=t.slice(r[0].length),i={type:e,value:r[0]},"attr"===e&&(r=r[0].match(/\[(\w[\w\._-]+)?(?:([!]?=)['\"]([\w\s#_-]*)['\"])?\]/),i.attribute=r[1],i.operator=r[2],i.attributeValue=r[3]),n.push(i))};for(;t&&(o=!1,r=t.match(/^\s*([>+~]|\s)\s*/),r&&(o=!0,n.push({type:" ",value:r[0]}),t=t.slice(r[0].length)),Object.keys(qd).forEach(a),n&&n.length&&e.indexOf(n)<0&&e.push(n),o););})),e}(t),o=e.descendants;for(let t=0,e=r.length;t<e;t++){a=r[t];const e=[];let n=o.slice(),s=!1;a.reverse().forEach((t=>{if(" "===t.type)return e.push(n),n=o.slice(),void(s=!1);n=Dd(t,n),s=!0})),s&&e.push(n);const l=e[0].filter((t=>{let n,i=t.parent;for(let t=1;t<e.length;t++){for(n=e[t].indexOf(i);i&&n<0;)i=i.parent,n=e[t].indexOf(i);if(n<0)return!1}return!0}));i.push(l)}for(let t=0,e=i.length;t<e;t++)for(let e=0,r=i[t].length;e<r;e++)n.indexOf(i[t][e])<0&&n.push(i[t][e])}return n||[]}};function Od(t,e,n){const i=t.type;let r=t.points();n&&(r=r.every((t=>Array.isArray(t)))?r.map((t=>n.transformPoints(t))):n.transformPoints(r)),function(t,e){for(let n=0,i=t.length;n<i;n++)t[n].x/=e,t[n].y/=e}(r,e);let o=null;if("rect"===i||"bounds"===i)o=I(r),o.type=i;else if("circle"===i)o=function(t,e){return{cx:t[0].x,cy:t[0].y,r:e}}(r,t.r),o.type=i;else if("line"===i)o=T(r),o.type=i;else if("polygon"===i||"polyline"===i){o={type:"path",d:Na(r,"polygon"===i)}}else if("geopolygon"===i){let t="";for(let e=0;e<r.length;e++)t+=Na(r[e],!0);o={type:"path",d:t}}return o}class Id{constructor(t){this._bounds=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{x:n,y:i,width:r,height:o}=t.boundingRect?t.boundingRect(e):{x:0,y:0,width:0,height:0};return{x:n,y:i,width:r,height:o}},this._attrs=t.attrs,this._type=t.type,this._data=t.data,this._dpi=t.stage?t.stage.dpi:1,this._collider=()=>function(t,e){if(t.collider){const n=t.modelViewMatrix;return"collection"===t.colliderType?{type:"container",children:t.collider.geometries.map((t=>Od(t,e,n)))}:Od(t.collider,e,n)}return null}(t,this._dpi),this._desc=t.desc,this._tag=t.tag,this._children=()=>t.children.map((t=>new Id(t))),this._parent=()=>t.parent?new Id(t.parent):null,this._cache={elementBoundingRect:null},this._getElementBoundingRect=()=>(!this._cache.elementBoundingRect&&this.element&&(this._cache.elementBoundingRect=this.element.getBoundingClientRect()),this._cache.elementBoundingRect||{left:0,top:0})}get children(){return this._children()}get parent(){return this._parent()}get type(){return this._type}get data(){return this._data}get attrs(){return this._attrs}set element(t){this._cache.elementBoundingRect=null,this._element=t}get element(){return this._element}set key(t){this._key=t}get key(){return this._key}get bounds(){const t=this._bounds();return t.x/=this._dpi,t.y/=this._dpi,t.width/=this._dpi,t.height/=this._dpi,t}get localBounds(){return this._bounds(!1)}boundsRelativeTo(t){const e=typeof t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?this.bounds:this.localBounds,i=this._getElementBoundingRect();let r=i.left,o=i.top;if("object"===e&&null!==t&&"function"==typeof t.getBoundingClientRect){const{left:e=0,top:n=0}=t.getBoundingClientRect();r-=e,o-=n}return n.x+=r,n.y+=o,n}get collider(){return this._collider()}get desc(){return this._desc}get tag(){return this._tag}}function Td(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Id(...e)}class jd{constructor(t){this._node=Td(t),this._parent=null,this._input=null}get node(){return this._node}set parent(t){this._parent=t}get parent(){return this._parent}set input(t){this._input=t}get input(){return this._input}}function Pd(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new jd(...e)}function zd(t,e){const n=t.parent;if(n&&"stage"!==n.type){e.parent=Pd(n);const t=n.parent;t&&"stage"!==t.type&&zd(t,e.parent)}}function Fd(t,e,n){if(null===t.colliderType)return null;const i=function(t,e){let n={};if(t.modelViewMatrix)if(Array.isArray(e))n=t.inverseModelViewMatrix.transformPoints(e);else if(isNaN(e.r))Array.isArray(e.vertices)?n.vertices=t.inverseModelViewMatrix.transformPoints(e.vertices):n=t.inverseModelViewMatrix.transformPoint(e);else{const i={x:e.cx,y:e.cy};({x:n.cx,y:n.cy}=t.inverseModelViewMatrix.transformPoint(i)),n.r=e.r}else n=e;return Array.isArray(n.vertices)&&(n=n.vertices.every((t=>Array.isArray(t)))?yd(n):fd(n)),n}(t,n);return"frontChild"===t.colliderType?function(t,e,n){for(let i=t.descendants.length-1;i>=0;i--){const r=t.descendants[i];if(null!==r.collider&&r.collider[e](n)){const t=Pd(r);return zd(r,t),t}}return null}(t,e,i):function(t,e,n){if(t.collider[e](n)){const e=Pd(t);return zd(t,e),e}return null}(t,e,i)}function Ld(t,e,n,i){const r=t.length;for(let o=0;o<r;o++){const r=t[o],a=Fd(r,e,i);a&&n.push(a),!r.children||a||r.collider||Ld(r.children,e,n,i)}}function Bd(t,e,n){const i=t.length;for(let r=0;r<i;r++){const i=t[r];if(null!==Fd(i,e,n))return!0;if(i.children&&!i.collider)return Bd(i.children,e,n)}return!1}function Hd(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=j(t);let i={};switch(n){case"circle":return i.cx=t.cx*e,i.cy=t.cy*e,i.r=t.r,["intersectsCircle",i];case"rect":return i=O(t).map((t=>Oa(t,e))),["intersectsRect",i];case"line":return i=E(t).map((t=>Oa(t,e))),["intersectsLine",i];case"point":return i=Oa(t,e),["containsPoint",i];case"polygon":return i.vertices=t.vertices.map((t=>Oa(t,e))),["intersectsPolygon",i];case"geopolygon":return i.vertices=t.vertices.map((t=>t.map((t=>Oa(t,e))))),["intersectsGeoPolygon",i];default:return[]}}function $d(t,e){const[n,i]=Hd(e,t.dpi),r=[];return n&&(Ld([t],n,r,i),function(t,e){for(let n=0,i=e.length;n<i;n++)e[n].input=t}(e,r)),r}function Vd(t,e){const[n,i]=Hd(e,t.dpi);return Bd([t],n,i)}class Wd extends ld{constructor(t){super(t),this._stage=null,this._collider={type:null,definition:null,fn:null},this._attrs={},this._node=null}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.node=t;const{data:e,desc:n,tag:i,strokeReference:r,fillReference:o}=t;var a,s;a=this.attrs,s=t,Object.keys(Ca).forEach((t=>{const e=s[t];void 0!==e&&(a[Ca[t]]=e)})),void 0!==e&&(this.data=e),"object"==typeof n&&(this.desc=_(!0,{},n)),"string"==typeof i&&(this.tag=i),"string"==typeof r&&(this.strokeReference=r),"string"==typeof o&&(this.fillReference=o)}findShapes(t){return Ed.find(t,this).map((t=>Td(t)))}getItemsFrom(t){return $d(this,t)}containsPoint(t){return Vd(this,t)}intersectsLine(t){return Vd(this,t)}intersectsRect(t){return Vd(this,t)}intersectsCircle(t){return Vd(this,t)}intersectsPolygon(t){return Vd(this,t)}intersectsGeoPolygon(t){return Vd(this,t)}resolveLocalTransform(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new kd;void 0!==this.attrs.transform&&Rd(this.attrs.transform,t),this.modelViewMatrix=t.clone()}resolveGlobalTransform(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new kd;const e=this.ancestors;if(e.length>0)for(let n=e.length-1;n>=0;n--)e[n].resolveLocalTransform(t),t=e[n].modelViewMatrix;this.resolveLocalTransform(t)}attr(t){return this.attrs[t]}equals(t){const e=this.attrs,n=Object.keys(e),i=t.attrs,r=Object.keys(i);if(n.length!==r.length)return!1;for(let t=0;t<n.length;t++){const r=n[t];if(!Object.hasOwnProperty.call(i,r))return!1;if(e[r]!==i[r])return!1}return super.equals(t)}toJSON(){const t=super.toJSON();return t.attrs=this.attrs,t}get attrs(){return this._attrs}get stage(){return this._parent&&!this._stage?this._stage=this._parent.stage:this._parent||this._stage===this||(this._stage=null),this._stage}set modelViewMatrix(t){this._mvm=t,this._imvm=null}get modelViewMatrix(){return this._mvm}get inverseModelViewMatrix(){return this._imvm=this._imvm?this._imvm:this._mvm.clone().invert(),this._imvm}set node(t){this._node=t}get node(){return this._node}set collider(t){const e=Array.isArray(t)?"collection":t&&t.type;return"string"!=typeof e?(this._collider.type=null,this._collider.definition=null,void(this._collider.fn=null)):null!==this._collider&&this._collider.type===e&&null!==this._collider.fn?(this._collider.fn.set(t),void(this._collider.definition=t)):(this._collider.type=e,void(this._collider.definition=t))}get collider(){if(null!==this._collider.fn)return this._collider.fn;switch(this._collider.type){case"collection":this._collider.fn=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new wd(...e)}(this._collider.definition);break;case"frontChild":return!0;case"bounds":this._collider.fn=bd("rect",this.boundingRect());break;case"line":case"rect":case"circle":case"polygon":case"geopolygon":case"polyline":this._collider.fn=bd(this._collider.type,this._collider.definition);break;default:return null}return this._collider.fn}get colliderType(){return this._collider.type}}class Ud extends ld{addChild(t){if(!(t&&t instanceof ld))throw new TypeError("Expecting a Node as argument, but got ".concat(t));if(t===this)throw new Error("Can not add itself as child!");if(t._children&&t._children.length&&this.ancestors.indexOf(t)>=0)throw new Error("Can not add an ancestor as child!");return t._parent&&t._parent!==this&&t._parent.removeChild(t),this._children.push(t),t._parent=this,t._ancestors=null,this}addChildren(t){let e,n=t?t.length:0;for(e=0;e<n;e++)this.addChild(t[e]);return this}removeChild(t){const e=this._children.indexOf(t);return e>=0&&(this._children.splice(e,1),t._parent=null,t._ancestors=null),this}removeChildren(t){let e,n;if(!this._children)return this;if(t)for(n=t.length,e=0;e<n;e++)this.removeChild(t[e]);else for(;this._children.length;)this.removeChild(this._children[0]);return this}}const Yd=Ud.prototype;class Xd extends Wd{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:e="container"}=t;super(e),this.set(t)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super.set(t);const{collider:e}=t,n=_({type:null},e);this.collider=n,this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}appendChildRect(t,e){if(void 0!==t.bounds){const n=this.__boundingRect[e]||{},[i,,r]=t.bounds(e),{x:o,y:a}=i,{x:s,y:l}=r,c=isNaN(n.width)?s:Math.max(s,n.width+n.x),u=isNaN(n.height)?l:Math.max(l,n.height+n.y);n.x=isNaN(n.x)?o:Math.min(o,n.x),n.y=isNaN(n.y)?a:Math.min(a,n.y),n.width=c-n.x,n.height=u-n.y,this.__boundingRect[e]=n}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];const e=this.children.length;for(let n=0;n<e;n++)this.appendChildRect(this.children[n],t);return this.__boundingRect[t]=_({x:0,y:0,width:0,height:0},this.__boundingRect[t]),this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}addChild(t){const e=Yd.addChild.call(this,t);if(this._collider&&"bounds"===this._collider.type){this.appendChildRect(t,!0);const e=_({type:"bounds",x:0,y:0,width:0,height:0},this.__boundingRect.true);this.collider=e}return e}addChildren(t){const e=Yd.addChildren.call(this,t),n=t.length;if(this._collider&&"bounds"===this._collider.type&&n>0){for(let e=0;e<n;e++)this.appendChildRect(t[e],!0);const e=_({type:"bounds",x:0,y:0,width:0,height:0},this.__boundingRect.true);this.collider=e}return e}removeChild(t){t._stage=null;let e,n=t.descendants,i=n?n.length:0;for(e=0;e<i;e++)n[e]._stage=null;if(Yd.removeChild.call(this,t),this._collider&&"bounds"===this._collider.type){this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null};const t=_(this.boundingRect(!0),{type:"bounds"});this.collider=t}return this}removeChildren(t){if(Yd.removeChildren.call(this,t),this._collider&&"bounds"===this._collider.type){this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null};const t=_(this.boundingRect(!0),{type:"bounds"});this.collider=t}return this}}function Kd(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Xd(...e)}class Gd extends Xd{constructor(t){super("stage"),this._stage=this,this._dpiRatio=t||1}get dpi(){return this._dpiRatio}}const Zd=Ud.prototype,Jd=["x1","x2","y1","y2","id","offset","style"];class Qd extends Wd{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:e="container"}=t;super(e),this.set(t),this._boundingRect={}}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super.set(t);const e=this.attrs;let n="";for(let i=0,r=Jd.length;i!==r;i++)n=Jd[i],void 0!==t[n]&&(e[n]=t[n])}addChild(t){return Zd.addChild.call(this,t)}addChildren(t){return Zd.addChildren.call(this,t)}removeChild(t){t._stage=null;let e,n=t.descendants,i=n?n.length:0;for(e=0;e<i;e++)n[e]._stage=null;return Zd.removeChild.call(this,t),this}removeChildren(t){return Zd.removeChildren.call(this,t),this}}function tf(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Qd(...e)}const ef=Ud.prototype,nf=["patternUnits","x","y","width","height","id"];class rf extends Wd{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:e="container"}=t;super(e),this.set(t),this._boundingRect={}}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super.set(t);const e=this.attrs;let n="";for(let i=0,r=nf.length;i!==r;i++)n=nf[i],void 0!==t[n]&&(e[n]=t[n])}addChild(t){return ef.addChild.call(this,t)}addChildren(t){return ef.addChildren.call(this,t)}removeChild(t){t._stage=null;let e,n=t.descendants,i=n?n.length:0;for(e=0;e<i;e++)n[e]._stage=null;return ef.removeChild.call(this,t),this}removeChildren(t){return ef.removeChildren.call(this,t),this}}class of extends Wd{constructor(){super("rect"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{x:e=0,y:n=0,width:i=0,height:r=0,rx:o=0,ry:a=0,collider:s}=t,l=_({type:"rect",x:e,y:n,width:i,height:r},s);super.set(t),i>=0?(this.attrs.x=e,this.attrs.width=i):(this.attrs.x=e+i,this.attrs.width=-i),r>=0?(this.attrs.y=n,this.attrs.height=r):(this.attrs.y=n+r,this.attrs.height=-r),o>0&&(this.attrs.rx=o),a>0&&(this.attrs.ry=a),this.collider=l,this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];const e=O(this.attrs),n=t&&this.modelViewMatrix?this.modelViewMatrix.transformPoints(e):e,[i,r,o,a]=D(n);return this.__boundingRect[t]={x:i,y:r,width:o-i,height:a-r},this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}}class af extends Wd{constructor(){super("circle"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{cx:e=0,cy:n=0,r:i=0,collider:r}=t,o=_({type:"circle",cx:e,cy:n,r:i},r);super.set(t),this.attrs.cx=e,this.attrs.cy=n,this.attrs.r=i,this.collider=o,this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];const e=this.bounds(t);return this.__boundingRect[t]={x:e[0].x,y:e[0].y,width:e[2].x-e[0].x,height:e[2].y-e[0].y},this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const{cx:e,cy:n,r:i,r:r}=this.attrs,o=e-i,a=n-r;let s=2*i,l=2*r,c=[{x:o,y:a},{x:o+s,y:a},{x:o+s,y:a+l},{x:o,y:a+l}];if(t&&this.modelViewMatrix){c=this.modelViewMatrix.transformPoints(c);const[e,n,i,r]=D(c);s=i-e,l=r-n,this.__bounds[t]=[{x:e,y:n},{x:e+s,y:n},{x:e+s,y:n+l},{x:e,y:n+l}]}else this.__bounds[t]=c;return this.__bounds[t]}}class sf extends Wd{constructor(){super("line"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{x1:e=0,y1:n=0,x2:i=0,y2:r=0,collider:o}=t;super.set(t),this.attrs.x1=e,this.attrs.y1=n,this.attrs.x2=i,this.attrs.y2=r;const a={type:"line",x1:e,y1:n,x2:i,y2:r};this.collider=_(a,o),this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];let e=E(this.attrs);t&&this.modelViewMatrix&&(e=this.modelViewMatrix.transformPoints(e));const[n,i,r,o]=D(e),a=n!==r||i!==o;return this.__boundingRect[t]={x:n,y:i,width:a?Math.max(1,r-n):0,height:a?Math.max(1,o-i):0},this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}}const lf=Math.PI/2;function cf(t,e){const n=Math.atan2(e.y-t.y,e.x-t.x);return n<0?n+2*Math.PI:n}function uf(t,e,n){return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}}const hf={step:function(t){return new Pt(t,.5)},stepAfter:function(t){return new Pt(t,1)},stepBefore:function(t){return new Pt(t,0)},linear:pt,basis:function(t){return new kt(t)},cardinal:St.tension(0),catmullRom:Nt,monotonex:function(t){return new Et(t)},monotoney:function(t){return new Ot(t)},natural:function(t){return new Tt(t)}};function df(t){if(t.length<2)return!1;const e=t[0],n=t[t.length-1];return Math.abs(e.x-n.x)<1e-12&&Math.abs(e.y-n.y)<1e-12}class ff extends Wd{constructor(){super("path"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(super.set(t),this.segments=[],this.points=[],t.arcDatum){const e=dt();e.innerRadius(t.desc.slice.innerRadius),e.outerRadius(t.desc.slice.outerRadius),e.cornerRadius(t.desc.slice.cornerRadius);const n=e(t.arcDatum);this.attrs.d=n}else if(t.points){const{major:e,minor:n,layerObj:i,points:r,stngs:o,generatorType:a}=t,s=yt(),l=o.coordinates?o.coordinates.defined:null;s[e.p]((t=>t.major*e.size))["".concat(n.p,"1")]((t=>t.minor*n.size))["".concat(n.p,"0")]((t=>t.minor0*n.size)).curve(hf["monotone"===i.curve?"monotone".concat(e.p):i.curve]),l?s.defined((t=>!t.dummy&&"number"==typeof t.minor&&!isNaN(t.minor)&&t.defined)):s.defined((t=>!t.dummy&&"number"==typeof t.minor&&!isNaN(t.minor)));const c=o.connect?r.filter(s.defined()):r,u=("area"===a?s:s[a]())(c);this.attrs.d=u}else t.d&&(this.attrs.d=t.d);if(this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null},Array.isArray(t.collider)||"object"==typeof t.collider&&void 0!==t.collider.type)this.collider=t.collider;else if(this.attrs.d){if(this.segments=od(this.attrs.d),this.segments.length>1&&this.segments.every((t=>df(t))))return void(this.collider=_({type:"geopolygon",vertices:this.segments},t.collider));this.segments.forEach((e=>{if(e.length<=1);else if(df(e))this.collider=_({type:"polygon",vertices:e},t.collider);else if("object"==typeof t.collider&&t.collider.visual){const n=this.attrs["stroke-width"]/2;this.collider=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=[],r=[];if("h"===n.forceOrientation){const e=t[0].x<t[1].x?-1:1,n=t[t.length-1].x>t[t.length-2].x?1:-1;t.unshift({x:t[0].x+e,y:t[0].y}),t.push({x:t[t.length-1].x+n,y:t[t.length-1].y})}else if("v"===n.forceOrientation){const e=t[0].y<t[1].y?-1:1,n=t[t.length-1].y>t[t.length-2].y?1:-1;t.unshift({x:t[0].x,y:t[0].y+e}),t.push({x:t[t.length-1].x,y:t[t.length-1].y+n})}const o=t.length-1;for(let n=1;n<o;n++){const a=t[n-1],s=t[n],l=t[n+1],c=cf(s,a),u=cf(s,l),h=(c+u)/2,d=h+Math.PI,f=Math.max(h,d),p=Math.min(h,d),g=c>u;if(1===n){const t=cf(a,s);i.push(uf(a,t-lf,e)),r.unshift(uf(a,t+lf,e))}const m=g?f:p,y=g?p:f;if(i.push(uf(s,m,e)),r.unshift(uf(s,y,e)),n===o-1){const t=cf(l,s);i.push(uf(l,t+lf,e)),r.unshift(uf(l,t-lf,e))}}return{type:"polygon",vertices:[...i,...r]}}(e,n,t.collider)}else this.collider=_({type:"polyline",points:e},t.collider)}))}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];this.points.length||(this.segments=this.segments.length?this.segments:od(this.attrs.d),this.points=function(t){const e=[];let n,i=t.length;for(let r=0;r<i;r++){n=t[r];for(let t=0;t<n.length;t++)e.push(n[t])}return e}(this.segments));const e=t&&this.modelViewMatrix?this.modelViewMatrix.transformPoints(this.points):this.points,[n,i,r,o]=D(e);return this.__boundingRect[t]={x:n||0,y:i||0,width:r-n||0,height:o-i||0},this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}}function pf(t){let{data:e,_boundingRect:n,_textBoundsFn:i}=t;return null!=e&&(n||i)}class gf extends Wd{constructor(){super("text"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{x:e=0,y:n=0,dx:i=0,dy:r=0,textBoundsFn:o,text:a,title:s,collider:l,boundingRect:c,ellipsed:u}=t;super.set(t),this.attrs.x=e,this.attrs.y=n,this.attrs.dx=i,this.attrs.dy=r,this.attrs.text=a,void 0!==s&&(this.attrs.title=String(s)),"object"==typeof c?this._textBoundsFn=()=>c:"function"==typeof o&&(this._textBoundsFn=o),"string"==typeof u&&(this.ellipsed=u),this.collider=_({type:pf(this)?"bounds":null},l),this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}boundingRect(){let t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[e])return this.__boundingRect[e];if("function"!=typeof this._textBoundsFn)return{x:0,y:0,width:0,height:0};t=this._textBoundsFn(this.attrs);const n=O(t),i=e&&this.modelViewMatrix?this.modelViewMatrix.transformPoints(n):n,[r,o,a,s]=D(i);return this.__boundingRect[e]={x:r,y:o,width:a-r,height:s-o},this.__boundingRect[e]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}}const mf=$t();function yf(t,e){return mf.get(t)(e)}mf.add("rect",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new of(...e)})),mf.add("circle",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new af(...e)})),mf.add("text",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new gf(...e)})),mf.add("line",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new sf(...e)})),mf.add("path",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new ff(...e)})),mf.add("stage",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Gd(...e)})),mf.add("container",Kd),mf.add("defs",Kd),mf.add("linearGradient",tf),mf.add("radialGradient",tf),mf.add("stop",tf),mf.add("pattern",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new rf(...e)}));const vf=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=[{}];function n(){return e[e.length-1]}return n.save=function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=n(),o={};let a="";for(let e=0;e<t.length;e++)a=t[e],void 0!==r[a]&&(o[a]=r[a]);return _(o,i),e.push(o),n()},n.restore=function(){e.splice(e.length-1,1)},n}(["stroke","fill","strokeWidth","opacity","fontFamily","fontSize","baseline"]);function xf(t,e){if(Array.isArray(e))for(let n=0,i=e.length;n<i;n++)e[n](t)}function bf(t,e,n){t.node=n[e],t.index=e}function wf(t,e,n,i){let r=!1;const o={siblings:t,node:null,index:0};for(let a=0,s=t.length;a<s;a++){if(bf(o,a,t),xf(o,i.create),r="function"==typeof o.node.disabled?o.node.disabled():o.node.disabled,r)continue;o.node=vf.save(o.node);const s=yf(o.node.type,o.node);s&&(o.node.transform&&(n.save(),Rd(o.node.transform,n)),n.isIdentity()||(s.modelViewMatrix=n.clone()),e.addChild(s),o.node.children&&wf(o.node.children,s,n,i),o.node.transform&&n.restore()),vf.restore()}}function kf(t){let{items:e,stage:n,dpi:i,on:r={}}=t;return n||(n=yf("stage",i)),wf(e,n,new kd,r),n}function _f(t,e,n){const{orientation:i,degree:r,stops:o=[]}=n;let a=null;if("radial"===i){const n=e.boundingRect();a=t.createRadialGradient(n.x+n.width/2,n.y+n.height/2,1e-5,n.x+n.width/2,n.y+n.height/2,Math.max(n.width,n.height)/2)}else{const i=Aa(r);["x1","x2","y1","y2"].forEach((t=>{t in n&&(i[t]=n[t])}));const o=e.boundingRect();a=t.createLinearGradient(o.x+i.x1*o.width,o.y+i.y1*o.height,o.x+i.x2*o.width,o.y+i.y2*o.height)}for(let t=0,e=o.length;t<e;t++){let e=o[t];a.addColorStop(e.offset,e.color)}return a}function Mf(t,e,n){return e.width=t.width,e.height=t.height,n.save(),n.fillStyle=t.fill,t.shapes.forEach((t=>{switch(t.type){case"rect":n.rect(t.x,t.y,t.width,t.height)}})),n.fill(),n.restore(),n.createPattern(e,"repeat")}function Sf(t){const e=t.createElement("canvas"),n=e.getContext("2d");let i={};return{create(t){const r=t.key;return r?(i[r]=i[r]||Mf(t,e,n),i[r]):Mf(t,e,n)},clear(){i={}}}}function Cf(){let{x:t,y:e,width:n,height:i,scaleRatio:r,margin:o,edgeBleed:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s={x:0,y:0,width:0,height:0,scaleRatio:{x:1,y:1},margin:{left:0,top:0},edgeBleed:{left:0,right:0,top:0,bottom:0,bool:!1}};return s.x=isNaN(t)?s.x:t,s.y=isNaN(e)?s.y:e,s.width=isNaN(n)?s.width:n,s.height=isNaN(i)?s.height:i,void 0!==r&&(s.scaleRatio.x=isNaN(r.x)?s.scaleRatio.x:r.x,s.scaleRatio.y=isNaN(r.y)?s.scaleRatio.y:r.y),void 0!==o&&(s.margin.left=isNaN(o.left)?0:o.left,s.margin.top=isNaN(o.top)?0:o.top),"object"==typeof a&&["left","right","top","bottom"].forEach((t=>{!isNaN(a[t])&&a[t]>0&&(s.edgeBleed[t]=a[t],s.edgeBleed.bool=!0)})),s.computedPhysical={x:Math.round(s.margin.left+(s.x-s.edgeBleed.left)*s.scaleRatio.x),y:Math.round(s.margin.top+(s.y-s.edgeBleed.top)*s.scaleRatio.y),width:Math.round((s.width+s.edgeBleed.left+s.edgeBleed.right)*s.scaleRatio.x),height:Math.round((s.height+s.edgeBleed.top+s.edgeBleed.bottom)*s.scaleRatio.y)},s}function Nf(){const t={element:()=>{},root:()=>{},settings:()=>{},appendTo:()=>{},getScene:()=>[],render:()=>!1,itemsAt:()=>[],findShapes:()=>[],clear:()=>{},destory:()=>{},size:()=>{},measureText:th,textBounds:nh,setKey:e=>{t.element().setAttribute("data-key",e)}};return t}function Rf(t){return e=>{let{node:n}=e;"text"===n.type&&function(t){return null!=t}(n.data)&&!n.textBoundsFn&&(n.textBoundsFn=t.textBounds)}}const qf=200,Af=200;class Df{constructor(t){this.targetCanvas=t,this.bufferCanvas=t.cloneNode()}updateSize(t){let e,{rect:n,dpiRatio:i,canvasBufferSize:r}=t;e=r?"function"==typeof r?r(n):r:{width:n.computedPhysical.width+2*qf,height:n.computedPhysical.height+2*Af},this.bufferCanvas.style.width="".concat(e.width,"px"),this.bufferCanvas.style.height="".concat(e.height,"px"),this.bufferCanvas.width=Math.round(e.width*i),this.bufferCanvas.height=Math.round(e.height*i)}apply(){this.targetCanvas.getContext("2d").drawImage(this.bufferCanvas,0,0)}clear(){this.bufferCanvas.width=this.bufferCanvas.width}getContext(){return this.bufferCanvas.getContext("2d")}}const Ef=$t();function Of(t){return Array.isArray(t)?t:"string"==typeof t?-1!==t.indexOf(",")?t.split(","):t.split(" "):[]}function If(t){return("undefined"==typeof window?1:window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)}function Tf(t,e){e.setTransform(t[0][0],t[1][0],t[0][1],t[1][1],t[0][2],t[1][2])}function jf(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=Object.keys(i);for(let r=0,o=n.length;r<o;r++){let o=n[r];const a=o[0],s=o[1],l=o[2];if(a in e.attrs&&!(s in i)&&t[s]!==e.attrs[a]){const n=l?l(e.attrs[a]):e.attrs[a];"function"==typeof t[s]?t[s](n):t[s]=n}}for(let e=0,n=r.length;e<n;e++){const n=r[e];t[n]=i[n]}}function Pf(t,e,n,i){for(let r=0,o=t.length;r<o;r++){let o=t[r],a={};e.save(),o.attrs&&(o.attrs.fill||o.attrs.stroke)&&(o.attrs.fill&&"object"==typeof o.attrs.fill&&"gradient"===o.attrs.fill.type?a.fillStyle=_f(e,o,o.attrs.fill):o.attrs.fill&&"object"==typeof o.attrs.fill&&"pattern"===o.attrs.fill.type&&(a.fillStyle=i.patterns.create(o.attrs.fill)),o.attrs.stroke&&"object"==typeof o.attrs.stroke&&"gradient"===o.attrs.stroke.type?a.strokeStyle=_f(e,o,o.attrs.stroke):o.attrs.stroke&&"object"==typeof o.attrs.stroke&&"pattern"===o.attrs.stroke.type&&(a.strokeStyle=i.patterns.create(o.attrs.stroke))),jf(e,o,n,a),o.modelViewMatrix&&Tf(o.modelViewMatrix.elements,e),Ef.has(o.type)&&Ef.get(o.type)(o.attrs,{g:e,doFill:"fill"in o.attrs&&"none"!==o.attrs.fill,doStroke:"stroke"in o.attrs&&0!==o.attrs["stroke-width"],ellipsed:o.ellipsed}),o.children&&Pf(o.children,e,n,i),e.restore()}}function zf(t){let{el:e,dpiRatio:n,transform:i}=t;if("object"==typeof i){const t=[i.horizontalScaling,i.horizontalSkewing,i.verticalSkewing,i.verticalScaling,i.horizontalMoving*n,i.verticalMoving*n];e.getContext("2d").setTransform(...t)}}function Ff(){let t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:kf;const i={transform:void 0,canvasBufferSize:void 0,progressive:void 0};let r,o=!1,a=Cf();const s=[["fill","fillStyle"],["stroke","strokeStyle"],["opacity","globalAlpha"],["globalAlpha","globalAlpha"],["stroke-width","lineWidth"],["stroke-linejoin","lineJoin"],["stroke-dasharray","setLineDash",Of]];let l;const c=Nf();return c.element=()=>t,c.root=()=>t,c.settings=t=>(t&&Object.keys(i).forEach((e=>{void 0!==t[e]&&(i[e]=t[e])})),i),c.appendTo=n=>(t||(t=n.ownerDocument.createElement("canvas"),t.style.position="absolute",t.style["-webkit-font-smoothing"]="antialiased",t.style["-moz-osx-font-smoothing"]="antialiased",t.style.pointerEvents="none"),"function"!=typeof i.transform||e||(e=new Df(t)),n.appendChild(t),t),c.getScene=i=>{const r=If(e&&e.getContext()||t.getContext("2d")),o=a.scaleRatio.x,s=a.scaleRatio.y,l={type:"container",children:i,transform:a.edgeBleed.bool?"translate(".concat(a.edgeBleed.left*r*o,", ").concat(a.edgeBleed.top*r*s,")"):""};return 1===r&&1===o&&1===s||(l.transform+="scale(".concat(r*o,", ").concat(r*s,")")),n({items:[l],dpi:r,on:{create:[Wu(c.measureText),Rf(c)]}})},c.render=n=>{if(!t)return!1;l||(l=Sf(t.ownerDocument));const u=e&&e.getContext()||t.getContext("2d"),h=If(u),d=e&&i.transform();if(d)return t.width=t.width,zf({el:t,dpiRatio:h,transform:d}),e.apply(),!0;o&&(t.style.left="".concat(a.computedPhysical.x,"px"),t.style.top="".concat(a.computedPhysical.y,"px"),t.style.width="".concat(a.computedPhysical.width,"px"),t.style.height="".concat(a.computedPhysical.height,"px"),t.width=Math.round(a.computedPhysical.width*h),t.height=Math.round(a.computedPhysical.height*h),e&&e.updateSize({rect:a,dpiRatio:h,canvasBufferSize:i.canvasBufferSize}));const f=c.getScene(n),p=!r||!f.equals(r);l.clear();const g=o||p,m="function"==typeof i.progressive&&i.progressive();return g&&(m&&!m.isFirst||c.clear(),Pf(f.children,u,s,{patterns:l})),e&&(t.width=t.width,e.apply()),o=!1,m&&!m.isFirst&&f.children.unshift(...r.children),r=f,g},c.itemsAt=t=>r?r.getItemsFrom(t):[],c.findShapes=t=>r?r.findShapes(t):[],c.clear=()=>(t&&(t.width=t.width),e&&e.clear(),r=null,c),c.size=t=>{if(t){const e=Cf(t);JSON.stringify(a)!==JSON.stringify(e)&&(o=!0,a=e)}return a},c.destroy=()=>{t&&(t.parentElement&&t.parentElement.removeChild(t),t=null),e&&(e=null),r=null},c}function Lf(t,e){Ef.add(t,e)}function Bf(t,e){return Math.max(0,Math.min(t,e))}const Hf=new RegExp("[A-Za-zªµºÀ-ÖØ-öø-ʸʻ-ˁː-ˑˠ-ˤˮͰ-ͳͶ-ͽΆΈ-ϵϷ-҂Ҋ-։ः-हऻऽ-ीॉ-ौॎ-ॐक़-ॡ।-ॿং-হঽ-ীে-ৌৎ-ৡ০-ৱ৴-৺ਃ-ਹਾ-ੀਖ਼-੯ੲ-ੴઃ-હઽ-ીૉ-ૌૐ-ૡ૦-૯ଂ-ହଽ-ାୀେ-ୌୗ-ୡ୦-୷ஃ-ிு-ௌௐ-௲ఁ-ఽు-ౄౘ-ౡ౦-౯౿-ಹಽ-ೋೕ-ೡ೦-ീെ-ൌൎ-ൡ൦-ෆා-ෑෘ-ะา-ำเ-ๆ๏-ະາ-ຳຽ-ໆ໐-༗༚-༴༶༸༾-ཬཿ྅ྈ-ྌ྾-࿅࿇-ာေးျ-ြဿ-ၗၚ-ၝၡ-ၰၵ-ႁႃ-ႄႇ-ႌႎ-ႜ႞-ፚ፠-ᎏᎠ-Ᏼᐁ-ᙿᚁ-ᚚᚠ-ᜑᜠ-ᜱ᜵-ᝑᝠ-ᝰក-ាើ-ៅះ-ៈ។-៚ៜ០-៩᠐-ᢨᢪ-ᤜᤣ-ᤦᤩ-ᤱᤳ-ᤸ᥆-᧚ᨀ-ᨖᨙ-ᩕᩗᩡᩣ-ᩤᩭ-ᩲ᪀-᪭ᬄ-ᬳᬵᬻᬽ-ᭁᭃ-᭪᭴-᭼ᮂ-ᮡᮦ-ᮧ᮪-ᯥᯧᯪ-ᯬᯮ᯲-ᰫᰴ-ᰵ᰻-᱿᳓᳡ᳩ-ᳬᳮ-ᶿḀ-ᾼιῂ-ῌῐ-Ίῠ-Ῥῲ-ῼ‎ⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎ-⅏Ⅰ-ↈ⌶-⍺⎕⒜-ⓩ⚬⠀-⣿Ⰰ-ⳤⳫ-ⳮⴀ-⵰ⶀ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ㆺㇰ-㈜㈠-㉏㉠-㉻㉿-㊰㋀-㋋㋐-㍶㍻-㏝㏠-㏾㐀-䶵一-ꒌꓐ-ꘌꘐ-ꙮꚀ-ꛯ꛲-꛷Ꜣ-ꞇ꞉-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠤꠧ꠰-꠷ꡀ-ꡳꢀ-ꣃ꣎-꣙ꣲ-ꤥ꤮-ꥆꥒ-ꥼꦃ-ꦲꦴ-ꦵꦺ-ꦻꦽ-ꨨꨯ-ꨰꨳ-ꨴꩀ-ꩂꩄ-ꩋꩍ-ꪯꪱꪵ-ꪶꪹ-ꪽꫀꫂ-ꯤꯦ-ꯧꯩ-꯬꯰-ﬗA-Za-zヲ-ᅵ]"),$f=new RegExp("[־׀׃׆א-״߀-ߪߴ-ߵߺ-ࠕࠚࠤࠨ࠰-ࡘ࡞‏יִײַ-ﬨשׁ-ﭏ]"),Vf=new RegExp("[؈؋؍؛-ي٭-ٯٱ-ەۥ-ۦۮ-ۯۺ-܍ܐܒ-ܯݍ-ޥޱﭐ-ﴽﵐ-﷼ﹰ-ﻼ]");function Wf(t){return Hf.test(t)}function Uf(t){return $f.test(t)||Vf.test(t)}function Yf(t){let e,n,i=t?t.length:0;for(e=0;e<i;e++){if(n=t[e],Wf(n))return"ltr";if(Uf(n))return"rtl"}return"ltr"}const Xf={start:"end",end:"start",center:"center",middle:"middle"};function Kf(t,e){return"rtl"===e?Xf[t]:t}function Gf(t,e){const n=[];let i;const r=[],o=[],a=[];let s,l;const c=t=>t.id,u=(t,e)=>{let n;return n="object"==typeof t?"id"in t?t.id:e:t,{content:t,id:"".concat(n,"__").concat(t.type||"")}};t.isTree||(t=t.map(u)),e=e.map(u),s=t.map(c),l=e.map(c);for(let t=0,i=e.length;t<i;t++){-1===s.indexOf(e[t].id)?n.push(e[t]):o.push(e[t])}for(let e=0,n=t.length;e<n;e++){-1===l.indexOf(t[e].id)?r.push(t[e]):a.push(t[e])}for(let t=0,e=n.length;t<e;t++)n[t].content.children&&(n[t].diff=Gf([],n[t].content.children),n[t].children=n[t].diff.updatedNew.concat(n[t].diff.added),n[t].children.isTree=!0);for(let t=0,e=o.length;t<e;t++)o[t].diff=Gf(a[t].children||[],o[t].content.children||[]),o[t].object=a[t].object,o[t].children=o[t].diff.items;return i=o.concat(n),n.isTree=!0,r.isTree=!0,o.isTree=!0,a.isTree=!0,i.isTree=!0,{added:n,updatedNew:o,updatedOld:a,removed:r,items:i}}function Zf(t,e,n){for(let i=0,r=t.length;i<r;i++)t[i].object=n(t[i].content.type,e)}function Jf(t,e){for(let n=0,i=t.length;n<i;n++)null!==t[n].object&&void 0!==t[n].object&&(e(t[n].object),t[n].object=null)}function Qf(t,e,n,i){let r;for(let o=0,a=t.length;o<a;o++)r=t[o],null!==r.object&&void 0!==r.object&&(n(r.object,r.content),r.diff&&(Zf(r.diff.added,r.object,e),Jf(r.diff.removed,i),Qf(r.diff.items,e,n,i)))}function tp(t,e,n,i,r,o){const a=Gf(t,e);return Zf(a.added,n,i),Jf(a.removed,o),Qf(a.items,i,r,o),a.items}Lf("rect",(function(t,e){let{g:n,doFill:i,doStroke:r}=e;n.beginPath(),t.rx>0||t.ry>0?function(t,e,n,i,r,o,a){o=Bf(i/2,o>0?o:a),a=Bf(r/2,a>0?a:o),t.moveTo(e,n+a),t.lineTo(e,n+r-a),t.quadraticCurveTo(e,n+r,e+o,n+r),t.lineTo(e+i-o,n+r),t.quadraticCurveTo(e+i,n+r,e+i,n+r-a),t.lineTo(e+i,n+a),t.quadraticCurveTo(e+i,n,e+i-o,n),t.lineTo(e+o,n),t.quadraticCurveTo(e,n,e,n+a)}(n,t.x,t.y,t.width,t.height,t.rx,t.ry):n.rect(t.x,t.y,t.width,t.height),i&&n.fill(),r&&n.stroke()})),Lf("circle",(function(t,e){let{g:n,doFill:i,doStroke:r}=e;n.beginPath(),n.moveTo(t.cx+t.r,t.cy),n.arc(t.cx,t.cy,t.r,0,2*Math.PI,!1),i&&n.fill(),r&&n.stroke()})),Lf("line",(function(t,e){let{g:n,doStroke:i}=e;n.beginPath(),n.moveTo(t.x1,t.y1),n.lineTo(t.x2,t.y2),i&&n.stroke()})),Lf("path",(function(t,e){let{g:n,doStroke:i,doFill:r}=e;const o=new Path2D(t.d);r&&n.fill(o),i&&n.stroke(o)})),Lf("text",(function(t,e){let{g:n,ellipsed:i,doStroke:r}=e;const o=i||Uu(t,th);t["font-weight"]?n.font="".concat(t["font-weight"]," ").concat(t["font-size"]," ").concat(t["font-family"]):n.font="".concat(t["font-size"]," ").concat(t["font-family"]);const a=Yf(t.text);n.canvas.dir!==a&&(n.canvas.dir=a);const s=Kf("middle"===t["text-anchor"]?"center":t["text-anchor"],n.canvas.dir);s&&n.textAlign!==s&&(n.textAlign=s);const l=Yu(t);n.fillText(o,t.x+t.dx,t.y+t.dy+l),r&&n.strokeText(o,t.x+t.dx,t.y+t.dy+l)}));const ep="http://www.w3.org/2000/svg",np=(t,e)=>{if(!t||"string"!=typeof t)throw new Error("Invalid type: ".concat(t));const n=e.ownerDocument.createElementNS(ep,"container"===t?"g":t);return e.appendChild(n),n},ip=t=>{t.parentNode&&t.parentNode.removeChild(t)},rp=(t,e)=>{if((t=>{switch(t.type){case"circle":return!isNaN(t.attrs.cx)&&!isNaN(t.attrs.cy)&&!isNaN(t.attrs.r);case"line":return!(isNaN(t.attrs.x1)||isNaN(t.attrs.y1)||isNaN(t.attrs.x2)||isNaN(t.attrs.y2));case"rect":return!(isNaN(t.attrs.x)||isNaN(t.attrs.y)||isNaN(t.attrs.width)||isNaN(t.attrs.height));case"text":return!isNaN(t.attrs.x)&&!isNaN(t.attrs.y);default:return!0}})(e)){for(const n in e.attrs)if("stroke"===n&&e.strokeReference)t.setAttribute("stroke",e.strokeReference);else if("fill"===n&&e.fillReference)t.setAttribute("fill",e.fillReference);else if("text"===n){t.setAttribute("style","white-space: pre"),t.textContent=e.ellipsed||Uu(e.attrs,th);const n=Yf(e.attrs.text);"rtl"===n&&(t.setAttribute("direction","rtl"),t.setAttribute("dir","rtl"),t.setAttribute("text-anchor",Kf(t.getAttribute("text-anchor"),n)))}else if("text"!==e.type||"dy"!==n&&"dominant-baseline"!==n)if("text"===e.type&&"title"===n&&e.attrs.title){const n=t.ownerDocument.createElementNS(ep,"title");n.textContent=e.attrs.title,t.appendChild(n)}else t.setAttribute(n,e.attrs[n]);else{const i=+t.getAttribute(n)||0;let r=0;r="dominant-baseline"===n?Yu(e.attrs):e.attrs[n],t.setAttribute("dy",r+i)}if("string"==typeof e.data||"number"==typeof e.data||"boolean"==typeof e.data)t.setAttribute("data",e.data);else if("object"==typeof e.data&&null!==e.data)for(const n in e.data)"string"!=typeof e.data[n]&&"number"!=typeof e.data[n]&&"boolean"!=typeof e.data[n]||t.setAttribute("data-".concat(n),e.data[n])}};class op{constructor(t,e,n,i){this.create=t,this.nodeCreator=e,this.nodeMaintainer=n,this.nodeDestroyer=i}render(t,e){return this.create([],t,e,this.nodeCreator,this.nodeMaintainer,this.nodeDestroyer)}}function ap(){return new op(tp,np,rp,ip)}function sp(t){let e,n,i,r=0;if(0===(t=JSON.stringify(t)).length)return r;for(e=0,i=t.length;e<i;e++)n=t.charCodeAt(e),r=(r<<5)-r+n,r&=r;return r}function lp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sp,n={},i=Date.now();const r={getOrCreateGradient(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fill",a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=e(r[o]),l="picasso-gradient-".concat(i,"-").concat(s);if(!n[s]){let{orientation:e,degree:i,stops:a=[]}=r[o],c={};void 0===i&&(i=90),"radial"===e?c.type="radialGradient":(c=Aa(i),["x1","x2","y1","y2"].forEach((t=>{t in r[o]&&(c[t]=r[o][t])})),c.type="linearGradient"),c.id=l,c.children=a.map((t=>{let{offset:e,color:n,opacity:i}=t;return{type:"stop",offset:"".concat(100*e,"%"),style:"stop-color:".concat(n,";stop-opacity:").concat(void 0!==i?i:1)}})),t.push(c),n[s]=l}return"url('".concat(a,"#").concat(l,"')")},onCreate(t){let e="";"undefined"!=typeof window&&(e=window.location.href.split("#")[0]);const n=t.node;n.fill&&"object"==typeof n.fill&&"gradient"===n.fill.type&&(n.fillReference=r.getOrCreateGradient(n,"fill",e)),n.stroke&&"object"==typeof n.stroke&&"gradient"===n.stroke.type&&(n.strokeReference=r.getOrCreateGradient(n,"stroke",e))},clear(){n={}}};return r}function cp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sp,n={},i=Date.now();const r={onCreate(r){let o={};r.node&&"object"==typeof r.node.fill&&"pattern"===r.node.fill.type&&r.node.fill.shapes&&(o.fill=r.node.fill),r.node&&"object"==typeof r.node.stroke&&"pattern"===r.node.stroke.type&&r.node.stroke.shapes&&(o.stroke=r.node.stroke),Object.keys(o).forEach((a=>{let s="";const l=o[a],c=e(l),u="picasso-pattern-".concat(i,"-").concat(c);if("undefined"!=typeof window&&(s=window.location.href.split("#")[0]),!n[c]){const e={patternUnits:"userSpaceOnUse",x:0,y:0,width:l.width,height:l.height,type:"pattern",id:u,children:[],fill:l.fill};l.shapes.forEach((t=>{e.children.push(t)})),t.push(e),n[c]=!0}r.node["".concat(a,"Reference")]="url('".concat(s,"#").concat(u,"')")}))},clear(){n={}}};return r}function up(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ap,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ep,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:kf;const i=t();let r,o,a,s=!1,l=Cf();const c={transform:void 0},u=Nf(),h={type:"defs",children:[]},d=cp(h.children),f=lp(h.children);return u.element=()=>r,u.root=()=>o,u.settings=t=>(t&&Object.keys(c).forEach((e=>{void 0!==t[e]&&(c[e]=t[e])})),c),u.appendTo=t=>(r||(r=t.ownerDocument.createElementNS(e,"svg"),r.style.position="absolute",r.style["-webkit-font-smoothing"]="antialiased",r.style["-moz-osx-font-smoothing"]="antialiased",r.style.pointerEvents="none",r.setAttribute("xmlns",e),o=t.ownerDocument.createElementNS(e,"g"),o.style.pointerEvents="auto",r.appendChild(o)),t.appendChild(r),r),u.getScene=t=>{const e=l.scaleRatio.x,i=l.scaleRatio.y,r={type:"container",children:Array.isArray(t)?[...t,h]:t,transform:l.edgeBleed.bool?"translate(".concat(l.edgeBleed.left*e,", ").concat(l.edgeBleed.top*i,")"):""};return 1===e&&1===i||(r.transform+="scale(".concat(e,", ").concat(i,")")),n({items:[r],on:{create:[t=>{t.node.fillReference=void 0,t.node.strokeReference=void 0},f.onCreate,d.onCreate,Wu(u.measureText),Rf(u)]}})},u.render=t=>{if(!r)return!1;const e="function"==typeof c.transform&&c.transform();if(e){const{a:t,b:n,c:i,d:r,e:a,f:s}=e;return o.style.transform="matrix(".concat(t,", ").concat(n,", ").concat(i,", ").concat(r,", ").concat(a,", ").concat(s,")"),!0}o.style.transform="",s&&(r.style.left="".concat(l.computedPhysical.x,"px"),r.style.top="".concat(l.computedPhysical.y,"px"),r.setAttribute("width",l.computedPhysical.width),r.setAttribute("height",l.computedPhysical.height)),f.clear(),d.clear(),h.children.length=0;const n=u.getScene(t),p=!a||!n.equals(a),g=s||p;return g&&(u.clear(),i.render(n.children,o)),s=!1,a=n,g},u.itemsAt=t=>a?a.getItemsFrom(t):[],u.findShapes=t=>a?a.findShapes(t):[],u.clear=()=>{if(!o)return u;a=null;const t=o.cloneNode(!1);return r.replaceChild(t,o),o=t,u},u.destroy=()=>{r&&r.parentNode&&r.parentNode.removeChild(r),r=null,o=null},u.size=t=>{if(t){const e=Cf(t);JSON.stringify(l)!==JSON.stringify(e)&&(s=!0,l=e)}return l},u}var hp,dp,fp,pp,gp,mp={},yp=[],vp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function xp(t,e){for(var n in e)t[n]=e[n];return t}function bp(t){var e=t.parentNode;e&&e.removeChild(t)}function wp(t,e,n){var i,r,o,a={};for(o in e)"key"==o?i=e[o]:"ref"==o?r=e[o]:a[o]=e[o];if(arguments.length>2&&(a.children=arguments.length>3?hp.call(arguments,2):n),"function"==typeof t&&null!=t.defaultProps)for(o in t.defaultProps)void 0===a[o]&&(a[o]=t.defaultProps[o]);return kp(t,a,i,r,null)}function kp(t,e,n,i,r){var o={type:t,props:e,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++fp:r};return null==r&&null!=dp.vnode&&dp.vnode(o),o}function _p(t){return t.children}function Mp(t,e){this.props=t,this.context=e}function Sp(t,e){if(null==e)return t.__?Sp(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?Sp(t):null}function Cp(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return Cp(t)}}function Np(t){(!t.__d&&(t.__d=!0)&&pp.push(t)&&!Rp.__r++||gp!==dp.debounceRendering)&&((gp=dp.debounceRendering)||setTimeout)(Rp)}function Rp(){for(var t;Rp.__r=pp.length;)t=pp.sort((function(t,e){return t.__v.__b-e.__v.__b})),pp=[],t.some((function(t){var e,n,i,r,o,a;t.__d&&(o=(r=(e=t).__v).__e,(a=e.__P)&&(n=[],(i=xp({},r)).__v=r.__v+1,jp(a,r,i,e.__n,void 0!==a.ownerSVGElement,null!=r.__h?[o]:null,n,null==o?Sp(r):o,r.__h),Pp(n,r),r.__e!=o&&Cp(r)))}))}function qp(t,e,n,i,r,o,a,s,l,c){var u,h,d,f,p,g,m,y=i&&i.__k||yp,v=y.length;for(n.__k=[],u=0;u<e.length;u++)if(null!=(f=n.__k[u]=null==(f=e[u])||"boolean"==typeof f?null:"string"==typeof f||"number"==typeof f||"bigint"==typeof f?kp(null,f,null,null,f):Array.isArray(f)?kp(_p,{children:f},null,null,null):f.__b>0?kp(f.type,f.props,f.key,f.ref?f.ref:null,f.__v):f)){if(f.__=n,f.__b=n.__b+1,null===(d=y[u])||d&&f.key==d.key&&f.type===d.type)y[u]=void 0;else for(h=0;h<v;h++){if((d=y[h])&&f.key==d.key&&f.type===d.type){y[h]=void 0;break}d=null}jp(t,f,d=d||mp,r,o,a,s,l,c),p=f.__e,(h=f.ref)&&d.ref!=h&&(m||(m=[]),d.ref&&m.push(d.ref,null,f),m.push(h,f.__c||p,f)),null!=p?(null==g&&(g=p),"function"==typeof f.type&&f.__k===d.__k?f.__d=l=Ap(f,l,t):l=Dp(t,f,d,y,p,l),"function"==typeof n.type&&(n.__d=l)):l&&d.__e==l&&l.parentNode!=t&&(l=Sp(d))}for(n.__e=g,u=v;u--;)null!=y[u]&&Fp(y[u],y[u]);if(m)for(u=0;u<m.length;u++)zp(m[u],m[++u],m[++u])}function Ap(t,e,n){for(var i,r=t.__k,o=0;r&&o<r.length;o++)(i=r[o])&&(i.__=t,e="function"==typeof i.type?Ap(i,e,n):Dp(n,i,i,r,i.__e,e));return e}function Dp(t,e,n,i,r,o){var a,s,l;if(void 0!==e.__d)a=e.__d,e.__d=void 0;else if(null==n||r!=o||null==r.parentNode)t:if(null==o||o.parentNode!==t)t.appendChild(r),a=null;else{for(s=o,l=0;(s=s.nextSibling)&&l<i.length;l+=1)if(s==r)break t;t.insertBefore(r,o),a=o}return void 0!==a?a:r.nextSibling}function Ep(t,e,n){"-"===e[0]?t.setProperty(e,n):t[e]=null==n?"":"number"!=typeof n||vp.test(e)?n:n+"px"}function Op(t,e,n,i,r){var o;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||Ep(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||Ep(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])o=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?i||t.addEventListener(e,o?Tp:Ip,o):t.removeEventListener(e,o?Tp:Ip,o);else if("dangerouslySetInnerHTML"!==e){if(r)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==e&&"list"!==e&&"form"!==e&&"tabIndex"!==e&&"download"!==e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&-1==e.indexOf("-")?t.removeAttribute(e):t.setAttribute(e,n))}}function Ip(t){this.l[t.type+!1](dp.event?dp.event(t):t)}function Tp(t){this.l[t.type+!0](dp.event?dp.event(t):t)}function jp(t,e,n,i,r,o,a,s,l){var c,u,h,d,f,p,g,m,y,v,x,b,w,k,_,M=e.type;if(void 0!==e.constructor)return null;null!=n.__h&&(l=n.__h,s=e.__e=n.__e,e.__h=null,o=[s]),(c=dp.__b)&&c(e);try{t:if("function"==typeof M){if(m=e.props,y=(c=M.contextType)&&i[c.__c],v=c?y?y.props.value:c.__:i,n.__c?g=(u=e.__c=n.__c).__=u.__E:("prototype"in M&&M.prototype.render?e.__c=u=new M(m,v):(e.__c=u=new Mp(m,v),u.constructor=M,u.render=Lp),y&&y.sub(u),u.props=m,u.state||(u.state={}),u.context=v,u.__n=i,h=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=M.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=xp({},u.__s)),xp(u.__s,M.getDerivedStateFromProps(m,u.__s))),d=u.props,f=u.state,h)null==M.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==M.getDerivedStateFromProps&&m!==d&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(m,v),!u.__e&&null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(m,u.__s,v)||e.__v===n.__v){for(u.props=m,u.state=u.__s,e.__v!==n.__v&&(u.__d=!1),u.__v=e,e.__e=n.__e,e.__k=n.__k,e.__k.forEach((function(t){t&&(t.__=e)})),x=0;x<u._sb.length;x++)u.__h.push(u._sb[x]);u._sb=[],u.__h.length&&a.push(u);break t}null!=u.componentWillUpdate&&u.componentWillUpdate(m,u.__s,v),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(d,f,p)}))}if(u.context=v,u.props=m,u.__v=e,u.__P=t,b=dp.__r,w=0,"prototype"in M&&M.prototype.render){for(u.state=u.__s,u.__d=!1,b&&b(e),c=u.render(u.props,u.state,u.context),k=0;k<u._sb.length;k++)u.__h.push(u._sb[k]);u._sb=[]}else do{u.__d=!1,b&&b(e),c=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++w<25);u.state=u.__s,null!=u.getChildContext&&(i=xp(xp({},i),u.getChildContext())),h||null==u.getSnapshotBeforeUpdate||(p=u.getSnapshotBeforeUpdate(d,f)),_=null!=c&&c.type===_p&&null==c.key?c.props.children:c,qp(t,Array.isArray(_)?_:[_],e,n,i,r,o,a,s,l),u.base=e.__e,e.__h=null,u.__h.length&&a.push(u),g&&(u.__E=u.__=null),u.__e=!1}else null==o&&e.__v===n.__v?(e.__k=n.__k,e.__e=n.__e):e.__e=function(t,e,n,i,r,o,a,s){var l,c,u,h=n.props,d=e.props,f=e.type,p=0;if("svg"===f&&(r=!0),null!=o)for(;p<o.length;p++)if((l=o[p])&&"setAttribute"in l==!!f&&(f?l.localName===f:3===l.nodeType)){t=l,o[p]=null;break}if(null==t){if(null===f)return document.createTextNode(d);t=r?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,d.is&&d),o=null,s=!1}if(null===f)h===d||s&&t.data===d||(t.data=d);else{if(o=o&&hp.call(t.childNodes),c=(h=n.props||mp).dangerouslySetInnerHTML,u=d.dangerouslySetInnerHTML,!s){if(null!=o)for(h={},p=0;p<t.attributes.length;p++)h[t.attributes[p].name]=t.attributes[p].value;(u||c)&&(u&&(c&&u.__html==c.__html||u.__html===t.innerHTML)||(t.innerHTML=u&&u.__html||""))}if(function(t,e,n,i,r){var o;for(o in n)"children"===o||"key"===o||o in e||Op(t,o,null,n[o],i);for(o in e)r&&"function"!=typeof e[o]||"children"===o||"key"===o||"value"===o||"checked"===o||n[o]===e[o]||Op(t,o,e[o],n[o],i)}(t,d,h,r,s),u)e.__k=[];else if(p=e.props.children,qp(t,Array.isArray(p)?p:[p],e,n,i,r&&"foreignObject"!==f,o,a,o?o[0]:n.__k&&Sp(n,0),s),null!=o)for(p=o.length;p--;)null!=o[p]&&bp(o[p]);s||("value"in d&&void 0!==(p=d.value)&&(p!==t.value||"progress"===f&&!p||"option"===f&&p!==h.value)&&Op(t,"value",p,h.value,!1),"checked"in d&&void 0!==(p=d.checked)&&p!==t.checked&&Op(t,"checked",p,h.checked,!1))}return t}(n.__e,e,n,i,r,o,a,l);(c=dp.diffed)&&c(e)}catch(t){e.__v=null,(l||null!=o)&&(e.__e=s,e.__h=!!l,o[o.indexOf(s)]=null),dp.__e(t,e,n)}}function Pp(t,e){dp.__c&&dp.__c(e,t),t.some((function(e){try{t=e.__h,e.__h=[],t.some((function(t){t.call(e)}))}catch(t){dp.__e(t,e.__v)}}))}function zp(t,e,n){try{"function"==typeof t?t(e):t.current=e}catch(t){dp.__e(t,n)}}function Fp(t,e,n){var i,r;if(dp.unmount&&dp.unmount(t),(i=t.ref)&&(i.current&&i.current!==t.__e||zp(i,null,e)),null!=(i=t.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){dp.__e(t,e)}i.base=i.__P=null,t.__c=void 0}if(i=t.__k)for(r=0;r<i.length;r++)i[r]&&Fp(i[r],e,n||"function"!=typeof t.type);n||null==t.__e||bp(t.__e),t.__=t.__e=t.__d=void 0}function Lp(t,e,n){return this.constructor(t,n)}function Bp(t,e,n){var i,r,o;dp.__&&dp.__(t,e),r=(i="function"==typeof n)?null:n&&n.__k||e.__k,o=[],jp(e,t=(!i&&n||e).__k=wp(_p,null,[t]),r||mp,mp,void 0!==e.ownerSVGElement,!i&&n?[n]:r?null:e.firstChild?hp.call(e.childNodes):null,o,!i&&n?n:r?r.__e:e.firstChild,i),Pp(o,t)}function Hp(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{createElement:e=document.createElement.bind(document)}=t;let n,i,r=Cf();const o={transform:void 0},a=Nf();return a.element=()=>n,a.root=()=>n,a.settings=t=>(t&&Object.keys(o).forEach((e=>{void 0!==t[e]&&(o[e]=t[e])})),o),a.appendTo=t=>(n||(n=e("div"),n.style.position="absolute",n.style["-webkit-font-smoothing"]="antialiased",n.style["-moz-osx-font-smoothing"]="antialiased",n.style.pointerEvents="none"),t.appendChild(n),n),a.render=t=>{if(!n)return!1;const e="function"==typeof o.transform&&o.transform();if(e){const{a:t,b:i,c:r,d:o,e:a,f:s}=e;return n.style.transform="matrix(".concat(t,", ").concat(i,", ").concat(r,", ").concat(o,", ").concat(a,", ").concat(s,")"),!0}let a;return n.style.transform="",n.style.left="".concat(r.computedPhysical.x,"px"),n.style.top="".concat(r.computedPhysical.y,"px"),n.style.width="".concat(r.computedPhysical.width,"px"),n.style.height="".concat(r.computedPhysical.height,"px"),a=Array.isArray(t)?wp("div",null,t):t,i=Bp(a,n,i),!0},a.renderArgs=[wp],a.clear=()=>{if(n){let t=n.firstChild;for(;t;)n.removeChild(t),t=n.firstChild;i=null}return a},a.destroy=()=>{n&&n.parentElement&&n.parentElement.removeChild(n),n=null,i=null},a.size=t=>(t&&(r=Cf(t)),r),a}hp=yp.slice,dp={__e:function(t,e,n,i){for(var r,o,a;e=e.__;)if((r=e.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(t)),a=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(t,i||{}),a=r.__d),a)return r.__E=r}catch(e){t=e}throw t}},fp=0,Mp.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=xp({},this.state),"function"==typeof t&&(t=t(xp({},n),this.props)),t&&xp(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),Np(this))},Mp.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Np(this))},Mp.prototype.render=_p,pp=[],Rp.__r=0;var $p=[function(t){t.renderer("svg",up)},function(t){t.renderer("canvas",Ff)},function(t){t.renderer("dom",Hp)}];const Vp={OFF:0,ERROR:1,WARN:2,INFO:3,DEBUG:4},Wp=function(){let{level:t=Vp.OFF,pipe:e=console}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t;const i={[Vp.OFF]:()=>{},[Vp.ERROR]:function(){return e.error(...arguments)},[Vp.WARN]:function(){return e.warn(...arguments)},[Vp.INFO]:function(){return e.info(...arguments)},[Vp.DEBUG]:function(){return e.log(...arguments)}},r=function(t){if(t&&!(n<t)){for(var e=arguments.length,r=new Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];(i[t]||i[Vp.DEBUG])(...r)}};return{log:r,error:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r(Vp.ERROR,...e)},warn:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r(Vp.WARN,...e)},info:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r(Vp.INFO,...e)},debug:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r(Vp.DEBUG,...e)},level:t=>("number"==typeof t&&(n=t),n),LOG_LEVEL:Vp}};function Up(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;t(n,e)}const Yp=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=Wp(e.logger),r={component:$t(n.component,"component",i),data:$t(n.data,"data",i),formatter:$t(n.formatter,"formatter",i),interaction:$t(n.interaction,"interaction",i),renderer:el(n.renderer),scale:$t(n.scale,"scale",i),symbol:$t(n.symbol,"symbol",i),logger:i};function o(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i={palettes:e.palettes.concat(n.palettes||[]),style:_({},e.style,n.style),logger:n.logger||e.logger,renderer:n.renderer||e.renderer};return t(i,r)}return e.renderer&&e.renderer.prio&&r.renderer.default(e.renderer.prio[0]),o.use=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Up(t,e,r)},o.chart=t=>tl(t,{registries:r,logger:i,style:e.style,palettes:e.palettes}),o.config=()=>e,Object.keys(r).forEach((t=>{o[t]=r[t]})),o.version=M,o}({renderer:{prio:["svg","canvas"]},logger:{level:0},style:{"$font-family":"'Source Sans Pro', Arial, sans-serif","$font-size":"12px","$line-height":"16px","$font-size--l":"16px","$font-weight":"normal","$gray-100":"#ffffff","$gray-98":"#f9f9f9","$gray-95":"#f2f2f2","$gray-90":"#e6e6e6","$gray-35":"#595959","$gray-30":"#4d4d4d","$gray-25":"#404040","$gray-20":"#333333","$border-95":"rgba(255, 255, 255, 0.05)","$border-90":"rgba(255, 255, 255, 0.1)","$border-80":"rgba(255, 255, 255, 0.2)","$border-20":"rgba(0, 0, 0, 0.2)","$border-10":"rgba(0, 0, 0, 0.1)","$border-5":"rgba(0, 0, 0, 0.05)","$primary-blue":"#3F8AB3","$primary-green":"#6CB33F","$primary-red":"#DC423F","$primary-orange":"#EF960F","$spacing--s":4,$spacing:8,"$spacing--l":12,"$font-color":"$gray-35","$font-color--inverted":"$gray-90","$guide-color":"$gray-90","$guide-color--inverted":"$gray-35",$border:"$border-80","$border--inverted":"$border-10",$shape:{fill:"$primary-blue",strokeWidth:1,stroke:"$border"},"$shape-outline":{stroke:"$primary-blue",strokeWidth:2},"$shape-guide":{stroke:"$guide-color",strokeWidth:1},"$shape-guide--inverted":{"@extend":"$shape-guide",stroke:"$guide-color--inverted"},$label:{fontSize:"$font-size",fontFamily:"$font-family",fill:"$font-color"},"$label--inverted":{$extend:"$label",fill:"$font-color--inverted"},"$label-overlay":{fontSize:"$font-size--l",fontFamily:"$font-family",fill:"$gray-100",color:"$font-color",stroke:"$guide-color--inverted",strokeWidth:1,borderRadius:4},$title:{"@extend":"$label",fontSize:"$font-size--l",fontWeight:"$font-weight",stroke:"$guide-color--inverted",strokeWidth:0},"$guide-line":{strokeWidth:1,stroke:"$guide-color"},"$guide-line--minor":{strokeWidth:1,stroke:"$gray-95"},"$padding--s":{left:"$spacing--s",right:"$spacing--s",top:"$spacing--s",bottom:"$spacing--s"},$padding:{left:"$spacing",right:"$spacing",top:"$spacing",bottom:"$spacing"},"$selection-area-target":{fill:"$primary-green",strokeWidth:0,opacity:.2}},palettes:[{key:"categorical",colors:[["#a54343","#d76c6c","#ec983d","#ecc43d","#f9ec86","#cbe989","#70ba6e","#578b60","#79d69f","#26a0a7","#138185","#65d3da"]]},{key:"diverging",colors:[["#3d52a1","#3a89c9","#77b7e5","#b4ddf7","#e6f5fe","#ffe3aa","#f9bd7e","#ed875e","#d24d3e","#ae1c3e"]]},{key:"sequential",colors:[["rgb(180,221,212)","rgb(34, 83, 90)"]]}]},{component:nl,data:ll,formatter:pi,interaction:cl,renderer:el(),scale:Ao,symbol:Ha});function Xp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function Kp(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Xp(Object(n),!0).forEach((function(e){Gp(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xp(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Gp(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;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:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}sd.forEach(Yp.use),$p.forEach(Yp.use),[].forEach(Yp.use);var Zp=Object.prototype.hasOwnProperty,Jp=Object.prototype.toString,Qp=Object.defineProperty,tg=Object.getOwnPropertyDescriptor,eg=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===Jp.call(t)},ng=function(t){if(!t||"[object Object]"!==Jp.call(t))return!1;var e,n=Zp.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&Zp.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;for(e in t);return void 0===e||Zp.call(t,e)},ig=function(t,e){Qp&&"__proto__"===e.name?Qp(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},rg=function(t,e){if("__proto__"===e){if(!Zp.call(t,e))return;if(tg)return tg(t,e).value}return t[e]},og=function t(){var e,n,i,r,o,a,s=arguments[0],l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),(null==s||"object"!=typeof s&&"function"!=typeof s)&&(s={});l<c;++l)if(null!=(e=arguments[l]))for(n in e)i=rg(s,n),s!==(r=rg(e,n))&&(u&&r&&(ng(r)||(o=eg(r)))?(o?(o=!1,a=i&&eg(i)?i:[]):a=i&&ng(i)?i:{},ig(s,{name:n,newValue:t(u,a,r)})):void 0!==r&&ig(s,{name:n,newValue:r}));return s};function ag(t,e,n){if(!t)return-1;const i=n.cache,r=t.origin?t.origin():null;r&&(t=r);let o=i.fields.indexOf(t),a=-1,s=-1;if(-1===o)for(let e=0;e<i.wrappedFields.length;e++)if(s=i.wrappedFields[e].attrDims.map((t=>t.instance)).indexOf(t),a=i.wrappedFields[e].attrExps.map((t=>t.instance)).indexOf(t),-1!==s||-1!==a){o=e;break}return o-=e.qArea.qLeft,o<0||o>=e.qArea.qWidth?-1:s>=0?t=>t[o].qAttrDims.qValues[s]:a>=0?t=>t[o].qAttrExps.qValues[a]:t=>t[o]}function sg(t,e,n){let{key:i}=n;const r={value:"function"==typeof t.value?t.value(e):void 0!==t.value?t.value:e};return r.label="function"==typeof t.label?t.label(e):void 0!==t.label?String(t.label):String(r.value),t.field&&(r.source={key:i,field:t.field.key()}),r}function lg(t){let{cache:e,f:n,mainCell:i,p:r,prop:o,page:a,rowIdx:s,row:l,sourceKey:c,target:u,targetProp:h}=t,d=i;if(r.field&&r.field!==n){const t=ag(r.field,a,{cache:e});if(-1===t)return;d=og({qRow:s},t(l))}u[h]=sg(r,d,{key:c})}function cg(t,e,n,i){const r=Array.isArray(t)?t:[t];let o=[];for(let t=0;t<r.length;t++)if(void 0!==r[t].field){const a=e.raw(),s=e.key(),l="object"==typeof r[t].field?r[t].field:e.field(r[t].field),{props:c,main:u}=i.normalizeConfig(r[t],e),h=Object.keys(c),d=!!r[t].trackBy,f=typeof r[t].trackBy,p={},g=[],m=[];for(let e=0;e<a.qDataPages.length;e++){const o=ag(l,a.qDataPages[e],{cache:n});if(-1!==o)for(let y=0;y<a.qDataPages[e].qMatrix.length;y++){const v=a.qDataPages[e].qArea.qTop+y,x=og({qRow:v},o(a.qDataPages[e].qMatrix[y])),b=sg(u,x,{key:s});if(!(u.filter&&!u.filter(x))){for(let t=0;t<h.length;t++){const i=c[h[t]];let r=i.fields||[i];i.fields&&(b[h[t]]=[]);for(let o=0;o<r.length;o++)lg({cache:n,f:l,mainCell:x,p:r[o],prop:h[t],props:c,page:a.qDataPages[e],rowIdx:v,row:a.qDataPages[e].qMatrix[y],sourceKey:s,target:i.fields?b[h[t]]:b,targetProp:i.fields?o:h[t]});if(i.fields){const e=b[h[t]].map((t=>t.value)),n=b[h[t]].map((t=>t.label));b[h[t]]={value:"function"==typeof i.value?i.value(e):void 0!==i.value?i.value:e,label:"function"==typeof i.label?i.label(n):void 0!==i.label?String(i.label):String(b[h[t]].value)}}}d&&i.track({cfg:r[t],itemData:x,obj:b,target:g,tracker:p,trackType:f}),m.push(b)}}}const y=d?i.collect(g,{main:u,propsArr:h,props:c}):m;o=[...o,...y]}return o}function ug(t){var e=0,n=t.children,i=n&&n.length;if(i)for(;--i>=0;)e+=n[i].value;else e=1;t.value=e}function hg(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=fg)):void 0===e&&(e=dg);for(var n,i,r,o,a,s=new mg(t),l=[s];n=l.pop();)if((r=e(n.data))&&(a=(r=Array.from(r)).length))for(n.children=r,o=a-1;o>=0;--o)l.push(i=r[o]=new mg(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(gg)}function dg(t){return t.children}function fg(t){return Array.isArray(t)?t[1]:null}function pg(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function gg(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function mg(t){this.data=t,this.depth=this.height=0,this.parent=null}function yg(t){return null==t?null:function(t){if("function"!=typeof t)throw new Error;return t}(t)}mg.prototype=hg.prototype={constructor:mg,count:function(){return this.eachAfter(ug)},each:function(t,e){let n=-1;for(const i of this)t.call(e,i,++n,this);return this},eachAfter:function(t,e){for(var n,i,r,o=this,a=[o],s=[],l=-1;o=a.pop();)if(s.push(o),n=o.children)for(i=0,r=n.length;i<r;++i)a.push(n[i]);for(;o=s.pop();)t.call(e,o,++l,this);return this},eachBefore:function(t,e){for(var n,i,r=this,o=[r],a=-1;r=o.pop();)if(t.call(e,r,++a,this),n=r.children)for(i=n.length-1;i>=0;--i)o.push(n[i]);return this},find:function(t,e){let n=-1;for(const i of this)if(t.call(e,i,++n,this))return i},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,i=e.children,r=i&&i.length;--r>=0;)n+=i[r].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),i=e.ancestors(),r=null;t=n.pop(),e=i.pop();for(;t===e;)r=t,t=n.pop(),e=i.pop();return r}(e,t),i=[e];e!==n;)e=e.parent,i.push(e);for(var r=i.length;t!==n;)i.splice(r,0,t),t=t.parent;return i},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return hg(this).eachBefore(pg)},[Symbol.iterator]:function*(){var t,e,n,i,r=this,o=[r];do{for(t=o.reverse(),o=[];r=t.pop();)if(yield r,e=r.children)for(n=0,i=e.length;n<i;++n)o.push(e[n])}while(o.length)}};var vg={depth:-1},xg={},bg={};function wg(t){return t.id}function kg(t){return t.parentId}function _g(){var t,e=wg,n=kg;function i(i){var r,o,a,s,l,c,u,h,d=Array.from(i),f=e,p=n,g=new Map;if(null!=t){const e=d.map(((e,n)=>function(t){let e=(t=""+t).length;Sg(t,e-1)&&!Sg(t,e-2)&&(t=t.slice(0,-1));return"/"===t[0]?t:"/"+t}(t(e,n,i)))),n=e.map(Mg),r=new Set(e).add("");for(const t of n)r.has(t)||(r.add(t),e.push(t),n.push(Mg(t)),d.push(bg));f=(t,n)=>e[n],p=(t,e)=>n[e]}for(a=0,r=d.length;a<r;++a)o=d[a],c=d[a]=new mg(o),null!=(u=f(o,a,i))&&(u+="")&&(h=c.id=u,g.set(h,g.has(h)?xg:c)),null!=(u=p(o,a,i))&&(u+="")&&(c.parent=u);for(a=0;a<r;++a)if(u=(c=d[a]).parent){if(!(l=g.get(u)))throw new Error("missing: "+u);if(l===xg)throw new Error("ambiguous: "+u);l.children?l.children.push(c):l.children=[c],c.parent=l}else{if(s)throw new Error("multiple roots");s=c}if(!s)throw new Error("no root");if(null!=t){for(;s.data===bg&&1===s.children.length;)s=s.children[0],--r;for(let t=d.length-1;t>=0&&(c=d[t]).data===bg;--t)c.data=null}if(s.parent=vg,s.eachBefore((function(t){t.depth=t.parent.depth+1,--r})).eachBefore(gg),s.parent=null,r>0)throw new Error("cycle");return s}return i.id=function(t){return arguments.length?(e=yg(t),i):e},i.parentId=function(t){return arguments.length?(n=yg(t),i):n},i.path=function(e){return arguments.length?(t=yg(e),i):t},i}function Mg(t){let e=t.length;if(e<2)return"";for(;--e>1&&!Sg(t,e););return t.slice(0,e)}function Sg(t,e){if("/"===t[e]){let n=0;for(;e>0&&"\\"===t[--e];)++n;if(0==(1&n))return!0}return!1}function Cg(t,e){"/"===t.charAt(0)&&(t=t.substring(1));const n=t.split("/");let i,r=e;for(let t=0;t<n.length;t++){if("*"===n[t]&&Array.isArray(r)){const e=[];i=n.slice(t+1).join("/");for(let t=0;t<r.length;t++){let n=Cg(i,r[t]);Array.isArray(n)?e.push(...n):e.push(n)}return e}if(!n[t]&&Array.isArray(r)){const e=new Array(r.length);i=n.slice(t+1).join("/");for(let t=0;t<r.length;t++)e[t]=Cg(i,r[t]);return e}n[t]in r&&(r=r[n[t]])}return r}function Ng(t,e,n){let i=[];if(!t||!t.length)return i;if(e<=0){const e=n>=0?[t[n]]:t;i=[...i,...e]}else for(let r=0;r<t.length;r++)t[r].children&&t[r].children.length&&(i=[...i,...Ng(t[r].children,e-1,n)]);return i}function Rg(t,e,n){if(t===e)return t=>t;if(t>e){const n=Math.max(0,Math.min(100,t-e));return t=>{let e=t;for(let t=0;t<n;++t)e=e.parent;return e}}if(e>t){const i=Math.max(0,Math.min(100,e-t));return t=>Ng(t.children,i-1,n)}return!1}function qg(t,e){let{cache:n}=e;if("number"==typeof t)return n.fields[t];const i=n.allFields;if("function"==typeof t){for(let e=0;e<i.length;e++)if(t(i[e]))return i[e];return!1}if("string"==typeof t){for(let e=0;e<i.length;e++)if(i[e].key()===t||i[e].title()===t)return i[e]}else if(t&&-1!==i.indexOf(t))return t;throw Error("Field not found: ".concat(t))}const Ag=/^qDimensionInfo(?:\/(\d+))?/,Dg=/^\/?qMeasureInfo\/(\d+)/,Eg=/\/qAttrExprInfo\/(\d+)/,Og=/\/qAttrDimInfo\/(\d+)/;function Ig(t){return(t.qColumnOrder&&t.qColumnOrder.length?t.qColumnOrder:t.qDimensionInfo.map(((t,e)=>e))).filter((e=>e<t.qDimensionInfo.length))}function Tg(t,e){let{cube:n}=e;if(!t)return-1;let i=t.origin&&t.origin()?t.origin().key():t.key(),r=!1,o=-1,a=-1,s=-1,l=-1,c=-1,u=-1,h=i;const d=n.qEffectiveInterColumnSortOrder,f=Ig(n);return Ag.test(h)&&(r=!0,o=+Ag.exec(h)[1],h=i.replace(Ag,"")),Dg.test(h)&&("K"===n.qMode?c=+Dg.exec(h)[1]:d&&-1!==d.indexOf(-1)?(c=+Dg.exec(h)[1],u=0):u=+Dg.exec(h)[1],h=h.replace(Dg,"")),h&&(Og.exec(h)?s=+Og.exec(h)[1]:Eg.exec(h)&&(a=+Eg.exec(h)[1])),l=r?"S"===n.qMode?f[o]:d?d.indexOf(o):o:d&&-1!==d.indexOf(-1)?d.indexOf(-1):n.qDimensionInfo.length-("K"===n.qMode?0:1),{fieldDepth:l+1,pseudoMeasureIndex:c,measureIdx:u,attrDimIdx:s,attrIdx:a}}function jg(t,e){let n,i,r=Rg(t.fieldDepth,e.fieldDepth,e.pseudoMeasureIndex);return n=e.measureIdx>=0?t=>t.data.qValues[e.measureIdx]:t=>t.data,e.attrDimIdx>=0?i=t=>{var n;return null==t||null===(n=t.qAttrDims)||void 0===n?void 0:n.qValues[e.attrDimIdx]}:e.attrIdx>=0&&(i=t=>{var n;return null==t||null===(n=t.qAttrExps)||void 0===n?void 0:n.qValues[e.attrIdx]}),{nodeFn:r,attrFn:i,valueFn:n}}function Pg(t,e,n){let{key:i}=n;const r={value:"function"==typeof t.value?t.value(e):void 0!==t.value?t.value:e};return r.label="function"==typeof t.label?t.label(e):void 0!==t.label?String(t.label):String(r.value),t.field&&(r.source={key:i,field:t.field.key()}),r}function zg(t){let{propsArr:e,props:n,item:i,itemData:r,ret:o,sourceKey:a}=t;for(let t=0;t<e.length;t++){const s=n[e[t]],l=s.fields||[s];let c,u;s.fields&&(c=[],u=[]);for(let n=0;n<l.length;n++){const h=l[n];let d,f,p,g,m,y;if("primitive"===h.type?(p=h.value,y=String(h.value)):("function"==typeof h.value&&(d=t=>h.value(t,i)),"function"==typeof h.label&&(f=t=>h.label(t,i)),h.accessor?(g=h.accessor(i),Array.isArray(g)?(m=g.map(h.valueAccessor),h.attrAccessor&&(m=m.map(h.attrAccessor)),d&&(p=m.map(d),d=null),f&&(y=m.map(f),f=null),p=h.reduce?h.reduce(p):p,y=h.reduceLabel?h.reduceLabel(y,p):String(p)):(p=h.attrAccessor?h.attrAccessor(h.valueAccessor(g)):h.valueAccessor(g),y=p)):(p=r,y=r)),s.fields){const t=d?d(p):p;c.push(t),u.push(f&&null!=y?f(y):null!=y?y:String(t))}else{const n=d?d(p):p;o[e[t]]={value:n,label:f?f(y):null!=y?y:String(n)},h.field&&(o[e[t]].source={field:h.field.key(),key:a})}}c&&(o[e[t]]={value:"function"==typeof s.value?s.value(c,i):c,label:"function"==typeof s.label?s.label(u,i):u})}}const Fg=(t,e,n)=>{const i="K"===t.qMode?"/qStackedDataPages/*/qData":"/qTreeDataPages/*",r="K"===t.qMode?"qSubNodes":"qNodes",o=Cg(i,t);return o&&o[0]?(e.tree=hg(o[0],n.children||(t=>t[r])),e.tree):null};function Lg(t){const e=t.raw().qDataPages.length?t.raw().qDataPages[0].qMatrix:[],n=function(t){const e=t.raw().qColumnOrder,n=t.fields();return e&&e.length===n.length?e:n.map(((t,e)=>e))}(t),i=t.fields(),r=t.fields().filter((t=>"dimension"===t.type())).map((t=>n.indexOf(i.indexOf(t)))),o=t.fields().filter((t=>"measure"===t.type())).map((t=>n.indexOf(i.indexOf(t)))),a={__root:{__id:"__root",qValues:[]}};for(let t=0;t<e.length;t++){const n=e[t];let i="__root",l=!1;for(let t=0;t<r.length;t++){var s;const e=n[r[t]],o="".concat(i,"__").concat(null!==(s=e.qElemNumber)&&void 0!==s?s:e.qElemNo);a[o]||(a[o]=Kp({__id:o,__parent:i,qValues:[]},e),l=!0),i=o}if(l)for(let t=0;t<o.length;t++){const e=n[o[t]];a[i].qValues.push(e)}}const l=Object.keys(a).map((t=>a[t]));return _g().id((t=>t.__id)).parentId((t=>t.__parent))(l)}const Bg=t=>{let{propsArr:e,props:n,cube:i,cache:r,itemDepthObject:o,f:a}=t;for(let t=0;t<e.length;t++){const s=n[e[t]],l=s.fields?s.fields:[s];for(let t=0;t<l.length;t++){const e=l[t];if(e.field!==a){const t=jg(o,Tg(e.field,{cube:i,cache:r}));e.accessor=t.nodeFn,e.valueAccessor=t.valueFn,e.attrAccessor=t.attrFn}}}};function Hg(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;const r=e.raw(),o=e.key(),a="S"===r.qMode?Lg(e):Fg(r,n,t);if(!a)return null;const s=a.height,l=[];for(let o=0;o<=s;o++){let a=null;if(o>0)if("S"===r.qMode){let t=Ig(r)[o-1];a=n.fields[t]}else{let t=r.qEffectiveInterColumnSortOrder[o-1];o>r.qEffectiveInterColumnSortOrder.length&&(t=r.qDimensionInfo.length),a=n.fields[t]}const{props:s,main:c}=i.normalizeConfig(Kp(Kp({},t),{},{field:a?a.key():void 0}),e),u=Object.keys(s);l[o]={propsArr:u,props:s,main:c};const h=a?Tg(a,{cube:r,cache:n}):{fieldDepth:0};Bg({propsArr:u,props:s,cube:r,cache:n,itemDepthObject:h,f:a})}const c=a.copy(),u=c.descendants(),h=a.descendants();for(let t=0;t<h.length;t++){const e=l[h[t].depth].propsArr,n=l[h[t].depth].props,i=l[h[t].depth].main,r=u[t],a=r.data,s=Pg(i,a,{key:o});zg({propsArr:e,props:n,item:r,itemData:a,ret:s,sourceKey:o,isTree:!0}),h[t].data=s}return a}function $g(t,e,n,i){const r=Array.isArray(t)?t:[t];let o=[];for(let a=0;a<r.length;a++)if(void 0!==r[a].field){const s=e.raw(),l=e.key();if(!Fg(s,n,t))continue;const c="object"==typeof r[a].field?r[a].field:e.field(r[a].field),{props:u,main:h}=i.normalizeConfig(r[a],e),d=Object.keys(u),f=Tg(c,{cube:s,cache:n}),{nodeFn:p,attrFn:g,valueFn:m}=jg({fieldDepth:0},f);Bg({propsArr:d,props:u,cube:s,cache:n,itemDepthObject:f,f:c});const y=!!r[a].trackBy,v=typeof r[a].trackBy,x={},b=[],w=p(n.tree),k=[];for(let t=0;t<w.length;t++){const e=w[t],n=g?g(m(e)):m(e);if(h.filter&&!h.filter(n))continue;const o=Pg(h,n,{key:l});zg({propsArr:d,props:u,item:e,itemData:n,ret:o,sourceKey:l}),y&&i.track({cfg:r[a],itemData:n,obj:o,target:b,tracker:x,trackType:v}),k.push(o)}const _=y?i.collect(b,{main:h,propsArr:d,props:u}):k;o=[...o,..._]}return o}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var Vg=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){
7
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@nebula.js/stardust")):"function"==typeof define&&define.amd?define(["@nebula.js/stardust"],e):(t="undefined"!=typeof globalThis?globalThis:t||self)["sn-funnel-chart"]=e(t.stardust)}(this,(function(t){"use strict";var e={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=/([astvzqmhlc])([^astvzqmhlc]*)/gi,i=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;var r=function(t){var r=[],o=String(t).trim();return"M"!==o[0]&&"m"!==o[0]||o.replace(n,(function(t,n,o){var a=n.toLowerCase(),s=function(t){var e=t.match(i);return e?e.map(Number):[]}(o),l=n;if("m"===a&&s.length>2&&(r.push([l].concat(s.splice(0,2))),a="l",l="m"===l?"l":"L"),s.length<e[a])return"";for(r.push([l].concat(s.splice(0,e[a])));s.length>=e[a]&&s.length&&e[a];)r.push([l].concat(s.splice(0,e[a])));return""})),r};function o(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function a(t){return function(t){if(Array.isArray(t))return s(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 s(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(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 s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var l=r;function c(t,e){var n=t.x*Math.cos(e)-t.y*Math.sin(e),i=t.y*Math.cos(e)+t.x*Math.sin(e);t.x=n,t.y=i}function u(t,e,n){t.x+=e,t.y+=n}function h(t,e){t.x*=e,t.y*=e}var d=r,f=function(t){if(void 0!==t&&t.CanvasRenderingContext2D&&(!t.Path2D||!function(t){var e=t.document.createElement("canvas").getContext("2d"),n=new t.Path2D("M0 0 L1 1");return e.strokeStyle="red",e.lineWidth=1,e.stroke(n),255===e.getImageData(0,0,1,1).data[0]}(t))){var e=function(){function t(e){var n;(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.segments=[],e&&e instanceof t)?(n=this.segments).push.apply(n,a(e.segments)):e&&(this.segments=l(e))}var e,n,i;return e=t,(n=[{key:"addPath",value:function(e){var n;e&&e instanceof t&&(n=this.segments).push.apply(n,a(e.segments))}},{key:"moveTo",value:function(t,e){this.segments.push(["M",t,e])}},{key:"lineTo",value:function(t,e){this.segments.push(["L",t,e])}},{key:"arc",value:function(t,e,n,i,r,o){this.segments.push(["AC",t,e,n,i,r,!!o])}},{key:"arcTo",value:function(t,e,n,i,r){this.segments.push(["AT",t,e,n,i,r])}},{key:"ellipse",value:function(t,e,n,i,r,o,a,s){this.segments.push(["E",t,e,n,i,r,o,a,!!s])}},{key:"closePath",value:function(){this.segments.push(["Z"])}},{key:"bezierCurveTo",value:function(t,e,n,i,r,o){this.segments.push(["C",t,e,n,i,r,o])}},{key:"quadraticCurveTo",value:function(t,e,n,i){this.segments.push(["Q",t,e,n,i])}},{key:"rect",value:function(t,e,n,i){this.segments.push(["R",t,e,n,i])}}])&&o(e.prototype,n),i&&o(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),n=t.CanvasRenderingContext2D.prototype.fill,i=t.CanvasRenderingContext2D.prototype.stroke;t.CanvasRenderingContext2D.prototype.fill=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var r="nonzero";if(0===e.length||1===e.length&&"string"==typeof e[0])n.apply(this,e);else{2===arguments.length&&(r=e[1]);var o=e[0];s(this,o.segments),n.call(this,r)}},t.CanvasRenderingContext2D.prototype.stroke=function(t){t?(s(this,t.segments),i.call(this)):i.call(this)};var r=t.CanvasRenderingContext2D.prototype.isPointInPath;t.CanvasRenderingContext2D.prototype.isPointInPath=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if("Path2D"===e[0].constructor.name){var i=e[1],o=e[2],a=e[3]||"nonzero",l=e[0];return s(this,l.segments),r.apply(this,[i,o,a])}return r.apply(this,e)},t.Path2D=e}function s(t,e){var n,i,r,o,a,s,l,d,f,p,g,m,y,v,x,b,w,k,_,M,S,C,q,N,R,A,O={x:0,y:0},D={x:0,y:0};t.beginPath();for(var E=0;E<e.length;++E){var I=e[E];switch("S"!==(M=I[0])&&"s"!==M&&"C"!==M&&"c"!==M&&(C=null,q=null),"T"!==M&&"t"!==M&&"Q"!==M&&"q"!==M&&(N=null,R=null),M){case"m":case"M":"m"===M?(g+=I[1],y+=I[2]):(g=I[1],y=I[2]),"M"!==M&&O||(O={x:g,y:y}),t.moveTo(g,y);break;case"l":g+=I[1],y+=I[2],t.lineTo(g,y);break;case"L":g=I[1],y=I[2],t.lineTo(g,y);break;case"H":g=I[1],t.lineTo(g,y);break;case"h":g+=I[1],t.lineTo(g,y);break;case"V":y=I[1],t.lineTo(g,y);break;case"v":y+=I[1],t.lineTo(g,y);break;case"a":case"A":"a"===M?(g+=I[6],y+=I[7]):(g=I[6],y=I[7]),b=I[1],w=I[2],l=I[3]*Math.PI/180,r=!!I[4],o=!!I[5],a={x:g,y:y},c(s={x:(D.x-a.x)/2,y:(D.y-a.y)/2},-l),(d=s.x*s.x/(b*b)+s.y*s.y/(w*w))>1&&(b*=d=Math.sqrt(d),w*=d),f=b*b*w*w,p=b*b*s.y*s.y+w*w*s.x*s.x,h(S={x:b*s.y/w,y:-w*s.x/b},o!==r?Math.sqrt((f-p)/p)||0:-Math.sqrt((f-p)/p)||0),i=Math.atan2((s.y-S.y)/w,(s.x-S.x)/b),n=Math.atan2(-(s.y+S.y)/w,-(s.x+S.x)/b),c(S,l),u(S,(a.x+D.x)/2,(a.y+D.y)/2),t.save(),t.translate(S.x,S.y),t.rotate(l),t.scale(b,w),t.arc(0,0,1,i,n,!o),t.restore();break;case"C":C=I[3],q=I[4],g=I[5],y=I[6],t.bezierCurveTo(I[1],I[2],C,q,g,y);break;case"c":t.bezierCurveTo(I[1]+g,I[2]+y,I[3]+g,I[4]+y,I[5]+g,I[6]+y),C=I[3]+g,q=I[4]+y,g+=I[5],y+=I[6];break;case"S":null!==C&&null!==q||(C=g,q=y),t.bezierCurveTo(2*g-C,2*y-q,I[1],I[2],I[3],I[4]),C=I[1],q=I[2],g=I[3],y=I[4];break;case"s":null!==C&&null!==q||(C=g,q=y),t.bezierCurveTo(2*g-C,2*y-q,I[1]+g,I[2]+y,I[3]+g,I[4]+y),C=I[1]+g,q=I[2]+y,g+=I[3],y+=I[4];break;case"Q":N=I[1],R=I[2],g=I[3],y=I[4],t.quadraticCurveTo(N,R,g,y);break;case"q":N=I[1]+g,R=I[2]+y,g+=I[3],y+=I[4],t.quadraticCurveTo(N,R,g,y);break;case"T":null!==N&&null!==R||(N=g,R=y),N=2*g-N,R=2*y-R,g=I[1],y=I[2],t.quadraticCurveTo(N,R,g,y);break;case"t":null!==N&&null!==R||(N=g,R=y),N=2*g-N,R=2*y-R,g+=I[1],y+=I[2],t.quadraticCurveTo(N,R,g,y);break;case"z":case"Z":g=O.x,y=O.y,O=void 0,t.closePath();break;case"AC":g=I[1],y=I[2],x=I[3],i=I[4],n=I[5],A=I[6],t.arc(g,y,x,i,n,A);break;case"AT":m=I[1],v=I[2],g=I[3],y=I[4],x=I[5],t.arcTo(m,v,g,y,x);break;case"E":g=I[1],y=I[2],b=I[3],w=I[4],l=I[5],i=I[6],n=I[7],A=I[8],t.save(),t.translate(g,y),t.rotate(l),t.scale(b,w),t.arc(0,0,1,i,n,A),t.restore();break;case"R":g=I[1],y=I[2],k=I[3],_=I[4],O={x:g,y:y},t.rect(g,y,k,_)}D.x=g,D.y=y}}};"undefined"!=typeof window&&f(window);var p={path2dPolyfill:f,parsePath:d},g=Object.prototype.hasOwnProperty,m=Object.prototype.toString,y=Object.defineProperty,v=Object.getOwnPropertyDescriptor,x=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===m.call(t)},b=function(t){if(!t||"[object Object]"!==m.call(t))return!1;var e,n=g.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&g.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;for(e in t);return void 0===e||g.call(t,e)},w=function(t,e){y&&"__proto__"===e.name?y(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},k=function(t,e){if("__proto__"===e){if(!g.call(t,e))return;if(v)return v(t,e).value}return t[e]},_=function t(){var e,n,i,r,o,a,s=arguments[0],l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),(null==s||"object"!=typeof s&&"function"!=typeof s)&&(s={});l<c;++l)if(null!=(e=arguments[l]))for(n in e)i=k(s,n),s!==(r=k(e,n))&&(u&&r&&(b(r)||(o=x(r)))?(o?(o=!1,a=i&&x(i)?i:[]):a=i&&b(i)?i:{},w(s,{name:n,newValue:t(u,a,r)})):void 0!==r&&w(s,{name:n,newValue:r}));return s},M="2.2.2";function S(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function C(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?S(Object(n),!0).forEach((function(e){q(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function q(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;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:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function N(t){return!!t.changedTouches}function R(t){return"number"==typeof t&&!isNaN(t)}function A(t){return"number"!=typeof t||isNaN(t)}function O(t){const e=t.length;let n=NaN,i=NaN,r=NaN,o=NaN;for(let a=0;a<e;a++)n=isNaN(n)?t[a].x:Math.min(n,t[a].x),i=isNaN(i)?t[a].x:Math.max(i,t[a].x),r=isNaN(r)?t[a].y:Math.min(r,t[a].y),o=isNaN(o)?t[a].y:Math.max(o,t[a].y);return[n,r,i,o]}function D(t){return[{x:t.x1||0,y:t.y1||0},{x:t.x2||0,y:t.y2||0}]}function E(t){return[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}]}function I(t){const[e,n,i,r]=O(t);return{x:e,y:n,width:i-e,height:r-n}}function T(t){return{x1:t[0].x,y1:t[0].y,x2:t[1].x,y2:t[1].y}}function j(t){const{x:e,y:n,width:i,height:r,x1:o,x2:a,y1:s,y2:l,cx:c,cy:u,r:h,vertices:d}=t||{};return R(c)&&R(u)&&R(h)?"circle":R(o)&&R(a)&&R(s)&&R(l)?"line":R(e)&&R(n)&&R(i)&&R(r)?"rect":R(e)&&R(n)?"point":Array.isArray(d)?d.every((t=>Array.isArray(t)))?"geopolygon":"polygon":null}function P(t,e){return{x:e.x-t,y:e.y-t,width:e.width+t,height:e.height+t}}function z(t,e){let{types:n,logger:i}=e;const r={},o=[];Array.isArray(t)?o.push(...t):(i.warn('Deprecated: "data-source" configuration"'),o.push(t)),o.forEach(((t,e)=>{let o=n(t.type);if(o){let n=t.key;void 0===t.key&&(i.warn("Missing key for dataset. Using index '".concat(e,"' as key.")),n=e);let a=o({key:n,data:t.data,config:t.config});r[n]=a}}));return t=>t?r[t]:r[Object.keys(r)[0]]}var F=Math.PI,L=2*F,$=1e-6,B=L-$;function H(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function V(){return new H}function W(t){return function(){return t}}H.prototype=V.prototype={constructor:H,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,i){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(t,e,n,i,r,o){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+o)},arcTo:function(t,e,n,i,r){t=+t,e=+e,n=+n,i=+i,r=+r;var o=this._x1,a=this._y1,s=n-t,l=i-e,c=o-t,u=a-e,h=c*c+u*u;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(h>$)if(Math.abs(u*s-l*c)>$&&r){var d=n-o,f=i-a,p=s*s+l*l,g=d*d+f*f,m=Math.sqrt(p),y=Math.sqrt(h),v=r*Math.tan((F-Math.acos((p+h-g)/(2*m*y)))/2),x=v/y,b=v/m;Math.abs(x-1)>$&&(this._+="L"+(t+x*c)+","+(e+x*u)),this._+="A"+r+","+r+",0,0,"+ +(u*d>c*f)+","+(this._x1=t+b*s)+","+(this._y1=e+b*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,i,r,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(i),s=n*Math.sin(i),l=t+a,c=e+s,u=1^o,h=o?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+l+","+c:(Math.abs(this._x1-l)>$||Math.abs(this._y1-c)>$)&&(this._+="L"+l+","+c),n&&(h<0&&(h=h%L+L),h>B?this._+="A"+n+","+n+",0,1,"+u+","+(t-a)+","+(e-s)+"A"+n+","+n+",0,1,"+u+","+(this._x1=l)+","+(this._y1=c):h>$&&(this._+="A"+n+","+n+",0,"+ +(h>=F)+","+u+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};var U=Math.abs,Y=Math.atan2,X=Math.cos,K=Math.max,G=Math.min,Z=Math.sin,J=Math.sqrt,Q=1e-12,tt=Math.PI,et=tt/2,nt=2*tt;function it(t){return t>1?0:t<-1?tt:Math.acos(t)}function rt(t){return t>=1?et:t<=-1?-et:Math.asin(t)}function ot(t){return t.innerRadius}function at(t){return t.outerRadius}function st(t){return t.startAngle}function lt(t){return t.endAngle}function ct(t){return t&&t.padAngle}function ut(t,e,n,i,r,o,a,s){var l=n-t,c=i-e,u=a-r,h=s-o,d=h*l-u*c;if(!(d*d<Q))return[t+(d=(u*(e-o)-h*(t-r))/d)*l,e+d*c]}function ht(t,e,n,i,r,o,a){var s=t-n,l=e-i,c=(a?o:-o)/J(s*s+l*l),u=c*l,h=-c*s,d=t+u,f=e+h,p=n+u,g=i+h,m=(d+p)/2,y=(f+g)/2,v=p-d,x=g-f,b=v*v+x*x,w=r-o,k=d*g-p*f,_=(x<0?-1:1)*J(K(0,w*w*b-k*k)),M=(k*x-v*_)/b,S=(-k*v-x*_)/b,C=(k*x+v*_)/b,q=(-k*v+x*_)/b,N=M-m,R=S-y,A=C-m,O=q-y;return N*N+R*R>A*A+O*O&&(M=C,S=q),{cx:M,cy:S,x01:-u,y01:-h,x11:M*(r/w-1),y11:S*(r/w-1)}}function dt(){var t=ot,e=at,n=W(0),i=null,r=st,o=lt,a=ct,s=null;function l(){var l,c,u=+t.apply(this,arguments),h=+e.apply(this,arguments),d=r.apply(this,arguments)-et,f=o.apply(this,arguments)-et,p=U(f-d),g=f>d;if(s||(s=l=V()),h<u&&(c=h,h=u,u=c),h>Q)if(p>nt-Q)s.moveTo(h*X(d),h*Z(d)),s.arc(0,0,h,d,f,!g),u>Q&&(s.moveTo(u*X(f),u*Z(f)),s.arc(0,0,u,f,d,g));else{var m,y,v=d,x=f,b=d,w=f,k=p,_=p,M=a.apply(this,arguments)/2,S=M>Q&&(i?+i.apply(this,arguments):J(u*u+h*h)),C=G(U(h-u)/2,+n.apply(this,arguments)),q=C,N=C;if(S>Q){var R=rt(S/u*Z(M)),A=rt(S/h*Z(M));(k-=2*R)>Q?(b+=R*=g?1:-1,w-=R):(k=0,b=w=(d+f)/2),(_-=2*A)>Q?(v+=A*=g?1:-1,x-=A):(_=0,v=x=(d+f)/2)}var O=h*X(v),D=h*Z(v),E=u*X(w),I=u*Z(w);if(C>Q){var T,j=h*X(x),P=h*Z(x),z=u*X(b),F=u*Z(b);if(p<tt&&(T=ut(O,D,z,F,j,P,E,I))){var L=O-T[0],$=D-T[1],B=j-T[0],H=P-T[1],W=1/Z(it((L*B+$*H)/(J(L*L+$*$)*J(B*B+H*H)))/2),K=J(T[0]*T[0]+T[1]*T[1]);q=G(C,(u-K)/(W-1)),N=G(C,(h-K)/(W+1))}}_>Q?N>Q?(m=ht(z,F,O,D,h,N,g),y=ht(j,P,E,I,h,N,g),s.moveTo(m.cx+m.x01,m.cy+m.y01),N<C?s.arc(m.cx,m.cy,N,Y(m.y01,m.x01),Y(y.y01,y.x01),!g):(s.arc(m.cx,m.cy,N,Y(m.y01,m.x01),Y(m.y11,m.x11),!g),s.arc(0,0,h,Y(m.cy+m.y11,m.cx+m.x11),Y(y.cy+y.y11,y.cx+y.x11),!g),s.arc(y.cx,y.cy,N,Y(y.y11,y.x11),Y(y.y01,y.x01),!g))):(s.moveTo(O,D),s.arc(0,0,h,v,x,!g)):s.moveTo(O,D),u>Q&&k>Q?q>Q?(m=ht(E,I,j,P,u,-q,g),y=ht(O,D,z,F,u,-q,g),s.lineTo(m.cx+m.x01,m.cy+m.y01),q<C?s.arc(m.cx,m.cy,q,Y(m.y01,m.x01),Y(y.y01,y.x01),!g):(s.arc(m.cx,m.cy,q,Y(m.y01,m.x01),Y(m.y11,m.x11),!g),s.arc(0,0,u,Y(m.cy+m.y11,m.cx+m.x11),Y(y.cy+y.y11,y.cx+y.x11),g),s.arc(y.cx,y.cy,q,Y(y.y11,y.x11),Y(y.y01,y.x01),!g))):s.arc(0,0,u,w,b,g):s.lineTo(E,I)}else s.moveTo(0,0);if(s.closePath(),l)return s=null,l+""||null}return l.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,i=(+r.apply(this,arguments)+ +o.apply(this,arguments))/2-tt/2;return[X(i)*n,Z(i)*n]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:W(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:W(+t),l):e},l.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:W(+t),l):n},l.padRadius=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:W(+t),l):i},l.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:W(+t),l):r},l.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:W(+t),l):o},l.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:W(+t),l):a},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function ft(t){this._context=t}function pt(t){return new ft(t)}function gt(t){return t[0]}function mt(t){return t[1]}function yt(){var t=gt,e=null,n=W(0),i=mt,r=W(!0),o=null,a=pt,s=null;function l(l){var c,u,h,d,f,p=l.length,g=!1,m=new Array(p),y=new Array(p);for(null==o&&(s=a(f=V())),c=0;c<=p;++c){if(!(c<p&&r(d=l[c],c,l))===g)if(g=!g)u=c,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),h=c-1;h>=u;--h)s.point(m[h],y[h]);s.lineEnd(),s.areaEnd()}g&&(m[c]=+t(d,c,l),y[c]=+n(d,c,l),s.point(e?+e(d,c,l):m[c],i?+i(d,c,l):y[c]))}if(f)return s=null,f+""||null}function c(){return function(){var t=gt,e=mt,n=W(!0),i=null,r=pt,o=null;function a(a){var s,l,c,u=a.length,h=!1;for(null==i&&(o=r(c=V())),s=0;s<=u;++s)!(s<u&&n(l=a[s],s,a))===h&&((h=!h)?o.lineStart():o.lineEnd()),h&&o.point(+t(l,s,a),+e(l,s,a));if(c)return o=null,c+""||null}return a.x=function(e){return arguments.length?(t="function"==typeof e?e:W(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:W(+t),a):e},a.defined=function(t){return arguments.length?(n="function"==typeof t?t:W(!!t),a):n},a.curve=function(t){return arguments.length?(r=t,null!=i&&(o=r(i)),a):r},a.context=function(t){return arguments.length?(null==t?i=o=null:o=r(i=t),a):i},a}().defined(r).curve(a).context(o)}return l.x=function(n){return arguments.length?(t="function"==typeof n?n:W(+n),e=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:W(+e),l):t},l.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:W(+t),l):e},l.y=function(t){return arguments.length?(n="function"==typeof t?t:W(+t),i=null,l):n},l.y0=function(t){return arguments.length?(n="function"==typeof t?t:W(+t),l):n},l.y1=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:W(+t),l):i},l.lineX0=l.lineY0=function(){return c().x(t).y(n)},l.lineY1=function(){return c().x(t).y(i)},l.lineX1=function(){return c().x(e).y(n)},l.defined=function(t){return arguments.length?(r="function"==typeof t?t:W(!!t),l):r},l.curve=function(t){return arguments.length?(a=t,null!=o&&(s=a(o)),l):a},l.context=function(t){return arguments.length?(null==t?o=s=null:s=a(o=t),l):o},l}function vt(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function xt(t){return t}ft.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var bt=Array.prototype.slice;function wt(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function kt(t){this._context=t}function _t(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Mt(t,e){this._context=t,this._k=(1-e)/6}kt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:wt(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:wt(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Mt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:_t(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:_t(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var St=function t(e){function n(t){return new Mt(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Ct(t,e){this._context=t,this._alpha=e}Ct.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:!function(t,e,n){var i=t._x1,r=t._y1,o=t._x2,a=t._y2;if(t._l01_a>Q){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);i=(i*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,r=(r*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>Q){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-e*t._l12_2a)/u,a=(a*c+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(i,r,o,a,t._x2,t._y2)}(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var qt=function t(e){function n(t){return e?new Ct(t,e):new Mt(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Nt(t){return t<0?-1:1}function Rt(t,e,n){var i=t._x1-t._x0,r=e-t._x1,o=(t._y1-t._y0)/(i||r<0&&-0),a=(n-t._y1)/(r||i<0&&-0),s=(o*r+a*i)/(i+r);return(Nt(o)+Nt(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function At(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Ot(t,e,n){var i=t._x0,r=t._y0,o=t._x1,a=t._y1,s=(o-i)/3;t._context.bezierCurveTo(i+s,r+s*e,o-s,a-s*n,o,a)}function Dt(t){this._context=t}function Et(t){this._context=new It(t)}function It(t){this._context=t}function Tt(t){this._context=t}function jt(t){var e,n,i=t.length-1,r=new Array(i),o=new Array(i),a=new Array(i);for(r[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e<i-1;++e)r[e]=1,o[e]=4,a[e]=4*t[e]+2*t[e+1];for(r[i-1]=2,o[i-1]=7,a[i-1]=8*t[i-1]+t[i],e=1;e<i;++e)n=r[e]/o[e-1],o[e]-=n,a[e]-=n*a[e-1];for(r[i-1]=a[i-1]/o[i-1],e=i-2;e>=0;--e)r[e]=(a[e]-r[e+1])/o[e];for(o[i-1]=(t[i]+r[i-1])/2,e=0;e<i-1;++e)o[e]=2*t[e+1]-r[e+1];return[r,o]}function Pt(t,e){this._context=t,this._t=e}function zt(t,e){if((r=t.length)>1)for(var n,i,r,o=1,a=t[e[0]],s=a.length;o<r;++o)for(i=a,a=t[e[o]],n=0;n<s;++n)a[n][1]+=a[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function Ft(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function Lt(t,e){return t[e]}function $t(t){for(var e,n=-1,i=0,r=t.length,o=-1/0;++n<r;)(e=+t[n][1])>o&&(o=e,i=n);return i}function Bt(t){for(var e,n=0,i=-1,r=t.length;++i<r;)(e=+t[i][1])&&(n+=e);return n}function Ht(t){let e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unspecified",i=arguments.length>2?arguments[2]:void 0;const r={},o=t||{get:()=>{},has:()=>!1,default:()=>{}};function a(t,e){if(!t||"string"!=typeof t)throw new TypeError("Invalid argument: key must be a non-empty string");return!(t in r)&&(r[t]=e,!0)}function s(t){return r[t]||o.get(t)}function l(t){return!!r[t]||o.has(t)}function c(t){const e=r[t];return delete r[t],e}function u(){return Object.keys(r)}function h(){return Object.keys(r).map((t=>r[t]))}function d(t){return void 0!==t&&(e=t),e}function f(t,r){if(void 0!==r)return a(t,r);const o=s(t);return i&&void 0===o&&i.warn("".concat(t," does not exist in ").concat(n," registry")),o||s(e)}return e=o.default(),f.add=a,f.get=s,f.has=l,f.remove=c,f.getKeys=u,f.getValues=h,f.default=d,f.register=a,f}function Vt(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}function Wt(t){return(t=Vt(Math.abs(t)))?t[1]:NaN}Dt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Ot(this,this._t0,At(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Ot(this,At(this,n=Rt(this,t,e)),n);break;default:Ot(this,this._t0,n=Rt(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(Et.prototype=Object.create(Dt.prototype)).point=function(t,e){Dt.prototype.point.call(this,e,t)},It.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,i,r,o){this._context.bezierCurveTo(e,t,i,n,o,r)}},Tt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var i=jt(t),r=jt(e),o=0,a=1;a<n;++o,++a)this._context.bezierCurveTo(i[0][o],r[0][o],i[1][o],r[1][o],t[a],e[a]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},Pt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var Ut,Yt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Xt(t){if(!(e=Yt.exec(t)))throw new Error("invalid format: "+t);var e;return new Kt({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Kt(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Gt(t,e){var n=Vt(t,e);if(!n)return t+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}Xt.prototype=Kt.prototype,Kt.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Zt={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Gt(100*t,e),r:Gt,s:function(t,e){var n=Vt(t,e);if(!n)return t+"";var i=n[0],r=n[1],o=r-(Ut=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,a=i.length;return o===a?i:o>a?i+new Array(o-a+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+Vt(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Jt(t){return t}var Qt,te,ee,ne=Array.prototype.map,ie=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function re(t){var e,n,i=void 0===t.grouping||void 0===t.thousands?Jt:(e=ne.call(t.grouping,Number),n=t.thousands+"",function(t,i){for(var r=t.length,o=[],a=0,s=e[0],l=0;r>0&&s>0&&(l+s+1>i&&(s=Math.max(1,i-l)),o.push(t.substring(r-=s,r+s)),!((l+=s+1)>i));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),r=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?Jt:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(ne.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=Xt(t)).fill,n=t.align,h=t.sign,d=t.symbol,f=t.zero,p=t.width,g=t.comma,m=t.precision,y=t.trim,v=t.type;"n"===v?(g=!0,v="g"):Zt[v]||(void 0===m&&(m=12),y=!0,v="g"),(f||"0"===e&&"="===n)&&(f=!0,e="0",n="=");var x="$"===d?r:"#"===d&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",b="$"===d?o:/[%p]/.test(v)?l:"",w=Zt[v],k=/[defgprs%]/.test(v);function _(t){var r,o,l,d=x,_=b;if("c"===v)_=w(t)+_,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:w(Math.abs(t),m),y&&(t=function(t){t:for(var e,n=t.length,i=1,r=-1;i<n;++i)switch(t[i]){case".":r=e=i;break;case"0":0===r&&(r=i),e=i;break;default:if(!+t[i])break t;r>0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),M&&0==+t&&"+"!==h&&(M=!1),d=(M?"("===h?h:c:"-"===h||"("===h?"":h)+d,_=("s"===v?ie[8+Ut/3]:"")+_+(M&&"("===h?")":""),k)for(r=-1,o=t.length;++r<o;)if(48>(l=t.charCodeAt(r))||l>57){_=(46===l?a+t.slice(r+1):t.slice(r))+_,t=t.slice(0,r);break}}g&&!f&&(t=i(t,1/0));var S=d.length+t.length+_.length,C=S<p?new Array(p-S+1).join(e):"";switch(g&&f&&(t=i(C+t,C.length?p-_.length:1/0),C=""),n){case"<":t=d+t+_+C;break;case"=":t=d+C+t+_;break;case"^":t=C.slice(0,S=C.length>>1)+d+t+_+C.slice(S);break;default:t=C+d+t+_}return s(t)}return m=void 0===m?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),_.toString=function(){return t+""},_}return{format:h,formatPrefix:function(t,e){var n=h(((t=Xt(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(Wt(e)/3))),r=Math.pow(10,-i),o=ie[8+i/3];return function(t){return n(r*t)+o}}}}!function(t){Qt=re(t),te=Qt.format,ee=Qt.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});const oe=new Date,ae=new Date;function se(t,e,n,i){function r(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return r.floor=e=>(t(e=new Date(+e)),e),r.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),r.round=t=>{const e=r(t),n=r.ceil(t);return t-e<n-t?e:n},r.offset=(t,n)=>(e(t=new Date(+t),null==n?1:Math.floor(n)),t),r.range=(n,i,o)=>{const a=[];if(n=r.ceil(n),o=null==o?1:Math.floor(o),!(n<i&&o>0))return a;let s;do{a.push(s=new Date(+n)),e(n,o),t(n)}while(s<n&&n<i);return a},r.filter=n=>se((e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),((t,i)=>{if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););})),n&&(r.count=(e,i)=>(oe.setTime(+e),ae.setTime(+i),t(oe),t(ae),Math.floor(n(oe,ae))),r.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?r.filter(i?e=>i(e)%t==0:e=>r.count(0,e)%t==0):r:null)),r}const le=6e4,ce=864e5,ue=6048e5,he=se((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*le)/ce),(t=>t.getDate()-1));he.range;const de=se((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/ce),(t=>t.getUTCDate()-1));de.range;function fe(t){return se((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*le)/ue))}se((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/ce),(t=>Math.floor(t/ce))).range;const pe=fe(0),ge=fe(1),me=fe(2),ye=fe(3),ve=fe(4),xe=fe(5),be=fe(6);function we(t){return se((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/ue))}pe.range,ge.range,me.range,ye.range,ve.range,xe.range,be.range;const ke=we(0),_e=we(1),Me=we(2),Se=we(3),Ce=we(4),qe=we(5),Ne=we(6);ke.range,_e.range,Me.range,Se.range,Ce.range,qe.range,Ne.range;const Re=se((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));Re.every=t=>isFinite(t=Math.floor(t))&&t>0?se((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,n)=>{e.setFullYear(e.getFullYear()+n*t)})):null,Re.range;const Ae=se((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function Oe(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function De(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Ee(t){let e,n,i;function r(t,i,r=0,o=t.length){if(r<o){if(0!==e(i,i))return o;do{const e=r+o>>>1;n(t[e],i)<0?r=e+1:o=e}while(r<o)}return r}return 2!==t.length?(e=Oe,n=(e,n)=>Oe(t(e),n),i=(e,n)=>t(e)-n):(e=t===Oe||t===De?t:Ie,n=t,i=t),{left:r,center:function(t,e,n=0,o=t.length){const a=r(t,e,n,o-1);return a>n&&i(t[a-1],e)>-i(t[a],e)?a-1:a},right:function(t,i,r=0,o=t.length){if(r<o){if(0!==e(i,i))return o;do{const e=r+o>>>1;n(t[e],i)<=0?r=e+1:o=e}while(r<o)}return r}}}function Ie(){return 0}Ae.every=t=>isFinite(t=Math.floor(t))&&t>0?se((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null,Ae.range;const Te=Ee(Oe).right;Ee((function(t){return null===t?NaN:+t})).center;var je=Te;class Pe extends Map{constructor(t,e=Fe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(ze(this,t))}has(t){return super.has(ze(this,t))}set(t,e){return super.set(function({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):(t.set(i,n),n)}(this,t),e)}delete(t){return super.delete(function({_intern:t,_key:e},n){const i=e(n);t.has(i)&&(n=t.get(i),t.delete(i));return n}(this,t))}}function ze({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):n}function Fe(t){return null!==t&&"object"==typeof t?t.valueOf():t}const Le=Math.sqrt(50),$e=Math.sqrt(10),Be=Math.sqrt(2);function He(t,e,n){const i=(e-t)/Math.max(0,n),r=Math.floor(Math.log10(i)),o=i/Math.pow(10,r),a=o>=Le?10:o>=$e?5:o>=Be?2:1;let s,l,c;return r<0?(c=Math.pow(10,-r)/a,s=Math.round(t*c),l=Math.round(e*c),s/c<t&&++s,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*a,s=Math.round(t/c),l=Math.round(e/c),s*c<t&&++s,l*c>e&&--l),l<s&&.5<=n&&n<2?He(t,e,2*n):[s,l,c]}function Ve(t,e,n){return He(t=+t,e=+e,n=+n)[2]}function We(t,e,n){t=+t,e=+e,n=(r=arguments.length)<2?(e=t,t=0,1):r<3?1:+n;for(var i=-1,r=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(r);++i<r;)o[i]=t+i*n;return o}function Ue(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Ye(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Xe(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function Ke(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,o=t.days,a=t.shortDays,s=t.months,l=t.shortMonths,c=nn(r),u=rn(r),h=nn(o),d=rn(o),f=nn(a),p=rn(a),g=nn(s),m=rn(s),y=nn(l),v=rn(l),x={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:Sn,e:Sn,f:An,g:$n,G:Hn,H:Cn,I:qn,j:Nn,L:Rn,m:On,M:Dn,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:di,s:fi,S:En,u:In,U:Tn,V:Pn,w:zn,W:Fn,x:null,X:null,y:Ln,Y:Bn,Z:Vn,"%":hi},b={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:Wn,e:Wn,f:Gn,g:si,G:ci,H:Un,I:Yn,j:Xn,L:Kn,m:Zn,M:Jn,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:di,s:fi,S:Qn,u:ti,U:ei,V:ii,w:ri,W:oi,x:null,X:null,y:ai,Y:li,Z:ui,"%":hi},w={a:function(t,e,n){var i=f.exec(e.slice(n));return i?(t.w=p.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(t,e,n){var i=h.exec(e.slice(n));return i?(t.w=d.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(t,e,n){var i=y.exec(e.slice(n));return i?(t.m=v.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(t,e,n){var i=g.exec(e.slice(n));return i?(t.m=m.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(t,n,i){return M(t,e,n,i)},d:gn,e:gn,f:wn,g:hn,G:un,H:yn,I:yn,j:mn,L:bn,m:pn,M:vn,p:function(t,e,n){var i=c.exec(e.slice(n));return i?(t.p=u.get(i[0].toLowerCase()),n+i[0].length):-1},q:fn,Q:_n,s:Mn,S:xn,u:an,U:sn,V:ln,w:on,W:cn,x:function(t,e,i){return M(t,n,e,i)},X:function(t,e,n){return M(t,i,e,n)},y:hn,Y:un,Z:dn,"%":kn};function k(t,e){return function(n){var i,r,o,a=[],s=-1,l=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===t.charCodeAt(s)&&(a.push(t.slice(l,s)),null!=(r=Ge[i=t.charAt(++s)])?i=t.charAt(++s):r="e"===i?" ":"0",(o=e[i])&&(i=o(n,r)),a.push(i),l=s+1);return a.push(t.slice(l,s)),a.join("")}}function _(t,e){return function(n){var i,r,o=Xe(1900,void 0,1);if(M(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(r=(i=Ye(Xe(o.y,0,1))).getUTCDay(),i=r>4||0===r?_e.ceil(i):_e(i),i=de.offset(i,7*(o.V-1)),o.y=i.getUTCFullYear(),o.m=i.getUTCMonth(),o.d=i.getUTCDate()+(o.w+6)%7):(r=(i=Ue(Xe(o.y,0,1))).getDay(),i=r>4||0===r?ge.ceil(i):ge(i),i=he.offset(i,7*(o.V-1)),o.y=i.getFullYear(),o.m=i.getMonth(),o.d=i.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),r="Z"in o?Ye(Xe(o.y,0,1)).getUTCDay():Ue(Xe(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(r+5)%7:o.w+7*o.U-(r+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Ye(o)):Ue(o)}}function M(t,e,n,i){for(var r,o,a=0,s=e.length,l=n.length;a<s;){if(i>=l)return-1;if(37===(r=e.charCodeAt(a++))){if(r=e.charAt(a++),!(o=w[r in Ge?e.charAt(a++):r])||(i=o(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return x.x=k(n,x),x.X=k(i,x),x.c=k(e,x),b.x=k(n,b),b.X=k(i,b),b.c=k(e,b),{format:function(t){var e=k(t+="",x);return e.toString=function(){return t},e},parse:function(t){var e=_(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=k(t+="",b);return e.toString=function(){return t},e},utcParse:function(t){var e=_(t+="",!0);return e.toString=function(){return t},e}}}var Ge={"-":"",_:" ",0:"0"},Ze=/^\s*\d+/,Je=/^%/,Qe=/[\\^$*+?|[\]().{}]/g;function tn(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",o=r.length;return i+(o<n?new Array(n-o+1).join(e)+r:r)}function en(t){return t.replace(Qe,"\\$&")}function nn(t){return new RegExp("^(?:"+t.map(en).join("|")+")","i")}function rn(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}function on(t,e,n){var i=Ze.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function an(t,e,n){var i=Ze.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function sn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function ln(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function cn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function un(t,e,n){var i=Ze.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function hn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function dn(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function fn(t,e,n){var i=Ze.exec(e.slice(n,n+1));return i?(t.q=3*i[0]-3,n+i[0].length):-1}function pn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function gn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function mn(t,e,n){var i=Ze.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function yn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function vn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function xn(t,e,n){var i=Ze.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function bn(t,e,n){var i=Ze.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function wn(t,e,n){var i=Ze.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function kn(t,e,n){var i=Je.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function _n(t,e,n){var i=Ze.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function Mn(t,e,n){var i=Ze.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function Sn(t,e){return tn(t.getDate(),e,2)}function Cn(t,e){return tn(t.getHours(),e,2)}function qn(t,e){return tn(t.getHours()%12||12,e,2)}function Nn(t,e){return tn(1+he.count(Re(t),t),e,3)}function Rn(t,e){return tn(t.getMilliseconds(),e,3)}function An(t,e){return Rn(t,e)+"000"}function On(t,e){return tn(t.getMonth()+1,e,2)}function Dn(t,e){return tn(t.getMinutes(),e,2)}function En(t,e){return tn(t.getSeconds(),e,2)}function In(t){var e=t.getDay();return 0===e?7:e}function Tn(t,e){return tn(pe.count(Re(t)-1,t),e,2)}function jn(t){var e=t.getDay();return e>=4||0===e?ve(t):ve.ceil(t)}function Pn(t,e){return t=jn(t),tn(ve.count(Re(t),t)+(4===Re(t).getDay()),e,2)}function zn(t){return t.getDay()}function Fn(t,e){return tn(ge.count(Re(t)-1,t),e,2)}function Ln(t,e){return tn(t.getFullYear()%100,e,2)}function $n(t,e){return tn((t=jn(t)).getFullYear()%100,e,2)}function Bn(t,e){return tn(t.getFullYear()%1e4,e,4)}function Hn(t,e){var n=t.getDay();return tn((t=n>=4||0===n?ve(t):ve.ceil(t)).getFullYear()%1e4,e,4)}function Vn(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+tn(e/60|0,"0",2)+tn(e%60,"0",2)}function Wn(t,e){return tn(t.getUTCDate(),e,2)}function Un(t,e){return tn(t.getUTCHours(),e,2)}function Yn(t,e){return tn(t.getUTCHours()%12||12,e,2)}function Xn(t,e){return tn(1+de.count(Ae(t),t),e,3)}function Kn(t,e){return tn(t.getUTCMilliseconds(),e,3)}function Gn(t,e){return Kn(t,e)+"000"}function Zn(t,e){return tn(t.getUTCMonth()+1,e,2)}function Jn(t,e){return tn(t.getUTCMinutes(),e,2)}function Qn(t,e){return tn(t.getUTCSeconds(),e,2)}function ti(t){var e=t.getUTCDay();return 0===e?7:e}function ei(t,e){return tn(ke.count(Ae(t)-1,t),e,2)}function ni(t){var e=t.getUTCDay();return e>=4||0===e?Ce(t):Ce.ceil(t)}function ii(t,e){return t=ni(t),tn(Ce.count(Ae(t),t)+(4===Ae(t).getUTCDay()),e,2)}function ri(t){return t.getUTCDay()}function oi(t,e){return tn(_e.count(Ae(t)-1,t),e,2)}function ai(t,e){return tn(t.getUTCFullYear()%100,e,2)}function si(t,e){return tn((t=ni(t)).getUTCFullYear()%100,e,2)}function li(t,e){return tn(t.getUTCFullYear()%1e4,e,4)}function ci(t,e){var n=t.getUTCDay();return tn((t=n>=4||0===n?Ce(t):Ce.ceil(t)).getUTCFullYear()%1e4,e,4)}function ui(){return"+0000"}function hi(){return"%"}function di(t){return+t}function fi(t){return Math.floor(+t/1e3)}const pi=Ht();pi("d3-number",(function(t,e,n){let i,r;function o(t){return r(t)}function a(){o.locale({decimal:n||".",thousands:e||",",grouping:[3],currency:["$",""]})}return o.locale=function(e){return i=re(e),r=i.format(t),this},a(),o.format=function(t,r,o,s){return(o||s)&&(e=o,n=s,a()),i.format(t)(r)},o.pattern=function(e){return e&&(t=e,r=i.format(e)),t},o})),pi("d3-time",(function(t){let e=Ke({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),n=e.format(t);function i(t){return n(t)}return i.format=function(t,n){return e.format(t)(n)},i.locale=function(){return e=Ke(...arguments),n=e.format(t),this},i.parse=function(t,n){return e.parse(t)(n)},i.parsePattern=function(t){return e.parse(t)},i}));const gi={id:t=>"".concat(t.source,"/").concat(t.key||t.title),key:t=>String(t.key||t.title),tags:t=>t.tags,min:t=>t.min,max:t=>t.max,type:t=>t.type,title:t=>String(t.title),values:t=>t.values,value:t=>t,label:t=>t,formatter:t=>(t=>{if("function"==typeof t.formatter)return t.formatter();const e=t.formatter||{};return pi(e.type||"d3-number")(e.format||"")})(t)};function mi(t){let{id:e=gi.id,key:n=gi.key,min:i=gi.min,max:r=gi.max,type:o=gi.type,tags:a=gi.tags,title:s=gi.title,values:l=gi.values,value:c=gi.value,label:u=gi.label,formatter:h=gi.formatter}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const d={id:()=>e(t),key:()=>n(t),raw:()=>t,tags:()=>a(t),type:()=>o(t),min:()=>i(t),max:()=>r(t),title:()=>s(t),items:()=>l(t),formatter:()=>h(t),value:c,label:u};return d}function yi(t,e){let{cache:n}=e;if("number"==typeof t)return n.fields[t];for(let e=0;e<n.fields.length;e++)if(n.fields[e].key()===t)return n.fields[e];for(let e=0;e<n.fields.length;e++)if(n.fields[e].title()===t)return n.fields[e];return null}const vi=t=>t.filter((t=>"number"==typeof t&&!isNaN(t))),xi=t=>t.reduce(((t,e)=>t+e),0),bi={first:t=>t[0],last:t=>t[t.length-1],min:t=>{const e=vi(t);return e.length?Math.min.apply(null,e):NaN},max:t=>{const e=vi(t);return e.length?Math.max.apply(null,e):NaN},sum:t=>{const e=vi(t);return e.length?e.reduce(((t,e)=>t+e),0):NaN},avg:t=>{const e=vi(t),n=e.length;return n?xi(e)/n:NaN}};function wi(t,e,n,i){const r={},o=i.field||(void 0!==t.field?e.field(t.field):null);return Object.keys(n).forEach((a=>{const s=n[a],l=r[a]={};-1!==["number","string","boolean"].indexOf(typeof s)?(l.type="primitive",l.value=s):"function"==typeof s?(l.type="function",l.value=s,l.label=s,l.field=o):"object"==typeof s&&(s.fields?l.fields=s.fields.map((n=>wi(t,e,{main:n},i).main)):void 0!==s.field?(l.type="field",l.field=e.field(s.field),l.value=l.field.value,l.label=l.field.label):o&&(l.value=o.value,l.label=o.label,l.field=o),"function"==typeof s.filter&&(l.filter=s.filter),void 0!==s.value&&(l.value=s.value),void 0!==s.label&&(l.label=s.label),"function"==typeof s.reduce?l.reduce=s.reduce:s.reduce?l.reduce=bi[s.reduce]:l.field&&l.field.reduce&&(l.reduce="string"==typeof l.field.reduce?bi[l.field.reduce]:l.field.reduce),"function"==typeof s.reduceLabel?l.reduceLabel=s.reduceLabel:s.reduceLabel?l.reduceLabel=bi[s.reduceLabel]:l.field&&l.field.reduceLabel&&(l.reduceLabel="string"==typeof l.field.reduceLabel?bi[l.field.reduceLabel]:l.field.reduceLabel))})),r}function ki(t,e){const{main:n}=wi(t,e,{main:{value:t.value,label:t.label,reduce:t.reduce,filter:t.filter}},{});return{props:wi(t,e,t.props||{},n),main:n}}function _i(t,e,n,i){const r=Array(t.length),o=Array(t.length);let a;for(let e=0;e<t.length;e++)a=i?t[e][i]:t[e],r[e]=a.value,o[e]=a.label;const s=e.reduce,l=e.reduceLabel,c=s?s(r):r,u={value:c,label:l?l(o,c):n?n(c):String(c)};return i&&t[0][i].source?(u.source=t[0][i].source,u):!i&&t[0].source?(u.source=t[0].source,u):u}function Mi(t,e){let{main:n,propsArr:i,props:r}=e,o=[];const a=n.field.formatter(),s={};return i.forEach((t=>{s[t]=r[t].field?r[t].field.formatter():t=>t})),o.push(...t.map((t=>{const e=_i(t.items,n,a);return i.forEach((n=>{e[n]=_i(t.items,r[n],s[n],n)})),e}))),o}function Si(t){let{cfg:e,itemData:n,obj:i,target:r,tracker:o,trackType:a}=t;const s="function"===a?e.trackBy(n):n[e.trackBy];let l=o[s];l||(l=o[s]={items:[],id:s},r.push(l)),l.items.push(i)}function Ci(t){if(t.length<1e4)return Math.max(...t);let e=-1/0;const n=t.length;for(let i=0;i<n;i++)e<t[i]&&(e=t[i]);return e}function qi(t){if(t.length<1e4)return Math.min(...t);let e=1/0;const n=t.length;for(let i=0;i<n;i++)e>t[i]&&(e=t[i]);return e}const Ni={diverging:function(t,e){if((s=t.length)>0)for(var n,i,r,o,a,s,l=0,c=t[e[0]].length;l<c;++l)for(o=a=0,n=0;n<s;++n)(r=(i=t[e[n]][l])[1]-i[0])>=0?(i[0]=o,i[1]=o+=r):r<0?(i[1]=a,i[0]=a+=r):i[0]=o},none:zt,silhouette:function(t,e){if((n=t.length)>0){for(var n,i=0,r=t[e[0]],o=r.length;i<o;++i){for(var a=0,s=0;a<n;++a)s+=t[a][i][1]||0;r[i][1]+=r[i][0]=-s/2}zt(t,e)}},expand:function(t,e){if((i=t.length)>0){for(var n,i,r,o=0,a=t[0].length;o<a;++o){for(r=n=0;n<i;++n)r+=t[n][o][1]||0;if(r)for(n=0;n<i;++n)t[n][o][1]/=r}zt(t,e)}},wiggle:function(t,e){if((r=t.length)>0&&(i=(n=t[e[0]]).length)>0){for(var n,i,r,o=0,a=1;a<i;++a){for(var s=0,l=0,c=0;s<r;++s){for(var u=t[e[s]],h=u[a][1]||0,d=(h-(u[a-1][1]||0))/2,f=0;f<s;++f){var p=t[e[f]];d+=(p[a][1]||0)-(p[a-1][1]||0)}l+=h,c+=d*h}n[a-1][1]+=n[a-1][0]=o,l&&(o-=c/l)}n[a-1][1]+=n[a-1][0]=o,zt(t,e)}}},Ri={ascending:function(t){var e=t.map(Bt);return Ft(t).sort((function(t,n){return e[t]-e[n]}))},insideout:function(t){var e,n,i=t.length,r=t.map(Bt),o=function(t){var e=t.map($t);return Ft(t).sort((function(t,n){return e[t]-e[n]}))}(t),a=0,s=0,l=[],c=[];for(e=0;e<i;++e)n=o[e],a<s?(a+=r[n],l.push(n)):(s+=r[n],c.push(n));return c.reverse().concat(l)},none:Ft,reverse:function(t){return Ft(t).reverse()}};function Ai(t,e,n){const i={},r=e.stackKey,o=e.value,a=e.startProp||"start",s=e.endProp||"end",l=e.offset||"none",c=e.order||"none",u=e.valueRef||"";let h=0,d={};for(let e=0;e<t.items.length;e++){let n=t.items[e],o=u?n[u]:null;if(o&&o.source){let t="".concat(o.source.key||"","/").concat(o.source.field);d[t]||(d[t]=o.source)}let a=r(n);i[a]=i[a]||{items:[]},i[a].items.push(n),h=Math.max(h,i[a].items.length)}const f=Array.apply(null,{length:h}).map(Number.call,Number),p=Object.keys(i).map((t=>i[t].items));let g=function(){var t=W([]),e=Ft,n=zt,i=Lt;function r(r){var o,a,s=t.apply(this,arguments),l=r.length,c=s.length,u=new Array(c);for(o=0;o<c;++o){for(var h,d=s[o],f=u[o]=new Array(l),p=0;p<l;++p)f[p]=h=[0,+i(r[p],d,p,r)],h.data=r[p];f.key=d}for(o=0,a=e(u);o<c;++o)u[a[o]].index=o;return n(u,a),u}return r.keys=function(e){return arguments.length?(t="function"==typeof e?e:W(bt.call(e)),r):t},r.value=function(t){return arguments.length?(i="function"==typeof t?t:W(+t),r):i},r.order=function(t){return arguments.length?(e=null==t?Ft:"function"==typeof t?t:W(bt.call(t)),r):e},r.offset=function(t){return arguments.length?(n=null==t?zt:t,r):n},r}().keys(f).value(((t,e)=>t[e]?o(t[e]):0)).order(Ri[c]).offset(Ni[l])(p),m=[];for(let t=0;t<g.length;t++){let e=g[t];for(let t=0;t<e.length;t++){let n=e[t],i=e[t].data[e.key];i&&(i[a]={value:n[0]},i[s]={value:n[1]},m.push(n[0],n[1]))}}let y=Object.keys(d).map((t=>{let e=n(d[t].key);return e?e.field(d[t].field):null})).filter((t=>!!t));const v=mi({title:y.map((t=>t.title())).join(", "),min:qi(m),max:Ci(m),type:"measure",formatter:y[0]?y[0].formatter:void 0});t.fields.push(v)}function Oi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i={};const r=n.logger;if(Array.isArray(t))i.items=t.map((t=>({value:t,label:String(t)})));else if(t){if("collection"in t)i=C({},e.collection(t.collection));else{const n=e.dataset?e.dataset(t.source):null;let o=t.value||(t=>t),a=t.label||(t=>t);if(t.groupBy||t.mapTo)r.warn('Deprecated "data" configuration',t),i.items=[];else if(t.hierarchy)i.root=n.hierarchy?n.hierarchy(t.hierarchy):null,i.fields=n.fields();else if(t.items)i.items=t.items.map((t=>({value:o(t),label:String(a(t))})));else if(t.extract){const r=Array.isArray(t.extract)?t.extract:[t.extract];i.items=[];const o=[];r.forEach((t=>{const r=t.source?e.dataset(t.source):n;r&&(i.items=[...i.items,...r.extract(t)],void 0!==t.field&&o.push(r.field(t.field)))})),o.length&&(i.fields=o),t.amend&&Array.isArray(t.amend)&&(i.items=[...i.items,...t.amend])}else if(void 0!==t.field&&n){const e=n.field(t.field);e&&(i.fields||(i.fields=[]),i.fields.push(e),"value"in t||(o=e.value||(t=>t),a=e.label||(t=>t),i.value=o),i.items=e.items().map((e=>({value:o(e),label:String(a(e)),source:{field:t.field}}))))}else t.fields&&t.fields.forEach((t=>{const r="object"==typeof t&&t.source?e.dataset(t.source):n;if(!r)return;let o;o="object"==typeof t&&void 0!==t.field?r.field(t.field):r.field(t),o&&(i.fields||(i.fields=[]),i.fields.push(o))}));i.items&&t.map&&(i.items=i.items.map(t.map))}t&&t.stack&&Ai(i,t.stack,e.dataset)}return t&&!Array.isArray(t)&&"function"==typeof t.filter&&i.items&&(i.items=i.items.filter(t.filter)),t&&!Array.isArray(t)&&"function"==typeof t.sort&&i.items&&(i.items=i.items.sort(t.sort)),i}function Di(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Oi;const r={};(t||[]).forEach((t=>{if(!t.key)throw new Error('Data collection is missing "key" property');if("object"==typeof t.data&&"collection"in t.data)throw new Error("Data config for collections may not reference other collections");r[t.key]=()=>i(t.data,e,n)}));const o=t=>{let e,n;if("string"==typeof t?e=t:"object"==typeof t&&(e=t.key,n=t),!(e in r))throw new Error("Unknown data collection: ".concat(e));"function"==typeof r[e]&&(r[e]=r[e]());let i=r[e];if(n&&n.fields&&n.fields.filter){let t=i.fields.filter(n.fields.filter);i.fields.length!==t.length&&(i=_(i,{fields:t}))}return i};return o}function Ei(t,e,n){let i,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Oi;if(t.data){const i=r(t.data,e,n);if(i&&i.fields&&i.fields[0])return i.fields[0].formatter()}if(i=t.formatter?"".concat(t.formatter,"-").concat(t.type||"number"):t.type||"d3-number",n.formatter.has(i)){return n.formatter.get(i)(t.format||"")}throw new Error("Formatter of type '".concat(i,"' was not found"))}function Ii(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ei;const r={};return{get(o){let a;return"string"==typeof o&&t[o]?a=o:"object"==typeof o&&"formatter"in o&&t[o.formatter]?a=o.formatter:"object"==typeof o&&"type"in o&&t[o.type]&&(a=o.type),a?(r[a]=r[a]||i(t[a],e,n),r[a]):i(o||{},e,n)},all(){return Object.keys(t).forEach(this.get),r}}}function Ti(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}const ji=Symbol("implicit");function Pi(){var t=new Pe,e=[],n=[],i=ji;function r(r){let o=t.get(r);if(void 0===o){if(i!==ji)return i;t.set(r,o=e.push(r)-1)}return n[o%n.length]}return r.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new Pe;for(const i of n)t.has(i)||t.set(i,e.push(i)-1);return r},r.range=function(t){return arguments.length?(n=Array.from(t),r):n.slice()},r.unknown=function(t){return arguments.length?(i=t,r):i},r.copy=function(){return Pi(e,n).unknown(i)},Ti.apply(r,arguments),r}function zi(){var t,e,n=Pi().unknown(void 0),i=n.domain,r=n.range,o=0,a=1,s=!1,l=0,c=0,u=.5;function h(){var n=i().length,h=a<o,d=h?a:o,f=h?o:a;t=(f-d)/Math.max(1,n-l+2*c),s&&(t=Math.floor(t)),d+=(f-d-t*(n-l))*u,e=t*(1-l),s&&(d=Math.round(d),e=Math.round(e));var p=We(n).map((function(e){return d+t*e}));return r(h?p.reverse():p)}return delete n.unknown,n.domain=function(t){return arguments.length?(i(t),h()):i()},n.range=function(t){return arguments.length?([o,a]=t,o=+o,a=+a,h()):[o,a]},n.rangeRound=function(t){return[o,a]=t,o=+o,a=+a,s=!0,h()},n.bandwidth=function(){return e},n.step=function(){return t},n.round=function(t){return arguments.length?(s=!!t,h()):s},n.padding=function(t){return arguments.length?(l=Math.min(1,c=+t),h()):l},n.paddingInner=function(t){return arguments.length?(l=Math.min(1,t),h()):l},n.paddingOuter=function(t){return arguments.length?(c=+t,h()):c},n.align=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),h()):u},n.copy=function(){return zi(i(),[o,a]).round(s).paddingInner(l).paddingOuter(c).align(u)},Ti.apply(h(),arguments)}function Fi(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Li(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function $i(){}var Bi=.7,Hi=1/Bi,Vi="\\s*([+-]?\\d+)\\s*",Wi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ui="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Yi=/^#([0-9a-f]{3,8})$/,Xi=new RegExp(`^rgb\\(${Vi},${Vi},${Vi}\\)$`),Ki=new RegExp(`^rgb\\(${Ui},${Ui},${Ui}\\)$`),Gi=new RegExp(`^rgba\\(${Vi},${Vi},${Vi},${Wi}\\)$`),Zi=new RegExp(`^rgba\\(${Ui},${Ui},${Ui},${Wi}\\)$`),Ji=new RegExp(`^hsl\\(${Wi},${Ui},${Ui}\\)$`),Qi=new RegExp(`^hsla\\(${Wi},${Ui},${Ui},${Wi}\\)$`),tr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function er(){return this.rgb().formatHex()}function nr(){return this.rgb().formatRgb()}function ir(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Yi.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?rr(e):3===n?new lr(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?or(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?or(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Xi.exec(t))?new lr(e[1],e[2],e[3],1):(e=Ki.exec(t))?new lr(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Gi.exec(t))?or(e[1],e[2],e[3],e[4]):(e=Zi.exec(t))?or(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ji.exec(t))?pr(e[1],e[2]/100,e[3]/100,1):(e=Qi.exec(t))?pr(e[1],e[2]/100,e[3]/100,e[4]):tr.hasOwnProperty(t)?rr(tr[t]):"transparent"===t?new lr(NaN,NaN,NaN,0):null}function rr(t){return new lr(t>>16&255,t>>8&255,255&t,1)}function or(t,e,n,i){return i<=0&&(t=e=n=NaN),new lr(t,e,n,i)}function ar(t){return t instanceof $i||(t=ir(t)),t?new lr((t=t.rgb()).r,t.g,t.b,t.opacity):new lr}function sr(t,e,n,i){return 1===arguments.length?ar(t):new lr(t,e,n,null==i?1:i)}function lr(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function cr(){return`#${fr(this.r)}${fr(this.g)}${fr(this.b)}`}function ur(){const t=hr(this.opacity);return`${1===t?"rgb(":"rgba("}${dr(this.r)}, ${dr(this.g)}, ${dr(this.b)}${1===t?")":`, ${t})`}`}function hr(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function dr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function fr(t){return((t=dr(t))<16?"0":"")+t.toString(16)}function pr(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new mr(t,e,n,i)}function gr(t){if(t instanceof mr)return new mr(t.h,t.s,t.l,t.opacity);if(t instanceof $i||(t=ir(t)),!t)return new mr;if(t instanceof mr)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=e===o?(n-i)/s+6*(n<i):n===o?(i-e)/s+2:(e-n)/s+4,s/=l<.5?o+r:2-o-r,a*=60):s=l>0&&l<1?0:a,new mr(a,s,l,t.opacity)}function mr(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function yr(t){return(t=(t||0)%360)<0?t+360:t}function vr(t){return Math.max(0,Math.min(1,t||0))}function xr(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Fi($i,ir,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:er,formatHex:er,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return gr(this).formatHsl()},formatRgb:nr,toString:nr}),Fi(lr,sr,Li($i,{brighter(t){return t=null==t?Hi:Math.pow(Hi,t),new lr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Bi:Math.pow(Bi,t),new lr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new lr(dr(this.r),dr(this.g),dr(this.b),hr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:cr,formatHex:cr,formatHex8:function(){return`#${fr(this.r)}${fr(this.g)}${fr(this.b)}${fr(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:ur,toString:ur})),Fi(mr,(function(t,e,n,i){return 1===arguments.length?gr(t):new mr(t,e,n,null==i?1:i)}),Li($i,{brighter(t){return t=null==t?Hi:Math.pow(Hi,t),new mr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Bi:Math.pow(Bi,t),new mr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new lr(xr(t>=240?t-240:t+120,r,i),xr(t,r,i),xr(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new mr(yr(this.h),vr(this.s),vr(this.l),hr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=hr(this.opacity);return`${1===t?"hsl(":"hsla("}${yr(this.h)}, ${100*vr(this.s)}%, ${100*vr(this.l)}%${1===t?")":`, ${t})`}`}}));var br=t=>()=>t;function wr(t){return 1==(t=+t)?kr:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):br(isNaN(e)?n:e)}}function kr(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):br(isNaN(t)?e:t)}var _r=function t(e){var n=wr(e);function i(t,e){var i=n((t=sr(t)).r,(e=sr(e)).r),r=n(t.g,e.g),o=n(t.b,e.b),a=kr(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=r(e),t.b=o(e),t.opacity=a(e),t+""}}return i.gamma=t,i}(1);function Mr(t,e){e||(e=[]);var n,i=t?Math.min(e.length,t.length):0,r=e.slice();return function(o){for(n=0;n<i;++n)r[n]=t[n]*(1-o)+e[n]*o;return r}}function Sr(t,e){var n,i=e?e.length:0,r=t?Math.min(i,t.length):0,o=new Array(r),a=new Array(i);for(n=0;n<r;++n)o[n]=Dr(t[n],e[n]);for(;n<i;++n)a[n]=e[n];return function(t){for(n=0;n<r;++n)a[n]=o[n](t);return a}}function Cr(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function qr(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Nr(t,e){var n,i={},r={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?i[n]=Dr(t[n],e[n]):r[n]=e[n];return function(t){for(n in i)r[n]=i[n](t);return r}}var Rr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ar=new RegExp(Rr.source,"g");function Or(t,e){var n,i,r,o=Rr.lastIndex=Ar.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=Rr.exec(t))&&(i=Ar.exec(e));)(r=i.index)>o&&(r=e.slice(o,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:qr(n,i)})),o=Ar.lastIndex;return o<e.length&&(r=e.slice(o),s[a]?s[a]+=r:s[++a]=r),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,i=0;i<e;++i)s[(n=l[i]).i]=n.x(t);return s.join("")})}function Dr(t,e){var n,i=typeof e;return null==e||"boolean"===i?br(e):("number"===i?qr:"string"===i?(n=ir(e))?(e=n,_r):Or:e instanceof ir?_r:e instanceof Date?Cr:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?Mr:Array.isArray(e)?Sr:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Nr:qr)(t,e)}function Er(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function Ir(t){return+t}var Tr=[0,1];function jr(t){return t}function Pr(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function zr(t,e,n){var i=t[0],r=t[1],o=e[0],a=e[1];return r<i?(i=Pr(r,i),o=n(a,o)):(i=Pr(i,r),o=n(o,a)),function(t){return o(i(t))}}function Fr(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),o=new Array(i),a=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<i;)r[a]=Pr(t[a],t[a+1]),o[a]=n(e[a],e[a+1]);return function(e){var n=je(t,e,1,i)-1;return o[n](r[n](e))}}function Lr(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function $r(){var t,e,n,i,r,o,a=Tr,s=Tr,l=Dr,c=jr;function u(){var t=Math.min(a.length,s.length);return c!==jr&&(c=function(t,e){var n;return t>e&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(a[0],a[t-1])),i=t>2?Fr:zr,r=o=null,h}function h(e){return null==e||isNaN(e=+e)?n:(r||(r=i(a.map(t),s,l)))(t(c(e)))}return h.invert=function(n){return c(e((o||(o=i(s,a.map(t),qr)))(n)))},h.domain=function(t){return arguments.length?(a=Array.from(t,Ir),u()):a.slice()},h.range=function(t){return arguments.length?(s=Array.from(t),u()):s.slice()},h.rangeRound=function(t){return s=Array.from(t),l=Er,u()},h.clamp=function(t){return arguments.length?(c=!!t||jr,u()):c!==jr},h.interpolate=function(t){return arguments.length?(l=t,u()):l},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,i){return t=n,e=i,u()}}function Br(){return $r()(jr,jr)}function Hr(t,e,n,i){var r,o=function(t,e,n){n=+n;const i=(e=+e)<(t=+t),r=i?Ve(e,t,n):Ve(t,e,n);return(i?-1:1)*(r<0?1/-r:r)}(t,e,n);switch((i=Xt(null==i?",f":i)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=i.precision||isNaN(r=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Wt(e)/3)))-Wt(Math.abs(t)))}(o,a))||(i.precision=r),ee(i,a);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Wt(e)-Wt(t))+1}(o,Math.max(Math.abs(t),Math.abs(e))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=function(t){return Math.max(0,-Wt(Math.abs(t)))}(o))||(i.precision=r-2*("%"===i.type))}return te(i)}function Vr(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){if(!((n=+n)>0))return[];if((t=+t)==(e=+e))return[t];const i=e<t,[r,o,a]=i?He(e,t,n):He(t,e,n);if(!(o>=r))return[];const s=o-r+1,l=new Array(s);if(i)if(a<0)for(let t=0;t<s;++t)l[t]=(o-t)/-a;else for(let t=0;t<s;++t)l[t]=(o-t)*a;else if(a<0)for(let t=0;t<s;++t)l[t]=(r+t)/-a;else for(let t=0;t<s;++t)l[t]=(r+t)*a;return l}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var i=e();return Hr(i[0],i[i.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var i,r,o=e(),a=0,s=o.length-1,l=o[a],c=o[s],u=10;for(c<l&&(r=l,l=c,c=r,r=a,a=s,s=r);u-- >0;){if((r=Ve(l,c,n))===i)return o[a]=l,o[s]=c,e(o);if(r>0)l=Math.floor(l/r)*r,c=Math.ceil(c/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,c=Math.floor(c*r)/r}i=r}return t},t}function Wr(){var t=Br();return t.copy=function(){return Lr(t,Wr())},Ti.apply(t,arguments),Vr(t)}function Ur(){var t,e=[.5],n=[0,1],i=1;function r(r){return null!=r&&r<=r?n[je(e,r,0,i)]:t}return r.domain=function(t){return arguments.length?(e=Array.from(t),i=Math.min(e.length,n.length-1),r):e.slice()},r.range=function(t){return arguments.length?(n=Array.from(t),i=Math.min(e.length,n.length-1),r):n.slice()},r.invertExtent=function(t){var i=n.indexOf(t);return[e[i-1],e[i]]},r.unknown=function(e){return arguments.length?(t=e,r):t},r.copy=function(){return Ur().domain(e).range(n).unknown(t)},Ti.apply(r,arguments)}function Yr(t){return void 0===t?t=>t:e=>t(e)}function Xr(t){return Math.max(0,Math.min(1,t))}function Kr(t){return"object"==typeof t}function Gr(t,e,n){const i=Math.abs(e-n)/(t+1),r=[];for(let o=1;o<=t;o++){const t=o*i;r.push(e<n?e+t:e-t)}return r}function Zr(t,e,n){if(1===t.length)return t;const i=t.concat([]);for(let r=0;r<t.length;r++){let o=t[r],a=t[r+1];0===r&&o!==n.start()?(i.push(...Gr(e,o,a)),o-=a-o,a=t[r],i.push(...Gr(e,o,a))):r===t.length-1&&a!==n.end()?(a=o+(o-t[r-1]),i.push(...Gr(e,o,a))):i.push(...Gr(e,o,a))}return i.filter((t=>t>=n.min()&&t<=n.max()))}function Jr(t){let{distance:e,scale:n,minorCount:i=0,unitDivider:r=100,formatter:o}=t;const a=A(r)||A(e)?2:Math.max(e/r,2),s=Math.min(1e3,Math.round(a));let l=n.ticks(s);l.length<=1&&(l=n.ticks(s+1));const c=i>0?Zr(l,i,n):l;c.sort(((t,e)=>t-e));const u=c.map(Yr(o));return c.map(((t,e)=>{const i=n(t);return{position:i,start:i,end:i,label:u[e],value:t,isMinor:-1===l.indexOf(t)}}))}function Qr(t){let{distance:e,scale:n,minorCount:i=0,unitDivider:r=100,formatter:o}=t;const a=A(r)||A(e)?2:Math.max(e/r,2),s=Math.min(1e3,Math.round(a)),l=s>10?10:s;n.nice(l);const c=n.ticks(s),u=i>0?Zr(c,i,n):c;u.sort(((t,e)=>t-e));const h=u.map(Yr(o));return u.map(((t,e)=>{const i=n(t);return{position:i,start:i,end:i,label:h[e],value:t,isMinor:-1===c.indexOf(t)}}))}function to(t){let e,{settings:n,scale:i,distance:r,formatter:o=(t=>t)}=t;const a=n.minorTicks&&!A(n.minorTicks.count)?Math.min(100,n.minorTicks.count):0;if(Array.isArray(n.ticks.values)){e=function(t){let{values:e,scale:n,formatter:i=(t=>t)}=t;return e.sort(((t,e)=>(Kr(t)?t.value:t)-(Kr(e)?e.value:e))).filter(((t,e,i)=>{const r=Kr(t)?t.value:t;return r<=n.max()&&r>=n.min()&&i.indexOf(t)===e})).map((t=>{const e=Kr(t),r=e?t.value:t,o=n(r);return{position:o,value:r,label:e&&void 0!==t.label?t.label:i(r),isMinor:!!e&&!!t.isMinor,start:e&&!isNaN(t.start)?Xr(n(t.start)):o,end:e&&!isNaN(t.end)?Xr(n(t.end)):o}}))}({values:n.ticks.values.filter((t=>"object"==typeof t?!A(t.value):!A(t))),scale:i.copy(),formatter:o})}else if(A(n.ticks.count)){e=(n.ticks.tight?Qr:Jr)({distance:r,minorCount:a,unitDivider:n.ticks.distance,scale:i,formatter:o}),n.ticks.forceBounds&&function(t,e,n){const i=t.map((t=>t.position)),r=e.range();-1===i.indexOf(r[0])?t.splice(0,0,{position:r[0],start:r[0],end:r[0],label:n(e.start()),isMinor:!1,value:e.start()}):t[0]&&t[0].isMinor&&(t[0].isMinor=!1);const o=t[t.length-1];-1===i.indexOf(r[1])?t.push({position:r[1],start:r[1],end:r[1],label:n(e.end()),isMinor:!1,value:e.end()}):o&&o.isMinor&&(o.isMinor=!1)}(e,i,o)}else{e=function(t){let{count:e,minorCount:n,scale:i,formatter:r}=t;return i.ticks((e-1)*n+e).map(((t,e)=>{const o=i(t);return{position:o,start:o,end:o,label:r(t),isMinor:e%(n+1)!=0,value:t}}))}({count:Math.min(1e3,n.ticks.count),minorCount:a,scale:i.copy(),formatter:o})}return e}function eo(t){let{scale:e}=t;const n=e.domain(),i=e.data().items,r=e.labels?e.labels():n,o=e.bandwidth();return n.map(((t,n)=>{const a=e(t);return{position:a+o/2,label:"".concat(r[n]),data:i?i[n]:void 0,start:a,end:a+o}}))}function no(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i={};return Object.keys(e).forEach((r=>{const o=typeof t[r];i[r]="function"===o?t[r](n):"undefined"===o?e[r]:t[r]})),i}const io={min:NaN,max:NaN,expand:NaN,include:[],invert:!1},ro={tight:!1,forceBounds:!1,values:void 0,count:NaN,distance:100},oo={count:NaN};function ao(t,e){const n=+t.min,i=+t.max;let r=0,o=1;if(e&&e[0]){const n=e.map((t=>t.min())).filter((t=>!isNaN(t))),i=e.map((t=>t.max())).filter((t=>!isNaN(t)));if(r=n.length?Math.min(...n):Number.NaN,o=i.length?Math.max(...i):Number.NaN,isNaN(r)||isNaN(o))r=-1,o=1;else if(r===o&&0===r)r=-1,o=1;else if(r===o&&r)r-=Math.abs(.1*r),o+=Math.abs(.1*o);else if(!isNaN(t.expand)){const e=o-r;r-=e*t.expand,o+=e*t.expand}if(Array.isArray(t.include)){const e=t.include.filter((t=>!isNaN(t)));r=Math.min(...e,r),o=Math.max(...e,o)}}return{mini:isNaN(n)?r:n,maxi:isNaN(i)?o:i}}function so(t,e){t.instance||(t.instance=e.copy(),t.instance.domain([e.start(),e.end()]),t.instance.clamp(!0),t.instance.range(t.invert?[1,0]:[0,1]))}function lo(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=Wr(),r={instance:null,invert:!1},o={data:e,resources:n},a=no(t,io,o);let s;function l(t){return A(t)?NaN:i(t)}a.ticks=no(t.ticks,ro,o),a.minorTicks=no(t.minorTicks,oo,o),l.data=()=>e,l.invert=function(t){return i.invert(t)},l.rangeRound=function(t){return i.rangeRound(t),l},l.clamp=function(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return i.clamp(t),l},l.cachedTicks=function(){return s},l.clearTicksCache=function(){return s=void 0,this},l.ticks=function(t){return null!==t&&"object"==typeof t?(t.settings=t.settings||{},t.settings=_(!0,{},a,t.settings),t.scale=l,s=to(t),s):(s=i.ticks(t),s)},l.nice=function(t){return i.nice(t),l},l.tickFormat=function(t,e){return i.tickFormat(t,e)},l.interpolate=function(t){return i.interpolate(t),l},l.domain=function(t){return arguments.length?(i.domain(t),r.instance&&r.instance.domain([l.start(),l.end()]),l):i.domain()},l.range=function(t){return arguments.length?(i.range(t),l):i.range()},l.start=function(){return l.domain()[0]},l.end=function(){return l.domain()[this.domain().length-1]},l.min=function(){return Math.min(this.start(),this.end())},l.max=function(){return Math.max(this.start(),this.end())},l.classify=function(t){let e=(l.start()-l.end())/t,n=[l.end()],i=[],r=e/2;for(let o=0;o<t;o++){let t=n[n.length-1]||0,o=t+e,a=l(t+r);n.push(o,o),i.push(a,a)}return n.pop(),l.domain(n),l.range(i),l},l.copy=function(){const r=lo(t,e,n);return r.domain(l.domain()),r.range(l.range()),r.clamp(i.clamp()),r},l.norm=function(t){return so(r,l),r.instance(t)},l.normInvert=function(t){return so(r,l),r.instance.invert(t)};const{mini:c,maxi:u}=ao(a,e?e.fields:[]);return l.domain([c,u]),l.range(a.invert?[1,0]:[0,1]),r.invert=a.invert,l}const co={padding:0,paddingInner:NaN,paddingOuter:NaN,align:.5,invert:!1,maxPxStep:NaN,range:[0,1]};function uo(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i={data:e,resources:n},r=no(t,co,i),o=e.items||[],a={},s=[],l=[];function c(t,n){t.data=()=>e,t.datum=t=>o[a[t]],t.start=function(){return t.domain()[0]},t.end=function(){return t.domain()[t.domain().length-1]},t.labels=()=>l,t.ticks=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.scale=t,eo(e,n.trackBy)}}const u=zi();c(u,t),u.pxScale=function(e){const n=r.maxPxStep;if(isNaN(n))return u;const i=u.domain().length,o=Math.max(1,i-u.paddingInner()+2*u.paddingOuter());if(o*n>=e)return u;const a=u.copy();a.type=u.type,c(a,t);const s=o*n/e,l=(1-s)*u.align();return a.range(r.invert?[s+l,l]:[l,s+l]),a};const h="function"==typeof t.value?t.value:t=>t.datum.value,d="function"==typeof t.label?t.label:t=>t.datum.label;for(let t=0;t<o.length;t++){const e=_({datum:o[t]},i),n=h(e,t);-1===s.indexOf(n)&&(s.push(n),l.push(d(e,t)),a[n]=t)}return u.domain(s),u.range(r.invert?r.range.slice().reverse():r.range),u.padding(isNaN(r.padding)?0:r.padding),isNaN(r.paddingInner)||u.paddingInner(r.paddingInner),isNaN(r.paddingOuter)||u.paddingOuter(r.paddingOuter),u.align(isNaN(r.align)?.5:r.align),u}const ho={depth:0};function fo(t,e,n){return t.ancestors().map((t=>e(_({datum:t.data},n)))).reverse().slice(1).toString()}function po(t,e,n){const i=e.ticks.depth,r=e.value,o=e.label,a=[],s=[],l={},c=[];let u=0;if(!t)return{values:a,labels:s,items:l,ticks:c};t.eachAfter((t=>{if(t.depth>0){const e=fo(t,r,n),h=t.leaves()||[t],d=r(_({datum:t.data},n)),f=o(_({datum:t.data},n)),p=Array.isArray(t.children),g={key:e,count:h.length,value:d,label:f,leftEdge:fo(h[0],r,n),rightEdge:fo(h[Math.max(h.length-1,0)],r,n),node:t};p?(a.push("SPACER_".concat(u,"_SPACER")),u++):(a.push(e),s.push(f)),(i<=0&&!p||t.depth===i)&&c.push(g),l[e]=g}}));const h=t.height-1;return h>0&&a.splice(-h),{values:a,labels:s,items:l,ticks:c}}const go=t=>t.min(),mo=t=>t.max();function yo(t,e){const n=t&&!isNaN(t.min),i=t&&!isNaN(t.max);let r=n?+t.min:0,o=i?+t.max:1;if(e&&e.length){if(!n){const t=e.map(go).filter(R);r=t.length?Math.min(...t):r}if(!i){const t=e.map(mo).filter(R);o=t.length?Math.max(...t):o}}return[r,o]}const vo={domain:[],range:[],invert:!1,min:NaN,max:NaN};function xo(t,e,n){const i=t.length;if(2===i)return[e,n];const r=[],o=(n-e)/(i-1);r.push(e);for(let t=1;t<i-1;t++)r.push(e+o*t);return r.push(n),r}function bo(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=lo(t,e,n).clamp(!0).interpolate(_r),r=no(t,vo,{data:e,resources:n}),o=Array.isArray(r.domain)&&r.domain.length,a=Array.isArray(r.range)&&r.range.length,s=i;_(!0,s,i);const[l,c]=yo(r,e?e.fields:[]),u=o?r.domain.length:-1,h=n.theme?n.theme.palette("sequential",u>0?u:2):[],d=a?r.range:h;return s.range(r.invert?d.slice().reverse():d.slice()),s.domain(o?r.domain:xo(s.range(),l,c)),s}const wo={domain:[],range:[],invert:!1,min:NaN,max:NaN,nice:!1};function ko(t,e,n){const i=t.length;if(2===i)return[e+(n-e)/2];const r=[],o=(n-e)/i;for(let t=1;t<i;t++)r.push(e+o*t);return r}function _o(t){const e=[];for(let n=0;n<t.length-1;n++)e.push((t[n]+t[n+1])/2);return e}function Mo(t,e,n,i){n=t[0],i=t&&t.length>=2?t[t.length-1]:i;const r=bo().domain([n,i]).range(e);return[n,..._o(t),i].map((t=>r(t)))}function So(t,e,n){const i=2===t.length?10:Math.max(1,t.length),r=Wr().domain([e,n]).nice(i).ticks(i);if(!t||!t.length)return r;const o=Math.max(0,t.length-1);for(;r.length>o;)r[0]-e<=n-r[r.length-1]?r.shift():r.pop();return r}const Co={domain:[],range:[]};function qo(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=Pi(),r={data:e,resources:n},o=no(t,Co,r),a="function"==typeof t.value?t.value:t=>t.datum.value,s="function"==typeof t.label?t.label:t=>t.datum.label,l=e.items||[],c={},u=[],h=[];for(let t=0;t<l.length;t++){const e=_({datum:l[t]},r),n=a(e,t);-1===u.indexOf(n)&&(u.push(n),h.push(s(e,t)),c[n]=t)}return i.data=()=>e,i.labels=()=>h,i.label=t=>h[u.indexOf(t)],i.datum=t=>l[c[t]],i.range(o.range),Array.isArray(o.domain)&&o.domain.length?i.domain(o.domain):i.domain(u),i}const No={domain:[],range:[],unknown:void 0},Ro={domain:[],range:[],override:!1};const Ao=Ht();function Oo(t,e,n){let i=t.data;t.source&&(n.logger.warn("Deprecated: Scale data source configuration"),i={extract:[]},(Array.isArray(t.source)?t.source:[t.source]).forEach((t=>{i.extract.push({field:t})})));const r=Oi(i,e,n);let o,a=t.type||function(t){return t.root?"h-band":t.fields&&t.fields[0]?-1!==t.fields.map((t=>"dimension"===t.type()?"band":"linear")).indexOf("linear")?"linear":"band":"linear"}(r);return"color"===a&&(a=r.fields&&r.fields[0]&&"dimension"===r.fields[0].type()?"categorical-color":"sequential-color"),n.scale.has(a)&&(o=n.scale.get(a),o=o(t,r,{theme:n.theme,logger:n.logger}),o.type=a),o}function Do(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Oo;const r={};return{get(o){let a;return"string"==typeof o&&t[o]?a=o:"object"==typeof o&&"scale"in o&&t[o.scale]&&(a=o.scale),a?(r[a]=r[a]||i(t[a],e,n),r[a]):i(o,e,n)},all(){return Object.keys(t).forEach(this.get),r}}}Ao("linear",lo),Ao("band",uo),Ao("h-band",(function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={data:n,resources:i},o=no(e,co,r);o.ticks=no(e.ticks,ho,r),o.value="function"==typeof e.value?e.value:t=>t.datum.value,o.label="function"==typeof e.label?e.label:t=>t.datum.value;let a=uo(o);const{values:s,labels:l,items:c,ticks:u}=po(n.root,o,r),h=function(t){const e=String(t),n=c[e];return a(n?o.invert?n.rightEdge:n.leftEdge:e)};_(!0,h,a),h.bandwidth=function(t){const e=c[String(t)],n=a.bandwidth();if(e&&!e.isLeaf){const t=h(e.leftEdge),i=h(e.rightEdge);return Math.abs(t-i)+n}return n},h.step=function(t){const e=c[String(t)],n=e?e.count:1;let i=a.step();return i*=n,i},h.data=()=>n,h.datum=t=>{const e=c[String(t)];return e?e.node.data:null},h.copy=()=>t(e,n,i),h.labels=()=>l,h.ticks=()=>u.map((t=>{const e=h(t.key),n=h.bandwidth(t.key);return{position:e+n/2,label:t.label,data:t.node.data,start:e,end:e+n}}));const d=a.pxScale;return h.pxScale=function(t){return a=d(t),h},h.domain(s),h})),Ao("sequential-color",bo),Ao("threshold-color",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=Ur(),r=no(t,wo,{data:e,resources:n}),o=Array.isArray(r.domain)&&r.domain.length,a=Array.isArray(r.range)&&r.range.length;function s(t){return A(t)?NaN:i(t)}Object.keys(i).forEach((t=>s[t]=i[t]));const l=e.fields,[c,u]=yo(r,l),h=o?r.domain.length:-1,d=n.theme?n.theme.palette("sequential",h>0?h:2):[];let f=a?r.range:d,p=[];return p=o?r.domain:r.nice?So(f,c,u):[c+(u-c)/2],f.length>p.length+1?p=ko(f,c,u):f.length<p.length+1&&(f=Mo(p,f,c,u)),s.data=()=>e,s.range(r.invert?f.slice().reverse():f),s.domain(p),s})),Ao("categorical-color",(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=qo(t,e,n),r=n.theme,o=no(t,No,{data:e,resources:n});let a;if(o.explicit=no(t.explicit,Ro,{data:e,resources:n}),a=Array.isArray(o.range)&&0!==o.range.length?o.range.slice():r?r.palette("categorical",i.domain().length).slice():[],o.unknown)i.unknown(o.unknown);else if(r&&r.palette("unknown")){let t=r.palette("unknown");i.unknown(t[0])}if(Array.isArray(o.explicit.domain)&&o.explicit.domain.length){const t=i.domain().slice(),e=o.explicit.domain,n=Array.isArray(o.explicit.range)?o.explicit.range:[],r=Math.floor(t.length/a.length);for(let t=1;t<r+1;t*=2)a=a.concat(a);if(o.explicit.override)for(let i=0;i<e.length;i++){const r=t.indexOf(e[i]);r>-1&&(a[r]=n[i])}else{e.map(((e,i)=>[t.indexOf(e),e,n[i]])).sort(((t,e)=>t[0]-e[0])).forEach((e=>{const n=t.indexOf(e[1]);-1!==n&&a.splice(n,0,e[2])}))}a.length=t.length}return i.range(a),i}));var Eo={};function Io(){Io.init.call(this)}Eo.isObject=function(t){return"object"==typeof t&&null!==t},Eo.isNumber=function(t){return"number"==typeof t},Eo.isUndefined=function(t){return void 0===t},Eo.isFunction=function(t){return"function"==typeof t};var To=Io;Io.EventEmitter=Io,Io.prototype._events=void 0,Io.prototype._maxListeners=void 0,Io.defaultMaxListeners=10,Io.init=function(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0},Io.prototype.setMaxListeners=function(t){if(!Eo.isNumber(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},Io.prototype.emit=function(t){var e,n,i,r,o,a;if(this._events||(this._events={}),"error"===t&&!this._events.error)throw(e=arguments[1])instanceof Error?e:Error('Uncaught, unspecified "error" event.');if(n=this._events[t],Eo.isUndefined(n))return!1;if(Eo.isFunction(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,r=new Array(i-1),o=1;o<i;o++)r[o-1]=arguments[o];n.apply(this,r)}else if(Eo.isObject(n)){for(i=arguments.length,r=new Array(i-1),o=1;o<i;o++)r[o-1]=arguments[o];for(i=(a=n.slice()).length,o=0;o<i;o++)a[o].apply(this,r)}return!0},Io.prototype.addListener=function(t,e){var n;if(!Eo.isFunction(e))throw TypeError("listener must be a function");(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,Eo.isFunction(e.listener)?e.listener:e),this._events[t]?Eo.isObject(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,Eo.isObject(this._events[t])&&!this._events[t].warned)&&((n=Eo.isUndefined(this._maxListeners)?Io.defaultMaxListeners:this._maxListeners)&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,Eo.isFunction(console.error)&&console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),Eo.isFunction(console.trace)&&console.trace()));return this},Io.prototype.on=Io.prototype.addListener,Io.prototype.once=function(t,e){if(!Eo.isFunction(e))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(t,i),n||(n=!0,e.apply(this,arguments))}return i.listener=e,this.on(t,i),this},Io.prototype.removeListener=function(t,e){var n,i,r,o;if(!Eo.isFunction(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=(n=this._events[t]).length,i=-1,n===e||Eo.isFunction(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(Eo.isObject(n)){for(o=r;o-- >0;)if(n[o]===e||n[o].listener&&n[o].listener===e){i=o;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},Io.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],Eo.isFunction(n))this.removeListener(t,n);else if(Array.isArray(n))for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},Io.prototype.listeners=function(t){return this._events&&this._events[t]?Eo.isFunction(this._events[t])?[this._events[t]]:this._events[t].slice():[]},Io.listenerCount=function(t,e){return t._events&&t._events[e]?Eo.isFunction(t._events[e])?1:t._events[e].length:0};var jo={mixin:t=>(Object.keys(To.prototype).forEach((e=>{t[e]=To.prototype[e]})),To.init(t),t)};function Po(){let t=0,e=0,n=0,i=0;n=n||t;const r={move(t){this.moveTo(n+t)},moveTo(o){const a=Math.max(t,Math.min(e-i,o));n!==a&&(n=a,r.emit("update"))},update(o){let a=!1;({min:t=t,max:e=e}=o),void 0!==o.viewSize&&o.viewSize!==i&&(i=o.viewSize,a=!0);const s=Math.max(t,Math.min(e-i,n));n!==s&&(n=s,a=!0),a&&r.emit("update")},getState:()=>({min:t,max:e,start:n,viewSize:i})};return jo.mixin(r),r}function zo(t,e){const n=t.min||0,i=t.max||0,r=t.viewSize||0,o=e||Po();return o.update({min:n,max:i,viewSize:r}),o}function Fo(t,e){const n={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=zo(t[i],e?e[i]:null));return n}function Lo(t,e){return e[t]||(e[t]=Po()),e[t]}function $o(t,e){return t<=e}function Bo(t,e){return t<e}function Ho(t,e,n){let i=0;for(;i<t.length&&e>t[i];)++i;return t[i]===e&&n&&++i,i}function Vo(t,e,n,i){const r=t.length;for(let o=1;o<r;o+=2)if(n(t[o-1],e)&&i(e,t[o]))return!0;return!1}function Wo(){let t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=[];function r(){}return r.configure=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{includeMax:i=!0,includeMin:r=!0}=n;t=i?$o:Bo,e=r?$o:Bo},r.add=t=>{let{min:e,max:n}=t;const r=Ho(i,e),o=Ho(i,n,!0),a=[r,o-r];r%2==0&&a.push(e),o%2==0&&a.push(n);const s=i.join(",");i.splice(...a);return s!==i.join(",")},r.remove=t=>{let{min:e,max:n}=t;const r=Ho(i,e),o=Ho(i,n,!0),a=[r,o-r];r%2==1&&a.push(e),o%2==1&&a.push(n);const s=i.join(",");i.splice(...a);return s!==i.join(",")},r.set=t=>{const e=i.join(",");i=[],Array.isArray(t)?t.forEach(r.add):r.add(t);return e!==i.join(",")},r.clear=()=>{const t=i.length>0;return i=[],t},r.containsValue=n=>Vo(i,n,e,t),r.containsRange=t=>{let{min:e,max:n}=t;const r=Ho(i,e,!0),o=Ho(i,n);return r===o&&o%2==1},r.toggle=t=>r.containsRange(t)?r.remove(t):r.add(t),r.ranges=()=>{const t=[];for(let e=1;e<i.length;e+=2)t.push({min:i[e-1],max:i[e]});return t},r.configure(n),r}function Uo(){let t=[];function e(){}return e.add=e=>-1===t.indexOf(e)&&(t.push(e),!0),e.remove=e=>{const n=t.indexOf(e);return-1!==n&&(t.splice(n,1),!0)},e.contains=e=>-1!==t.indexOf(e),e.values=()=>t.slice(),e.clear=()=>t=[],e.toString=()=>t.join(";"),e}const Yo={key:void 0,includeMin:!0,includeMax:!0};function Xo(t){let{items:e,collection:n,vc:i}=t;const r={},o=[];let a,s;for(let t=0,o=e.length;t<o;t++){a=e[t].key,n[a]||(n[a]=i()),s=e[t].values||[e[t].value];for(let t=0;t<s.length;t++)n[a].add(s[t])&&(r[a]=r[a]||[],r[a].push(s[t]))}const l=Object.keys(r);for(let t=0,e=l.length;t<e;t++)a=l[t],o.push({id:a,values:r[a]});return o}function Ko(t){let{items:e,collection:n}=t;const i={},r=[];let o,a;for(let t=0,r=e.length;t<r;t++)if(o=e[t].key,n[o]){a=e[t].values||[e[t].value];for(let t=0;t<a.length;t++)n[o].remove(a[t])&&(i[o]=i[o]||[],i[o].push(a[t]))}const s=Object.keys(i);for(let t=0,e=s.length;t<e;t++)o=s[t],r.push({id:o,values:i[o]});return r}function Go(t){const e={};let n,i;for(let r=0,o=t.length;r<o;r++){n=t[r].key,i=t[r].values||[t[r].value],e[n]||(e[n]=[]);for(let t=0;t<i.length;t++){-1===e[n].indexOf(i[t])&&e[n].push(i[t])}}return e}function Zo(t){let{key:e,collection:n,obj:i,fn:r,value:o}=t;n[e]||(n[e]=r()),i[e]=i[e]||[],i[e].push(o),n[e].add(o)}function Jo(t){let{items:e,values:n,vc:i}=t;const r={},o={},a=[],s=[],l=Go(e);let c,u,h;const d=Object.keys(l);for(let t=0,e=d.length;t<e;t++){c=d[t],h=l[c];for(let t=0,e=h.length;t<e;t++)u=h[t],n[c]&&n[c].contains(u)?n[c]&&n[c].contains(u)&&(o[c]=o[c]||[],o[c].push(u),n[c].remove(u)):Zo({key:c,value:u,collection:n,obj:r,fn:i})}const f=Object.keys(r);for(let t=0,e=f.length;t<e;t++)c=f[t],a.push({id:c,values:r[c]});const p=Object.keys(o);for(let t=0,e=p.length;t<e;t++)c=p[t],s.push({id:c,values:o[c]});return[a,s]}function Qo(t,e){const n=[],i=Object.keys(t);let r,o;const a=t=>-1===e[r].indexOf(t);for(let s=0,l=i.length;s<l;s++)r=i[s],e[r]?(o=t[r].filter(a),o.length&&n.push({id:r,values:o})):n.push({id:r,values:t[r]});return n}function ta(t){let{items:e,vCollection:n,vc:i}=t;const r={},o=Go(e);let a,s=[],l=[];const c={},u=Object.keys(n);for(let t=0,e=u.length;t<e;t++)a=u[t],c[a]=n[a].values().slice(),delete n[a];const h=t=>{n[a]&&n[a].contains(t)||Zo({key:a,value:t,collection:n,obj:r,fn:i})},d=Object.keys(o);for(let t=0,e=d.length;t<e;t++)a=d[t],o[a].forEach(h);return l=Qo(c,r),s=Qo(r,c),[s,l]}function ea(t,e,n){const i=function(t,e){if(!Object.keys(e).length)return t;const n=t.length,i=Array(n);for(let r=0;r<n;r++)i[r]=t[r].key in e?_({},t[r],{key:e[t[r].key]}):t[r];return i}(e,n);return t&&t.length?t.reduce(((t,e)=>e(t)),i):i}function na(t){return t.replace(/(-[a-z])/g,(t=>t.toUpperCase().replace("-","")))}function ia(t){return t.replace(/([A-Z])/g,(t=>"-".concat(t.toLowerCase())))}function ra(t,e,n){let{ranges:i,interceptors:r,rc:o,aliases:a,rangeConfig:s}=n;const l=ea(r["".concat(e,"Ranges")],t,a);let c=!1;return l.forEach((t=>{const n=t.key;if(i[n]||(i[n]=o(s.sources[n]||s.default)),"set"===e)c=i[n][e](t.ranges||t.range)||c;else{const r=t.ranges||[t.range];for(let t=0;t<r.length;t++)c=i[n][e](r[t])||c}})),c}function oa(){let{vc:t=Uo,rc:e=Wo}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=!1,i={},r={},o={},a={sources:{},default:_({},Yo)};const s={addValues:[],removeValues:[],toggleValues:[],setValues:[],addRanges:[],setRanges:[],removeRanges:[],toggleRanges:[]},l=()=>{const t={values:{},ranges:{}};return Object.keys(r).forEach((e=>{t.values[e]=r[e].values()})),Object.keys(i).forEach((e=>{t.ranges[e]=i[e].ranges()})),t},c={ls:[],clear(){this.ls.forEach((t=>t.clear()))},start(){this.ls.forEach((t=>t.start()))},end(){this.ls.forEach((t=>t.end()))},update(){const t=l();this.ls.forEach((e=>e._state(t)))},updateValues(){const t=l();this.ls.forEach((e=>e._state({values:t.values})))},updateRanges(){const t=l();this.ls.forEach((e=>e._state({ranges:t.ranges})))}},u={configure:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Array.isArray(t.ranges)&&t.ranges.length&&(a={sources:{},default:_({},Yo)},t.ranges.forEach((t=>{const e={};Object.keys(Yo).filter((t=>"key"!==t)).forEach((n=>{e[n]=void 0!==t[n]?t[n]:Yo[n]})),void 0!==t.key?a.sources[t.key]=e:a.default=e})),Object.keys(i).forEach((t=>i[t].configure(a.sources[t]||a.default))),u.emit("update",[],[]))},link:t=>{if(u===t)throw new Error("Can't link to self");c.ls.push(t),t._state(l())},_state:t=>{if(!t)return l();if(t.values){const e=[];Object.keys(t.values).forEach((n=>{r[n]&&t.values[n].join(";")===r[n].toString()||e.push({key:n,values:t.values[n]})})),Object.keys(r).forEach((n=>{t.values[n]||e.push({key:n,values:[]})})),e.length&&u.setValues(e)}if(t.ranges){const e=[];Object.keys(t.ranges).forEach((n=>{i[n]&&t.ranges[n].join(";")===i[n].toString()||e.push({key:n,ranges:t.ranges[n]})})),Object.keys(i).forEach((n=>{t.ranges[n]||e.push({key:n,ranges:[]})})),e.length&&u.setRanges(e)}},start:function(){if(!n){n=!0;for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];u.emit("start",...e),c.start()}},end:function(){if(n){n=!1,i={},r={};for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];u.emit("end",...e),c.end()}},isActive:()=>n,clear:()=>{const t=u.brushes().filter((t=>"value"===t.type&&t.brush.values().length)).map((t=>({id:t.id,values:t.brush.values()}))),e=Object.keys(i).length>0||t.length;i={},r={},e&&(u.emit("update",[],t),c.clear())},brushes:()=>{let t=[];return t=t.concat(Object.keys(i).map((t=>({type:"range",id:t,brush:i[t]})))),t=t.concat(Object.keys(r).map((t=>({type:"value",id:t,brush:r[t]})))),t},addValue:(t,e)=>{u.addValues([{key:t,value:e}])},addValues:e=>{const i=ea(s.addValues,e,o),a=Xo({vc:t,collection:r,items:i});u.emit("add-values",i),a.length&&(n||(n=!0,u.emit("start")),u.emit("update",a,[]),c.updateValues())},setValues:e=>{const i=ea(s.setValues,e,o),a=ta({items:i,vCollection:r,vc:t});u.emit("set-values",i),(a[0].length>0||a[1].length>0)&&(n||(n=!0,u.emit("start")),u.emit("update",a[0],a[1]),c.updateValues())},removeValue:(t,e)=>{u.removeValues([{key:t,value:e}])},removeValues:t=>{const e=ea(s.removeValues,t,o),n=Ko({collection:r,items:e});u.emit("remove-values",e),n.length&&(u.emit("update",[],n),c.updateValues())},addAndRemoveValues:(e,i)=>{const a=ea(s.addValues,e,o),l=ea(s.removeValues,i,o),h=Xo({vc:t,collection:r,items:a}),d=Ko({collection:r,items:l});u.emit("add-values",a),u.emit("remove-values",l),(h.length||d.length)&&(n||(n=!0,u.emit("start")),u.emit("update",h,d),c.updateValues())},toggleValue:(t,e)=>{u.toggleValues([{key:t,value:e}])},toggleValues:e=>{const i=ea(s.toggleValues,e,o),a=Jo({items:i,values:r,vc:t});u.emit("toggle-values",i),(a[0].length>0||a[1].length>0)&&(n||(n=!0,u.emit("start")),u.emit("update",a[0],a[1]),c.updateValues())},containsValue:(t,e)=>{let n=o[t]||t;return!!r[n]&&r[n].contains(e)},addRange:(t,e)=>{u.addRanges([{key:t,range:e}])},addRanges:t=>{ra(t,"add",{ranges:i,rc:e,interceptors:s,aliases:o,rangeConfig:a})&&(n||(n=!0,u.emit("start")),u.emit("update",[],[]),c.updateRanges())},removeRange:(t,e)=>{u.removeRanges([{key:t,range:e}])},removeRanges:t=>{ra(t,"remove",{ranges:i,rc:e,interceptors:s,aliases:o,rangeConfig:a})&&(n||(n=!0,u.emit("start")),u.emit("update",[],[]),c.updateRanges())},setRange:(t,e)=>{u.setRanges([{key:t,range:e}])},setRanges:t=>{ra(t,"set",{ranges:i,rc:e,interceptors:s,aliases:o,rangeConfig:a})&&(n||(n=!0,u.emit("start")),u.emit("update",[],[]),c.updateRanges())},toggleRange:(t,e)=>{u.toggleRanges([{key:t,range:e}])},toggleRanges:t=>{ra(t,"toggle",{ranges:i,rc:e,interceptors:s,aliases:o,rangeConfig:a})&&(n||(n=!0,u.emit("start")),u.emit("update",[],[]),c.updateRanges())},containsRangeValue:(t,e)=>{let n=o[t]||t;return!!i[n]&&i[n].containsValue(e)},containsRange:(t,e)=>{let n=o[t]||t;return!!i[n]&&i[n].containsRange(e)},containsMappedData:(t,e,n)=>{let a=[];const s=Object.keys(t);let l,c,u,h;for(let e=0,n=s.length;e<n;e++){if(l=s[e],"value"===l)c=t,a[e]={key:"",i:e,bool:!1};else{if("source"===l)continue;c=t[l],a[e]={key:l,i:e,bool:!1}}u=c.source&&c.source.field,void 0!==u&&(void 0!==c.source.key&&(u="".concat(c.source.key,"/").concat(u)),u in o&&(u=o[u]),h=c.value,i[u]?a[e].bool=Array.isArray(h)?i[u].containsRange({min:h[0],max:h[1]}):i[u].containsValue(h):r[u]&&r[u].contains(h)&&(a[e].bool=!0))}return e?(a=a.filter((t=>-1!==e.indexOf(t.key))),"and"===n?!!a.length&&!a.some((t=>!1===t.bool)):"xor"===n?!!a.length&&a.some((t=>t.bool))&&a.some((t=>!1===t.bool)):a.some((t=>t.bool))):a.some((t=>t.bool))},intercept:(t,e)=>{const n=na(t);s[n]&&s[n].push(e)},removeInterceptor:(t,e)=>{const n=na(t);if(!s[n])return;const i=s[n].indexOf(e);-1!==i&&s[n].splice(i,1)},removeAllInterceptors:t=>{const e=[];if(t){const n=na(t);s[n]&&s[n].length&&e.push({name:t,handlers:s[n]})}else Object.keys(s).forEach((t=>{s[t].length&&e.push({name:ia(t),handlers:s[t]})}));e.forEach((t=>{t.handlers.slice().forEach((e=>u.removeInterceptor(t.name,e)))}))},addKeyAlias:(t,e)=>{o[t]=e},removeKeyAlias:t=>{delete o[t]}};return jo.mixin(u),u}function aa(t){return t*t*t}function sa(t){return--t*t*t+1}function la(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}function ca(t,e){return t.data?t.data.value:"text"===t.type?t.text:e}function ua(t,e,n,i){let r,{old:o,current:a}=t,{renderer:s}=e,l=[],c={nodes:[],ips:[]},u={nodes:[],ips:[]},h={nodes:[],ips:[]},d=[],f=null;const p=n.trackBy||ca,g={start(){let t={};if(o.forEach(((e,n)=>{let i=p(e,n);t[i]=e})),a.forEach(((e,n)=>{let i=p(e,n);if(t[i]){if("path"===e.type&&e.points&&e.points.length>0&&"trend"!==e.data.source.key){const n=function(t,e){const n=t.points.filter((t=>!t.dummy)),i=e.points.filter((t=>!t.dummy)),r=i.map((t=>t.data.major.value)),o=n.filter((t=>r.includes(t.data.major.value))).map((t=>t.data.major.value));return{old:n.filter((t=>o.includes(t.data.major.value))),current:i.filter((t=>o.includes(t.data.major.value)))}}(t[i],e);h.ips.push(Nr(_({},t[i],{points:n.old}),_({},e,{points:n.current}))),l.push(_({},t[i],{commonPoints:n.old}))}else h.ips.push(Nr(t[i],e)),l.push(t[i]);h.nodes.push(e),t[i]=!1}else c.nodes.push(e),c.ips.push(Nr(_({},e,{r:.001,opacity:0}),e))})),Object.keys(t).forEach((e=>{t[e]&&(u.nodes.push(t[e]),u.ips.push(Nr(t[e],_({},t[e],{r:1e-4,opacity:0}))))})),d.push({name:"exiting",easing:aa,duration:200,tweens:u.ips,nodes:[...l]}),d.push({name:"updating",easing:la,duration:400,tweens:h.ips,nodes:[]}),d.push({name:"entering",easing:sa,duration:200,tweens:c.ips,nodes:[...h.nodes]}),n.isMainComponent){var e;const t=null===(e=n.isMainComponent)||void 0===e?void 0:e.filterFn,r=t?l.filter(t).length:l.length,{isInit:o,shouldBeRemoved:a}=i.getValue("animations.updatingStageMeta");!1===o?(i.setValue("animations.updatingStageMeta.shouldBeRemoved",0===r),i.setValue("animations.updatingStageMeta.isInit",!0)):i.setValue("animations.updatingStageMeta.shouldBeRemoved",a&&0===r)}d.length&&(f=s.getScene(a),d[0].started=Date.now(),"undefined"!=typeof window&&(r=window.requestAnimationFrame(g.tick)))},tick(){let t=d[0];t||g.stop(),t.started||(t.started=Date.now());let e=(Date.now()-t.started)/t.duration,n=[],o=t.tweens.map((n=>n(t.easing(Math.min(1,e)))));if(n.push(...o),n.push(...t.nodes),s.render(n),e>=1){d.shift();const{isInit:t,shouldBeRemoved:e}=i.getValue("animations.updatingStageMeta");d.length?"updating"===d[0].name&&e&&d.shift():(!0===t&&i.setValue("animations.updatingStageMeta.isInit",!1),g.stop())}r&&(r=window.requestAnimationFrame(g.tick))},stop(){r&&(window.cancelAnimationFrame(r),r=!1)},inProgress:()=>!!r,get targetScene(){return f}};return g}Ht();const ha={fontFamily:"Arial",fontSize:"13px",color:"#595959",backgroundColor:"#ffffff",stroke:"#000000",strokeWidth:0,$fill:"#333333"},da=/^\$/;function fa(t){const e=typeof t;return"object"!==e&&"function"!==e&&"undefined"!==e}function pa(t,e,n){const i=t[e];i&&i.scale&&i.scale.pxScale?i.scale=i.scale.pxScale(n):i&&i.pxScale&&(t[e]=i.pxScale(n))}function ga(t,e){return t.pxScale?t.pxScale(e):t}const ma={normalizeSettings:function(t,e,n){const i=_({},t),r=_({},e);return Object.keys(i).forEach((t=>{r[t]={};const o=i[t],a=typeof o;if("function"==typeof o)r[t].fn=o;else if(fa(o)){let n=e[t];"string"==typeof n&&da.test(n)&&(n=ha[n]);const i=typeof n;r[t]="undefined"===i||i===a?o:n}else o&&"object"==typeof o&&("function"==typeof o.fn&&(r[t].fn=o.fn),void 0!==o.scale&&(r[t].scale=n.scale(o.scale)),"string"==typeof o.ref&&(r[t].ref=o.ref))})),Object.keys(e).forEach((t=>{if(t in i)return;const n=e[t];"string"===typeof n&&da.test(n)?r[t]=ha[n]:r[t]=n})),r},resolveForItem:function(t,e,n){const i={},r=Object.keys(e),o=r.length,a=t.datum,s=t.datum;for(let l=0;l<o;l++){const o=r[l],c=e[o],u="object"==typeof s&&void 0!==c,h=u&&"string"==typeof c.ref,d=u&&o in s,f=h?s[c.ref]:d?s[o]:a;fa(c)?i[o]=c:u&&c.fn?(c.scale&&(t.scale=c.scale),i[o]=c.fn.call(null,t,n)):u&&c.scale&&f?(i[o]=c.scale(f.value),c.scale.bandwidth&&(i[o]+=c.scale.bandwidth()/2)):h&&f?i[o]=f.value:c.fn?i[o]=c.fn.call(null,t,n):i[o]=c}return i},updateScaleSize:pa};function ya(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ma,n={};function i(i){let{data:r,settings:o,defaults:a={},scaled:s}=i;const l=n.norm=e.normalizeSettings(o,a,t.chart),c={scale:t.chart.scale,formatter:t.chart.formatter};s&&Object.keys(s).forEach((t=>{l[t]&&e.updateScaleSize(l,t,s[t])}));const u=[];if(!r||!Array.isArray(r.items)){const t={data:r,resources:c};let i=e.resolveForItem(t,n.norm,-1);return{settings:n.norm,item:i}}{let t;for(let i=0,o=r.items.length;i<o;i++){t={datum:r.items[i],data:r,resources:c};let o=e.resolveForItem(t,n.norm,i);o.data=r.items[i],u.push(o)}}return{settings:n.norm,items:u}}return{resolve:i}}function va(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return t.reduce(((t,e)=>Array.isArray(e.children)?(t.push(...va(e.children)),t):(t.push(e),t)),[])}function xa(t,e){let{context:n,data:i,style:r,filter:o,mode:a}=e;const s=t.chart.brush(n),l=i,c=r.active||{},u=r.inactive||{},h=[];Object.keys(c).forEach((t=>{h.push(t)})),Object.keys(u).forEach((t=>{-1===h.indexOf(t)&&h.push(t)}));const d=[];let f=!1;const p=()=>{let e=va(t.nodes);return"function"==typeof o&&(e=e.filter(o)),e},g=()=>{const t=p(),e=t.length;let n,i=!1;const r="function"==typeof l?l({brush:s}):l;for(let i=0;i<e;i++){if(n=t[i].data,!n)continue;t[i].__style||(t[i].__style={},h.forEach((e=>{t[i].__style[e]=t[i][e]})));const e=s.containsMappedData(n,r,a),o=d.indexOf(t[i]);let l=!1;e&&-1===o?(d.push(t[i]),l=!0):e||-1===o||(d.splice(o,1),l=!0),t[i].needToUpdate=l||f,t[i].isActive=e}for(let r=0;r<e;r++)if(n=t[r].data,n){if(t[r].needToUpdate){const e=_({},t[r],t[r].__style),n=t[r].isActive;h.forEach((i=>{t[r][i]=n&&i in c?"function"==typeof c[i]?c[i].call(null,e,d):c[i]:!n&&i in u?"function"==typeof u[i]?u[i].call(null,e,d):u[i]:t[r].__style[i]})),i=!0}delete t[r].needToUpdate}return f=!1,i},m=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{suppressRender:!1};const{suppressRender:n}=e,i=p(),r=i.length;for(let t=0;t<r;t++)i[t].data&&(i[t].__style=i[t].__style||{},h.forEach((e=>{i[t].__style[e]=i[t][e],e in u&&(i[t][e]="function"==typeof u[e]?u[e].call(null,i[t]):u[e])})));f=!0,d.length=0,n||t.renderer.render(t.nodes)},y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{suppressRender:!1};const{suppressRender:n}=e,i=p(),r=i.length;for(let t=0;t<r;t++)i[t].__style&&(Object.keys(i[t].__style).forEach((e=>{i[t][e]=i[t].__style[e]})),i[t].__style=void 0);d.length=0,n||t.renderer.render(t.nodes)},v=()=>{if(g()){const e="function"==typeof t.config.sortNodes?t.config.sortNodes(t):t.nodes;"function"==typeof t.config.customRender?t.config.customRender({render:t.renderer.render,nodes:e}):t.renderer.render(e)}};return s.on("start",m),s.on("end",y),s.on("update",v),{isActive:()=>s.isActive(),update:()=>{d.length=0,f=!0,g()},cleanUp:function(){s.removeListener("start",m),s.removeListener("end",y),s.removeListener("update",v)}}}function ba(t){let{nodes:e,action:n,chart:i,trigger:r}=t;const o=[];for(let t=0;t<e.length;t++){let n=e[t].data;null!==n&&o.push(n)}!function(t){let{dataPoints:e,action:n,chart:i,trigger:r}=t;if(!r)return;const o=r.data||[""];let a={items:[],actionFn:"toggleRanges"},s={items:[],actionFn:"toggleValues"};-1!==["add","remove","set","toggle"].indexOf(n)&&(a.actionFn="".concat(n,"Ranges"),s.actionFn="".concat(n,"Values"));for(let t=0;t<e.length;t++){const n=e[t];n&&o.forEach((t=>{let e=n&&!t?n:n[t];if(e){let t={key:e.source.field};void 0!==e.source.key&&(t.key="".concat(e.source.key,"/").concat(e.source.field)),Array.isArray(e.value)?(t.range={min:e.value[0],max:e.value[1]},a.items.push(t)):(t.value=e.value,s.items.push(t))}}))}r.contexts.forEach((t=>{a.items.length?i.brush(t)[a.actionFn](a.items):i.brush(t)[s.actionFn](s.items)}))}({dataPoints:o,action:n,chart:i,trigger:r})}function wa(t){let{collisions:e,t:n,config:i,action:r}=t,o=[],a=!1;e.length>0&&(o=e,a=!0,"stop"===n.propagation&&(o=[e[e.length-1]]));return ba({nodes:o.map((t=>t.node)),action:r,chart:i.chart,data:i.data,trigger:n}),a}function ka(t,e,n){const i=n.element().getBoundingClientRect();let r=N(t)?function(t,e){return 1!==t.changedTouches.length?null:{x:t.changedTouches[0].clientX-e.left,y:t.changedTouches[0].clientY-e.top}}(t,i):function(t,e){return{x:t.clientX-e.left,y:t.clientY-e.top}}(t,i);return null===r||r.x<0||r.y<0||r.x>i.width||r.y>i.height?[]:(e.touchRadius>0&&N(t)?r={cx:r.x,cy:r.y,r:e.touchRadius}:e.mouseRadius>0&&!N(t)&&(r={cx:r.x,cy:r.y,r:e.mouseRadius}),n.itemsAt(r))}function _a(t,e,n){return t?"function"==typeof t?t(e):t:n}function Ma(t){let{e:e,t:n,config:i}=t;return wa({collisions:ka(e,n,i.renderer),t:n,config:i,action:_a(n.action,e,"toggle")})}function Sa(t){let{e:e,t:n,config:i}=t;return wa({collisions:ka(e,n,i.renderer),t:n,config:i,action:_a(n.action,e,"set")})}const Ca={fill:"fill",stroke:"stroke",opacity:"opacity",strokeWidth:"stroke-width",strokeLinejoin:"stroke-linejoin",fontFamily:"font-family",fontSize:"font-size",fontWeight:"font-weight",baseline:"dominant-baseline",dominantBaseline:"dominant-baseline",anchor:"text-anchor",textAnchor:"text-anchor",maxWidth:"maxWidth",transform:"transform",strokeDasharray:"stroke-dasharray",id:"id"};function qa(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n="";for(let e=0;e<t.length;e++){const i=t[e];n+=0===e?"M".concat(i.x," ").concat(i.y):"L".concat(i.x," ").concat(i.y),n+=" "}return e&&(n+="Z"),n}function Na(t,e,n,i){const r=n/2,o=t-i/2,a=e-i/2,s=t-r,l=e-r;return[{x:o,y:a},{x:o,y:l},{x:o+i,y:l},{x:o+i,y:a},{x:s+n,y:a},{x:s+n,y:a+i},{x:o+i,y:a+i},{x:o+i,y:l+n},{x:o,y:l+n},{x:o,y:a+i},{x:s,y:a+i},{x:s,y:a}]}function Ra(t){return-t/180*Math.PI}function Aa(t){return function(t){let e=(.5*(Math.floor(t/Math.PI*2)+2)+.25)*Math.PI,n=Math.cos(Math.abs(e-t))*Math.sqrt(2),i=n*Math.cos(t),r=n*Math.sin(t);return{x1:i<0?1:0,y1:r<0?1:0,x2:i>=0?i:i+1,y2:r>=0?r:r+1}}(Ra(t))}function Oa(t,e){return{x:t.x+e.x,y:t.y+e.y}}function Da(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Ea(t,e){return{x:t.x*e,y:t.y*e}}function Ia(t,e){return t.x-e.x}function Ta(t,e){return t.y-e.y}function ja(t,e){return Ia(t,e)**2+Ta(t,e)**2}function Pa(t,e){return Math.sqrt(ja(t,e))}function za(t,e){return t.x*e.x+t.y*e.y}function Fa(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};const i=Math.cos(e),r=Math.sin(e),o=Da(t,n),a={x:i*o.x-r*o.y,y:r*o.x+i*o.y};return Oa(a,n)}const La={up:0,down:180,left:90,right:-90};function $a(t){let{x:e,y:n,size:i}=t;const r=i/2;return{type:"rect",x:e-r,y:n-r,width:i,height:i}}const Ba=Ht();function Ha(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.keys(e).forEach((n=>{void 0!==Ca[n]&&"transform"!==n&&(t[n]=e[n])}))}Ba.add("circle",(function(t){return{type:"circle",fill:"black",cx:t.x,cy:t.y,r:t.size/2}})),Ba.add("diamond",(function(t){const e=t.size,n=t.x-e/2,i=t.y-e/2;return{type:"path",fill:"black",d:qa([{x:n,y:i+e/2},{x:n+e/2,y:i},{x:n+e,y:i+e/2},{x:n+e/2,y:i+e},{x:n,y:i+e/2}])}})),Ba.add("saltire",(function(t){const e=Ra(45),n=t.size/2,i=isNaN(t.width)?n/2:t.width,r=Math.min(i,n);let o=t.size;const a=Math.sin(Math.asin(-e))*(r/2);o+=2*(n/Math.sin(-e)-n),o-=2*a;const s={x:t.x,y:t.y};return{type:"path",fill:"black",d:qa(Na(t.x,t.y,o,r).map((t=>Fa(t,e,s))))}})),Ba.add("square",(function(t){const e=t.size;return{type:"rect",fill:"black",x:t.x-e/2,y:t.y-e/2,width:e,height:e}})),Ba.add("triangle",(function(t){const e=t.size,n={x:t.x,y:t.y},i=La[t.direction]||0,r=e/2,o=t.x-r,a=t.y-r;let s=[{x:o,y:a+e},{x:o+r,y:a},{x:o+e,y:a+e},{x:o,y:a+e}];const l=Ra(i);return s=s.map((t=>Fa(t,l,n))),{type:"path",fill:"black",d:qa(s)}})),Ba.add("line",(function(t){const e="vertical"===t.direction,n=t.size/2,i=t.x,r=t.y;return{type:"line",stroke:"black",strokeWidth:1,x1:i-(e?0:n),y1:r-(e?n:0),x2:i+(e?0:n),y2:r+(e?n:0),collider:$a(t)}})),Ba.add("star",(function(t){const e=t.size,n=[],i=e/2,r=t.points||5,o=Math.min(t.innerRadius||e/2,e)/2,a=isNaN(t.startAngle)?90:t.startAngle,s=360/r;for(let e=1;e<=r;e++){const r=s*e+a,l=Ra(r),c=Ra(r+s/2),u=Math.sin(l),h=Math.cos(l),d=Math.sin(c),f=Math.cos(c);n.push({x:t.x+h*i,y:t.y+u*i}),n.push({x:t.x+f*o,y:t.y+d*o})}return{type:"path",fill:"black",d:qa(n)}})),Ba.add("n-polygon",(function(t){const e=[],n=t.size/2,i=Math.max(isNaN(t.sides)?6:t.sides,3),r=360/i,o=isNaN(t.startAngle)?0:t.startAngle;for(let a=1;a<=i;a++){const i=Ra(r*a+o),s=Math.sin(i),l=Math.cos(i);e.push({x:t.x+l*n,y:t.y+s*n})}return{type:"path",fill:"black",d:qa(e)}})),Ba.add("cross",(function(t){const e=t.x,n=t.y,i=t.size/2,r=isNaN(t.width)?i/2:t.width,o=Math.min(r,i);return{type:"path",fill:"black",d:qa(Na(e,n,t.size,o))}})),Ba.add("bar",(function(t){const e={x:t.x,y:t.y},n="vertical"===t.direction,i=t.size/2,r=i/2/2;let o=[{x:e.x-i,y:e.y+r},{x:e.x-i,y:e.y-r},{x:e.x+i,y:e.y-r},{x:e.x+i,y:e.y+r}];if(n){const t=Ra(90);o=o.map((n=>Fa(n,t,e)))}const a=I(o);return a.type="rect",a.fill="black",a})),Ba.add("rect",(function(t){const{x:e,y:n,size:i}=t,r=void 0===t.width?i:t.width,o=void 0===t.height?i:t.height;return{type:"rect",fill:"black",x:e-r/2,y:n-o/2,width:r,height:o}}));const Va=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ba;return function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=t.get(e.type);if(n){const t=n(e);return Ha(t,e),void 0!==e.data&&(t.data=e.data),t}return n}};function Wa(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{dock:n="center",displayOrder:i=0,prioOrder:r=0,preferredSize:o=0,minimumLayoutMode:a,show:s=!0}=t;n=n||"center";const l={computePreferredSize(t){let{inner:n,outer:i,children:r}=t;return"function"==typeof o?o({inner:n,outer:i,children:r,dock:this.dock()},e):o},dock(t){return void 0!==t?(n=t,this):"function"==typeof n?n(e):n},displayOrder(t){return void 0!==t?(i=t,this):"function"==typeof i?i(e):i},prioOrder(t){return void 0!==t?(r=t,this):"function"==typeof r?r(e):r},minimumLayoutMode(t){return void 0!==t?(a=t,this):"function"==typeof a?a(e):a},show(t){return void 0!==t?(s=t,this):"function"==typeof s?s(e):s}};return l}function Ua(t,e,n){const{require:i=[]}=e,r=e.mediator||{},{settings:o,formatter:a,scale:s,data:l,renderer:c,chart:u,dockConfig:h,mediator:d,instance:f,rect:p,style:g,registries:m,resolver:y,update:v,_DO_NOT_USE_getInfo:x,symbol:b,isVisible:w}=n;t.emit=()=>{},w&&(t.isVisible=w),Object.defineProperty(t,"settings",{get:o}),Object.defineProperty(t,"data",{get:l}),Object.defineProperty(t,"formatter",{get:a}),Object.defineProperty(t,"scale",{get:s}),Object.defineProperty(t,"mediator",{get:d}),Object.defineProperty(t,"style",{get:g}),Object.defineProperty(t,"registries",{get:m}),p&&Object.defineProperty(t,"rect",{get:p}),x&&(t._DO_NOT_USE_getInfo=x),Object.keys(e).forEach((n=>{var i;i=n,["on","preferredSize","created","beforeMount","mounted","resize","beforeUpdate","updated","beforeRender","render","beforeUnmount","beforeDestroy","destroyed","defaultSettings","data","settings","formatter","scale","chart","dockConfig","mediator","style","resolver","registries","_DO_NOT_USE_getInfo","symbol","isVisible"].some((t=>t===i))||("function"==typeof e[n]?t[n]=e[n].bind(t):t[n]=e[n])})),i.forEach((e=>{"renderer"===e?Object.defineProperty(t,"renderer",{get:c}):"chart"===e?Object.defineProperty(t,"chart",{get:u}):"dockConfig"===e?Object.defineProperty(t,"dockConfig",{get:h}):"instance"===e?Object.defineProperty(t,"instance",{get:f}):"update"===e&&v?Object.defineProperty(t,"update",{get:v}):"resolver"===e?Object.defineProperty(t,"resolver",{get:y}):"symbol"===e&&Object.defineProperty(t,"symbol",{get:b})})),Object.keys(r).forEach((e=>{t.mediator.on(e,r[e].bind(t))}))}function Ya(t,e,n){const i=e=>t[e]?(n.warn("Deprecation Warning the ".concat(e," property should be moved into layout: {} property")),t[e]):t.layout?t.layout[e]:void 0,r={};return r.displayOrder=i("displayOrder"),r.dock=i("dock"),r.prioOrder=i("prioOrder"),r.minimumLayoutMode=i("minimumLayoutMode"),t.layout=t.layout||{},t.layout.displayOrder=void 0!==r.displayOrder?r.displayOrder:t.layout.displayOrder,t.layout.prioOrder=void 0!==r.prioOrder?r.prioOrder:t.layout.prioOrder,t.layout.dock=r.dock||t.layout.dock,t.layout.minimumLayoutMode=r.minimumLayoutMode||t.layout.minimumLayoutMode,r.show=t.show,r.preferredSize=e,r}function Xa(t,e,n){Object.keys(n.on||{}).forEach((i=>{t.eventListeners=t.eventListeners||[];const r=n.on[i].bind(t);t.eventListeners.push({event:i,listener:r}),e.on(i,r)})),t.emit=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return e.emit(t,...i)}}function Ka(t,e){t.eventListeners&&(t.eventListeners.forEach((t=>{let{event:n,listener:i}=t;e.removeListener(n,i)})),t.eventListeners.length=0),t.emit=()=>{}}function Ga(t){const e=_(!0,{},t);return{getAll:()=>e,getValue:(t,n)=>function(t,e,n){if(void 0===t||void 0===e)return n;const i=e.split(".");let r=t;for(let t=0;t<i.length;++t){const e=i[t];if(void 0===r[e])return n;r=r[e]}return r}(e,t,n),setValue:(t,n)=>function(t,e,n){if(void 0===t||void 0===e)return;const i=e.split("."),r=i[i.length-1];let o=t;for(let t=0;t<i.length-1;++t){const e=i[t];void 0===o[e]&&(o[e]=Number.isNaN(+i[t+1])?{}:[]),o=o[e]}void 0!==n?o[r]=n:delete o[r]}(e,t,n)}}function Za(t,e,n){return Oa(function(t,e){const n=za(t,e)/za(e,e)||1;return{x:e.x*n,y:e.y*n}}(Da(n,t),Da(e,t)),t)}function Ja(t,e,n){return Pa(t,n)+Pa(e,n)-Pa(t,e)<1e-12}function Qa(t,e){return t.x>=e.x&&t.x+t.width<=e.x+e.width&&t.y>=e.y&&t.y+t.height<=e.y+e.height}function ts(t){return t.x1===t.x2&&t.y1===t.y2}function es(t){return t.width<=0||t.height<=0}function ns(t){return t.r<=0}function is(t){return t.edges.length<=2}function rs(t,e){let n=!1;for(let i=0,r=e.edges.length;i<r;i++)if(n=hs(t,T(e.edges[i])),!0===n)return!0;return!1}function os(t,e){let n=!1;const{numPolygons:i,polygons:r}=e;for(let e=0;e<i;e++){if(n=bs(t,r[e]),!0===n)return!0}return!1}function as(t,e){if(ns(t))return!1;return ja({x:t.cx,y:t.cy},e)<=t.r**2}function ss(t,e){if(es(e)||ns(t))return!1;const n=e.width/2,i=e.height/2,r=e.x+n,o=e.y+i,a=t.r,s=t.cx,l=t.cy,c=Math.abs(s-r),u=Math.abs(l-o);if(c>n+a||u>i+a)return!1;if(c<=n||u<=i)return!0;return(c-n)**2+(u-i)**2<=a**2}function ls(t,e){if(ns(t)||ts(e))return!1;const[n,i]=D(e);if(as(t,n)||as(t,i))return!0;const r={x:t.cx,y:t.cy},o=Za(n,i,r);return ja(o,r)<=t.r**2&&Ja(n,i,o)}function cs(t,e){if(is(e)||ns(t))return!1;if(us(e,{x:t.cx,y:t.cy}))return!0;const n=e.edges.length;for(let i=0;i<n;i++){if(ls(t,T(e.edges[i])))return!0}return!1}function us(t,e){if(is(t)||!gs(t.boundingRect(),e))return!1;const{x:n,y:i}=e,r=t.vertices;let o,a,s,l,c;for(o=!1,l=-1,a=r.length,s=a-1;++l<a;s=l){if(r[l].x===n&&r[l].y===i)return!0;if(r[l].y===r[s].y&&r[l].y===i&&(n-r[l].x)*(n-r[s].x)<=0)return!0;if(r[l].y<i&&i<=r[s].y||r[s].y<i&&i<=r[l].y){if(c=(r[s].x-r[l].x)*(i-r[l].y)/(r[s].y-r[l].y)+r[l].x,n===c)return!0;n<c&&(o=!o)}}return o}function hs(t,e){if(is(t))return!1;for(let n=0,i=t.edges.length;n<i;n++){if(ys(e,T(t.edges[n])))return!0}const[n,i]=D(e);return us(t,n)||us(t,i)}function ds(t,e){if(is(t))return!1;for(let n=0,i=t.edges.length;n<i;n++){if(ms(e,T(t.edges[n])))return!0}const[n,i,r,o]=E(e);return us(t,n)||us(t,i)||us(t,r)||us(t,o)}function fs(t,e){return!es(t)&&!es(e)&&(t.x<=e.x+e.width&&e.x<=t.x+t.width&&t.y<=e.y+e.height&&e.y<=t.y+t.height)}function ps(t,e){if(es(t)||es(e))return!1;return[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}].every((e=>gs(t,e)))}function gs(t,e){return!es(t)&&(e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height)}function ms(t,e){if(ts(e)||es(t))return!1;const[n,i]=D(e);if(gs(t,n)||gs(t,i))return!0;const r=E(t);let o=r.length;for(let t=0;t<o;t++){if(ys(T([r[t],r[3!==t?t+1:0]]),e))return!0}return!1}function ys(t,e){const[n,i]=D(t),[r,o]=D(e),a=Ia(i,n),s=Ta(i,n),l=Ia(o,r),c=Ta(o,r),u=Ia(n,r),h=Ta(n,r);let d=c*a-l*s;const f=l*h-c*u,p=a*h-s*u;let g,m;if(0===a&&0===s)return!1;if(0===l&&0===c)return!1;if(0===d){if(0===f&&0===p){if(0===a){if(0===s)return n.x===i.x&&n.y===i.y;g=Ta(r,n)/s,m=Ta(o,n)/s}else g=(r.x-n.x)/a,m=(o.x-n.x)/a;return!(g<0&&m<0||g>1&&m>1)}return!1}const y=f/d;return d=p/d,y>=0&&y<=1&&d>=0&&d<=1}function vs(t,e){if(ts(t))return!1;const[n,i]=D(t);return Ja(n,i,e)}function xs(t,e){const n=t.boundingRect(),i=e.boundingRect();return!!fs(n,i)&&(ps(n,i)?rs(t,e):rs(e,t))}function bs(t,e){const n=t.boundingRect(),i=e.boundingRect();return!!fs(n,i)&&(ps(i,n)?function(t,e){let n=!1;const{numPolygons:i,polygons:r}=t;for(let t=0;t<i;t++)if(n=xs(e,r[t]),!0===n)return!0;return!1}(t,e):function(t,e){let n=!1;for(let i=0,r=e.edges.length;i<r;i++)if(n=_s(t,T(e.edges[i])),!0===n)return!0;return!1}(t,e))}function ws(t,e){if(ns(t))return!1;if(ks(e,{x:t.cx,y:t.cy}))return!0;const{numPolygons:n,polygons:i}=e;for(let e=0;e<n;e++){const n=i[e],r=n.edges.length;for(let e=0;e<r;e++){if(ls(t,T(n.edges[e])))return!0}}return!1}function ks(t,e){if(!gs(t.boundingRect(),e))return!1;const{x:n,y:i}=e,r=t.numPolygons;let o,a,s,l,c,u,h=!1;for(a=0;a<r;a++)for(o=t.vertices[a],c=-1,s=o.length,l=s-1;++c<s;l=c){if(o[c].x===n&&o[c].y===i)return!0;if(o[c].y===o[l].y&&o[c].y===i&&(n-o[c].x)*(n-o[l].x)<=0)return!0;if(o[c].y<i&&i<=o[l].y||o[l].y<i&&i<=o[c].y){if(u=(o[l].x-o[c].x)*(i-o[c].y)/(o[l].y-o[c].y)+o[c].x,n===u)return!0;n<u&&(h=!h)}}return h}function _s(t,e){const[n,i]=D(e);if(ks(t,n)||ks(t,i))return!0;const{numPolygons:r,polygons:o}=t;for(let t=0;t<r;t++){const n=o[t];for(let t=0,i=n.edges.length;t<i;t++){if(ys(e,T(n.edges[t])))return!0}}return!1}function Ms(t,e){const[n,i,r,o]=E(e);if(ks(t,n)||ks(t,i)||ks(t,r)||ks(t,o))return!0;const{numPolygons:a,polygons:s}=t;for(let t=0;t<a;t++){const n=s[t];for(let t=0,i=n.edges.length;t<i;t++){if(ms(e,T(n.edges[t])))return!0}}return!1}const Ss=/^\$/,Cs="@extend";function qs(t){throw new Error('Cyclical reference for "'.concat(t,'"'))}function Ns(t,e,n){if("string"==typeof t){let i=e[t];return-1!==n.indexOf(t)&&qs(t),Ss.test(i)?(n.push(t),Ns(i,e,n)):i}let i=t;const r=_(!0,{},e,t),o={};if(t[Cs]){const o=t[Cs];-1!==n.indexOf(o)&&qs(o);let a=n.slice();a.push(o),i=_(!0,{},Ns(r[o],e,a),t)}return Object.keys(i).forEach((t=>{let e=n.slice();if(t===Cs||Ss.test(t))return;o[t]=i[t];let a=o[t];Ss.test(a)&&a in r?(-1!==n.indexOf(a)&&qs(a),e.push(a),a=r[a],"object"==typeof a||Ss.test(a)&&a in r?o[t]=Ns(a,r,e):o[t]=a):"object"==typeof a&&(o[t]=Ns(a,r,e))})),o}function Rs(t,e){return Ns(t,e,[])}function As(t){t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.floor(t.width),t.height=Math.floor(t.height)}function Os(t,e){const n={x:0,y:0,width:0,height:0},i={x:0,y:0,width:0,height:0};return n.width=t.width||0,n.height=t.height||0,void 0!==e.size&&(n.width=isNaN(e.size.width)?n.width:e.size.width,n.height=isNaN(e.size.height)?n.height:e.size.height),void 0!==e.logicalSize?(i.width=isNaN(e.logicalSize.width)?n.width:e.logicalSize.width,i.height=isNaN(e.logicalSize.height)?n.height:e.logicalSize.height,i.align=isNaN(e.logicalSize.align)?.5:Math.min(Math.max(e.logicalSize.align,0),1),i.preserveAspectRatio=e.logicalSize.preserveAspectRatio):(i.width=n.width,i.height=n.height,i.preserveAspectRatio=!1),As(i),As(n),{logicalContainerRect:i,containerRect:n}}function Ds(t){const e={center:{minWidthRatio:.5,minHeightRatio:.5,minWidth:0,minHeight:0}};return _(!0,e,t),e.center.minWidthRatio=Math.min(Math.max(e.center.minWidthRatio,0),1),e.center.minHeightRatio=Math.min(Math.max(e.center.minHeightRatio,0),1),e.center.minWidth=Math.max(e.center.minWidth,0),e.center.minHeight=Math.max(e.center.minHeight,0),e}function Es(t,e,n,i,r){return{x:isNaN(t)?0:t,y:isNaN(t)?0:e,width:isNaN(t)?0:n,height:isNaN(t)?0:i,margin:isNaN(r)?0:r}}function Is(t,e,n){if(void 0===t.cachedSize){const i=t.config.dock();let r,o=t.comp.preferredSize({inner:e,outer:n,dock:i});isNaN(o)?o&&!isNaN(o.size)&&(o.width=o.size,o.height=o.size):o={width:o,height:o},r="top"===i||"bottom"===i?o.height:"right"===i||"left"===i?o.width:Math.max(o.width,o.height),t.cachedSize=Math.ceil(r),t.edgeBleed=o.edgeBleed||0}return t.cachedSize}function Ts(t,e){switch(e.config.dock()){case"top":t.y+=e.cachedSize,t.height-=e.cachedSize;break;case"bottom":t.height-=e.cachedSize;break;case"left":t.x+=e.cachedSize,t.width-=e.cachedSize;break;case"right":t.width-=e.cachedSize}}function js(t,e){const n=e.edgeBleed;n&&(t.left=Math.max(t.left,n.left||0),t.right=Math.max(t.right,n.right||0),t.top=Math.max(t.top,n.top||0),t.bottom=Math.max(t.bottom,n.bottom||0))}function Ps(t,e,n){e.x<n.left&&(e.width-=n.left-e.x,e.x=n.left);const i=t.width-(e.x+e.width);i<n.right&&(e.width-=n.right-i),e.y<n.top&&(e.height-=n.top-e.y,e.y=n.top);const r=t.height-(e.y+e.height);r<n.bottom&&(e.height-=n.bottom-r)}function zs(t,e,n,i,r){const o=_({},e),a=_({},n);Ts(o,i),js(a,i),Ps(t,o,a);return!!function(t,e,n){const i=Math.min(n.center.minWidth,t.width)||Math.max(t.width*n.center.minWidthRatio,1),r=Math.min(n.center.minHeight,t.height)||Math.max(t.height*n.center.minHeightRatio,1);return e.width>=i&&e.height>=r}(t,o,r)&&(Ts(e,i),js(n,i),!0)}function Fs(t){let{layoutRect:e,visible:n,hidden:i,settings:r}=t;const o=Es(e.x,e.y,e.width,e.height),a={left:0,right:0,top:0,bottom:0},s=n.slice();s.sort(((t,e)=>t.config.prioOrder()-e.config.prioOrder()));for(let t=0;t<s.length;++t){const n=s[t];Is(n,o,e),zs(e,o,a,n,r)||(i.push(s.splice(t,1)[0]),--t)}!function(t,e){if(0!==e.length)for(let n=0;n<t.length;++n){let i=t[n];i.referencedDocks.length&&i.referencedDocks.every((t=>e.some((e=>e.key===t))))&&e.push(t.splice(n,1)[0])}}(n,i);const l=n.filter((t=>-1!==s.indexOf(t)));return n.length=0,n.push(...l),Ps(e,o,a),o}function Ls(t){return{x:t.margin.left+t.x*t.scaleRatio.x,y:t.margin.top+t.y*t.scaleRatio.y,width:t.width*t.scaleRatio.x,height:t.height*t.scaleRatio.y}}function $s(t){return I([].concat(...t.map(E)))}function Bs(t){let{visible:e,layoutRect:n,reducedRect:i,containerRect:r,translation:o}=t;const a=Es(i.x,i.y,i.width,i.height),s=Es(i.x,i.y,i.width,i.height),l={},c=e.slice(),u=c.slice().sort(((t,e)=>t.config.displayOrder()-e.config.displayOrder()));return e.sort(((t,e)=>{if(t.referencedDocks.length>0&&e.referencedDocks.length>0)return 0;if(e.referencedDocks.length>0)return-1;if(t.referencedDocks.length>0)return 1;const n=t.config.displayOrder()-e.config.displayOrder();return 0===n?c.indexOf(t)-c.indexOf(e):n})).forEach((t=>{let e={},c={};switch(t.config.dock()){case"top":e.height=c.height=t.cachedSize,e.width=n.width,c.width=a.width,e.x=n.x,c.x=a.x,e.y=c.y=a.y-t.cachedSize,a.y-=t.cachedSize,a.height+=t.cachedSize;break;case"bottom":e.x=n.x,c.x=a.x,e.y=c.y=a.y+a.height,e.width=n.width,c.width=a.width,e.height=c.height=t.cachedSize,a.height+=t.cachedSize;break;case"left":e.x=c.x=s.x-t.cachedSize,e.y=n.y,c.y=s.y,e.width=c.width=t.cachedSize,e.height=n.height,c.height=s.height,s.x-=t.cachedSize,s.width+=t.cachedSize;break;case"right":e.x=c.x=s.x+s.width,e.y=n.y,c.y=s.y,e.width=c.width=t.cachedSize,e.height=n.height,c.height=s.height,s.width+=t.cachedSize;break;case"center":e.x=c.x=i.x,e.y=c.y=i.y,e.width=c.width=i.width,e.height=c.height=i.height;break;default:if(t.referencedDocks.length>0){const n=t.referencedDocks.map((t=>l[t])).filter((t=>!!t));n.length>0&&(e=$s(n.map((t=>t.outerRect))),c=$s(n.map((t=>t.r))))}}t.key&&(l[t.key]={r:c,outerRect:e}),function(t,e,n,i){const r={x:i.width/n.width,y:i.height/n.height},o={left:0,top:0};if(n.preserveAspectRatio){const t=r.x<r.y,e=Math.min(r.x,r.y);r.x=e,r.y=e;const a=t?"height":"width",s=(i[a]-n[a]*r.x)*n.align;o.left=t?0:s,o.top=t?s:0}t.scaleRatio=r,t.margin=o,e.scaleRatio=r,e.margin=o,n.scaleRatio=r,n.margin=o}(c,e,n,r),c.edgeBleed=t.edgeBleed,c.computed=Ls(c),e.edgeBleed=t.edgeBleed,e.computed=Ls(e),c.x+=o.x,c.y+=o.y,e.x+=o.x,e.y+=o.y,t.comp.resize(c,e),t.cachedSize=void 0,t.edgeBleed=void 0})),u}function Hs(t,e,n){const i=t.layoutModes||{},r=e.minimumLayoutMode();let o=e.show();return o&&"object"==typeof r?o=i[r.width]&&i[r.height]&&n.width>=i[r.width].width&&n.height>=i[r.height].height:o&&void 0!==r&&(o=i[r]&&n.width>=i[r].width&&n.height>=i[r].height),o}function Vs(t){if(!t.resize||"function"!=typeof t.resize)throw new Error("Component is missing resize function");if(!t.dockConfig&&!t.preferredSize)throw new Error("Component is missing preferredSize function")}function Ws(t,e,n){const i=[],r=[];for(let o=0;o<t.length;++o){const a=t[o];Vs(a);let s=a.dockConfig;const l=a.key,c=s.dock(),u=/@/.test(c)?c.split(",").map((t=>t.replace(/^\s*@/,""))):[];Hs(e,s,n)?i.push({comp:a,key:l,config:s,referencedDocks:u}):r.push({comp:a,key:l,config:s,referencedDocks:u})}return[i,r]}const Us=(t,e)=>{for(let n=0;n<t.length;n++){const i=t[n];if(i.hasKey&&i.key===e)return t[n]}return null},Ys=t=>null==t?void 0:t.map((t=>{const e=t.instance.dockConfig();return{preferredSize:n=>e.computePreferredSize(C(C({},n),{},{children:Ys(t.children)}))}})),Xs=(t,e)=>({visible:[],hidden:e,ordered:[]}),Ks=t=>(e,n)=>{var i;const r=n.map(((t,e)=>{const n=t.instance.dockConfig();return{index:e,key:t.key,dockConfig:n,resize:t.instance.resize,preferredSize:e=>n.computePreferredSize(C(C({},e),{},{children:Ys(t.children)}))}})),o=t=>n[t.index],{visible:a=r,hidden:s=[],ordered:l=a}=null!==(i=t(e,r))&&void 0!==i?i:{};return{visible:a.map(o),hidden:s.map(o),ordered:l.map(o)}},Gs=t=>{const e=function(t){let e=Ds(t);return{layout:function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t||isNaN(t.x)||isNaN(t.y)||isNaN(t.width)||isNaN(t.height))throw new Error("Invalid rect");if(!n.length)return{visible:[],hidden:[],ordered:[]};const{logicalContainerRect:i,containerRect:r}=Os(t,e),[o,a]=Ws(n,e,i),s=Bs({visible:o,layoutRect:i,reducedRect:Fs({layoutRect:i,visible:o,hidden:a,settings:e}),containerRect:r,translation:{x:t.x,y:t.y}});return a.forEach((t=>{t.comp.visible=!1;const e=Es();t.comp.resize(e,e)})),{visible:o.map((t=>t.comp)),hidden:a.map((t=>t.comp)),ordered:s.map((t=>t.comp))}},settings:function(t){e=Ds(t)}}}(t);return Ks(((t,n)=>e.layout(t,n)))},Zs=t=>"function"==typeof t?Ks(t):Gs(t);function Js(t,e,n){const i=e.left-n.left,r=e.top-n.top,o=j(t),a=_(!0,{},t);switch(o){case"circle":a.cx+=i,a.cy+=r;break;case"polygon":for(let t=0,e=a.vertices.length;t<e;t++){const e=a.vertices[t];e.x+=i,e.y+=r}break;case"geopolygon":for(let t=0;t<a.vertices.length;t++){const e=a.vertices[t];for(let t=0,n=e.length;t<n;t++){const n=e[t];n.x+=i,n.y+=r}}break;case"line":a.x1+=i,a.y1+=r,a.x2+=i,a.y2+=r;break;case"point":case"rect":a.x+=i,a.y+=r}return a}function Qs(t,e){const n=[];let i=0;e.forEach((t=>{n.push(i),i++;const e=t.instance.def.additionalElements&&t.instance.def.additionalElements();e&&(i+=e.length)})),e.forEach(((e,i)=>((t,e,n)=>{const i=e.instance.renderer().element();if(isNaN(n)||!i||!t||!t.children)return;const r=t.children[Math.max(0,n)];if(i===r)return;const o=e.instance.def.additionalElements&&e.instance.def.additionalElements().filter(Boolean);t.insertBefore&&void 0!==r?(t.insertBefore(i,r),o&&o.forEach((e=>{t.insertBefore(e,i)}))):(o&&o.forEach((e=>{t.appendChild(e,i)})),t.appendChild(i))})(t,e,n[i])))}function tl(t,e){let{element:n,data:i=[],settings:r={},on:o={}}=t;const a=e.registries,s=e.logger,l=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={},n=t;const i=t=>{t.forEach((t=>{const n=Array.isArray(t.colors[0])?t.colors:[t.colors];e[t.key]={colors:n,sizes:n.map((t=>t?t.length:0))}}))},r=(t,n)=>{const i=e[t];if(!i)return[];const r=i.sizes;for(let t=0;t<r.length;t++)if(n<=r[t])return i.colors[t];return i.colors[r.length-1]},o={palette:(t,e)=>r(t,e),setPalettes:i,style:t=>Rs(t,n),setStyle:e=>{n=_({},t,e)}};return i(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]),o}(e.style,e.palettes),c=[],u=_({},t),h=function(){const t={};return jo.mixin(t),t}();let d=[],f=null,p=null,g=null,m=[],y=()=>{},v=()=>{};const x={};let b=!1;const w=function(t){let{createComponent:e}=t;const n={};let i=[],r=[];const o=t=>{const n=e(t);return n&&(i.push(n),t.components&&(n.children=t.components.map((t=>o(t))).filter((t=>!!t)))),n},a=t=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)},s=(t,e)=>{for(let n=t.length-1;n>=0;n--){const i=t[n],r=e.find((t=>i.hasKey&&i.key===t.key));r?i.children&&r.components&&s(i.children,r.components):(t.splice(n,1),a(i),i.children&&s(i.children,[]),i.instance.destroy())}},l=t=>{let{compList:e,data:n,excludeFromUpdate:i,formatters:r,scales:a,settingsList:s}=t;return s.map((t=>{const s=Us(e,t.key);return i.indexOf(t.key)>-1?(delete s.updateWith,s):s?(t.rendererSettings&&"function"==typeof s.instance.renderer().settings&&s.instance.renderer().settings(t.rendererSettings),t.rendererSettings&&"function"==typeof t.rendererSettings.transform&&t.rendererSettings.transform()?(s.applyTransform=!0,s):(s.updateWith={formatters:r,scales:a,data:n,settings:t},t.components&&(s.children=l({compList:s.children||[],data:n,excludeFromUpdate:i,formatters:r,scales:a,settingsList:t.components})),s)):o(t)})).filter((t=>!!t))},c=t=>{let{components:e,hidden:n,layoutFn:i,ordered:r,rect:o,visible:a}=t;const{visible:s,hidden:l,ordered:u}=i(o,e);a.push(...s),n.push(...l),r.push(...u),s.forEach((t=>{if(t.children){var e,i;const o=Zs(null!==(e=null===(i=t.settings)||void 0===i?void 0:i.strategy)&&void 0!==e?e:{});c({components:t.children,hidden:n,layoutFn:o,ordered:r,rect:t.instance.getRect(),visible:a})}})),l.forEach((t=>{t.children&&c({components:t.children,hidden:n,layoutFn:Xs,ordered:r,rect:null,visible:a})}))};return n.destroy=()=>{i.forEach((t=>t.instance.destroy())),i=[],r=[]},n.findComponentByKey=t=>Us(i,t),n.forEach=t=>{i.forEach(t)},n.layout=t=>{let{layoutSettings:e,rect:n}=t;const i=[],o=[],a=[],s=Zs(e);return c({components:r,hidden:o,layoutFn:s,ordered:a,rect:n,visible:i}),{visible:i,hidden:o,ordered:a}},n.set=t=>{let{components:e}=t;r=e.map((t=>o(t))).filter((t=>!!t))},n.update=t=>{let{components:e,data:n,excludeFromUpdate:i,formatters:o,scales:a}=t;s(r,e),r=l({compList:r,data:n,excludeFromUpdate:i,formatters:o,scales:a,settingsList:e})},n}({createComponent:t=>{if(!a.component.has(t.type))return s.warn("Unknown component: ".concat(t.type)),!1;return{instance:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{defaultSettings:n={},_DO_NOT_USE_getInfo:i=(()=>({}))}=t,{chart:r,container:o,mediator:a,registries:s,theme:l,renderer:c}=e,u=jo.mixin({});let h,d,f,p,g,m=e.settings||{},y=_(!0,{},n,m),v=[],x=ya({chart:r}),b=!1;const w={nodes:[],chart:r,config:y.brush||{},renderer:null},k={tap:[],over:[]},M=[],S={},q=_({},m);function N(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(){const r=void 0!==t[e],o=void 0!==m[e];let a;for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return r&&("function"==typeof t[e]?a=t[e].call(S,...l):i&&(a=t[e])),o&&("function"==typeof m[e]?a=m[e].call(q,...l):i&&(a=m[e])),r||o||(a=n.call(S,...l)),a}}const R=N("preferredSize",(()=>0),!0),A=N("resize",(t=>{let{inner:e}=t;return e})),O=N("created"),D=N("beforeMount"),E=N("mounted"),I=N("beforeUnmount"),T=N("beforeUpdate"),j=N("updated"),P=N("beforeRender"),z=N("beforeDestroy"),F=N("destroyed"),L=t.render,$=()=>{y.brush&&(y.brush.consume||[]).forEach((t=>{t.context&&t.style&&M.push(xa(w,t))}))},B=()=>{y.brush&&(y.brush.trigger||[]).forEach((t=>{"over"===t.on?k.over.push(t):k.tap.push(t)}))};Object.defineProperty(w,"data",{get:()=>v});const H=y.renderer||t.renderer,V=H?c||s.renderer(H)():c||s.renderer()();"function"==typeof V.settings&&V.settings(y.rendererSettings),w.renderer=V;const W={resources:r.logger?{logger:r.logger()}:{}};let U=Wa(Ya(y,R,r.logger()),W);const Y=t=>{t.key=y.key,t.element=V.element()},X=()=>{};X.dockConfig=()=>U,X.set=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.settings&&(m=t.settings,y=_(!0,{},n,t.settings),U=Wa(Ya(y,R,r.logger()),W),w.config=y.brush||{}),y.scale&&(h=r.scale(y.scale)),y.data){const{rendererSettings:t}=y,e="function"==typeof(null==t?void 0:t.progressive)&&t.progressive(),n=Oi(y.data,{dataset:r.dataset,collection:r.dataCollection},{logger:r.logger()},r.dataCollection);e?e.isFirst?(v=n,v.items&&(v.items=[...n.items])):v.items&&(v.items=[...v.items,...n.items||[]]):v=n}else v=h?h.data():[];"string"==typeof y.formatter||"object"==typeof y.formatter?d=r.formatter(y.formatter):h&&h.data().fields&&(d=h.data().fields[0].formatter()),g=l.style(y.style||{})},X.resize=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=A({inner:t,outer:e});p=n?V.size(n):V.size(t),q.rect=_(!0,{computedPhysical:p.computedPhysical,computedOuter:e.computed||e,computedInner:t.computed||t},t),p=_(!0,{computedOuter:e.computed||e,computedInner:t.computed||t},p)},X.getRect=()=>q.rect;const K=()=>{const t=V.renderArgs?V.renderArgs.slice(0):[],{rendererSettings:e}=y;let n=v;const i="function"==typeof(null==e?void 0:e.progressive)&&e.progressive();return v.items&&i&&(n=C(C({},v),{},{items:v.items.slice(i.start,i.end)})),t.push({data:n}),t};let G,Z,J;function Q(t){const{rendererSettings:e}=y,n="function"==typeof(null==e?void 0:e.progressive)&&e.progressive();n?n.isFirst?w.nodes=[...t||[]]:w.nodes&&(w.nodes=[...w.nodes,...t||[]]):w.nodes=t}X.beforeMount=D,X.beforeRender=()=>{P({size:p})},X.render=()=>{const t=L.call(S,...K());Q(t),V.render(t),G=t,Z=q.rect.computed},X.hide=()=>{X.unmount(),V.size({x:0,y:0,width:0,height:0}),V.clear()},X.beforeUpdate=()=>{T({settings:y,data:v})},X.update=()=>{J&&J.stop();const{rendererSettings:t,brush:e,animations:n}=y;if("function"==typeof(null==t?void 0:t.transform)&&t.transform())return V.render(),void(G=null);const i=L.call(S,...K());Q(i),M.forEach((t=>t.cleanUp())),M.length=0,k.tap=[],k.over=[],e&&($(),B()),M.forEach((t=>{t.isActive()&&t.update()})),G&&n&&("function"==typeof n.enabled?n.enabled():n.enabled)?(n.compensateForLayoutChanges&&n.compensateForLayoutChanges({currentNodes:G,currentRect:q.rect.computed,previousRect:Z}),J=ua({old:G,current:i},{renderer:V},n,r.storage),J.start()):V.render(i),G=i,Z=q.rect.computed,V.setKey&&"string"==typeof m.key&&V.setKey(m.key)},X.updated=j,X.destroy=()=>{X.unmount(),z(f),V.destroy(),F(),f=null};const tt=t=>{w.nodes=t,M.forEach((t=>{t.isActive()&&t.update()})),V.render(t)};return Ua(S,t,{settings:()=>y,data:()=>v,scale:()=>h,formatter:()=>d,renderer:()=>V,chart:()=>r,dockConfig:()=>U,mediator:()=>a,instance:()=>q,rect:()=>q.rect,style:()=>g,update:()=>tt,registries:()=>s,resolver:()=>x,symbol:()=>Va(s.symbol)}),Ua(q,m,{settings:()=>y,data:()=>v,scale:()=>h,formatter:()=>d,renderer:()=>V,chart:()=>r,dockConfig:()=>U,mediator:()=>a,style:()=>g,_DO_NOT_USE_getInfo:i.bind(S),isVisible:()=>b}),X.getBrushedShapes=function(t,e,n){const i=[];if(y.brush&&y.brush.consume){const o=r.brush(t),a=V.findShapes("*");y.brush.consume.filter((e=>e.context===t)).forEach((t=>{for(let r=0;r<a.length;r++){const s=a[r];s.data&&o.containsMappedData(s.data,n||t.data,e)&&(Y(s),i.push(s),a.splice(r,1),r--)}}))}return i},X.findShapes=t=>{var e;const n=(null!==(e=J)&&void 0!==e&&e.inProgress()?J.targetScene:V).findShapes(t);for(let t=0,e=n.length;t<e;t++)Y(n[t]);return n},X.shapesAt=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=V.itemsAt(t);let i;i=e&&"stop"===e.propagation&&n.length>0?[n.pop().node]:n.map((t=>t.node));for(let t=0,e=i.length;t<e;t++)Y(i[t]);return i},X.brushFromShapes=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.contexts=Array.isArray(e.contexts)?e.contexts:[];ba({nodes:t,action:e.action||"toggle",trigger:e,chart:r,data:w.data})},X.mount=()=>{f=V.element&&V.element()?f:V.appendTo(o),V.setKey&&"string"==typeof m.key&&V.setKey(m.key),y.brush&&($(),B()),Xa(q,u,m),Xa(S,u,t),b=!0},X.mounted=()=>E(f),X.unmount=()=>{[q,S].forEach((t=>{Ka(t,u)})),k.tap=[],k.over=[],M.forEach((t=>{t.cleanUp()})),M.length=0,I(),b=!1},X.onBrushTap=t=>{k.tap.forEach((e=>{Ma({e:t,t:e,config:w})&&"stop"===e.globalPropagation&&r.toggleBrushing(!0)}))},X.onBrushOver=t=>{k.over.forEach((e=>{Sa({e:t,t:e,config:w})&&"stop"===e.globalPropagation&&r.toggleBrushing(!0)}))},X.def=S,X.ctx=q,X.renderer=()=>V,X.set({settings:m}),O(),X}(a.component(t.type),{settings:t,chart:u,mediator:h,registries:a,theme:l,container:n}),settings:_(!0,{},t),key:t.key,hasKey:void 0!==t.key}}});function k(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};return function(){const i="function"==typeof t[e];let r;for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return r=i?t[e].call(u,...a):n.call(u,...a),r}}const M=()=>{let t;r.dockLayout?(s.warn('Deprecation Warning: "dockLayout" property should be renamed to "strategy"'),t=r.dockLayout):t=r.strategy;const e=function(t){if("function"==typeof t.getBoundingClientRect){const{width:e,height:n}=t.getBoundingClientRect();return{x:0,y:0,width:e,height:n}}return{x:0,y:0,width:0,height:0}}(n);return w.layout({layoutSettings:t,rect:e})},S=k("created"),q=k("beforeMount"),R=k("mounted"),A=k("beforeUpdate"),O=k("updated"),D=k("beforeRender"),E=k("beforeDestroy"),I=k("destroyed"),T=function(t,e){let{partialData:n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{formatters:i={},scales:r={},scroll:o={}}=e;y=z(t,{logger:s,types:a.data}),n||Object.keys(x).forEach((t=>x[t].clear())),e.palettes&&l.setPalettes(e.palettes),e.style&&l.setStyle(e.style),v=Di(e.collections,{dataset:y},{logger:s});const c={theme:l,logger:s};f=Do(r,{dataset:y,collection:v},C(C({},c),{},{scale:a.scale})),p=Ii(i,{dataset:y,collection:v},C(C({},c),{},{formatter:a.formatter})),g=Fo(o,g)};function j(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e={},i=t.filter((t=>!!t.key)).map((t=>t.key));m.forEach((t=>{t.key&&-1!==i.indexOf(t.key)?e[t.key]=t:t.destroy()})),m=t.map((t=>{const i=t.key&&e[t.key]?e[t.key]:a.interaction(t.type)(u,h,n);return i.set(t),i}))}const P=t=>{const e=n.getBoundingClientRect(),i="clientX"in t?t.clientX:t.x,r="clientY"in t?t.clientY:t.y,o={x:i-e.left,y:r-e.top},a=[];return d.forEach((t=>{const e=t.instance.getRect();gs(e.computedPhysical?e.computedPhysical:{x:e.margin.left+e.x*e.scaleRatio.x,y:e.margin.top+e.y*e.scaleRatio.y,width:e.width*e.scaleRatio.x,height:e.height*e.scaleRatio.y},o)&&a.push(t)})),a},F=()=>{if(c.length||!n)return;Object.keys(o).forEach((t=>{const e=o[t].bind(u);n.addEventListener(t,e),c.push({key:t,listener:e})}));const t={},e=e=>{e.touches?(t.x=e.touches[0].clientX,t.y=e.touches[0].clientY,t.multiTouch=e.touches.length>1):(t.x=e.clientX,t.y=e.clientY,t.multiTouch=!1),t.time=Date.now(),t.comps=P(t)},i=e=>{const n=t.comps||P(e);if(!n.every((t=>t.instance.def.disableTriggers))&&("touchend"===e.type&&e.preventDefault(),function(t,e){const n=N(t),i=n?t.changedTouches[0]:t,r=Date.now()-e.time,o=isNaN(e.x)?0:Math.abs(i.clientX-e.x),a=isNaN(e.y)?0:Math.abs(i.clientY-e.y);return(0===t.button||n)&&!e.multiTouch&&o<=12&&a<=12&&r<=300}(e,t)))for(let t=n.length-1;t>=0;t--){if(n[t].instance.onBrushTap(e),b){b=!1;break}}},r=[];r.push({key:"mousedown",listener:e}),r.push({key:"mouseup",listener:i}),function(t){return"ontouchstart"in t&&"ontouchend"in t||navigator.maxTouchPoints>1}(n)&&(r.push({key:"touchstart",listener:e}),r.push({key:"touchend",listener:i})),r.push({key:"mousemove",listener:t=>{const e=P(t);for(let n=e.length-1;n>=0;n--){if(e[n].instance.onBrushOver(t),b){b=!1;break}}}}),r.forEach((t=>{n.addEventListener(t.key,t.listener),c.push(t)}))},L=()=>{c.forEach((t=>{let{key:e,listener:i}=t;return n.removeEventListener(e,i)})),c.length=0},$=()=>{n.innerHTML="",(()=>{const{components:t=[]}=r;D(),T(i,r),w.set({components:t});const{visible:e,hidden:o,ordered:a}=M();d=e,o.forEach((t=>{t.instance.hide(),t.visible=!1})),e.forEach((t=>t.instance.beforeMount())),e.forEach((t=>t.instance.mount())),e.forEach((t=>t.instance.beforeRender())),e.forEach((t=>t.instance.render())),e.forEach((t=>t.instance.mounted())),e.forEach((t=>{t.visible=!0})),Qs(n,a)})(),F(),j(r.interactions)};return u.layoutComponents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{excludeFromUpdate:e=[]}=t;t.data&&(i=t.data),t.settings&&(r=t.settings,j(t.settings.interactions)),A(),T(i,r);const{formatters:n,scales:o,components:a=[]}=r;w.update({components:a,data:i,excludeFromUpdate:e,formatters:n,scales:o}),w.forEach((t=>{t.updateWith&&t.instance.set(t.updateWith)})),w.forEach((t=>{t.updateWith&&t.instance.beforeUpdate()})),M()},u.update=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{partialData:e,excludeFromUpdate:o=[]}=t;let a;t.data&&(i=t.data),t.settings&&(r=t.settings,j(t.settings.interactions)),A(),T(i,r,{partialData:e});const{formatters:s,scales:l,components:c=[]}=r;w.update({components:c,data:i,excludeFromUpdate:o,formatters:s,scales:l}),w.forEach((t=>{t.updateWith&&t.instance.set(t.updateWith)})),w.forEach((t=>{t.updateWith&&t.instance.beforeUpdate()}));const u=[],h=[];let f;if(e)w.forEach((t=>{(t.updateWith||t.applyTransform)&&t.visible&&u.push(t)})),f=u;else{const{visible:t,hidden:e,ordered:n}=M();d=t,f=t,a=n,t.forEach((t=>{t.updateWith&&t.visible?u.push(t):h.push(t)})),e.forEach((t=>{t.instance.hide(),t.visible=!1,delete t.updateWith,t.applyTransform=!1}))}h.forEach((t=>t.instance.beforeMount())),h.forEach((t=>t.instance.mount())),f.forEach((t=>t.instance.beforeRender())),f.forEach((t=>{(t.updateWith||t.applyTransform)&&t.visible?t.instance.update():t.instance.render()})),e||Qs(n,a),h.forEach((t=>t.instance.mounted())),u.forEach((t=>t.instance.updated())),d.forEach((t=>{delete t.updateWith,t.visible=!0,t.applyTransform=!1})),O()},u.destroy=()=>{E(),w.destroy(),L(),j(),delete u.update,delete u.destroy,I()},u.getAffectedShapes=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"and",n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,r=[];return d.filter((t=>null==i||t.key===i)).forEach((i=>{const o=i.instance.getBrushedShapes(t,e,n);r=[...r,...o]})),r},u.findShapes=t=>{let e=[];return d.forEach((n=>{const i=n.instance.findShapes(t);e=[...e,...i]})),e},u.componentsFromPoint=t=>P(t).map((t=>t.instance.ctx)),u.shapesAt=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=[];const r=n.getBoundingClientRect();let o=d;if(Array.isArray(e.components)&&e.components.length>0){const t=e.components.map((t=>t.key));o=d.filter((e=>-1!==t.indexOf(e.key))).map((n=>({instance:n.instance,opts:e.components[t.indexOf(n.key)]})))}for(let n=o.length-1;n>=0;n--){const a=o[n],s=Js(t,r,a.instance.renderer().element().getBoundingClientRect()),l=a.instance.shapesAt(s,a.opts),c=l.length>0&&"stop"===e.propagation;if(i=[...i,...l],i.length>0&&c)return i}return i},u.brushFromShapes=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{components:[]};for(let n=0;n<e.components.length;n++){const i=e.components[n].key;d.filter((t=>i===t.key)).forEach((i=>{let r=t.filter((t=>t.key===i.key));i.instance.brushFromShapes(r,e.components[n])}))}},u.scroll=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";return Lo(t,g)},u.dataset=t=>y(t),u.dataCollection=t=>v(t),u.scales=function(){return f.all()},u.formatters=function(){return p.all()},u.brush=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";return x[t]||(x[t]=oa()),x[t]},u.scale=function(t){return f.get(t)},u.formatter=function(t){return p.get(t)},u.toggleBrushing=function(t){b=void 0!==t?t:!b},u.component=t=>{const e=w.findComponentByKey(t);return null==e?void 0:e.instance.ctx},u.logger=()=>s,u.theme=()=>l,u.storage=Ga({animations:{updatingStageMeta:{isInit:!1,shouldBeRemoved:!1}}}),Object.defineProperty(u,"interactions",{get:()=>({instances:m,on(){F(),m.forEach((t=>t.on()))},off(){L(),m.forEach((t=>t.off()))}})}),S(),n&&(q(),$(),R(n),u.element=n),u}const el=t=>{let e=Ht(t);return e.prio=t=>t?e.default(t[0]):[e.default()],e.types=()=>e.getKeys(),e};var nl=Ht();function il(t,e,n){let{key:i}=n;const r={value:"function"==typeof t.value?t.value(e):void 0!==t.value?t.value:e};return r.label="function"==typeof t.label?t.label(e):void 0!==t.label?String(t.label):String(r.value),t.field&&(r.source={key:i,field:t.field.key()}),r}function rl(t,e){const n=Array.isArray(t)?t:[t];let i=[];return n.forEach((t=>{if(void 0!==t.field){const n=e.field(t.field),r=e.key();if(!n)throw Error("Field '".concat(t.field,"' not found"));const{props:o,main:a}=ki(t,e),s=Object.keys(o),l=!!t.trackBy,c=typeof t.trackBy,u={},h=[],d=n.items(),f=[];for(let e=0;e<d.length;e++){const n=d[e];if(a.filter&&!a.filter(n))continue;const i=il(a,n,{key:r});s.forEach((t=>{const a=o[t];let s=a.field?a.field.items()[e]:n;i[t]=il(a,s,{key:r})})),l&&Si({cfg:t,itemData:n,obj:i,target:h,tracker:u,trackType:c}),f.push(i)}i=l?[...i,...Mi(h,{main:a,propsArr:s,props:o})]:[...i,...f]}})),i}const ol=t=>t.filter((t=>"number"==typeof t&&!isNaN(t)));const al=t=>{let{key:e,data:n,cache:i,config:r}=t;if(!n)return;let o=n;"string"==typeof o&&(o=(t=>{let{data:e,config:n}=t;const i=e.split("\n"),r=i[0],o=i[1];let a=",";if(n&&n.parse&&n.parse.delimiter)a=n.parse.delimiter;else if(r){const t=[/,/,/\t/,/;/];for(let e=0;e<t.length;e++){const n=t[e];if(r&&o){if(n.test(r)&&n.test(o)&&r.split(n).length===o.split(n).length){a=n;break}}else n.test(r)&&(a=n)}}return i.map((t=>t.split(a)))})({data:n,config:r})),Array.isArray(o)&&function(t){let e,{source:n,data:i,cache:r,config:o}=t,a=i;const s=o&&o.parse;Array.isArray(i[0])?s&&!1===s.headers?e=i[0].map(((t,e)=>e)):(e=i[0],a=i.slice(1)):e=Object.keys(i[0]);const l=!!s&&"function"==typeof s.row&&s.row;let c,u=e;u=s&&"function"==typeof s.fields?s.fields(u.slice()):e.map((t=>({key:t,title:t}))),Array.isArray(i[0])?c=u.map((()=>[])):(c={},u.forEach((t=>{c[t.key]=[]})));for(let t=0;t<a.length;t++){const e=l?l(a[t],t,u):a[t];if(e)if(Array.isArray(e))for(let t=0;t<u.length;t++)c[t].push(e[t]);else for(let t=0;t<u.length;t++)c[u[t].key].push(e[u[t].key])}const h=Array.isArray(c)?t=>c[t]:t=>c[u[t].key];for(let t=0;t<u.length;t++){const e=h(t),i=ol(e),o=i.length>0,a=o?"measure":"dimension",s=o?Math.min(...i):NaN,l=o?Math.max(...i):NaN;r.fields.push(mi(_({source:n,key:t,title:u[t].title,values:e,min:s,max:l,type:a},u[t]),{value:u[t].value,label:u[t].label}))}}({data:o,cache:i,source:e,config:r})};function sl(){let{key:t,data:e,config:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const i={fields:[]},r={key:()=>t,raw:()=>e,field:t=>yi(t,{cache:i,matrix:e}),fields:()=>i.fields.slice(),extract:t=>rl(t,r),hierarchy:()=>null};return al({key:t,data:e,config:n,cache:i}),r}sl.util={normalizeConfig:ki,collect:Mi,track:Si};const ll=Ht();ll.default("matrix"),ll("matrix",sl),ll("default",sl);const cl=Ht();function ul(t,e,n){return Math.max(t,Math.min(e,n))}function hl(t){let{item:e,value:n,boxCenter:i,rendWidth:r,rendHeight:o,flipXY:a,symbol:s}=t,l="x",c="y",u=r,h=o,d=n<.5?90:-90;return a&&(l="y",c="x",u=o,h=r,d=n<.5?180:0),s(_({},e.oob,{[l]:i*u,[c]:Math.max(e.oob.size/2,Math.min(n*h,h-e.oob.size/2)),startAngle:d}))}function dl(t){let{item:e,boxWidth:n,boxPadding:i,rendWidth:r,rendHeight:o,flipXY:a}=t,s="x",l="y",c="width",u="height",h=r,d=o;a&&(s="y",l="x",c="height",u="width",h=o,d=r);const{actualDiff:f,actualLow:p}=function(t){let{start:e,end:n,minPx:i=.1,maxPx:r=1}=t;const o=Math.max(e,n),a=Math.min(e,n),s=ul(-.1,1.2,o),l=ul(-.1,1.2,a),c=s*r-l*r,u=Math.max(i,c),h=(u-c)/2;return{actualDiff:u,startModifier:h,actualLow:l*r-h}}({start:e.start,end:e.end,minPx:e.box.minHeightPx,maxPx:d});return _({},e.box,{type:"rect",[s]:(i+e.major)*h,[l]:p,[u]:f,[c]:n*h,data:e.data||{},collider:{type:null}})}function fl(t){let{item:e,from:n,to:i,boxCenter:r,rendWidth:o,rendHeight:a,flipXY:s}=t,l="x1",c="y1",u="x2",h="y2",d=o,f=a;return s&&(l="y1",c="x1",u="y2",h="x2",d=a,f=o),_({},e.line,{type:"line",[h]:Math.floor(n*f),[l]:r*d,[c]:Math.floor(i*f),[u]:r*d,data:e.data||{},collider:{type:null}})}function pl(t){let{item:e,key:n,position:i,width:r,boxCenter:o,rendWidth:a,rendHeight:s,flipXY:l}=t,c="x1",u="y1",h="x2",d="y2",f=a,p=s;l&&(c="y1",u="x1",h="y2",d="x2",f=s,p=a);const g=r/2;return _({type:"line"},e[n],{[u]:Math.floor(i*p),[c]:(o-g)*f,[d]:Math.floor(i*p),[h]:(o+g)*f,r:g*f,cx:o*f,cy:i*p,width:r*f,data:e.data||{},collider:{type:null}})}function gl(t,e,n){const{width:i,maxWidthPx:r,minWidthPx:o}=e.box,a=t>=0?1:-1;let s=Math.min(a*t*i,isNaN(r)?n:r/n);return s=isNaN(o)?s:Math.max(o/n,s),s*a}cl("native",(function(t,e,n){let i,r,o={chart:t,mediator:e,element:n},a=[],s=!0;function l(){"function"==typeof i.enable&&(i.enable=i.enable.bind(o)()),i.enable&&Object.keys(i.events).forEach((t=>{const e=i.events[t].bind(o);n.addEventListener(t,e),a.push({key:t,listener:e})}))}function c(){a.forEach((t=>{let{key:e,listener:i}=t;n.removeEventListener(e,i)})),a=[]}return{get key(){return r},set(t){!function(t){r=t.key,i=t,i.events=i.events||[],void 0===i.enable&&(i.enable=!0)}(t),c(),s&&l()},off(){s=!1,c()},on(){s=!0,0===a.length&&l()},destroy(){c(),o=null,i=null}}}));const ml={oob:{show:!0,type:"n-polygon",fill:"#999",stroke:"#000",strokeWidth:0,size:10,sides:3,startAngle:-90},box:{show:!0,fill:"#fff",stroke:"#000",strokeWidth:1,strokeLinejoin:"miter",width:1,maxWidthPx:void 0,minWidthPx:1,minHeightPx:1},line:{show:!0,stroke:"#000",strokeWidth:1},median:{show:!0,stroke:"#000",strokeWidth:1},whisker:{show:!0,stroke:"#000",strokeWidth:1,fill:"",type:"line",width:1}},yl=Object.keys(ml),vl={require:["chart","resolver","symbol"],defaultSettings:{settings:{},data:{},style:{box:"$shape",line:"$shape-guide",whisker:"$shape-guide",median:"$shape-guide--inverted"}},created(){this.state={}},render(t){let{data:e}=t;const{width:n,height:i}=this.rect,r="horizontal"===this.settings.settings.orientation,{style:o,resolver:a,symbol:s}=this,l=yl.filter((t=>!this.settings.settings[t]||!1!==this.settings.settings[t].show)),c={};l.forEach((t=>c[t]=ml[t]));const u=function(t){let{keys:e,data:n,defaultSettings:i,style:r,settings:o,width:a,height:s,resolver:l}=t;const c=_(!0,{},i||{},r||{}),u={major:"horizontal"===o.orientation?s:a,minor:"horizontal"===o.orientation?a:s},h=o.major;let d;d="object"==typeof h&&"object"==typeof h.ref&&void 0!==h.ref.start&&void 0!==h.ref.end?l.resolve({data:n,defaults:{start:0,end:1},scaled:u,settings:_(!0,{},{binStart:{scale:o.major.scale,ref:o.major.ref.start},binEnd:{scale:o.major.scale,ref:o.major.ref.end}})}):"object"==typeof h&&void 0!==h.binStart&&void 0!==h.binEnd?l.resolve({data:n,defaults:{start:0,end:1},scaled:u,settings:_(!0,{},{binStart:{scale:o.major.scale,ref:"binStart"},binEnd:{scale:o.major.scale,ref:"binEnd"}},o.major)}):l.resolve({data:n,scaled:u,defaults:{major:.5},settings:{major:o.major}});const f=o.minor||{},p={};["start","end","min","max","med"].forEach((t=>{(f[t]||n.items&&n.items.length&&n.items[0][t])&&(p[t]={scale:f.scale,ref:t})}));let g,m={major:d,minor:l.resolve({data:n,defaults:{start:0,end:1},scaled:u,settings:_(!0,{},p,f)})};for(let t=0,i=e.length;t<i;t++)o[g]&&!1===o[g].show||(g=e[t],m[g]=l.resolve({data:n,defaults:c[g],settings:o[g],scaled:u}));return m}({keys:l,data:e,defaultSettings:c,style:o,settings:this.settings.settings,width:n,height:i,resolver:a}),{settings:h,items:d}=u;return function(t){let{width:e,height:n,flipXY:i,resolved:r,keys:o,symbol:a}=t;const s=[],l=r.major.items;if(!l.length)return s;const c=e,u=n,h=i?n:e,d=r.major.settings,f=["start","end","min","max","med"].filter((t=>void 0!==r.minor.settings[t])),p=f.length,g=o.filter((t=>"oob"!==t));let m,y,v,x,b,w,k,M,S;const C=o?o.length:0,q=g?g.length:0,N={box:function(){v.box&&R(v.start)&&R(v.end)&&m.push(dl({item:v,boxWidth:x,boxPadding:b,rendWidth:c,rendHeight:u,flipXY:i}))},line:function(){R(v.min)&&R(v.start)&&m.push(fl({item:v,from:v.min,to:v.start,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i})),R(v.max)&&R(v.end)&&m.push(fl({item:v,from:v.max,to:v.end,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i}))},median:function(){v.median&&R(v.med)&&m.push(pl({item:v,key:"median",position:v.med,width:x,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i}))},whisker:function(){if(v.whisker){const t=x*v.whisker.width;R(v.min)&&m.push(pl({item:v,key:"whisker",position:v.min,width:t,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i})),R(v.max)&&m.push(pl({item:v,key:"whisker",position:v.max,width:t,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i}))}}};function A(){let t,e=-Number.MAX_VALUE,n=Number.MAX_VALUE;for(let i=0;i<p;i++)t=v[f[i]],R(t)&&(e<t&&(e=t),n>t&&(n=t));k=e<0&&e!==-Number.MAX_VALUE,M=n>1&&n!==Number.MAX_VALUE,S=k||M}for(let t=0,e=l.length;t<e;t++){m=[],y=null;const e=l[t],n=e.data;let f=null,p=null;void 0!==d.binStart?(f=e.binStart,p=e.binEnd,y=d.binStart.scale):(y=d.major.scale,f=y?e.major:0);let R=0;y?y.bandwidth?(R=y.bandwidth(),f-=R/2):R=p-f:R=1,v=_({},{major:f,majorEnd:p},r.minor.items[t]);for(let e=0;e<C;e++)v[o[e]]=r[o[e]].items[t];if(x=gl(R,v,h),b=(R-x)/2,w=b+v.major+x/2,A(),S)v.oob&&(k?m.push(hl({item:v,value:0,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i,symbol:a})):M&&m.push(hl({item:v,value:1,boxCenter:w,rendWidth:c,rendHeight:u,flipXY:i,symbol:a})));else for(let t=0;t<q;t++)v[g[t]]&&!1===v[g[t]].show||N[g[t]]();const O={type:"container",data:n,collider:{type:"bounds"},children:m};s.push(O)}return s}({items:d,settings:h,width:n,height:i,flipXY:r,resolved:u,keys:l,symbol:s})}};const xl={shape:"saltire",width:2,size:.5,fill:"#333",stroke:"#333",strokeWidth:0},bl=/px$/,wl={shape:"circle",label:"",fill:"#333",stroke:"#ccc",strokeDasharray:"",strokeWidth:0,strokeLinejoin:"miter",opacity:1,x:.5,y:.5,size:1,show:!0},kl={maxPx:1e4,minPx:1,maxRelExtent:.1,minRelExtent:.01,maxRelDiscrete:1,minRelDiscrete:.1};function _l(t,e){return t&&"function"==typeof t.bandwidth?{isBandwidth:!0,value:Math.max(1,t.bandwidth()*e)}:{isBandwidth:!1,value:Math.max(1,e)}}function Ml(t,e,n,i){let{width:r,height:o}=e;return t.filter((t=>!1!==t.show&&!isNaN(t.x+t.y))).map((t=>{let e=t,a=bl.test(t.size)?parseInt(t.size,10):n.min+e.size*(n.max-n.min);A(a)&&(e=xl,a=n.min+e.size*(n.max-n.min));const[s,l]=function(t){let e=wl.shape,n={};return"object"==typeof t.shape&&"string"==typeof t.shape.type?(e=t.shape.type,n=t.shape):"string"==typeof t.shape&&(e=t.shape),[e,n]}(e),c=C(C({},l),{},{type:s,label:t.label,x:t.x*r,y:t.y*o,fill:e.fill,size:Math.min(n.maxGlobal,Math.max(n.minGlobal,a)),stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.strokeDasharray,opacity:e.opacity});e===t.errorShape&&(c.width=e.width);const u=i(c);return u.data=t.data,u}))}const Sl={require:["chart","resolver","symbol"],defaultSettings:{settings:{},data:{},animations:{enabled:!1,trackBy:t=>t.data.value},style:{item:"$shape"}},render(t){let{data:e}=t;const n=this.resolver.resolve({data:e,defaults:_({},wl,this.style.item),settings:this.settings.settings,scaled:{x:this.rect.width,y:this.rect.height}}),{width:i,height:r}=this.rect,o=_({},kl,this.settings.settings.sizeLimits),a=n.items,s=function(t,e,n,i,r){const o=_l(t?t.scale:void 0,n),a=_l(e?e.scale:void 0,i);let s=Math.min(o.value*r[o.isBandwidth?"maxRelDiscrete":"maxRelExtent"],a.value*r[a.isBandwidth?"maxRelDiscrete":"maxRelExtent"]),l=Math.min(o.value*r[o.isBandwidth?"minRelDiscrete":"minRelExtent"],a.value*r[a.isBandwidth?"minRelDiscrete":"minRelExtent"]);return{min:Math.max(1,Math.floor(l)),max:Math.max(1,Math.floor(s)),maxGlobal:r.maxPx,minGlobal:r.minPx}}(n.settings.x,n.settings.y,i,r,o);return Ml(a,this.rect,s,this.settings.shapeFn||this.symbol)}};Math.PI;const Cl={label:"",arc:1,show:!0,fill:"#333",stroke:"#ccc",strokeWidth:1,strokeLinejoin:"round",opacity:1,innerRadius:0,outerRadius:.8,cornerRadius:0,offset:0};function ql(t,e,n,i){let{x:r,y:o,width:a,height:s}=e;const l=dt(),c={x:r+a/2,y:o+s/2},u=Math.min(a,s)/2,h=Math.min(a,s)/2,d=h/100;return t.map(((t,e)=>{const r=n[e];r.type="path";const o=h*r.outerRadius,a=u*r.innerRadius,s=d*r.cornerRadius;l.innerRadius(a),l.outerRadius(o),l.cornerRadius(s),r.arcDatum=t;const f=l.centroid(t),p=r.offset?function(t,e,n,i){let[r,o]=t;const a=Math.sqrt(r*r+o*o);r/=a,o/=a;const s=n-i;return{x:r*e*s,y:o*e*s}}(f,r.offset,o,a):{x:0,y:0};return r.transform="translate(".concat(p.x,", ").concat(p.y,") translate(").concat(c.x,", ").concat(c.y,")"),r.desc={share:t.value/i,slice:{start:t.startAngle,end:t.endAngle,innerRadius:a,outerRadius:o,cornerRadius:s,offset:{x:c.x+p.x,y:c.y+p.y}}},r}))}function Nl(t,e){return t.slice&&"arc"in t.slice?e.arc:e.data.value}const Rl={require:["chart","resolver"],defaultSettings:{settings:{startAngle:0,endAngle:2*Math.PI,padAngle:0,slice:{}},style:{slice:"$shape"},data:{}},render(t){let{data:e}=t;const n=[],i=[],r=this.settings.settings,{items:o}=this.resolver.resolve({data:e,defaults:_({},Cl,this.style.slice),settings:r.slice});let a=0;for(let t=0,e=o.length;t<e;t++){const e=Nl(r,o[t]);e>0&&o[t].outerRadius>=o[t].innerRadius&&(n.push(e),i.push(o[t]),a+=e)}const s=function(){var t=xt,e=vt,n=null,i=W(0),r=W(nt),o=W(0);function a(a){var s,l,c,u,h,d=a.length,f=0,p=new Array(d),g=new Array(d),m=+i.apply(this,arguments),y=Math.min(nt,Math.max(-nt,r.apply(this,arguments)-m)),v=Math.min(Math.abs(y)/d,o.apply(this,arguments)),x=v*(y<0?-1:1);for(s=0;s<d;++s)(h=g[p[s]=s]=+t(a[s],s,a))>0&&(f+=h);for(null!=e?p.sort((function(t,n){return e(g[t],g[n])})):null!=n&&p.sort((function(t,e){return n(a[t],a[e])})),s=0,c=f?(y-d*x)/f:0;s<d;++s,m=u)l=p[s],u=m+((h=g[l])>0?h*c:0)+x,g[l]={data:a[l],index:s,value:h,startAngle:m,endAngle:u,padAngle:v};return g}return a.value=function(e){return arguments.length?(t="function"==typeof e?e:W(+e),a):t},a.sortValues=function(t){return arguments.length?(e=t,n=null,a):e},a.sort=function(t){return arguments.length?(n=t,e=null,a):n},a.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:W(+t),a):i},a.endAngle=function(t){return arguments.length?(r="function"==typeof t?t:W(+t),a):r},a.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:W(+t),a):o},a}().sortValues(null);s.startAngle(r.startAngle),s.endAngle(r.endAngle),s.padAngle(r.padAngle);return ql(s(n),_({},this.rect,{x:0,y:0}),i,a)}};const Al=function(t){function e(e){if(t[e.type]&&t[e.type].condition(e)){const n=t[e.type],i=void 0===n.conditionAppend||n.conditionAppend(e);n.items.forEach((t=>{const n=Math.round(e[t.key]),r=e[t.key]-n;e[t.key]=n,i&&"append"===t.type&&(r>0?e[t.key]+=.5:e[t.key]-=.5)}))}}return void 0===t&&((t={}).line={append:["x1","x2","y1","y2"],round:[],condition:t=>t.x1===t.x2||t.y1===t.y2,conditionAppend:t=>t.strokeWidth%2!=0},t.rect={append:["x","y"],round:["width","height"],condition:()=>!0,conditionAppend:t=>t.strokeWidth%2!=0}),Object.keys(t).forEach((e=>{const n=t[e];n.items=[],n.append.forEach((t=>{n.items.push({key:t,type:"append"})})),n.round.forEach((t=>{n.items.push({key:t,type:"round"})}))})),e.multiple=t=>t.forEach((t=>e(t))),e}();class Ol{constructor(){this.reset(),this.push(...arguments)}static evaluateKey(t,e){if(e){const e=t.substring(0,1),n=t.substring(1);if("x"===e)return"y".concat(n);if("y"===e)return"x".concat(n);if("cx"===t)return"cy";if("cy"===t)return"cx";if("width"===t)return"height";if("height"===t)return"width"}return t}transposeCoordinate(t,e,n){if("number"==typeof e&&isFinite(e)){const i=t.substring(0,1);if("x"===i||"cx"===t)return e*this.width;if("width"===t)return e*this.width;if("r"===t)return e*(n?this.height:this.width);if("y"===i||"cy"===t)return e*this.height;if("height"===t)return e*this.height}return e}push(){return this.storage.push(...arguments),this}processItem(t){let e={};const n=void 0!==t.flipXY?t.flipXY:this.flipXY,i=void 0!==t.crisp?t.crisp:this.crisp;if(t.fn&&"function"==typeof t.fn){let i=n?this.height:this.width,r=n?this.width:this.height;t=t.fn({width:i,height:r,flipXY:n});const o=Object.keys(t);for(let i=0,r=o.length;i<r;i++){let r=o[i];e[Ol.evaluateKey(r,n)]=t[r]}}else{const i=Object.keys(t);for(let r=0,o=i.length;r<o;r++){let o=i[r];const a=Ol.evaluateKey(o,n),s=this.transposeCoordinate(a,t[o],n);e[a]=s}}return i&&Al(e),e}output(){let t=[];for(let e=0,n=this.storage.length;e<n;e++){let n=this.processItem(this.storage[e]);t.push(n)}return t}reset(){this.storage=[],this.flipXY=!1,this.crisp=!1,this.width=0,this.height=0}}function Dl(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Ol(...e)}function El(t,e){return t&&e?t.cachedTicks&&t.cachedTicks()||t.ticks({distance:e}):[]}const Il={created(){},require:["chart","renderer","resolver"],defaultSettings:{layout:{displayOrder:0},style:{ticks:"$guide-line",minorTicks:"$guide-line--minor"}},beforeRender(){this.blueprint=Dl(),this.blueprint.width=this.rect.width,this.blueprint.height=this.rect.height,this.blueprint.x=this.rect.x,this.blueprint.y=this.rect.y,this.blueprint.crisp=!0},render(){if(this.x=this.settings.x?this.chart.scale(this.settings.x):null,this.y=this.settings.y?this.chart.scale(this.settings.y):null,pa(this,"x",this.rect.width),pa(this,"y",this.rect.height),!this.x&&!this.y)return[];this.settings.ticks=_({show:!0},this.style.ticks,this.settings.ticks||{}),this.settings.minorTicks=_({show:!1},this.style.minorTicks,this.settings.minorTicks||{}),this.lines={x:[],y:[]},this.lines.x=El(this.x,this.rect.width),this.lines.y=El(this.y,this.rect.height),this.lines.y=this.lines.y.map((t=>_(t,{flipXY:!0})));let t=t=>{let{dir:e,isMinor:n}=t,i=this.lines[e].filter((t=>!!t.isMinor===n)),r=n?this.settings.minorTicks:this.settings.ticks;this.resolver.resolve({settings:r,data:{items:i,dir:e}}).items.forEach((t=>{let n=t.data;var i,r;t.show&&this.blueprint.push({type:"line",x1:n.position,y1:0,x2:n.position,y2:1,stroke:t.stroke||"black",strokeWidth:void 0!==t.strokeWidth?t.strokeWidth:1,strokeDasharray:void 0!==t.strokeDasharray?t.strokeDasharray:void 0,flipXY:n.flipXY||!1,value:null!==(i=n.value)&&void 0!==i?i:null===(r=n.data)||void 0===r?void 0:r.value,dir:e})}))};return t({dir:"x",isMinor:!1}),t({dir:"x",isMinor:!0}),t({dir:"y",isMinor:!1}),t({dir:"y",isMinor:!0}),this.blueprint.output()}};function Tl(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"bottom";if(n*=.8,"left"===i||"right"===i){let r="right"===i;return"\n M ".concat(t," ").concat(e-n,"\n A ").concat(1.25*n," ").concat(1.25*n,", 0, 1, ").concat(r?0:1,", ").concat(t," ").concat(e+n,"\n L ").concat(r?t+n:t-n," ").concat(e," Z\n ")}let r="bottom"===i;return"\n M ".concat(t-n," ").concat(e,"\n A ").concat(1.25*n," ").concat(1.25*n,", 0, 1, ").concat(r?1:0,", ").concat(t+n," ").concat(e,"\n L ").concat(t," ").concat(r?e+n:e-n," Z\n ")}function jl(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"bottom";if(n*=.75,"left"===i||"right"===i){let r="right"===i;return"\n M ".concat(t+=r?1.5*n:-1.5*n," ").concat(e-n,"\n L ").concat(t," ").concat(e+n,"\n L ").concat(r?t+n:t-n," ").concat(e," Z\n ")}let r="bottom"===i;return e+=r?1.5*n:-1.5*n,"\n M ".concat(t-n," ").concat(e,"\n L ").concat(t+n," ").concat(e,"\n L ").concat(t," ").concat(r?e+n:e-n," Z\n ")}function Pl(t){if(void 0===t)return 0;if("number"==typeof t&&isFinite(t))return t;if("string"==typeof t)switch(t){case"center":case"middle":return.5;case"bottom":case"right":return 1;case"top":case"left":default:return 0}return 0}function zl(t){const e={value:t.value};return t.label&&(e.label=t.label.text),e}function Fl(t){return void 0!==("function"==typeof t.value?t.value():t.value)}function Ll(t,e){const n=t.min();if(n===t.max()){const i=function(t){const e=t.range();return 2===(null==e?void 0:e.length)&&e[0]>e[1]}(t);if(e<n)return i?2:-1;if(e>n)return i?-1:2}return t(e)}const $l={require:["chart","renderer"],defaultSettings:{layout:{displayOrder:0},style:{oob:{show:!0,width:10,fill:"#1A1A1A",stroke:"transparent",strokeWidth:0,opacity:1,text:{fontFamily:"Arial",stroke:"transparent",fill:"#fff",strokeWidth:0,opacity:1},triangle:{fill:"#4D4D4D",stroke:"transparent",strokeWidth:0,opacity:1},padding:{x:28,y:5}},line:{stroke:"#000"},label:{strokeWidth:0}}},preferredSize:()=>30,beforeRender(){this.blueprint=Dl(),this.blueprint.width=this.rect.width,this.blueprint.height=this.rect.height,this.blueprint.x=this.rect.x,this.blueprint.y=this.rect.y,this.blueprint.crisp=!0},render(){let t=this.settings;if(this.lines={x:[],y:[]},this.lines.x=t.lines&&t.lines.x||[],this.lines.y=t.lines&&t.lines.y||[],0===this.lines.x.length&&0===this.lines.y.length)return[];const e={x0:[],x1:[],y0:[],y1:[]};this.lines.x=this.lines.x.filter(Fl).map((t=>{if("function"==typeof t.value&&(t.value=t.value()),t.scale){let e=this.chart.scale(t.scale);const n=Ll(e,t.value);return _(t,{scale:e,position:n})}return _(t,{position:t.value})})),this.lines.y=this.lines.y.filter(Fl).map((t=>{if("function"==typeof t.value&&(t.value=t.value()),t.scale){let e=this.chart.scale(t.scale);const n=Ll(e,t.value);return _(t,{scale:e,position:n,flipXY:!0})}return _(t,{position:t.value,flipXY:!0})})),this.lines.x=this.lines.x.filter((t=>!(t.position<0||t.position>1)||(e["x".concat(t.position>1?1:0)].push(zl(t)),!1))),this.lines.y=this.lines.y.filter((t=>!(t.position<0||t.position>1)||(e["y".concat(t.position>1?1:0)].push(zl(t)),!1)));let n=[];return[...this.lines.x,...this.lines.y].forEach((e=>{(!0===e.show||void 0===e.show)&&function(t){let{chart:e,blueprint:n,renderer:i,p:r,settings:o,items:a}=t,s=!0,l=!1,c=!1,u=!1,h=!1,d=_(!0,{},o.style.line,r.line||{});if(l=n.processItem({type:"line",x1:r.position,y1:0,x2:r.position,y2:1,stroke:d.stroke||"black",strokeWidth:d.strokeWidth||1,strokeDasharray:d.strokeDasharray,flipXY:r.flipXY||!1,value:r.valueInfo?r.valueInfo.id:r.value}),r.label){const t=_(!0,{fill:"#000",fontFamily:"Arial",fontSize:"12px",opacity:1,maxWidth:1,maxWidthPx:9999,padding:5,background:{fill:"#fff",stroke:"transparent",strokeWidth:0,opacity:.5}},o.style.label||{},{fill:d.stroke},r.label);let l,f={width:0,height:0},p="";if("string"==typeof r.formatter)l=e.formatter(r.formatter);else if("object"==typeof r.formatter)l=e.formatter(r.formatter);else if(void 0!==r.scale&&r.scale.data){const t=r.scale.data()&&r.scale.data().fields;l=t&&t[0]?t[0].formatter():null}!1!==r.label.showValue&&(l?p=" (".concat(l(r.value),")"):r.scale&&(p=" (".concat(r.value,")"))),p&&(f=i.measureText({text:p,fontFamily:t.fontFamily,fontSize:t.fontSize}));let g=i.measureText({text:t.text||"",fontFamily:t.fontFamily,fontSize:t.fontSize}),m={width:g.width+f.width,height:Math.max(g.height,f.height)},y=t.padding,v=Pl(r.flipXY?t.vAlign:t.align),x=Pl(r.flipXY?t.align:t.vAlign),b=Math.min(1+m.width+2*y,t.maxWidth*n.width,t.maxWidthPx),w=m.height+2*y,k=r.flipXY?w:b,M=r.flipXY?b:w;if(c=n.processItem({fn:e=>{let{width:i,height:o}=e,a=r.position*i-(r.flipXY?w:b)*(1-v);return a=r.flipXY?a:Math.max(a,0),{type:"rect",x:a,y:Math.max(Math.abs(x*o-M*x),0),width:r.flipXY?k:Math.min(k,n.width-a),height:M,stroke:t.background.stroke,strokeWidth:t.background.strokeWidth,fill:t.background.fill,opacity:t.background.opacity}},flipXY:r.flipXY||!1}),c.x<-1||c.x+c.width>n.width+1||c.y<-1||c.y+c.height>n.height+1)c=void 0;else{u={type:"text",text:t.text||"",fill:t.fill,opacity:t.opacity,fontFamily:t.fontFamily,fontSize:t.fontSize,x:c.x+y,y:c.y+c.height/2+m.height/3,maxWidth:c.width-2*y-f.width,anchor:"start"},p&&(h={type:"text",text:p||"",fill:t.fill,opacity:t.opacity,fontFamily:t.fontFamily,fontSize:t.fontSize,x:u.x+3+(c.width-(f.width+2*y)),y:u.y});for(let t=0,e=a.length;t<e;t++){let e=a[t];"rect"===e.type?fs(c,e)&&(s=!1):"line"===e.type&&r.flipXY===e.flipXY&&ms(c,e)&&(s=!1)}}}a.push(l),s&&c&&u&&(a.push(c,u),h&&a.push(h))}({chart:this.chart,blueprint:this.blueprint,renderer:this.renderer,p:e,settings:t,items:n})})),t.style.oob.show&&function(t){let{blueprint:e,oob:n,settings:i,items:r}=t;const o=Object.keys(n);let a=i.style.oob||{};for(let t=0,i=o.length;t<i;t++){const i=o[t],s=n[i];if(s.length>0){let t=i.charAt(1),n="y"===i.charAt(0),o=a.padding.x+a.width,l=a.padding.y+a.width,c="bottom";c=n?"1"===t?"bottom":"top":"1"===t?"right":"left";let u=e.processItem({fn:e=>{let{width:i,height:r}=e,u=t*i+("1"===t?-o:o),h=n?l:r-l;return"arc"===a.type?{type:"path",d:Tl(n?h:u,n?u:h,a.width,c),x:u,y:h,stroke:a.stroke,fill:a.fill,strokeWidth:a.strokeWidth||0}:{type:"circle",cx:u,cy:h,r:a.width,stroke:a.stroke,fill:a.fill,strokeWidth:a.strokeWidth||0,opacity:a.opacity,data:s}},flipXY:n}),h=u.cx||u.x,d=u.cy||u.y,f={type:"text",text:s.length||"",x:h-.4*a.width,y:d+.4*a.width,fontFamily:a.text.fontFamily,fontSize:"".concat(1.3*a.width,"px"),stroke:a.text.stroke,fill:a.text.fill,strokeWidth:a.text.strokeWidth||0,opacity:a.text.opacity},p={type:"path",d:jl(h,d,a.width,c),x:h,y:d,stroke:a.triangle.stroke,fill:a.triangle.fill,strokeWidth:a.triangle.strokeWidth||0,opacity:a.triangle.opacity};r.push(u,f,p)}}}({blueprint:this.blueprint,oob:e,settings:t,items:n}),n}};function Bl(t){const e={type:"line",x1:0,x2:0,y1:0,y2:0,collider:{type:null}};return"top"===t.align||"bottom"===t.align?(e.x1=t.innerRect.x-t.outerRect.x,e.x2=e.x1+t.innerRect.width,e.y1=e.y2="top"===t.align?t.innerRect.height-t.padding:t.padding):(e.x1=e.x2="left"===t.align?t.innerRect.width-t.padding:t.padding,e.y1=t.innerRect.y-t.outerRect.y,e.y2=e.y1+t.innerRect.height),function(t,e){_(t,e.style)}(e,t),e}function Hl(t){return"string"==typeof t||"number"==typeof t?t:"-"}function Vl(t,e,n){n.layered||!n.stepSize?function(t,e){e.collider={type:"polygon",vertices:[{x:e.boundingRect.x,y:e.boundingRect.y},{x:e.boundingRect.x+e.boundingRect.width,y:e.boundingRect.y},{x:e.boundingRect.x+e.boundingRect.width,y:e.boundingRect.y+e.boundingRect.height},{x:e.boundingRect.x,y:e.boundingRect.y+e.boundingRect.height}]}}(0,e):n.tilted?function(t,e,n){const i=n.angle*(Math.PI/180),r=Math.max(n.stepSize/2,e.boundingRect.height/2),o="start"===e.anchor,a="end"===e.anchor&&i<0,s="start"===e.anchor&&i>=0,l=e.boundingRect.y+(s||a?e.boundingRect.height:0),c=[{x:e.x-r,y:l},{x:e.x+r,y:l}].map((t=>Fa(t,i,{x:e.x,y:e.y}))),u={x:o?e.boundingRect.x+e.boundingRect.width+10:e.boundingRect.x-10,y:e.boundingRect.y+e.boundingRect.height},h={x:o?e.boundingRect.x+e.boundingRect.width+10:e.boundingRect.x-10,y:e.boundingRect.y},d=i>=0?[u,h]:[h,u];c.push(...d),e.collider={type:"polygon",vertices:c}}(0,e,n):function(t,e,n){if("bottom"===n.align||"top"===n.align){const i=t.position*n.innerRect.width+(n.innerRect.x-n.outerRect.x-n.stepSize/2);e.collider={type:"rect",x:i,y:0,width:i<0?n.stepSize+i:n.stepSize,height:n.innerRect.height}}else{const i=t.position*n.innerRect.height+(n.innerRect.y-n.outerRect.y-n.stepSize/2);e.collider={type:"rect",x:0,y:i,width:n.innerRect.width,height:i<0?n.stepSize+i:n.stepSize}}const i=e.collider;i.x=Math.max(i.x,0),i.y=Math.max(i.y,0);const r=i.x+i.width-(n.outerRect.x+n.outerRect.width);i.width=r>0?i.width-r:i.width;const o=i.y+i.height-(n.outerRect.y+n.outerRect.height);i.height=o>0?i.height-o:i.height}(t,e,n)}function Wl(t,e){const n=isNaN(t.style.align)?.5:Math.min(Math.max(t.style.align,0),1);let i=0;if(t.tilted)i=t.stepSize*n;else{const r=e?t.textRect.height:t.textRect.width;i=Math.max(0,t.stepSize-r)*n}return i}function Ul(t,e){var n,i;const r={type:"text",text:Hl(t.label),x:0,y:0,maxWidth:e.maxWidth,maxHeight:e.maxHeight,tickValue:null!==(n=t.value)&&void 0!==n?n:null===(i=t.data)||void 0===i?void 0:i.value};return"top"===e.align||"bottom"===e.align?(r.x=t.start*e.innerRect.width+(e.innerRect.x-e.outerRect.x)+Wl(e,!1),r.y="top"===e.align?e.innerRect.height:0,r.anchor=e.stepSize?"start":"middle",r.x+=isNaN(e.style.offset)?0:+e.style.offset):(r.y=t.start*e.innerRect.height+(e.innerRect.y-e.outerRect.y)+Wl(e,!0),r.x="left"===e.align?e.innerRect.width:0,r.anchor="left"===e.align?"end":"start",r.baseline=e.stepSize?"text-before-edge":"central",r.y+=isNaN(e.style.offset)?0:+e.style.offset),function(t,e){["fill","fontSize","fontFamily"].forEach((n=>{t[n]=e.style[n]}))}(r,e),function(t,e){if(!e.tilted&&!e.stepSize)if("top"===e.align||"bottom"===e.align){const n=0,i=e.outerRect.width,r=Math.min(e.maxWidth/2,e.textRect.width/2),o=t.x-r,a=t.x+r;o<n?(t.anchor="start",t.x=e.innerRect.x-e.outerRect.x):a>i&&(t.anchor="end",t.x=e.innerRect.width+e.innerRect.x)}else{const n=0,i=e.outerRect.height,r=e.maxHeight/2,o=t.y-r,a=t.y+r;o<n?(t.y=e.innerRect.y-e.outerRect.y,t.baseline="text-before-edge"):a>i&&(t.y=e.innerRect.height+(e.innerRect.y-e.outerRect.y),t.baseline="text-after-edge")}}(r,e),function(t,e){"top"===e.align?t.y-=e.padding:"bottom"===e.align?t.y+=e.padding+e.maxHeight:"left"===e.align?t.x-=e.padding:"right"===e.align&&(t.x+=e.padding)}(r,e),function(t,e){if(e.tilted){const n=-e.angle,i=n*(Math.PI/180);"bottom"===e.align?(t.x-=e.maxHeight*Math.sin(i)/2,t.y-=e.maxHeight,t.y+=e.maxHeight*Math.cos(i)/2):t.x-=e.maxHeight*Math.sin(i)/3,t.transform="rotate(".concat(n,", ").concat(t.x,", ").concat(t.y,")"),t.anchor="bottom"===e.align==e.angle<0?"start":"end";const r=Math.cos(i)*e.maxWidth;if("bottom"===e.align==e.angle<0){const n=e.outerRect.width-e.paddingEnd;t.x+r>n&&(t.maxWidth=(n-t.x-10)/Math.cos(i))}else{const n=e.paddingEnd;t.x-r<n&&(t.maxWidth=(t.x-n-10)/Math.cos(i))}}}(r,e),function(t,e){t.boundingRect=e.textBounds(t)}(r,e),Vl(t,r,e),r}function Yl(t,e){const n={type:"line",x1:0,x2:0,y1:0,y2:0,collider:{type:null},tickValue:t.value};return"top"===e.align||"bottom"===e.align?(n.x1=n.x2=t.position*e.innerRect.width+(e.innerRect.x-e.outerRect.x),n.y1="top"===e.align?e.innerRect.height:0,n.y2="top"===e.align?n.y1-e.tickSize:n.y1+e.tickSize):(n.y1=n.y2=t.position*e.innerRect.height+(e.innerRect.y-e.outerRect.y),n.x1="left"===e.align?e.innerRect.width:0,n.x2="left"===e.align?n.x1-e.tickSize:n.x1+e.tickSize),function(t,e){_(t,e.style)}(n,e),function(t,e){"top"===e.align?(t.y1-=e.padding,t.y2-=e.padding):"bottom"===e.align?(t.y1+=e.padding,t.y2+=e.padding):"left"===e.align?(t.x1-=e.padding,t.x2-=e.padding):"right"===e.align&&(t.x1+=e.padding,t.x2+=e.padding)}(n,e),function(t,e){const n=t.strokeWidth/2;t.x1===e.innerRect.width?(t.x1-=n,t.x2-=n):0===t.x1?(t.x1+=n,t.x2+=n):t.y1===e.innerRect.height?(t.y1-=n,t.y2-=n):0===t.y1&&(t.y1+=n,t.y2+=n)}(n,e),n}function Xl(t){return!t.isMinor&&t.position>=0&&t.position<=1}function Kl(t){let{rect:e,state:n,majorTicks:i,measure:r,horizontal:o}=t;return o?function(t){let{majorTicks:e,measureText:n,rect:i,state:r}=t;const o="layered"===r.labels.activeMode?2:1,a=i.width,s=e.map((t=>t.label)).map((t=>"".concat(t.slice(0,1)).concat(t.length>1?"…":""))).map(n).map((t=>t.width));for(let t=0;t<e.length;++t){const n=e[t];if(o*a*Math.abs(n.start-n.end)<s[t])return!0}return!1}({majorTicks:i,measureText:r,rect:e,state:n}):function(t){let{majorTicks:e,measureText:n,rect:i}=t;const r=i.height,o=n("M").height;return!(e.length<2)&&r*Math.abs(e[0].position-e[1].position)<o}({majorTicks:i,measureText:r,rect:e,state:n})}function Gl(t){let{value:e,maxValue:n,minValue:i,range:r,modifier:o}=t;return isNaN(r)||isNaN(o)||(e=r*o),e>n&&(e=n),e<i&&(e=i),e}function Zl(t){let{isDiscrete:e,rect:n,formatter:i,measureText:r,scale:o,settings:a,state:s}=t,l=0;const c={left:0,top:0,right:0,bottom:0},{maxLengthPx:u,minLengthPx:h}=a.labels;if(a.labels.show){const t=a.align,d="top"===t||"bottom"===t,f=d?n.inner.width:n.inner.height,p=o.ticks({settings:a,distance:f,formatter:i}).filter(Xl),g=t=>{const e=r({text:t,fontSize:a.labels.fontSize,fontFamily:a.labels.fontFamily});return e.width=Gl({value:e.width,maxValue:u,minValue:h}),e};if(e&&d&&"auto"===a.labels.mode&&(!function(t){let{majorTicks:e,measure:n,rect:i,state:r,settings:o}=t;const a=o.labels.maxGlyphCount,s="layered"===r.labels.activeMode?2:1,l=o.labels.tiltThreshold?o.labels.tiltThreshold:.7,c=n("…").width,u=i.width;let h=0,d=0;if(isNaN(a))for(let t=0;t<e.length;t++){const i=e[t],r=i.label,o=n(r).width*(r.length>1?l:1);if(d=s*u*Math.abs(i.start-i.end),o+c>d)return!0}else if(d=s*u*e.reduce(((t,e)=>Math.min(Math.abs(e.start-e.end),t)),1/0),h=n("M").width*l*a,h+c>d)return!0;return!1}({majorTicks:p,measure:g,rect:n.inner,state:s,settings:a})?s.labels.activeMode="horizontal":s.labels.activeMode="tilted"),!a.labels.filterOverlapping&&"tilted"!==s.labels.activeMode&&Kl({rect:n.inner,state:s,majorTicks:p,measure:g,horizontal:d})){return{size:Math.max(n.outer.width,n.outer.height),isToLarge:!0}}let m,y;if("tilted"===s.labels.activeMode){const t=Math.abs(a.labels.tiltAngle)*(Math.PI/180);m=e=>Gl({value:e.width,maxValue:u,minValue:h})*Math.sin(t)+e.height*Math.cos(t)}else m=d?t=>t.height:t=>Gl({value:t.width,maxValue:u,minValue:h});if(d&&"tilted"!==s.labels.activeMode)y=["M"];else if(isNaN(a.labels.maxGlyphCount))y=p.map((t=>t.label));else{let t="";for(let e=0;e<a.labels.maxGlyphCount;e++)t+="M";y=[t]}const v=y.map(g),x=v.map(m),b=Math.max(...x,0);if(l+=b,l+=a.labels.margin,"layered"===s.labels.activeMode&&(l*=2),"tilted"===s.labels.activeMode){const t="bottom"===a.align==a.labels.tiltAngle>=0,e=Math.abs(a.labels.tiltAngle)*(Math.PI/180),i=(b-g("M").height*Math.cos(e))/Math.sin(e),r=t=>Math.min(i,t.width)*Math.cos(e)+t.height,o=(e,i)=>{const r=p[i]?p[i].position:0;return t?e-r*n.inner.width:e-(1-r)*n.inner.width},s=Math.min(a.labels.maxEdgeBleed,Math.max(...v.map(r).map(o),0))+a.paddingEnd;if(c[t?"left":"right"]=s,!a.labels.filterOverlapping&&function(t){let{majorTicks:e,measureText:n,rect:i,bleedSize:r,angle:o}=t;if(e.length<2)return!1;if(0===o)return!0;const a=Math.abs(o),s=1/(Math.min(i.outer.width-r,i.inner.width)*Math.abs(e[0].position-e[1].position));return n("M").height>Math.sin(a*(Math.PI/180))/s}({majorTicks:p,measureText:g,rect:n,bleedSize:s,angle:a.labels.tiltAngle})){return{size:Math.max(n.outer.width,n.outer.height),isToLarge:!0}}}}return{size:l,edgeBleed:c}}const Jl=(t,e,n)=>t.width*Math.abs(e.position-n.position);function Ql(t){let{layered:e,major:n,innerRect:i,outerRect:r,tick:o,index:a}=t;const s=e?2:1,l=n[a-s],c=n[a+s],u=l?Jl(i,o,l)/2-2:1/0,h=c?Jl(i,o,c)/2-2:1/0;return n.length<2?i.width:l?c?2*Math.min(u,h):(t=>{let{innerRect:e,outerRect:n,tick:i,prevWidth:r}=t;const o=e.x-n.x,a=n.width-e.width-o,s=e.width-e.width*i.position+a,l=2*Math.min(r,s),c=1===i.position?e.width/2-2:0;return Math.max(r,l,c)})({innerRect:i,outerRect:r,tick:o,prevWidth:u}):(t=>{let{innerRect:e,outerRect:n,tick:i,nextWidth:r}=t;const o=e.x-n.x,a=e.width*i.position+o,s=2*Math.min(r,a),l=0===i.position?e.width/2-2:0;return Math.max(r,s,l)})({innerRect:i,outerRect:r,tick:o,nextWidth:h})}function tc(t){let e=0;return e+=t.paddingStart,e+=t.line.show?t.line.strokeWidth/2:0,e+=t.ticks.show?t.ticks.margin:0,e}function ec(t){let e=0;return e+=t.ticks.show?t.ticks.tickSize:0,e+=tc(t)+t.labels.margin,e}function nc(t,e){return t.map((t=>Yl(t,e)))}function ic(t,e){return e?Math.abs(e.end-e.start):t.bandwidth()}function rc(t){let{textMetrics:e,settings:n,innerRect:i,scale:r,tilted:o,layered:a,tick:s}=t;const l=e.height,c=ic(r,s),u={width:0,height:l};if("left"===n.align||"right"===n.align)u.width=i.width-ec(n)-n.paddingEnd;else if(a)u.width=c*i.width*2;else if(o){const t=Math.abs(n.labels.tiltAngle)*(Math.PI/180);u.width=(i.height-ec(n)-n.paddingEnd-l*Math.cos(t))/Math.sin(t)}else u.width=c*i.width;return u.width=Gl({value:u.width,maxValue:n.labels.maxLengthPx,minValue:n.labels.minLengthPx}),u}function oc(t){let{textMetrics:e,settings:n,innerRect:i,outerRect:r,tilted:o,layered:a,tick:s,index:l,major:c}=t;const u=e.height,h={width:0,height:u};if("left"===n.align||"right"===n.align)h.width=i.width-ec(n)-n.paddingEnd;else if(o){const t=Math.abs(n.labels.tiltAngle)*(Math.PI/180);h.width=(i.height-ec(n)-n.paddingEnd-u*Math.cos(t))/Math.sin(t)}else h.width=Ql({layered:a,major:c,innerRect:i,outerRect:r,tick:s,index:l});return h.width=Gl({value:h.width,maxValue:n.labels.maxLengthPx,minValue:n.labels.minLengthPx}),h}function ac(t){let e;function n(){return e=oc,n}function i(){return e=rc,i}function r(t){let{settings:n,scale:i,innerRect:r,outerRect:o,measureText:a,ticks:s,state:l,textBounds:c}=t;const u=[],h=function(t){return t.filter((t=>!t.isMinor))}(s),d=function(t){return t.filter((t=>t.isMinor))}(s),f={innerRect:r,align:n.align,outerRect:o},p="tilted"===l.labels.activeMode,g="layered"===l.labels.activeMode;let m;if(n.line.show&&(f.style=n.line,f.padding=n.paddingStart,u.push(Bl(f))),n.ticks.show&&(f.style=n.ticks,f.tickSize=n.ticks.tickSize,f.padding=tc(n),m=nc(h,f)),n.labels.show){const t=ec(n);f.style=n.labels,f.padding=t,f.tilted=p,f.layered=g,f.angle=n.labels.tiltAngle,f.paddingEnd=n.paddingEnd,f.textBounds=c;const l=(t,l)=>{f.textRect=function(t){let{style:e,measureText:n,tick:i}=t;return n({text:i.label,fontSize:e.fontSize,fontFamily:e.fontFamily})}({tick:t,measureText:a,style:f.style});const c=e({textMetrics:f.textRect,settings:n,innerRect:r,outerRect:o,scale:i,tilted:p,layered:g,tick:t,major:h,index:l});f.maxWidth=c.width,f.maxHeight=c.height,f.stepSize=function(t){let{innerRect:e,scale:n,settings:i,tick:r}=t;return("top"===i.align||"bottom"===i.align?e.width:e.height)*ic(n,r)}({innerRect:r,scale:i,ticks:s,settings:n,tick:t})};let d=[];d=!g||"top"!==n.align&&"bottom"!==n.align?function(t,e,n){return t.map(((t,i)=>{n(t,i);const r=Ul(t,e);return r.data=t.data,r}))}(h,f,l):function(t,e,n,i){const r=e.padding,o=ec(n);return t.map(((t,a)=>{i(t,a);const s=o+e.maxHeight+n.labels.margin;e.layer=a%2,e.padding=a%2==0?r:s;const l=Ul(t,e);return l.data=t.data,l}))}(h,f,n,l),n.labels.filterOverlapping&&function(t,e,n){let i=(e,n)=>fs(P(1,t[e].boundingRect),P(1,t[n].boundingRect));if(n&&n.tilted){const e=Math.abs(n.angle);i=(n,i)=>{const r=1/Math.abs(t[n].x-t[i].x),o=Math.sin(e*(Math.PI/180))/r;return t[n].boundingRect.height>o}}for(let n=0;n<=t.length-1;n++)for(let r=n+1;r<=Math.min(n+5,n+(t.length-1));r++)t[n]&&t[r]&&i(n,r)&&(r===t.length-1?(t.splice(n,1),e&&e.splice(n,1)):(t.splice(r,1),e&&e.splice(r,1)),r--,n--)}(d,m,f),u.push(...d)}return n.minorTicks&&n.minorTicks.show&&d.length>0&&(f.style=n.minorTicks,f.tickSize=n.minorTicks.tickSize,f.padding=function(t){return t.line.strokeWidth+t.minorTicks.margin}(n),u.push(...nc(d,f))),m&&u.push(...m),u}return n.build=r,i.build=r,t?i():n()}const sc={labels:{show:!0,tiltAngle:40,tiltThreshold:.7,maxEdgeBleed:1/0,margin:4,maxLengthPx:150,minLengthPx:0,mode:"auto",maxGlyphCount:NaN,align:.5,offset:0,filterOverlapping:!1},ticks:{show:!1,margin:0,tickSize:4},line:{show:!1},paddingStart:0,paddingEnd:10,align:"auto"},lc={labels:{show:!0,margin:4,maxLengthPx:150,minLengthPx:0,align:.5,offset:0,filterOverlapping:!0},ticks:{show:!0,margin:0,tickSize:8},minorTicks:{show:!1,tickSize:3,margin:0},line:{show:!0},paddingStart:0,paddingEnd:10,align:"auto"};const cc={require:["chart","renderer","dockConfig"],defaultSettings:{layout:{displayOrder:0,prioOrder:0},settings:{},style:{labels:"$label",ticks:"$guide-line",minorTicks:"$guide-line--minor",line:"$guide-line"}},created(){this.state={isDiscrete:!!this.scale.bandwidth,isHorizontal:!1,labels:{activeMode:"horizontal"},ticks:[],innerRect:{width:0,height:0,x:0,y:0},outerRect:{width:0,height:0,x:0,y:0},defaultDock:void 0,concreteNodeBuilder:void 0,settings:void 0},this.state.isDiscrete?this.state.defaultDock="bottom":this.state.defaultDock="left",this.setState(this.settings)},setState(){this.state.isDiscrete=!!this.scale.bandwidth,this.state.settings=function(t){let{state:e,style:n,settings:i}=t;const r=_(!0,{},e.isDiscrete?sc:lc,n),o=_(!0,{},r,i.settings),a=i.layout.dock||e.defaultDock;o.dock=a,o.align=function(t,e){const n=["top","bottom"],i=["left","right"];return-1!==n.indexOf(t)&&-1===i.indexOf(e)||-1!==i.indexOf(t)&&-1===n.indexOf(e)?t:e}(i.settings.align,a),o.labels.tiltAngle=Math.max(-90,Math.min(o.labels.tiltAngle,90));const{paddingStart:s,paddingEnd:l}=o;return o.paddingStart="function"==typeof s?s.call(null):s,o.paddingEnd="function"==typeof l?l.call(null):l,o}(this),this.state.concreteNodeBuilder=ac(this.state.isDiscrete),this.dockConfig.dock(this.state.settings.dock),this.state.isHorizontal="top"===this.state.settings.align||"bottom"===this.state.settings.align,this.state.labels.activeMode=function(t,e,n){const i=e.labels.mode;return n&&t.isHorizontal?"auto"===i?t.labels.activeMode:-1!==["layered","tilted"].indexOf(e.labels.mode)&&-1!==["top","bottom"].indexOf(e.dock)?i:"horizontal":"horizontal"}(this.state,this.state.settings,this.state.isDiscrete)},preferredSize(t){const{formatter:e,state:n,scale:i}=this,r=this.state.isHorizontal?t.inner.width:t.inner.height;this.state.pxScale=ga(i,r);return function(t){let{isDiscrete:e,rect:n,formatter:i,measureText:r,scale:o,settings:a,state:s}=t,l=0;const{size:c,edgeBleed:u,isToLarge:h}=Zl({isDiscrete:e,rect:n,formatter:i,measureText:r,scale:o,settings:a,state:s});if(l+=c,h)return{size:l};if(a.ticks.show&&(l+=a.ticks.margin,l+=a.ticks.tickSize),a.minorTicks&&a.minorTicks.show){const t=a.minorTicks.margin+a.minorTicks.tickSize;t>l&&(l=t)}if(a.line.show){const t=a.line.strokeWidth/2;l+=t,u[function(t){switch(t){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left";default:return t}}(a.align)]=Math.ceil(t)}return l+=a.paddingStart,l+=a.paddingEnd,{size:l,edgeBleed:u}}({isDiscrete:this.state.isDiscrete,rect:{inner:t.inner,outer:t.outer},formatter:e,measureText:this.renderer.measureText,scale:this.state.pxScale,settings:this.state.settings,state:n})},beforeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{settings:e}=t;this.setState(e)},resize(t){const{inner:e,outer:n}=t,i=_({},e,function(t){let{align:e,inner:n}=t;return"left"===e?{x:n.width+n.x}:"right"===e||"bottom"===e?n:{y:n.y+n.height}}({align:this.state.settings.align,inner:e})),r=n||i;return _(this.state.innerRect,i),_(this.state.outerRect,r),n},beforeRender(){const{scale:t,formatter:e}=this,n=this.state.isHorizontal?this.state.innerRect.width:this.state.innerRect.height;this.state.pxScale=ga(t,n),this.state.ticks=this.state.pxScale.ticks({distance:n,formatter:e}).filter((t=>t.position>=0&&t.position<=1))},render(){const{state:t}=this,e=[];return e.push(...this.state.concreteNodeBuilder.build({settings:this.state.settings,scale:this.state.pxScale,innerRect:this.state.innerRect,outerRect:this.state.outerRect,measureText:this.renderer.measureText,textBounds:this.renderer.textBounds,ticks:this.state.ticks,state:t})),Al.multiple(e),e}};const uc={render:()=>[]};function hc(t,e,n){let i="";if("function"==typeof t)i=t();else if("string"==typeof t)i=t;else if(n){i=(n.data().fields||[]).map((t=>t.title())).join(e)}return i}function dc(t,e){let n="middle";return"left"===t?"top"===e?n="end":"bottom"===e&&(n="start"):"right"===t?"top"===e?n="start":"bottom"===e&&(n="end"):"left"===e?n="start":"right"===e&&(n="end"),n}const fc={require:["renderer","chart"],defaultSettings:{layout:{dock:"bottom",displayOrder:0,prioOrder:0},settings:{paddingStart:5,paddingEnd:5,paddingLeft:0,paddingRight:0,anchor:"center",join:", ",maxLengthPx:NaN},style:{text:"$title"}},created(){this.definitionSettings=this.settings.settings;const t=this.settings.text,e=this.definitionSettings.join;this.title=hc(t,e,this.scale)},preferredSize(){return this.renderer.measureText({text:this.title,fontSize:this.style.text.fontSize,fontFamily:this.style.text.fontFamily}).height+this.definitionSettings.paddingStart+this.definitionSettings.paddingEnd},render(){const{title:t,definitionSettings:e,rect:n}=this,i=[];return i.push(function(t){let{title:e,definitionSettings:n,dock:i,rect:r,measureText:o,style:a}=t;const s={type:"text",text:e,x:0,y:0,dx:0,dy:0,anchor:dc(i,n.anchor),baseline:"alphabetical",stroke:"transparent",strokeWidth:0,fontWeight:"normal"};_(s,a.text);const l=o(s);if("top"===i||"bottom"===i){let t=r.width/2;"left"===n.anchor?t=n.paddingLeft||0:"right"===n.anchor&&(t=r.width-(n.paddingRight||0)),s.x=t,s.y="top"===i?r.height-n.paddingStart:n.paddingStart+l.height,s.dy="top"===i?-l.height/6:-l.height/3,s.maxWidth=.8*r.width}else{let t=r.height/2;"top"===n.anchor?t=n.paddingStart:"bottom"===n.anchor&&(t=r.height-n.paddingStart),s.y=t,s.x="left"===i?r.width-n.paddingStart:n.paddingStart,s.dx="left"===i?-l.height/3:l.height/3;const e="left"===i?270:90;s.transform="rotate(".concat(e,", ").concat(s.x+s.dx,", ").concat(s.y+s.dy,")"),s.maxWidth=.8*r.height}return isNaN(n.maxLengthPx)||(s.maxWidth=Math.min(s.maxWidth,n.maxLengthPx)),s}({title:t,dock:this.settings.layout.dock,definitionSettings:e,rect:n,measureText:this.renderer.measureText,style:this.style})),i},beforeUpdate(t){t.settings&&(_(this.settings,t.settings),this.definitionSettings=t.settings.settings);const e=this.settings.text,n=this.definitionSettings.join;this.title=hc(e,n,this.scale)}};function pc(t,e){const n=t.settings.layout.dock,i=t.settings.settings.invert,r="top"===n||"bottom"===n,o=r?"width":"height",a=t.rect[o],s=t.chart.scroll(t.settings.scroll);let l;{let t=e[r?"x":"y"];i&&(t=a-t);const n=s.getState();l={startOffset:t,startScroll:n.start,swipe:!1};const o=t/a*(n.max-n.min)+n.min;o<n.start?l.startScroll=o:o>n.start+n.viewSize&&(l.startScroll=o-n.viewSize)}return{update:t=>{let e=t[r?"x":"y"];if(i&&(e=a-e),!l.swipe){if(Math.abs(l.startOffset-e)<=1)return;l.swipe=!0}const n=s.getState(),o=(e-l.startOffset)/a*(n.max-n.min),c=l.startScroll+o;s.moveTo(c)},end:t=>{let e=t[r?"x":"y"];i&&(e=a-e);const n=s.getState();if(l.swipe){const t=(e-l.startOffset)/a*(n.max-n.min),i=l.startScroll+t;s.moveTo(i)}else{const t=e/a*(n.max-n.min)+n.min-n.viewSize/2;s.moveTo(t)}}}}function gc(t,e){const n=e.element().getBoundingClientRect();return{x:t.center.x-n.left,y:t.center.y-n.top}}const mc={require:["chart","renderer"],on:{panStart(t){const e=gc(t,this.renderer),n={x:e.x-t.deltaX,y:e.y-t.deltaY};this.currentMove=pc(this,n),this.currentMove.update(e)},panMove(t){if(!this.currentMove)return;const e=gc(t,this.renderer);this.currentMove.update(e)},panEnd(t){if(!this.currentMove)return;const e=gc(t,this.renderer);this.currentMove.end(e),this.currentMove=null},panCancel(){this.currentMove=null},tap(t){const e=gc(t,this.renderer);pc(this,e).end(e)}},defaultSettings:{settings:{backgroundColor:"#eee",thumbColor:"#ccc",width:16}},preferredSize:function(t){const e=this.chart.scroll(this.settings.scroll).getState();if(e.viewSize>=e.max-e.min){return Math.max(t.width,t.height)}return this.settings.settings.width},render:function(t){const e=this.settings.layout.dock,n=this.settings.settings.invert,i="top"===e||"bottom"===e,r=i?"width":"height",o=this.rect[r],a=this.chart.scroll(this.settings.scroll).getState();let s=o*(a.start-a.min)/(a.max-a.min);const l=o*a.viewSize/(a.max-a.min);return n&&(s=o-s-l),t("div",{style:{position:"relative",width:"100%",height:"100%",background:this.settings.settings.backgroundColor,pointerEvents:"auto"}},[].concat(t("div",{class:"scroller",style:{position:"absolute",[i?"left":"top"]:"".concat(s,"px"),[i?"top":"left"]:"25%",[i?"height":"width"]:"50%",[r]:"".concat(Math.max(1,l),"px"),background:this.settings.settings.thumbColor}})))},renderer:"dom"};function yc(t){let{h:e,isVertical:n,value:i,pos:r,align:o,borderHit:a,state:s,idx:l}=t;const c="end"!==o,u=c?{left:"0",top:"0"}:{right:"0",bottom:"0"};let h=0,d="100%",f="100%";return s.targetRect&&"start"===s.settings.bubbles.align?(d="".concat(s.targetRect.x+s.targetRect.width,"px"),f="".concat(s.targetRect.y+s.targetRect.height,"px")):s.targetRect&&"end"===s.settings.bubbles.align&&(h=n?s.targetRect.x:s.targetRect.y,d="".concat(s.rect.width-h,"px"),f="".concat(s.rect.height-h,"px")),c||(r-=a),e("div",{onmouseover(t){t.srcElement.children[0].style.backgroundColor="#000",t.srcElement.children[0].style[n?"height":"width"]="2px"},onmouseout(t){t.srcElement.children[0].style.backgroundColor=s.style.line.stroke,t.srcElement.children[0].style[n?"height":"width"]="1px"},"data-value":i,"data-key":[s.key,"edge",l].join("-"),style:{cursor:n?"ns-resize":"ew-resize",position:"absolute",left:"".concat(n?h:r,"px"),top:"".concat(n?r:h,"px"),height:n?"".concat(a,"px"):f,width:n?d:"".concat(a,"px"),pointerEvents:"auto"}},[e("div",{style:_({backgroundColor:s.style.line.stroke,position:"absolute",height:n?"".concat(1,"px"):"100%",width:n?"100%":"".concat(1,"px"),pointerEvents:"none"},u)})])}function vc(t){let{h:e,isVertical:n,label:i,otherValue:r,rangeIdx:o,idx:a,pos:s,align:l,state:c,value:u}=t;const h="end"!==l,d="outside"===c.settings.bubbles.placement;let f,p="none";n?(f=h?"left":"right",d&&(p=h?"translate(-100%, 0px)":"translate(100%, 0px)")):(f=h?"top":"bottom",d&&(p=h?"translate(0px, -100%)":"translate(0px, 100%)"));let g=c.edit&&c.edit.rangeIdx===o&&c.edit.bubbleIdx===a;const m={position:"relative",borderRadius:"".concat(c.style.bubble.borderRadius,"px"),border:"".concat(c.style.bubble.strokeWidth,"px solid ").concat(c.style.bubble.stroke),backgroundColor:c.style.bubble.fill,color:c.style.bubble.color,fontFamily:c.style.bubble.fontFamily,fontSize:c.style.bubble.fontSize,padding:"4px 8px",textAlign:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"150px",minWidth:"50px",minHeight:"1em",pointerEvents:"auto",transform:n?"translate(0,-50%)":"translate(-50%,0)",cursor:n?"ns-resize":"ew-resize"};let y=c.style.bubble.stroke;const v=g?e("input",{type:"text",value:u,style:C(C({},m),{},{textAlign:"start",textOverflow:"",fontSize:"13px"}),onkeyup(t){if("Enter"===t.key){t.preventDefault(),t.stopPropagation();const e=parseFloat(t.target.value);isNaN(e)?(y="rgba(230, 78, 78, 0.6)",t.target.style.border="".concat(c.style.bubble.strokeWidth,"px solid ").concat(y)):c.onEditConfirmed(o,e,r)}else"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),c.onEditCanceled())}}):e("div",{"data-key":[c.key,"bubble",o,a].join("-"),"data-other-value":r,"data-idx":o,"data-bidx":a,style:m},[i]);return e("div",{style:{position:"absolute",[f]:"0",[n?"top":"left"]:"".concat(s,"px"),transform:p}},[v])}function xc(t){let{h:e,isVertical:n,top:i,height:r,color:o,on:a,opacity:s}=t;return e("div",_({style:{backgroundColor:o,opacity:s,position:"absolute",left:n?0:"".concat(i,"px"),top:n?"".concat(i,"px"):0,height:n?"".concat(r,"px"):"100%",width:n?"100%":"".concat(r,"px"),pointerEvents:"auto"}},a),[])}function bc(t){let{borderHit:e,els:n,isVertical:i,state:r,vStart:o,vEnd:a,idx:s}=t,l=0;r.targetRect&&(l=i?r.targetRect.y:r.targetRect.x);const c=!!r.scale,u=c?r.scale.norm(o)*r.size:o,h=c?r.scale.norm(a)*r.size:a,d=Math.abs(u-h),f=Math.min(u,h)+l,p=f+d;if(r.targetRect){const t=r.targetFillRect||r.targetRect,e=i?t.height:t.width,s=c?r.scale.norm(o)*e:o,l=c?r.scale.norm(a)*e:a,u=Math.abs(s-l),h=Math.min(s,l),d={h:r.h,isVertical:i,top:h,height:u,color:r.style.target.fill,opacity:r.style.target.opacity};r.style.target.opacity<.8&&(d.on={onmouseover(t){t.srcElement.style.opacity=r.style.target.opacity+.1},onmouseout(t){t.srcElement.style.opacity=r.style.target.opacity}}),n.push(r.h("div",{style:{position:"absolute",left:"".concat(t.x,"px"),top:"".concat(t.y,"px"),height:"".concat(t.height,"px"),width:"".concat(t.width,"px")}},[xc(d)]))}const g=u<h?o:a,m=u<h?a:o,[y,v]=c?r.scale.domain():[Math.min(o,a),Math.max(o,a)],x=g+1e-5>=y&&g-1e-5<=v,b=m-1e-5<=v&&m+1e-5>=y;x&&n.push(yc({h:r.h,isVertical:i,borderHit:e,value:g,pos:f,align:"start",state:r,idx:s})),b&&n.push(yc({h:r.h,isVertical:i,borderHit:e,value:m,pos:p,align:"end",state:r,idx:s}));const w=r.settings.bubbles;if(w&&w.show){const t={fontSize:w.fontSize,fontFamily:w.fontFamily,color:w.fill},e=[o,a];x&&n.push(vc({h:r.h,isVertical:i,align:w.align,style:t,rangeIdx:s,idx:0,otherValue:m,value:g,label:"".concat(r.format(g,e)),pos:f,state:r})),b&&n.push(vc({h:r.h,isVertical:i,align:w.align,style:t,rangeIdx:s,idx:1,otherValue:g,value:m,label:"".concat(r.format(m,e)),pos:p,state:r}))}}function wc(t){const e=t.active.limitHigh-t.active.end,n=t.active.limitLow-t.active.start;let i=t.current-t.start;return i=i<0?Math.max(i,n):Math.min(i,e),i}function kc(t){let e=[];const n=0===t.direction;if(Array.isArray(t.ranges)&&t.ranges.forEach(((i,r)=>{t.active&&r===t.active.idx||bc({borderHit:5,els:e,isVertical:n,state:t,vStart:Math.min(i.min,i.max),vEnd:Math.max(i.min,i.max),idx:r})})),t.active){let i=t.start,r=t.current;if(-1!==t.active.idx)if("foo"===t.active.mode)i=Math.min(t.active.start,t.active.end),r=Math.max(t.active.start,t.active.end);else if("modify"===t.active.mode)i=Math.min(t.start,t.current),r=Math.max(t.start,t.current);else{const e=wc(t);i=t.active.start+e,r=t.active.end+e}bc({borderHit:5,els:e,isVertical:n,state:t,vStart:i,vEnd:r,idx:t.active.idx})}return e}function _c(t){return{min:t.scale.min(),max:t.scale.max()}}function Mc(t){return{min:0,max:t.direction?t.rect.width:t.rect.height}}function Sc(t,e,n){let i,r,o=t.ranges,a=-1;for(i=0;i<o.length;i++){if(o[i].min<=e&&e<=o[i].max){a=i,n.min=i?o[i-1].max:n.min,n.max=i+1<o.length?o[i+1].min:n.max;break}if(e<o[i].min){n.max=o[i].min,n.min=i?o[i-1].max:n.min;break}}-1===a&&o.length&&i>=o.length&&(n.min=o[o.length-1].max),-1!==a&&(r={idx:a,start:o[a].min,end:o[a].max,limitLow:n.min,limitHigh:n.max,mode:"foo"}),t.active=r}function Cc(t){t.renderer.render(kc(t))}function qc(t,e){if(!e||!e.isActive())return[];const n=t.scale.data(),i=(n&&n.fields||[]).map((t=>t.id())),r=e.brushes().filter((t=>"range"===t.type&&-1!==i.indexOf(t.id)))[0];return r?r.brush.ranges():[]}function Nc(t,e){let n,i=1/0;const r=e.domain(),o=e.bandwidth()/2;for(let a=0;a<r.length;++a){const s=Math.abs(t-o-e(r[a]));s<i&&(i=s,n=r[a])}return n}function Rc(t,e){return Math.min(...t)<=Math.max(...e)&&Math.max(...t)>=Math.min(...e)}function Ac(t){return I(t.reduce(((t,e)=>(t.push(...E(e.bounds)),t)),[]))}const Oc={require:["chart","settings","renderer"],defaultSettings:{settings:{bubbles:{show:!0,align:"start"}},style:{bubble:"$label-overlay",line:"$shape-guide--inverted",target:"$selection-area-target"}},renderer:"dom",on:{rangeStart(t){this.start(t)},rangeMove(t){this.move(t)},rangeEnd(t){this.end(t)},rangeClear(t){this.clear(t)},bubbleStart(t){this.bubbleStart(t)}},created(){this.state={key:this.settings.key||"brush-range"}},beforeRender(t){this.state.rect=t.size.computedInner},renderRanges(){this.state.started||(this.state.ranges=qc(this.state,this.state.brushInstance),this.state.active=null,Cc(this.state))},render(t){const e=this.settings.settings;this.state.direction="vertical"===e.direction?0:1;const n=this.renderer.element().getBoundingClientRect(),i=this.state.rect[0===this.state.direction?"height":"width"];let r=ga(this.chart.scale(e.scale),i);const o=function(t){const e={targetRect:null,targetFillRect:null,scale:null,size:null},n=t.settings.settings,i=n.target&&(n.target.components||(n.target.component?[n.target.component]:[])).map((e=>t.chart.component(e))).filter((t=>!!t&&!!t.rect)),r=n.target&&n.target.selector?t.chart.findShapes(n.target.selector):[],o=n.target&&n.target.fillSelector?t.chart.findShapes(n.target.fillSelector):[];if(r.length>0){const i=Ac(r);if(e.size=i[0===t.state.direction?"height":"width"],e.scale=ga(t.chart.scale(n.scale),e.size),e.targetRect=i,o.length>0){const t=Ac(o);e.targetFillRect=t}}else if(i&&i.length>0){const n=i.slice(1).reduce(((t,e)=>({x0:Math.min(t.x0,e.rect.computedInner.x),y0:Math.min(t.y0,e.rect.computedInner.y),x1:Math.max(t.x1,e.rect.computedInner.x+e.rect.computedInner.width),y1:Math.max(t.y1,e.rect.computedInner.y+e.rect.computedInner.height)})),{x0:i[0].rect.computedInner.x,y0:i[0].rect.computedInner.y,x1:i[0].rect.computedInner.x+i[0].rect.computedInner.width,y1:i[0].rect.computedInner.y+i[0].rect.computedInner.height});e.targetRect={x:n.x0-t.state.rect.x,y:n.y0-t.state.rect.y,width:n.x1-n.x0,height:n.y1-n.y0}}return e}(this);if(r=o.scale?o.scale:r,this.state.targetRect=o.targetRect,this.state.targetFillRect=o.targetFillRect,this.state.size=null===o.size?i:o.size,this.state.settings=e,this.state.style=this.style,this.state.offset=n,this.state.brush="object"==typeof e.brush?e.brush.context:e.brush,this.state.brushInstance=this.chart.brush(this.state.brush),this.state.renderer=this.renderer,this.state.multi=!!e.multiple,this.state.h=t,this.state.onEditConfirmed=(t,e,n)=>{this.state.edit=null,function(t,e,n,i){let r=t.ranges.map((t=>({min:t.min,max:t.max})));const o=t.scale.min(),a=t.scale.max();r[e]={min:Math.max(o,Math.min(n,i)),max:Math.min(a,Math.max(n,i))},t.ranges[e]=C({},r[e]);const s=t.scale.data();s&&s.fields&&s.fields.forEach((e=>{t.fauxBrushInstance||t.brushInstance.setRange(e.id(),r)}))}(this.state,t,e,n),this.emit("bubbleEnd"),Cc(this.state)},this.state.onEditCanceled=()=>{this.state.edit=null,Cc(this.state)},this.state.cssCoord={offset:0===this.state.direction?"top":"left",coord:0===this.state.direction?"y":"x",pos:0===this.state.direction?"deltaY":"deltaX"},this.state.format="function"==typeof e.bubbles.label&&((t,n)=>e.bubbles.label.call(void 0,{datum:t,data:n,scale:r,resources:{scale:this.chart.scale,formatter:this.chart.formatter}})),{}.hasOwnProperty.call(r,"norm")){this.state.editable=!0,this.state.observeBrush="object"==typeof e.brush&&e.brush.observe,this.state.fauxBrushInstance=null,this.state.findValues=null,this.state.scale=r;const t=this.state.scale.data();!this.state.format&&t&&t.fields&&t.fields[0]&&(this.state.format=t.fields[0].formatter())}else this.state.editable=!1,this.state.scale=lo(),this.state.scale.data=r.data,this.state.format||(this.state.format=(t,e)=>Rc(r.range(),e)?function(t,e){const n=e.ticks(),i=e.domain().indexOf(Nc(t,e));return-1!==i?n[i].label:"-"}(t,r):"-"),this.state.fauxBrushInstance=oa(),this.state.findValues=t=>function(t,e){const n=e.domain(),i=e.range(),r=[];return t.forEach((t=>{if(!Rc(i,[t.min,t.max]))return;const o=n.indexOf(Nc(t.min,e)),a=n.indexOf(Nc(t.max,e));r.push.apply(r,n.slice(Math.min(o,a),Math.max(o,a)+1))})),r}(t,r);return this.state.ranges=qc(this.state,this.state.brushInstance),this.state.observeBrush||this.state.sourcedFromThisComponent?[kc(this.state)]:[]},mounted(){this.state.observeBrush&&this.state.brushInstance&&this.state.brushInstance.on("update",this.renderRanges)},beforeDestroy(){this.state.observeBrush&&this.state.brushInstance&&this.state.brushInstance.removeListener("update",this.renderRanges)},start(t){!function(t){let{state:e,e:n,renderer:i,ranges:r,targetSize:o}=t;if(e.started)return;e.edit=null;const a=n.center.x-n.deltaX,s=n.center.y-n.deltaY;let l=document.elementFromPoint(a,s);i.element().contains(l)||(l=null);const c={started:!0};e.offset=_({},i.element().getBoundingClientRect());const u=a-e.offset.left,h=s-e.offset.top;e.offset.left+=e.targetRect?e.targetRect.x:0,e.offset.top+=e.targetRect?e.targetRect.y:0,e.ranges=r(e,e.fauxBrushInstance||e.brushInstance);const d=n.center[e.cssCoord.coord]-n[e.cssCoord.pos]-e.offset[e.cssCoord.offset],f=n.center[e.cssCoord.coord]-e.offset[e.cssCoord.offset];c.current=e.scale.normInvert(f/e.size),c.start=e.scale.normInvert(d/e.size);let p=e.ranges;const g=_c(e);let m,y,v=-1;if(l&&l.hasAttribute("data-idx"))v=parseInt(l.getAttribute("data-idx"),10),g.min=v>0?p[v-1].max:g.min,g.max=v+1<p.length?p[v+1].min:g.max;else{for(m=0;m<p.length;m++){if(p[m].min<=c.start&&c.start<=p[m].max){v=m,g.min=m?p[m-1].max:g.min,g.max=m+1<p.length?p[m+1].min:g.max;break}if(c.start<p[m].min){g.max=p[m].min,g.min=m?p[m-1].max:g.min;break}}-1===v&&p.length&&m>=p.length&&(g.min=p[p.length-1].max)}if(-1!==v||e.multi||(c.ranges=[],g.min=e.scale.min(),g.max=e.scale.max()),-1!==v)if(y={idx:v,start:p[v].min,end:p[v].max,limitLow:g.min,limitHigh:g.max,mode:"move"},l&&l.hasAttribute("data-other-value"))c.start=parseFloat(l.getAttribute("data-other-value")),y.mode="modify";else{let t=e.scale.norm(y.start)*e.size,n=e.scale.norm(y.end)*e.size;Math.abs(d-t)<=o?(c.start=y.end,y.mode="modify"):Math.abs(d-n)<=o&&(c.start=y.start,y.mode="modify")}else y={idx:-1,start:c.start,end:c.current,limitLow:g.min,limitHigh:g.max,mode:"current"};c.active=y,"modify"!==y.mode&&e.targetRect&&!gs(e.targetRect,{x:u,y:h})||Object.keys(c).forEach((t=>e[t]=c[t]))}({e:t,state:this.state,renderer:this.renderer,ranges:qc,targetSize:5})},end(){this.state.started&&(!function(t,e){t.started=!1,t.ranges=e(t,t.fauxBrushInstance||t.brushInstance);const n=_c(t);Sc(t,t.current,n)}(this.state,qc),Cc(this.state),this.state.sourcedFromThisComponent=!0,this.state.active=null)},move(t){this.state.started&&(!function(t,e){const n=(e.center[t.cssCoord.coord]-t.offset[t.cssCoord.offset])/t.size,i=t.scale.normInvert(n);t.current=Math.max(Math.min(i,t.active.limitHigh),t.active.limitLow)}(this.state,t),function(t){let e=t.ranges.map((t=>({min:t.min,max:t.max})));if(-1!==t.active.idx)if("modify"===t.active.mode)e[t.active.idx].min=Math.min(t.start,t.current),e[t.active.idx].max=Math.max(t.start,t.current);else{const n=wc(t);e[t.active.idx].min+=n,e[t.active.idx].max+=n}else e.push({min:Math.min(t.start,t.current),max:Math.max(t.start,t.current)});const n=t.scale.data();n&&n.fields&&n.fields.forEach((n=>{if(t.fauxBrushInstance){let i=qc(t,t.fauxBrushInstance),r=t.findValues(i),o=t.findValues(e),a=o.filter((t=>-1===r.indexOf(t))),s=r.filter((t=>-1===o.indexOf(t))),l=a.map((t=>({key:n.id(),value:t}))),c=s.map((t=>({key:n.id(),value:t})));t.brushInstance.addAndRemoveValues(l,c),t.fauxBrushInstance.setRange(n.id(),e)}else t.brushInstance.setRange(n.id(),e)}))}(this.state),Cc(this.state))},clear(){this.state.fauxBrushInstance&&this.state.fauxBrushInstance.clear(),this.state.renderer.render([]),this.state.started=!1,this.state.active=null,this.state.sourcedFromThisComponent=!1},bubbleStart(t){if(!this.state.editable)return;const e=t.srcEvent||t,n=e.target,i={rangeIdx:parseInt(n.getAttribute("data-idx"),10),bubbleIdx:parseInt(n.getAttribute("data-bidx"),10)};if(isNaN(i.rangeIdx)||JSON.stringify(i)===JSON.stringify(this.state.edit))return;this.state.edit=i,e.stopPropagation(),e.stopImmediatePropagation(),e.preventDefault();const r=n.parentNode;Cc(this.state);const o=r.querySelector("input");o.focus(),o.select()}};function Dc(t){t.renderer.render(kc(t))}function Ec(t){return t.rc.ranges()}function Ic(t,e){const n={x:t.direction?e.min+t.rect.x:t.rect.x,y:t.direction?t.rect.y:e.min+t.rect.y,width:t.direction?e.max-e.min:t.rect.width+t.rect.x,height:t.direction?t.rect.height+t.rect.y:e.max-e.min};return t.chart.shapesAt(n,t.settings.brush)}const Tc={require:["chart","settings","renderer"],defaultSettings:{settings:{bubbles:{show:!0,align:"start"}},style:{bubble:"$label-overlay",line:"$shape-guide--inverted",target:"$selection-area-target"}},renderer:"dom",on:{areaStart(t){this.start(t)},areaMove(t){this.move(t)},areaEnd(t){this.end(t)},areaClear(t){this.clear(t)}},created(){this.state={key:this.settings.key||"brush-area-dir"}},render(t){this.state.rect=this.rect;const e=this.settings.settings,n="vertical"===e.direction?0:1,i=this.state.rect[0===n?"height":"width"],r=this.renderer.element().getBoundingClientRect(),o=(e.target?e.target.components||[e.target.component]:[]).map((t=>this.chart.component(t))).filter((t=>!!t&&!!t.rect)),a=o[0]?o.slice(1).reduce(((t,e)=>({x0:Math.min(t.x0,e.rect.x),y0:Math.min(t.y0,e.rect.y),x1:Math.max(t.x1,e.rect.x+e.rect.width),y1:Math.max(t.y1,e.rect.y+e.rect.height)})),{x0:o[0].rect.x,y0:o[0].rect.y,x1:o[0].rect.x+o[0].rect.width,y1:o[0].rect.y+o[0].rect.height}):null;return this.state.targetRect=a?{x:a.x0-this.rect.x,y:a.y0-this.rect.y,width:a.x1-a.x0,height:a.y1-a.y0}:null,this.state.style=this.style,this.state.chart=this.chart,this.state.direction=n,this.state.settings=e,this.state.offset=r,this.state.rc=Wo(),this.state.renderer=this.renderer,this.state.multi=!!e.multiple,this.state.h=t,this.state.size=i,this.state.cssCoord={offset:0===this.state.direction?"top":"left",coord:0===this.state.direction?"y":"x",pos:0===this.state.direction?"deltaY":"deltaX",area:0===this.state.direction?"height":"width"},this.state.format=function(t,e){return function(t,e,n){const i=Math.min(...n),r=Math.max(...n),o={x:t.direction?i+t.rect.x:t.rect.x,y:t.direction?t.rect.y:i+t.rect.y,width:t.direction?r-i:t.rect.width+t.rect.x,height:t.direction?t.rect.height+t.rect.y:r-i},a=t.chart.shapesAt(o,t.settings.brush);if(0===a.length)return"-";const s=a.reduce(((n,r)=>{const o=n.bounds,a=r.bounds;return e===i?o[t.cssCoord.coord]<=a[t.cssCoord.coord]?n:r:o[t.cssCoord.coord]+o[t.cssCoord.area]>=a[t.cssCoord.coord]+a[t.cssCoord.area]?n:r})),l=t.settings.brush.components.reduce(((t,e)=>t.key===s.key?t:e));return"function"==typeof t.settings.bubbles.label?t.settings.bubbles.label(s.data):Array.isArray(l.data)&&l.data.length?s.data[l.data[0]].label:s.data&&s.data.label?s.data.label:"-"}(this,t,e)},[]},start(t){!function(t){let{state:e,e:n,renderer:i,ranges:r,targetSize:o}=t;if(e.started)return;const a=n.center.x-n.deltaX,s=n.center.y-n.deltaY;let l=document.elementFromPoint(a,s);i.element().contains(l)||(l=null);const c={started:!0};e.offset=i.element().getBoundingClientRect(),e.ranges=r(e);const u=a-e.offset.left,h=s-e.offset.top,d=n.center[e.cssCoord.coord]-n[e.cssCoord.pos]-e.offset[e.cssCoord.offset],f=n.center[e.cssCoord.coord]-e.offset[e.cssCoord.offset];let p=f,g=d;c.start=d,c.current=f;let m=e.ranges;const y=Mc(e);let v,x,b=-1;if(l&&l.hasAttribute("data-idx"))b=parseInt(l.getAttribute("data-idx"),10),y.min=b>0?m[b-1].max:y.min,y.max=b+1<m.length?m[b+1].min:y.max;else{for(v=0;v<m.length;v++){if(m[v].min<=g&&g<=m[v].max){b=v,y.min=v?m[v-1].max:y.min,y.max=v+1<m.length?m[v+1].min:y.max;break}if(g<m[v].min){y.max=m[v].min,y.min=v?m[v-1].max:y.min;break}}-1===b&&m.length&&v>=m.length&&(y.min=m[m.length-1].max)}if(-1!==b||e.multi||(c.ranges=[],y.min=0,y.max=e.direction?e.rect.width:e.rect.height),-1!==b)if(x={idx:b,start:m[b].min,end:m[b].max,limitLow:y.min,limitHigh:y.max,mode:"move"},l&&l.hasAttribute("data-other-value"))c.start=parseFloat(l.getAttribute("data-other-value")),x.mode="modify";else{let t=x.start,e=x.end;Math.abs(d-t)<=o?(c.start=x.end,x.mode="modify"):Math.abs(d-e)<=o&&(c.start=x.start,x.mode="modify")}else x={idx:-1,start:g,end:p,limitLow:y.min,limitHigh:y.max,mode:"current"};c.active=x,"modify"!==x.mode&&e.targetRect&&!gs(e.targetRect,{x:u,y:h})||Object.keys(c).forEach((t=>e[t]=c[t]))}({e:t,state:this.state,renderer:this.renderer,ranges:Ec,targetSize:5})},end(){this.state.started&&(!function(t,e){t.started=!1,t.ranges=e(t);const n=Mc(t);Sc(t,t.current,n)}(this.state,Ec),Dc(this.state))},move(t){this.state.started&&(!function(t,e){const n=e.center[t.cssCoord.coord]-t.offset[t.cssCoord.offset];t.current=Math.max(Math.min(n,t.active.limitHigh),t.active.limitLow)}(this.state,t),function(t){const e=t.ranges.map((t=>({min:t.min,max:t.max})));if(-1!==t.active.idx)if("modify"===t.active.mode)e[t.active.idx].min=Math.min(t.start,t.current),e[t.active.idx].max=Math.max(t.start,t.current);else{const n=wc(t);e[t.active.idx].min=t.active.start+n,e[t.active.idx].max=t.active.end+n}else e.push({min:Math.min(t.start,t.current),max:Math.max(t.start,t.current)});t.rc.set(e);let n=[];e.forEach((e=>{n=[...n,...Ic(t,e)]})),function(t,e){t.chart.brushFromShapes(e,t.settings.brush)}(t,n)}(this.state),Dc(this.state))},clear(){this.state.rc&&this.state.rc.clear(),this.state.renderer.render([])}};function jc(t){const e="vertical"===t.direction,n=t.rect[e?"height":"width"],i=t.rect[e?"width":"height"];return function(t){const e=t.brush;if(!e||!e.isActive())return[];const n=t.scale.data(),i=(n&&n.fields||[]).map((t=>t.id())),r=e.brushes().filter((t=>"range"===t.type&&-1!==i.indexOf(t.id)))[0];return r?r.brush.ranges():[]}(t).map((r=>{const o=t.scale(r.min)*n,a=t.scale(r.max)*n,s=Math.min(o,a),l=Math.abs(o-a);return{type:"rect",fill:t.fill,opacity:t.opacity,x:e?0:s,width:e?i:l,y:e?s:0,height:e?l:i}}))}function Pc(t,e,n,i){function r(){!function(t){t.renderer.render(jc(t))}(t)}function o(){!function(t){t.renderer.render(jc(t))}(t)}function a(){!function(t){t.renderer.render(jc(t))}(t)}t.brush=e,e&&(e.on("start",r),e.on("update",o),e.on("end",a),t.start=r,t.update=o,t.end=a,t.brush=e,t.scale=n,t.renderer=i)}function zc(t){t.brush&&(t.brush.removeListener("start",t.start),t.brush.removeListener("update",t.update),t.brush.removeListener("end",t.end)),t.start=void 0,t.update=void 0,t.end=void 0,t.brush=void 0,t.scale=void 0,t.renderer=void 0}const Fc={require:["chart","settings","renderer"],defaultSettings:{settings:{}},preferredSize:()=>50,created(){this.state={}},render(){const t=this.settings.settings,e=this.chart.brush(t.brush),n=t.direction||"horizontal",i="horizontal"===n?this.rect.width:this.rect.height,r=ga(this.chart.scale(t.scale),i);return zc(this.state),Pc(this.state,e,r,this.renderer),this.state.rect=this.rect,this.state.fill=t.fill||"#ccc",this.state.opacity=void 0!==t.opacity?t.opacity:1,this.state.direction=n,jc(this.state)},beforeDestroy(){zc(this.state)}};function Lc(t,e){const n=e.center.x,i=e.center.y;return{x:n-t.left,y:i-t.top}}function $c(t,e,n){return ja(t,e.points[0])<n.settings.snapIndicator.threshold**2}function Bc(t,e){null==t.path.d?t.path.d="M".concat(e.x," ").concat(e.y," "):t.path.d+="L".concat(e.x," ").concat(e.y," "),t.points.push(e)}function Hc(t){let{state:e,start:n=null,end:i=null}=t;null!==n&&(e.snapIndicator.x1=n.x,e.snapIndicator.y1=n.y),null!==i&&(e.snapIndicator.x2=i.x,e.snapIndicator.y2=i.y)}function Vc(t,e){t.snapIndicator.visible=e}const Wc={require:["chart","renderer","settings"],defaultSettings:{layout:{displayOrder:0},settings:{brush:{components:[]},snapIndicator:{threshold:75,strokeDasharray:"5, 5",stroke:"black",strokeWidth:2,opacity:.5},lasso:{fill:"transparent",stroke:"black",strokeWidth:2,opacity:.7,strokeDasharray:"20, 10"},startPoint:{r:10,fill:"green",stroke:"black",strokeWidth:1,opacity:1}}},on:{lassoStart(t){this.start(t)},lassoEnd(t){this.end(t)},lassoMove(t){this.move(t)},lassoCancel(){this.cancel()}},created(){this.state={points:[],active:!1,path:null,snapIndicator:null,startPoint:null,rendererBounds:null,componentDelta:null,brushConfig:null,lineBrushShape:{x1:0,y1:0,x2:0,y2:0}}},start(t){var e;this.state.active=!0,this.state.path={visible:!0,type:"path",d:null,fill:(e=this.settings.settings.lasso).fill,stroke:e.stroke,strokeWidth:e.strokeWidth,opacity:e.opacity,strokeDasharray:e.strokeDasharray,collider:{type:null}},this.state.snapIndicator=function(t){return{visible:!1,type:"line",x1:0,y1:0,x2:0,y2:0,strokeDasharray:t.strokeDasharray,stroke:t.stroke,strokeWidth:t.strokeWidth,opacity:t.opacity,collider:{type:null}}}(this.settings.settings.snapIndicator),this.state.startPoint=function(t){return{visible:!0,type:"circle",cx:0,cy:0,r:t.r,fill:t.fill,opacity:t.opacity,stroke:t.stroke,strokeWidth:t.strokeWidth,collider:{type:null}}}(this.settings.settings.startPoint),this.state.rendererBounds=this.renderer.element().getBoundingClientRect(),this.state.componentDelta=function(t,e){const n=t.element.getBoundingClientRect();return{x:e.left-n.left,y:e.top-n.top}}(this.chart,this.state.rendererBounds),this.state.brushConfig=function(t){return t.settings.brush.components.map((t=>({key:t.key,contexts:t.contexts||["lassoBrush"],data:t.data||[""],action:t.action||"add"})))}(this.settings);const n=Lc(this.state.rendererBounds,t);Bc(this.state,n),Hc({state:this.state,start:n}),function(t,e){t.startPoint.cx=e.x,t.startPoint.cy=e.y}(this.state,n)},move(t){if(!this.state.active)return;const e=Lc(this.state.rendererBounds,t);$c(e,this.state,this.settings)?Vc(this.state,!0):Vc(this.state,!1),Bc(this.state,e),Hc({state:this.state,end:e}),function(t,e){const n=[t.startPoint,t.path,t.snapIndicator].filter((t=>t.visible));e.render(n)}(this.state,this.renderer),function(t,e){if(t.active){const n=t.points[t.points.length-2],i=t.points[t.points.length-1];t.lineBrushShape.x1=n.x+t.componentDelta.x,t.lineBrushShape.y1=n.y+t.componentDelta.y,t.lineBrushShape.x2=i.x+t.componentDelta.x,t.lineBrushShape.y2=i.y+t.componentDelta.y;const r=e.shapesAt(t.lineBrushShape,{components:t.brushConfig});e.brushFromShapes(r,{components:t.brushConfig})}}(this.state,this.chart)},end(t){if(!this.state.active)return;Vc(this.state,!1);$c(Lc(this.state.rendererBounds,t),this.state,this.settings)&&function(t,e){if(t.active){const n=t.componentDelta.x,i=t.componentDelta.y,r=t.points.map((t=>({x:t.x+n,y:t.y+i}))),o=e.shapesAt({vertices:r},{components:t.brushConfig});e.brushFromShapes(o,{components:t.brushConfig})}}(this.state,this.chart),this.state={points:[],active:!1,path:null,snapIndicator:null,startPoint:null,rendererBounds:null,componentDelta:null,brushConfig:null,lineBrushShape:{x1:0,y1:0,x2:0,y2:0}},this.renderer.render([])},cancel(){var t,e;this.state.active&&(t=this.state,e=this.chart,t.brushConfig.forEach((t=>{t.contexts.forEach((t=>{e.brush(t).end()}))})),this.state={points:[],active:!1,path:null,snapIndicator:null,startPoint:null,rendererBounds:null,componentDelta:null,brushConfig:null,lineBrushShape:{x1:0,y1:0,x2:0,y2:0}},this.renderer.render([]))},render(){}};function Uc(t,e,n,i,r){let o,a=0,s=e.length-1;for(;a<s;){let l=Math.floor((a+s)/2);o=r(e[l]),o[n]+o[i]<t[n]?a=l+1:s=l}return a}function Yc(t){let{orientation:e,targetNodes:n,labels:i,container:r}=t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Uc;const a=[],s="v"===e?"x":"y",l="v"===e?"width":"height",c=t=>t.textBounds,u=t=>t.node.localBounds;return(t,e)=>{const{textBounds:h,node:d}=i[e];if(h[s]<r[s]||h[s]+h[l]>r[s]+r[l])return!1;for(let t=o(h,a,s,l,c);t<a.length;t++)if(fs(h,a[t].textBounds))return!1;const f=o(h,n,s,l,u),p=h[s]+h[l];for(let t=f;t<n.length;t++){const e=n[t].node;if(p<e.localBounds[s])break;if(fs(h,e.localBounds)&&d!==e)return!1}return a.push(i[e]),!0}}const Xc=4;function Kc(t,e){return{node:t,data:t.data,scale:e.scale,formatter:e.formatter,dataset:e.dataset}}function Gc(t){const e=typeof t;return("string"===e||"number"===e)&&""!==t}function Zc(t){return C(C({type:"rect",rx:2,ry:2,fill:t.backgroundColor},t.backgroundBounds),{},{data:"".concat(t.data," ").concat(t.text),rotation:t.transform&&t.transform.match(/rotate/gi)?"rotated":"horizontal"})}function Jc(t,e,n){return n?t.width>=e.height:t.width>=e.width}function Qc(t,e,n){return n?t.height>=e.width:t.height>=e.height}function tu(t,e,n,i,r){let o,a;return"v"===t?(o=i||r||Jc(e,n,!0),a=Qc(e,n,!i)):(o=Jc(e,n),a=r||Qc(e,n,!1)),o&&a}function eu(t,e,n,i){return t+.5*e+(i-.5)*(e-n)-.5*n}function nu(t,e,n){const i={type:"text",text:e,maxWidth:n.rotate?t.height:t.width,x:0,y:t.y,dx:0,dy:0,fill:n.fill,anchor:n.rotate?"end":"start",baseline:"central",fontSize:"".concat(n.fontSize,"px"),fontFamily:n.fontFamily},r=n.textMetrics;if(!n.overflow&&!function(t,e,n){return Jc(t,e,n.rotate)&&Qc(t,e,n.rotate)}(t,r,n))return!1;const o=.5*r.height;return n.rotate?(i.x=eu(t.x,t.width,r.height,n.align)+o,i.y=eu(t.y,t.height,r.width,n.justify),i.transform="rotate(-90, ".concat(i.x+i.dx,", ").concat(i.y+i.dy,")")):(i.x=eu(t.x,t.width,r.width,n.align),i.y=eu(t.y,t.height,r.height,n.justify)+o),i}function iu(t){let{bar:e,view:n,direction:i,position:r,padding:o=Xc}=t;const a={};if(_(a,e),r&&"inside"!==r)if("up"===i||"down"===i){const t=Math.max(0,Math.min(e.y,n.height)),o=Math.max(0,Math.min(e.y+e.height,n.height));"outside"===r&&"up"===i||"opposite"===r&&"down"===i?(a.y=0,a.height=t):("outside"===r&&"down"===i||"opposite"===r&&"up"===i)&&(a.y=o,a.height=n.height-o)}else{const t=Math.max(0,Math.min(e.x,n.width)),o=Math.max(0,Math.min(e.x+e.width,n.width));"outside"===r&&"left"===i||"opposite"===r&&"right"===i?(a.x=0,a.width=t):("outside"===r&&"right"===i||"opposite"===r&&"left"===i)&&(a.x=o,a.width=n.width-o)}else;return function(t,e){const n=Math.max(0,Math.min(t.y,e.height)),i=Math.max(0,Math.min(t.y+t.height,e.height)),r=Math.max(0,Math.min(t.x,e.width)),o=Math.max(0,Math.min(t.x+t.width,e.width));t.x=r,t.width=o-r,t.y=n,t.height=i-n}(a,n),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{top:n=Xc,bottom:i=Xc,left:r=Xc,right:o=Xc}=e;t.x+=r,t.width-=r+o,t.y+=n,t.height-=n+i}(a,o),a}function ru(t){let e,n,i,r,o,{direction:a,fitsHorizontally:s,measured:l,node:c,orientation:u,placementSettings:h,rect:d}=t,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:iu;const p=[],g="h"===u?"width":"height";for(o=0;o<h.length;o++)if(i=h[o],r=f({bar:c.localBounds,view:d,direction:a,position:i.position,padding:i.padding}),p.push(r),e=!o||r[g]>e[g]?r:e,tu(u,r,l,s,i.overflow)){n=r;break}return n||(n=e,o=p.indexOf(n)),i=h[o],{bounds:n,placement:i}}function ou(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const{top:o=Xc,bottom:a=Xc,left:s=Xc,right:l=Xc}=r,c=t.x+t.dx,u=t.y+t.dy,h=n?Math.min(e.width,i.height):Math.min(e.height,i.width),d=n?Math.min(e.height,i.height):Math.min(e.width,i.width),f=.5*e.height,p=1e-9,g=n?c-f:c,m=n?u:u-f,y={x:g-s-p,y:m-o-p,width:d+(s+l)-p,height:h+(o+a)-p};return y}function au(t){let{chart:e,targetNodes:n,rect:i,fitsHorizontally:r,collectiveOrientation:o}=t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ru,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:nu,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Yc;const c=[],u={container:i,targetNodes:n,labels:[],orientation:o};let h,d,f,p,g,m,y,v,x,b,w,k,_,M;for(let t=0,l=n.length;t<l;t++){m=null,d=n[t],f=d.node,_=Kc(f,e),x=d.direction,M="left"===x||"right"===x?"h":"v";for(let e=0;e<d.texts.length;e++){if(p=d.texts[e],!Gc(p))continue;b=d.labelSettings[e],v=d.measurements[e],k=b.placements;const n=a({direction:x,fitsHorizontally:r,lblStngs:b,measured:v,node:f,orientation:M,placements:k,placementSettings:d.placementSettings[e],rect:i});if(m=n.bounds,w=n.placement,m&&w){g=w.justify;const e="function"==typeof b.linkData?b.linkData(_,t):void 0,n="function"==typeof w.overflow?w.overflow(_,t):w.overflow;"up"===x&&(g=1-g),"opposite"===w.position&&(g=1-g),"left"===x&&(g=1-g);const i=!("h"===o||r);if(h=s(m,p,{justify:"h"===M?w.align:g,align:"h"===M?g:w.align,fontSize:b.fontSize,fontFamily:b.fontFamily,textMetrics:v,rotate:i,overflow:!!n}),h){const n=ou(h,v,i,m,w.padding);y="function"==typeof w.fill?w.fill(C(C({},_),{},{textBounds:n}),t):w.fill,h.fill=y,void 0!==e&&(h.data=e),"object"==typeof w.background&&(h.backgroundColor="function"==typeof w.background.fill?w.background.fill(C(C({},_),{},{textBounds:n}),t):w.background.fill,void 0!==h.backgroundColor&&(h.backgroundBounds=ou(h,v,i,m,w.background.padding))),c.push(h),u.labels.push({node:f,textBounds:n})}}}}const S=c.filter(l(u)),q=S.filter((t=>void 0!==t.backgroundBounds)).map(Zc);return[...q,...S]}function su(t){let{nodes:e,rect:n,chart:i,labelSettings:r,placementSettings:o,settings:a,renderer:s}=t;const l={},c=[];let u,h,d,f,p,g,m,y=!0,v=!1;for(let t=0;t<e.length;t++){if(h=e[t],f=h.localBounds,!fs(f,n))continue;let x=Kc(h,i);u={node:h,texts:[],measurements:[],labelSettings:[],placementSettings:[]};for(let e=0;e<r.length;e++)g=r[e],d="function"==typeof g.label?g.label(x,t):void 0,Gc(d)&&(m="function"==typeof a.direction?a.direction(x,t):a.direction||"up",v=v||"left"===m||"right"===m,l.fontFamily=g.fontFamily,l.fontSize="".concat(g.fontSize,"px"),l.text=d,p=s.measureText(l),u.measurements.push(p),u.texts.push(d),u.labelSettings.push(g),u.placementSettings.push(o[e]),u.direction=m,y=y&&p.width<=f.width-2*Xc);c.push(u)}return{targetNodes:c,fitsHorizontally:y,hasHorizontalDirection:v}}function lu(t){let{orientation:e="auto",defaultOrientation:n="h"}=t;switch(e.toLocaleLowerCase()){case"vertical":return"v";case"horizontal":return"h";default:return n}}function cu(t){const e=2*Math.PI;return(t%e+e)%e}function uu(t,e){t.x+=e,t.width-=2*e,t.y+=e,t.height-=2*e}function hu(t){return{x:t.x,y:t.y-t.height/2,width:t.width,height:t.height}}function du(t,e,n){let{x:i,y:r}=e;if(i*i+r*r>t*t)return null;let o=Math.sin(n),a=Math.cos(n),s=i*a-r*o,l=t*t-s*s;if(l<0)return null;let c=Math.sqrt(l);return{x:s*a+o*c,y:-s*o+a*c}}function fu(t){let e,n,{radius:i,size:r,angle:o}=t,{width:a,height:s}=r,l={x:a/2,y:s/2};switch(Math.floor(o/(Math.PI/2))){case 0:if(e=du(i,l,o),!e)return null;e.y*=-1,n={x:-a,y:0};break;case 1:if(e=du(i,l,Math.PI-o),!e)return null;n={x:-a,y:-s};break;case 2:if(e=du(i,l,o-Math.PI),!e)return null;e.x*=-1,n={x:0,y:-s};break;case 3:if(e=du(i,l,2*Math.PI-o),!e)return null;e.x*=-1,e.y*=-1,n={x:0,y:0};break;default:throw new Error("invalid angle")}return{x:e.x+n.x,y:e.y+n.y,width:a,height:s}}function pu(t){let{slice:e,measured:n,padding:i}=t,{start:r,end:o,innerRadius:a,outerRadius:s}=e,l=s-a-2*i,c=o-r;if(c<Math.PI){let t=(n.height/2+i)/Math.tan(c/2);t>a&&(l=s-t-2*i)}if(l<0||l<n.minReqWidth)return null;const u=cu((r+o)/2);let h=s-i,d={x:Math.sin(u)*h,y:-Math.cos(u)*h,width:l,height:n.height};return u<Math.PI?(d.angle=u-Math.PI/2,d.anchor="end"):(d.angle=u+Math.PI/2,d.anchor="start"),d}function gu(t){let{context:e,node:n,bounds:i}=t;let{start:r,end:o}=n.desc.slice;const a=cu((r+o)/2);switch(Math.floor(a/(Math.PI/2))){case 0:e.q1maxY=i.y-2,void 0===e.q2minY&&(e.q2minY=i.y+i.height+2);break;case 1:e.q2minY=i.y+i.height+2;break;case 2:e.q3minY=i.y+i.height+2;break;case 3:e.q4maxY=i.y-2,void 0===e.q3minY&&(e.q3minY=i.y+i.height+2)}}function mu(t,e){return{node:t,data:t.data,scale:e.scale,formatter:e.formatter,dataset:e.dataset}}function yu(t,e,n){const i={type:"text",text:e,maxWidth:t.width,x:t.x,y:t.y+("top"===t.baseline?t.height/2:0),fill:n.fill,anchor:t.anchor||"start",baseline:"middle",fontSize:"".concat(n.fontSize,"px"),fontFamily:n.fontFamily};if(!isNaN(t.angle)){let e=t.angle*(360/(2*Math.PI));i.transform="rotate(".concat(e,", ").concat(i.x,", ").concat(i.y,")")}return i}function vu(t){let e,n,{slice:i,direction:r,position:o,padding:a,measured:s,view:l,context:c,store:u}=t,{start:h,end:d,innerRadius:f,offset:p}=i;switch(o){case"into":e="rotate"===r?pu({slice:i,measured:s,padding:a}):function(t){let{slice:e,padding:n,measured:i}=t,{start:r,end:o,innerRadius:a,outerRadius:s}=e;const l=cu((r+o)/2);let c=fu({radius:s,size:{width:i.width+2*n+1,height:i.height+2*n},angle:l});return c?(c.baseline="top",ms(c,{x1:0,y1:0,x2:Math.sin(r)*s,y2:-Math.cos(r)*s})||ms(c,{x1:0,y1:0,x2:Math.sin(o)*s,y2:-Math.cos(o)*s})||ss({cx:0,cy:0,r:a},c)?null:(uu(c,n),c)):null}({slice:i,measured:s,padding:a});break;case"inside":n={start:h,end:d,innerRadius:0,outerRadius:f},e="rotate"===r?pu({slice:n,measured:s,padding:a}):function(t){let{slice:e,padding:n,measured:i,store:r}=t;const{start:o,end:a,outerRadius:s}=e,l=cu((o+a)/2);let c=fu({radius:s,size:{width:i.width+2*n+1,height:i.height+2*n},angle:l});return c?(c.baseline="top",uu(c,n),r.insideLabelBounds.some((t=>fs(t,c)))?null:(r.insideLabelBounds.push({x:c.x-4,y:c.y,width:c.width+8,height:c.height}),c)):null}({slice:n,measured:s,padding:a,store:u});break;case"outside":e="rotate"===r?function(t){let{slice:e,measured:n,padding:i,view:r}=t,{start:o,end:a,outerRadius:s,offset:l}=e,c=s+i,u=a-o;if(u<Math.PI&&(n.height/2+i)/Math.tan(u/2)>c)return null;const h=cu((o+a)/2);let d=Math.sin(h)*c,f=-Math.cos(h)*c,p=n.width+1,g=h%Math.PI;if(g>Math.PI/2&&(g=Math.PI-g),Math.cos(g)>.001){let t=f<0?r.y:r.y+r.height,e=Math.abs(t-l.y)/Math.cos(g)-Math.tan(g)*(n.height/2)-2*i-s;e<p&&(p=e)}if(Math.sin(g)>.001){let t=d<0?r.x:r.x+r.width,e=Math.abs(t-l.x)/Math.sin(g)-n.height/2/Math.tan(g)-2*i-s;e<p&&(p=e)}if(p<=0||p<n.minReqWidth)return null;let m={x:d,y:f,width:p,height:n.height};return h<Math.PI?(m.angle=h-Math.PI/2,m.anchor="start"):(m.angle=h+Math.PI/2,m.anchor="end"),m}({slice:i,measured:s,padding:a,view:l}):function(t){let{slice:e,measured:n,padding:i,view:r,context:o}=t,{start:a,end:s,outerRadius:l,offset:c}=e;const u=cu((a+s)/2);if(function(t,e,n){switch(e){case 0:return t.q1maxY<0;case 1:return t.q2minY>n.height;case 2:return t.q3minY>n.height;case 3:return t.q4maxY<0;default:return!0}}(o,Math.floor(u/(Math.PI/2)),r))return null;let h=l+i+n.height/2,d=Math.sin(u)*h,f=-Math.cos(u)*h,p=n.width+1;if(u<Math.PI){let t=Math.abs(r.x+r.width-(d+c.x));t<p&&(p=t)}else{let t=Math.abs(r.x-(d+c.x));t<p&&(p=t)}if(p<n.minReqWidth)return null;let g={x:d,y:f,width:p,height:n.height};return u<Math.PI?g.anchor="start":g.anchor="end",g}({slice:i,measured:s,padding:a,view:l,context:c});break;default:throw new Error("not implemented")}return e&&(e.x+=p.x,e.y+=p.y,"outside"===o&&"rotate"!==r&&function(t,e,n){const{start:i,end:r,offset:o,outerRadius:a}=n,s=cu((i+r)/2);switch(Math.floor(s/(Math.PI/2))){case 0:if(void 0!==e.q1maxY){let n=Math.min(t.y,e.q1maxY-t.height),i=t.y-n;if(t.y=n,i>1){let e=a+2;t.line={type:"line",x1:t.x-2,y1:t.y+2,x2:o.x+Math.sin(s)*e,y2:o.y-Math.cos(s)*e,strokeWidth:1}}}break;case 1:if(void 0!==e.q2minY){let n=Math.max(t.y,e.q2minY),i=n-t.y;if(t.y=n,i>1){let e=a+2;t.line={type:"line",x1:t.x-2,y1:t.y-2,x2:o.x+Math.sin(s)*e,y2:o.y-Math.cos(s)*e,strokeWidth:1}}}break;case 2:if(void 0!==e.q3minY){let n=Math.max(t.y,e.q3minY),i=n-t.y;if(t.y=n,i>1){let e=a+2;t.line={type:"line",x1:t.x+2,y1:t.y-2,x2:o.x+Math.sin(s)*e,y2:o.y-Math.cos(s)*e,strokeWidth:1}}}break;case 3:if(void 0!==e.q4maxY){let n=Math.min(t.y,e.q4maxY-t.height),i=t.y-n;if(t.y=n,i>1){let e=a+2;t.line={type:"line",x1:t.x+2,y1:t.y+2,x2:o.x+Math.sin(s)*e,y2:o.y-Math.cos(s)*e,strokeWidth:1}}}}}(e,c,i)),e}function xu(t){let{context:e,direction:n,measured:i,node:r,placementSettings:o,rect:a,store:s}=t,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vu;for(let t=0;t<o.length;t++){let c=o[t],u=l({context:e,slice:r.desc.slice,view:a,direction:n,position:c.position,measured:i,padding:c.padding,store:s});if(u)return{bounds:u,placement:c}}return{bounds:null,placement:null}}function bu(t){const e=[],n=[],i=[],r=[];for(let o=0;o<t.length;++o){const{start:a,end:s}=t[o].desc.slice,l=cu((a+s)/2);switch(Math.floor(l/(Math.PI/2))){case 0:e.push(t[o]);break;case 1:n.push(t[o]);break;case 2:i.push(t[o]);break;case 3:r.push(t[o])}}const o=(t,e)=>cu((t.desc.slice.start+t.desc.slice.end)/2)-cu((e.desc.slice.start+e.desc.slice.end)/2),a=(t,e)=>o(e,t);return e.sort(a),n.sort(o),i.sort(a),r.sort(o),e.concat(n,r,i)}function wu(t,e,n){const i=e.fontFamily,r="".concat(e.fontSize,"px"),o=n.measureText({text:t,fontFamily:i,fontSize:r});return o.minReqWidth=Math.min(o.width,n.measureText({text:"".concat(t[0],"…"),fontFamily:i,fontSize:r}).width),o}const ku=/\n+|\r+|\r\n/,_u=/\s/,Mu=/[a-zA-Z\u00C0-\u00F6\u00F8-\u00FF\u00AD]/;function Su(t){return"string"==typeof t?-1!==t.search(ku):-1!==String(t).search(ku)}function Cu(t){return-1!==t.search(_u)}function qu(t){return-1!==t.search(Mu)}function Nu(t,e,n,i,r){return i.some((i=>i(t,e,n)))?1:r.some((i=>i(t,e,n)))?0:2}function Ru(t){""===t[0]&&t.shift(),""===t[t.length-1]&&t.pop()}function Au(t,e,n){return Math.max(e,Math.min(n,t))}function Ou(){let{string:t,separator:e="",reverse:n=!1,measureText:i=(t=>({width:t.length,height:1})),mandatoryBreakIdentifiers:r=[Su],noBreakAllowedIdentifiers:o=[],suppressIdentifier:a=[Cu,Su,t=>""===t],hyphenationIdentifiers:s=[qu]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const l=String(t).split(e);Ru(l);const c=l.length,u=n?t=>t>=0:t=>t<c;let h=n?c:-1;function d(t){const e=Au(t,0,c-1),n=l[e],u=i(n),h=Nu(n,e,l,r,o);return{index:e,value:n,breakOpportunity:h,suppress:a.some((t=>t(n,e,l))),hyphenation:s.some((t=>t(n,e,l))),width:u.width,height:u.height,done:!1}}function f(t){return isNaN(t)?n?h--:h++:h=Au(t,0,c-1),u(h)?d(h):{done:!0}}return{next:f,peek:d,length:c}}const Du="…",Eu=/^\s*\d+(\.\d+)?px\s*$/i;function Iu(t){return"string"===typeof t&&Eu.test(t)}function Tu(t){const e=t["font-size"]||t.fontSize;return Iu(e)?parseFloat(e)*Math.max(isNaN(t.lineHeight)?1.2:t.lineHeight,0):19.2}function ju(t){const e=t.maxHeight,n=Math.max(t.maxLines,1)||1/0;if(isNaN(e))return n;const i=Tu(t);return Math.max(1,Math.min(Math.floor(e/i),n))}function Pu(t,e){return{lines:[],line:"",width:0,maxLines:ju(t),maxWidth:t.maxWidth,hyphens:{enabled:"auto"===t.hyphens,char:"‐",metrics:e("‐")}}}function zu(t){t.lines.push(t.line),t.line="",t.width=0}function Fu(t,e){t.line+=e.value,t.width+=e.width}function Lu(t,e,n){if(e.width>t.maxWidth)return e;const i=e.index;for(let r=1;r<5;r++){const o=n.peek(e.index-1);if(!e.hyphenation||!o.hyphenation||0===e.index)return e;if(t.width+t.hyphens.metrics.width<=t.maxWidth)return t.line+=t.hyphens.char,e;if(1===t.line.length)return e;e=n.next(i-r),t.line=t.line.slice(0,-1),t.width-=e.width}return e}function $u(t,e,n){const i=Ou({string:e.value,measureText:n});for(;t.lines.length<t.maxLines;){let e=i.next();if(e.done)break;t.width+e.width>t.maxWidth&&2===e.breakOpportunity&&t.line.length>0?(e=t.hyphens.enabled?Lu(t,e,i):e,zu(t),Fu(t,e)):Fu(t,e)}}function Bu(t,e){const n=Ou({string:t.text,separator:"",measureText:e,noBreakAllowedIdentifiers:[(t,e)=>0===e]}),i=Pu(t,e);let r=!0;for(;i.lines.length<i.maxLines;){let t=n.next();if(t.done){zu(i),r=!1;break}1===t.breakOpportunity?zu(i):i.width+t.width>i.maxWidth&&2===t.breakOpportunity?t.suppress?i.width+=t.width:(t=i.hyphens.enabled?Lu(i,t,n):t,zu(i),Fu(i,t)):Fu(i,t)}return{lines:i.lines,reduced:r}}function Hu(t,e){const n=Ou({string:t.text,separator:/(\s|-|\u2010)/,measureText:e}),i=Pu(t,e);let r=!0;for(;i.lines.length<i.maxLines;){let t=n.next();if(t.done){zu(i),r=!1;break}1===t.breakOpportunity?zu(i):i.width+t.width>i.maxWidth&&2===t.breakOpportunity?t.suppress?zu(i):t.width>i.maxWidth?$u(i,t,e):(zu(i),Fu(i,t)):Fu(i,t)}return{lines:i.lines,reduced:r}}function Vu(t){return{"break-all":Bu,"break-word":Hu}[t.wordBreak]}function Wu(t){return e=>{const n=e.node;if(function(t){return"text"===t.type&&!t._lineBreak}(n)){const i=Vu(n);if(!i)return;const r=t(n);if(r.width>n.maxWidth||Su(n.text)){const o=(Tu(n)-r.height)/2,a=i(n,function(t,e){return n=>e({text:n,fontSize:t.fontSize,fontFamily:t.fontFamily})}(n,t));e.node=function(t,e,n,i){const r={type:"container",children:[]};void 0!==e.id&&(r.id=e.id);let o=0;return t.lines.forEach(((a,s)=>{const l=_({},e);l.text=a,l._lineBreak=!0,o+=n,t.reduced&&s===t.lines.length-1?l.text+=Du:delete l.maxWidth,l.dy=isNaN(l.dy)?o:l.dy+o,o+=i,o+=n,r.children.push(l)})),r}(a,n,o,r.height)}}}}function Uu(t,e){let{text:n,"font-size":i,"font-family":r,maxWidth:o}=t;if(n="string"==typeof n?n:"".concat(n),void 0===o)return n;let a=e({text:n,fontSize:i,fontFamily:r}).width;if(a<=o)return n;let s=0,l=n.length-1;for(;s<=l;){let t=Math.floor((s+l)/2);a=e({text:n.substr(0,t)+Du,fontSize:i,fontFamily:r}).width,a<=o?s=t+1:l=t-1}return n.substr(0,l)+Du}function Yu(t){const e=t.baseline||t["dominant-baseline"];let n=0;const i=parseInt(t.fontSize||t["font-size"],10)||0;switch(e){case"hanging":n=.75*i;break;case"text-before-edge":n=.85*i;break;case"middle":n=.25*i;break;case"central":n=.35*i;break;case"mathemetical":n=i/2;break;case"text-after-edge":case"ideographic":n=.2*-i;break;default:n=0}return n}const Xu={},Ku={},Gu={fontSize:void 0,fontFamily:void 0};let Zu;function Ju(t,e,n){const i=t+e+n;return"number"!=typeof Ku[i]&&(Zu=Zu||document.createElement("canvas").getContext("2d"),function(t,e){Gu.fontSize===t&&Gu.fontFamily===e||(Zu.font=t+" "+e,Gu.fontSize=t,Gu.fontFamily=e)}(e,n),Ku[i]=Zu.measureText(t).width),Ku[i]}function Qu(t){return"number"!=typeof Xu[t]&&(Xu[t]=function(t){if(Iu(t)){const e=parseFloat(t);return e+4*Math.ceil((e+1e-12)/24)}return 16}(t)),Xu[t]}function th(t){let{text:e,fontSize:n,fontFamily:i}=t;return{width:Ju(e,n,i),height:Qu(n)}}function eh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:th;const n=t["font-size"]||t.fontSize,i=t["font-family"]||t.fontFamily,r=e({text:t.text,fontFamily:i,fontSize:n}),o=Math.min(t.maxWidth||r.width,r.width),a=t.x||0,s=t.y||0,l=t.dx||0,c=(t.dy||0)+Yu(t),u={x:0,y:s+c-.75*r.height,width:o,height:r.height},h=t["text-anchor"]||t.anchor;return u.x="middle"===h?a+l-o/2:"end"===h?a+l-o:a+l,u}function nh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:th;const n=Vu(t),i=t["font-size"]||t.fontSize,r=t["font-family"]||t.fontFamily,o=e({text:t.text,fontFamily:r,fontSize:i});if(n&&(o.width>t.maxWidth||Su(t.text))){const o=n(t,(t=>e({text:t,fontFamily:r,fontSize:i}))),a=_({},t);let s=0,l="";for(let t=0,n=o.lines.length;t<n;t++){let a=o.lines[t];a+=t===n-1&&o.reduced?Du:"";const c=e({text:a,fontSize:i,fontFamily:r}).width;c>=s&&(s=c,l=a)}a.text=l;const c=eh(a,e);return c.height=Tu(t)*o.lines.length,c}return eh(t,e)}const ih=.9;function rh(t,e){return{node:t,data:t.data,scale:e.scale,formatter:e.formatter,dataset:e.dataset}}function oh(t,e,n){const i={type:"text",text:e,maxWidth:t.width,x:0,y:t.y,dx:0,dy:0,fill:n.fill,anchor:"start",baseline:"alphabetical",fontSize:"".concat(n.fontSize,"px"),fontFamily:n.fontFamily},r=n.textMetrics;if(t.width<n.fontSize)return!1;const o=Math.max(0,t.width-r.width);return i.x=t.x+n.align*o,i.y=t.y+r.height/1.2,i}function ah(t){let{cx:e,cy:n,r:i}=t;return{type:"circle",bounds:{cx:e,cy:n,r:i}}}function sh(t){return t.desc&&t.desc.slice?function(t){let{start:e,end:n,innerRadius:i,outerRadius:r,offset:o}=t;if(Math.abs(e+2*Math.PI-n)>1e-12)return{type:null,bounds:null};let a=0!==i?i:r;return ah({cx:o.x,cy:o.y,r:a})}(t.desc.slice):"circle"===t.type?ah(t.attrs):"rect"===t.type?{type:"rect",bounds:t.bounds}:{type:null,bounds:null}}var lh={bar:function(t){let{settings:e,chart:n,nodes:i,rect:r,renderer:o,style:a}=t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:au;const l=_({fontSize:12,fontFamily:"Arial",align:.5,justify:0,fill:"#333"},a.label);l.fontSize=parseInt(l.fontSize,10);const c=e.labels.map((t=>_({},l,e,t))),u=e.labels.map((t=>t.placements.map((n=>_({},l,e,t,n))))),{fitsHorizontally:h,hasHorizontalDirection:d,targetNodes:f}=su({nodes:i,chart:n,renderer:o,settings:e,rect:r,labelSettings:c,placementSettings:u}),p=lu({orientation:e.orientation,defaultOrientation:d?"h":"v"}),g="h"===p?"y":"x",m="h"===p?"height":"width";return f.sort(((t,e)=>t.node.localBounds[g]+t.node.localBounds[m]-(e.node.localBounds[g]+e.node.localBounds[m]))),s({chart:n,targetNodes:f,stngs:e,rect:r,fitsHorizontally:h,collectiveOrientation:p})},slice:function(t){let{settings:e,chart:n,nodes:i,rect:r,renderer:o,style:a}=t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xu,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:yu;const c=_({fontSize:12,fontFamily:"Arial",fill:"#333",padding:4,position:"into"},a.label);c.fontSize=parseInt(c.fontSize,10);const u=e.labels.map((t=>_({},c,e,t))),h=e.labels.map((t=>t.placements.map((n=>_({},c,e,t,n))))),d=[],f={insideLabelBounds:[]};i=bu(i);const p={};for(let t=0,e=i.length;t<e;t++){const e=i[t],a=mu(e,n);for(let n=0;n<u.length;n++){const i=u[n],c="function"==typeof i.label?i.label(a,t):"";if(!c)continue;const g="function"==typeof i.direction?i.direction(a,t):i.direction||"horizontal",m="function"==typeof i.linkData?i.linkData(a,t):void 0,y=wu(c,i,o),v=s({context:p,direction:g,lblStngs:i,measured:y,node:e,placementSettings:h[n],rect:r,store:f}),x=v.bounds,b=v.placement;if(x&&b){if("outside"===b.position&&"rotate"!==g){gu({context:p,node:e,bounds:x});if(!Qa(hu(x),r))continue}const n="function"==typeof b.fill?b.fill(a,t):b.fill,o=l(x,c,{fill:n,fontSize:i.fontSize,fontFamily:i.fontFamily,textMetrics:y});o&&(void 0!==m&&(o.data=m),d.push(o),x.line&&(x.line.stroke=n,d.push(x.line)))}}}return d},rows:function(t){let{settings:e,chart:n,nodes:i,renderer:r,style:o}=t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oh;const s=_({fontSize:12,fontFamily:"Arial",fill:"#333",padding:4,align:.5,justify:.5},o.label);s.fontSize=parseInt(s.fontSize,10);const l=_({},s,e),c=e.labels.map((t=>_({},l,t))),u={},h=[];for(let t=0,e=i.length;t<e;t++){let e=i[t],o=rh(e,n),{type:s,bounds:d}=sh(e);if(!d)continue;let f,p=0,g=[],m=[],y="circle"===s?2*d.r*ih:d.height;for(p+=l.padding,f=0;f<c.length;f++){let e=c[f],n="function"==typeof e.label?e.label(o,t):"";u.fontFamily=e.fontFamily,u.fontSize="".concat(e.fontSize,"px"),u.text=n;let i=r.measureText(u);if(p+=i.height+e.padding,p>y)break;m.push(n),g.push(i)}const v=f,x=Math.max(0,y-p);let b;for(b="circle"===s?d.cy-d.r*ih:d.y,b+=l.justify*x+l.padding,f=0;f<v;f++){let e,n=c[f];if("circle"===s){let t=Math.max(Math.abs(b-d.cy),Math.abs(b+g[f].height-d.cy)),n=Math.sqrt(d.r*d.r-t*t);e={x:d.cx-n+l.padding,y:b,width:2*n-2*l.padding,height:g[f].height}}else e={x:d.x+l.padding,y:b,width:d.width-2*l.padding,height:g[f].height};b+=g[f].height+l.padding;let i="function"==typeof n.fill?n.fill(o,t):n.fill;const u="function"==typeof n.linkData?n.linkData(o,t):void 0;let p=a(e,m[f],{fill:i,align:n.align,fontSize:n.fontSize,fontFamily:n.fontFamily,textMetrics:g[f]});if(p){if(p.text&&p.text!==Du){const t=Uu(p,r.measureText);if(Du===t)continue;p.ellipsed=t}void 0!==u&&(p.data=u),h.push(p)}}}return h}};const ch={require:["chart","renderer","settings"],defaultSettings:{settings:{},style:{label:"$label"}},render(){const t=this.settings.settings,e=[];return(t.sources||[]).forEach((t=>{t.strategy&&lh[t.strategy.type]&&t.component&&e.push(...function(t,e){let{chart:n,source:i,rect:r,renderer:o,style:a}=t;if(!n.component(i.component))return[];const s=n.findShapes(i.selector).filter((t=>t.key===i.component));return e({chart:n,settings:i.strategy.settings,nodes:s,rect:{x:0,y:0,width:r.width,height:r.height},renderer:o,style:a})}({chart:this.chart,rect:this.rect,renderer:this.renderer,source:t,style:this.style},lh[t.strategy.type]))})),e}};const uh={layout:{size:1,direction:"ltr",scrollOffset:0},item:{show:!0,justify:.5,align:.5,label:{fontSize:"12px",fontFamily:"Arial",fill:"#595959",wordBreak:"none",maxLines:2,maxWidth:136,lineHeight:1.2},shape:{type:"square",size:12}},title:{show:!0,text:void 0,anchor:"start",fontSize:"16px",fontFamily:"Arial",fill:"#595959",wordBreak:"none",maxLines:2,maxWidth:156,lineHeight:1.25},navigation:{button:{class:void 0,content:void 0,tabIndex:void 0},disabled:!1}};function hh(t){let{x:e=0,y:n,item:i,globalMetrics:r,createSymbol:o,direction:a="ltr"}=t,s=i.label.displayObject,l=i.label.bounds,c=i.symbol.meta;const u="rtl"===a;let h={x:u?e+r.maxLabelBounds.width:e+r.maxSymbolSize+r.spacing,y:n,width:r.maxLabelBounds.width,height:Math.max(r.maxSymbolSize,r.maxLabelBounds.height)},d=function(t,e,n){const i=Math.max(0,t.width-e),r=Math.max(0,t.height-e);return{x:t.x+e/2+n.align*i,y:t.y+e/2+n.justify*r}}({x:u?e+r.maxLabelBounds.width+r.spacing:e,y:n,width:r.maxSymbolSize,height:h.height},c.size,{align:void 0===c.align?.5:c.align,justify:void 0===c.justify?.5:c.justify});const f=o(_({},c,d));return delete f.collider,s.anchor=u?"end":"start",function(t,e,n){const i=n.textMetrics;if(t.height<i.height)return!1;const r=Math.max(0,t.width-i.width);e.baseline="text-before-edge";const o=Math.max(0,t.height-i.height);e.x=t.x+n.align*r,e.y=t.y+n.justify*o+.175*parseInt(e.fontSize,10)}(h,s,{textMetrics:l,fontSize:parseInt(s.fontSize,10),align:0,justify:.5}),{item:{type:"container",data:i.label.displayObject.data,children:[f,s],collider:{type:"rect",x:e,y:n,width:r.maxItemBounds.width,height:r.maxItemBounds.height}},metrics:h}}function dh(t,e){const n=t.items.length,i=Math.ceil(n/e),r="horizontal"===t.layout.orientation?"width":"height",o="width"===r?"horizontal":"vertical";return t.globalMetrics.maxItemBounds[r]*i+(i-1)*t.layout.margin[o]}function fh(t,e){let n,i,r,o,{onScroll:a=(()=>{})}=e,s=null,l=0;const c={itemize:e=>{n=function(t,e){let n,i,{resolved:r,dock:o}=t,a=[],s=r.items.items,l=r.symbols.items,c=r.labels.items,u=0,h=0,d=0;for(let t=0;t<s.length;t++){if(!1===s[t].show)continue;const r=void 0!==c[t].text?c[t].text:c[t].data.label||"";n=_({},c[t],{type:"text",fontSize:"".concat(parseInt(c[t].fontSize,10),"px"),text:r,title:r}),i={symbol:{meta:l[t]},label:{displayObject:n,bounds:e.textBounds(n)}},a.push(i),u=Math.max(l[t].size,u),h=Math.max(i.label.bounds.width,h),d=Math.max(i.label.bounds.height,d)}return{items:a,globalMetrics:{spacing:8,maxSymbolSize:u,maxItemBounds:{height:Math.max(u,d),width:u+8+h},maxLabelBounds:{width:h,height:d}},layout:{margin:{vertical:void 0!==r.layout.item.vertical?r.layout.item.vertical:4,horizontal:void 0!==r.layout.item.horizontal?r.layout.item.horizontal:4},mode:r.layout.item.mode,size:r.layout.item.size,orientation:"top"===o||"bottom"===o?"horizontal":"vertical",direction:r.layout.item.direction,scrollOffset:r.layout.item.scrollOffset}}}(e,t.renderer),s=isNaN(n.layout.scrollOffset)?s:n.layout.scrollOffset},getItemsToRender:e=>{r=e.viewRect,l=c.getContentOverflow(r);const a=c.extent();s=Math.max(0,Math.min(s,l)),o=_({},r);const u="horizontal"===c.orientation()?"x":"y";return o[u]-=s,o["x"===u?"width":"height"]=a,function(t,e,n){let{viewRect:i}=t,{itemized:r,create:o=hh,parallels:a,createSymbol:s}=n;const l=r.layout.direction,c=r.globalMetrics,u=r.items,h="horizontal"===r.layout.orientation;let d=0;const f=[],p=c.maxItemBounds.height,g=c.maxItemBounds.width,m=r.layout.margin.vertical+p,y=r.layout.margin.horizontal+g;let v=e.x,x=e.y,b=i.x-e.x;for(let t=0;t<u.length;t++){let n=o({y:x,x:"rtl"===l?i.x+b+i.width-g-(v-e.x):v,item:u[t],globalMetrics:c,direction:l,createSymbol:s});if((h&&v>=i.x-g||!h&&x>=i.y-p)&&f.push(n.item),d++,d>=a?(d=0,h?(v+=y,x=e.y):(x+=m,v=e.x)):h?x+=m:v+=y,!h&&x>i.y+i.height)break;if(h&&v>i.x+i.width)break}return f}(e,o,{itemized:n,parallels:i,createSymbol:t.symbol})},parallelize:(t,e)=>(i=function(t,e,n){const i=n.items.length,r="horizontal"===n.layout.orientation?"width":"height",o="width"===r?"horizontal":"vertical",a=n.globalMetrics.maxItemBounds[r]*i+(i-1)*n.layout.margin[o];let s=Math.ceil(a/t);if(null!=e){const t="horizontal"===n.layout.orientation?"height":"width",i="width"===t?"horizontal":"vertical",r=n.layout.margin[i]||4,o=Math.floor((e+r)/(r+n.globalMetrics.maxItemBounds[t]));s=Math.min(s,o)}const l=isNaN(n.layout.size)?1:n.layout.size;return Math.max(1,Math.min(s,l))}(t,e,n),i),hasContentOverflow:()=>{const t="horizontal"===n.layout.orientation?"width":"height";return dh(n,i)>r[t]},getContentOverflow:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r;const e="horizontal"===n.layout.orientation?"width":"height";return Math.max(0,dh(n,i)-t[e])},getNextSize:()=>{const t="horizontal"===n.layout.orientation?"width":"height",e="width"===t?"horizontal":"vertical";return n.globalMetrics.maxItemBounds[t]+n.layout.margin[e]},getPrevSize:()=>{const t="horizontal"===n.layout.orientation?"width":"height",e="width"===t?"horizontal":"vertical";return n.globalMetrics.maxItemBounds[t]+n.layout.margin[e]},hasNext:()=>"horizontal"===c.orientation()?r.x+r.width<o.x+o.width:r.y+r.height<o.y+o.height,hasPrev:()=>"horizontal"===c.orientation()?o.x<r.x:o.y<r.y,next:()=>{c.scroll(-c.getNextSize())},prev:()=>{c.scroll(c.getPrevSize())},scroll:t=>{const e=Math.max(0,Math.min(l,s-t));e!==s&&(s=e,a())},offset:()=>s,orientation:()=>n.layout.orientation,direction:()=>n.layout.direction,extent:()=>dh(n,i),spread:()=>function(t,e){const n=e,i="horizontal"===t.layout.orientation?"height":"width",r="width"===i?"horizontal":"vertical";return t.globalMetrics.maxItemBounds[i]*n+(n-1)*t.layout.margin[r]}(n,i)};return c}function ph(t){return Object.keys(t).filter((e=>t[e])).join(" ")}const gh={up:"▲",right:"▶",down:"▼",left:"◀"};function mh(t,e){let{size:n,isActive:i,direction:r,nav:o,attrs:a}=e,s={},l="";const c=a;o&&o.button&&("function"==typeof o.button.class?s=o.button.class({direction:r}):o.button.class&&(s=o.button.class),"function"==typeof o.button.content&&(l=o.button.content(t,{direction:r})),void 0!==o.button.tabIndex&&(c.tabindex=o.button.tabIndex));const u={width:"".concat(n,"px"),minWidth:"".concat(n,"px"),height:"".concat(n,"px")};return Object.keys(s).length||(u.border="0",u.background="none"),(!i||o&&o.disabled)&&(c.disabled="disabled"),t("button",_({class:ph(s),style:u},c),[l||t("span",{style:{pointerEvents:"none"}},[gh[r]])])}function yh(t){let e;const n={itemize:t=>{e=function(t){let{dock:e,navigation:n}=t;return{layout:{orientation:"top"===e||"bottom"===e?"vertical":"horizontal"},navigation:n}}(t)},render:i=>function(t,e,n,i){let{rect:r,itemRenderer:o}=e;if(!t||!t.renderArgs)return;t.size(r);const a=t.renderArgs[0],s="vertical"===n.layout.orientation,l="rtl"===o.direction(),c=o.hasNext(),u=o.hasPrev();if(!u&&!c)return void t.render([]);const h=s?["right","left"]:["down","up"];l&&s&&h.reverse();const d=[a("div",{style:{position:"relative",display:"flex","flex-direction":s?"column":"row","justify-content":"center",height:"100%",pointerEvents:"auto"},dir:l&&!s?"rtl":"ltr"},[mh(a,{size:32,isActive:c,direction:h[0],attrs:{"data-action":"next","data-component-key":i.settings.key},nav:n.navigation}),mh(a,{size:32,isActive:u,direction:h[1],attrs:{"data-action":"prev","data-component-key":i.settings.key},nav:n.navigation})])];t.render(d)}(n.renderer,i,e,t),extent:()=>32,spread:()=>64};return n}function vh(t){let e;const n={itemize:n=>{e=function(t,e){let{resolved:n}=t;if(!1===n.title.item.show)return null;const i=_({},n.title.item,{type:"text"});if("rtl"===n.layout.item.direction&&(i.anchor&&"start"!==i.anchor?"end"===i.anchor&&(i.anchor="start"):i.anchor="end"),void 0===n.title.settings.text){const t=e.scale.data().fields;i.text=t&&t[0]?t[0].title():""}return{displayObject:i,bounds:e.renderer.textBounds(i)}}(n,t)},render:t=>{!function(t,e,n){let{rect:i}=t;if(!e)return;const r=[];if(e.size(i),n){const t={start:0,end:i.width,middle:i.width/2};r.push(_({},n.displayObject,{x:t[n.displayObject.anchor]||0,y:0,baseline:"text-before-edge",title:n.displayObject.text}))}e.render(r)}(t,n.renderer,e)},spread:()=>e?e.bounds.height:0,extent:()=>e?e.bounds.width:0};return n}function xh(t,e,n,i){let r,o,a,{itemRenderer:s,navigationRenderer:l,titleRenderer:c,isPreliminary:u=!1}=i,h=0;const d={x:e.spacing,y:e.spacing,width:t.width-2*e.spacing,height:t.height-2*e.spacing};if(r={x:d.x,y:d.y,width:d.width,height:c.spread()},"horizontal"===n){r={x:d.x,y:d.y,width:c.extent(),height:c.spread()};const t=d.width-r.width-(r.width?e.spacing:0),n=d.height;s.parallelize(t,u?void 0:n);const i=s.extent()>t?l.extent():0,f=s.spread(),p=i?l.spread():0;o={x:r.x+r.width+(r.width?e.spacing:0),y:d.y+Math.max(0,(p-f)/2),width:d.width-i-r.width-(i?e.spacing:0)-(r.width?e.spacing:0),height:n},a={x:o.x+o.width+(i?e.spacing:0),y:d.y,width:i,height:d.height},r.y=o.y;"rtl"===s.direction()&&(a.x=d.x,o.x=a.x+a.width+(a.width?e.spacing:0),r.x=o.x+o.width+(r.width?e.spacing:0)),h=Math.max(r.height,p,s.spread())}else{const t=d.height-r.height-(r.height?e.spacing:0),n=d.width;s.parallelize(t,u?void 0:n);const i=s.extent()>t?l.extent():0;a={x:d.x,y:d.y+d.height-i,width:d.width,height:i},o={x:d.x,y:r.y+r.height+(r.height?e.spacing:0),width:d.width,height:d.height-r.height-(r.height?e.spacing:0)-a.height-(a.height?e.spacing:0)},h=Math.max(c.extent(),i?l.spread():0,s.spread())}return o=_({},t,{x:t.x+o.x,y:t.y+o.y,width:o.width,height:o.height}),a.x+=t.x,a.y+=t.y,r.x+=t.x,r.y+=t.y,{title:_({},t,r),content:_({},t,o),navigation:_({},t,a),orientation:n,preferredSize:h}}function bh(t){t.state.resolved=function(t){const e=t.scale.domain();let n={items:[]};const i=t.settings.layout.dock;if("threshold-color"===t.scale.type){const r=t.scale.data().fields[0];let o=t=>String(t);t.settings.formatter?o=t.chart.formatter(t.settings.formatter):r&&(o=r.formatter());for(let t=0;t<e.length-1;t++){const i={value:e[t],label:"".concat(o(e[t])," - < ").concat(o(e[t+1]))};r&&(i.source={field:r.id()}),n.items.push(i)}"vertical"==("top"===i||"bottom"===i?"horizontal":"vertical")&&n.items.reverse()}else{const i=t.scale.labels?t.scale.labels():null;n.items=e.map(((e,n)=>{const r=t.scale.datum?_({},t.scale.datum(e)):{value:e};return r.value=e,t.scale.label?r.label=t.scale.label(e):i&&(r.label=i[n]),r}))}const r=t.resolver.resolve({data:{fields:t.scale.data().fields},defaults:_(!0,{},uh.title,t.style.title),settings:t.settings.settings.title}),o=t.resolver.resolve({data:{fields:t.scale.data().fields},defaults:uh.layout,settings:t.settings.settings.layout}),a=t.resolver.resolve({data:n,defaults:_(!0,{},uh.item.label,t.style.item.label),settings:(t.settings.settings.item||{}).label}),s=_(!0,{},(t.settings.settings.item||{}).shape);void 0===s.fill&&t.settings.scale&&(s.fill={scale:t.settings.scale});const l=t.resolver.resolve({data:n,defaults:_(!0,{},uh.item.shape,t.style.item.shape),settings:s}),c=t.resolver.resolve({data:n,defaults:_(!0,{},{show:uh.item.show}),settings:{show:(t.settings.settings.item||{}).show}});function u(t,n){let i=t.data.value,r=e[n+1];t.data.value=[i,r]}"threshold-color"===t.scale.type&&("vertical"==("top"===i||"bottom"===i?"horizontal":"vertical")?(c.items.reverse().forEach(u),c.items.reverse()):c.items.forEach(u));return{title:r,labels:a,symbols:l,items:c,layout:o}}(t),t.titleRenderer.itemize({resolved:t.state.resolved,dock:t.settings.layout.dock||"center"}),t.itemRenderer.itemize({resolved:t.state.resolved,dock:t.settings.layout.dock||"center"}),t.navigationRenderer.itemize({resolved:t.state.resolved,dock:t.settings.layout.dock||"center",navigation:t.settings.settings.navigation}),t.state.display={spacing:8}}function wh(t){const{rect:e,settings:n,state:i,itemRenderer:r,navigationRenderer:o,titleRenderer:a}=t,s=n.layout.dock,l="top"===s||"bottom"===s?"horizontal":"vertical",c=xh(e,i.display,l,{itemRenderer:r,navigationRenderer:o,titleRenderer:a});t.renderer.size(c.content);let u=r.getItemsToRender({viewRect:_({},c.content,{x:0,y:0})});return o.render({rect:c.navigation,itemRenderer:r}),a.render({rect:c.title}),t.state.views={layout:c},u}const kh={require:["chart","settings","renderer","update","resolver","registries","symbol"],defaultSettings:{settings:{},style:{item:{label:"$label",shape:"$shape"},title:"$title"}},mounted(t){t&&t.parentNode&&(this.navigationRenderer.renderer.appendTo(t.parentNode),this.titleRenderer.renderer.appendTo(t.parentNode),t.parentNode.insertBefore(this.navigationRenderer.renderer.element(),t),t.parentNode.insertBefore(this.titleRenderer.renderer.element(),t)),this.navigationRenderer.render({rect:this.state.views.layout.navigation,itemRenderer:this.itemRenderer}),this.titleRenderer.render({rect:this.state.views.layout.title})},beforeUnmount(){this.navigationRenderer.renderer.clear(),this.titleRenderer.renderer.clear()},on:{panstart(){if(this.state.interaction.started)return;this.itemRenderer.getContentOverflow()&&(this.state.interaction.started=!0,this.state.interaction.delta=0)},panmove(t){if(!this.state.interaction.started)return;const e="horizontal"===this.itemRenderer.orientation()?("rtl"===this.itemRenderer.direction()?-1:1)*t.deltaX:t.deltaY;this.itemRenderer.scroll(e-this.state.interaction.delta),this.state.interaction.delta=e},panend(){this.state.interaction.started=!1},scroll(t){this.itemRenderer.scroll(-t)},next(){this.itemRenderer.next()},prev(){this.itemRenderer.prev()}},created(){this.state={interaction:{}},this.onScroll=()=>{const t=wh(this);this.update(t)},this.itemRenderer=fh(this,{onScroll:this.onScroll}),this.navigationRenderer=yh(this),this.titleRenderer=vh(this),this.navigationRenderer.renderer=this.registries.renderer("dom")(),this.titleRenderer.renderer=this.registries.renderer(this.settings.renderer)(),bh(this)},preferredSize(t){return function(t,e){let n=0;const i=t.settings.layout.dock||"center",r="top"===i||"bottom"===i?"horizontal":"vertical",o=t.state.display,a=xh(e.inner,o,r,{itemRenderer:t.itemRenderer,navigationRenderer:t.navigationRenderer,titleRenderer:t.titleRenderer,isPreliminary:!0});return n+=o.spacing,n+=a.preferredSize,n+=o.spacing,n}(this,t)},beforeUpdate(){bh(this)},render(){return wh(this)},beforeDestroy(){this.navigationRenderer.renderer.destroy(),this.titleRenderer.renderer.destroy()},additionalElements(){return[this.titleRenderer.renderer.element(),this.navigationRenderer.renderer.element()]},_DO_NOT_USE_getInfo(){return{offset:this.itemRenderer.offset()}}};function _h(t,e){let n=0;const i=t.state.isVertical?"justify":"align",r=t.state.isVertical?"y":"x",o=t.state.isVertical?"height":"width",a=t.state.isVertical?"requiredHeight":"requiredWidth";n=t.state.rect[o]-t.state.legend.length()-t.state.title[a](),n*=Math.min(1,Math.max(t.stgns[i],0)),e[r]+=n}function Mh(t,e,n){const i=n[t];return"object"==typeof i?-1!==i.valid.indexOf(e)?e:i.default:n.default}function Sh(t){return Mh(t.layout.dock,t.settings.title.anchor,{left:{valid:["top"],default:"top"},right:{valid:["top"],default:"top"},top:{valid:["left","right"],default:"left"},bottom:{valid:["left","right"],default:"left"},default:"top"})}function Ch(t,e){const n={x:0,y:0,width:0,height:0},i=t.stgns.padding;return n.x=i.left,n.y=i.top,n.width=e.width-i.left-i.right,n.height=e.height-i.top-i.bottom,n}function qh(t){const e="top"!==t.settings.layout.dock&&"bottom"!==t.settings.layout.dock,n=t.stgns.title,i=t.chart.scale(t.stgns.fill),r=t.chart.scale(t.stgns.major),o=function(t,e){const n=e.domain();let i=n,r=t.stgns.tick.label;return!r&&t.formatter?r=t.formatter:!r&&e.data().fields&&(r=e.data().fields[0].formatter()),"function"==typeof r&&(i=n.map(r).map(String)),n.map(((n,r)=>{const o=i[r];return{value:n,label:o,pos:e.norm(parseFloat(n,10)),textMetrics:t.renderer.measureText({text:o,fontSize:t.stgns.tick.fontSize,fontFamily:t.stgns.tick.fontFamily})}}))}(t,r),a=function(t){return Mh(t.layout.dock,t.settings.tick.anchor,{left:{valid:["left","right"],default:"left"},right:{valid:["left","right"],default:"right"},top:{valid:["top","bottom"],default:"top"},bottom:{valid:["top","bottom"],default:"bottom"},default:"right"})}(t.settings);if(void 0===n.text){const t=r.data().fields;n.text=t&&t[0]?t[0].title():""}const s=t.renderer.measureText({text:n.text,fontSize:n.fontSize,fontFamily:n.fontFamily}),l=t.renderer.textBounds({text:n.text,fontSize:n.fontSize,fontFamily:n.fontFamily,maxLines:n.maxLines,maxWidth:n.maxLengthPx,wordBreak:n.wordBreak,hyphens:n.hyphens,lineHeight:n.lineHeight}),c={isVertical:e,nodes:[],title:{anchor:Sh(t.settings),textMetrics:s,textBounds:l,requiredWidth:()=>{if(!n.show)return 0;let t=l.width,i=n.maxLengthPx;return e||(t+=n.padding,i+=n.padding),Math.min(t,i,c.rect.width)},requiredHeight:()=>{if(!n.show)return 0;let t=l.height;return e&&(t+=n.padding),Math.min(t,c.rect.height)}},ticks:{values:o,anchor:a,length:Math.min(Math.max(...o.map((t=>t.textMetrics.width))),t.stgns.tick.maxLengthPx),requiredHeight:()=>"top"===a?Math.max(...c.ticks.values.map((t=>t.textMetrics.height)))+t.stgns.tick.padding:0,height:Math.max(...o.map((t=>t.textMetrics.height)))},legend:{fillScale:i,majorScale:r,length:()=>{const n=e?"height":"width",i=e?"requiredHeight":"requiredWidth",r=Math.min(c.rect[n],c.rect[n]*t.stgns.length)-c.title[i]();return Math.max(0,Math.min(r,t.stgns.maxLengthPx))}}};return c}const Nh={require:["chart","settings","renderer"],defaultSettings:{layout:{displayOrder:0,dock:"right"},settings:{size:15,length:.5,maxLengthPx:250,align:.5,justify:0,padding:{left:5,right:5,top:5,bottom:5},tick:{label:null,fill:"#595959",fontSize:"12px",fontFamily:"Arial",maxLengthPx:100,anchor:null,padding:5},title:{show:!0,text:void 0,fill:"#595959",fontSize:"12px",fontFamily:"Arial",maxLengthPx:100,padding:5,maxLines:2,wordBreak:"none",lineHeight:1.2,hyphens:"auto",anchor:null}}},preferredSize(t){const e=this.state;e.rect=Ch(this,t.inner);let n=this.stgns.size;const i=e.isVertical?this.stgns.padding.left+this.stgns.padding.right:this.stgns.padding.top+this.stgns.padding.bottom;n+=i;const r=Math.max(t.inner.width,t.inner.height);if("left"===e.ticks.anchor||"right"===e.ticks.anchor){if(e.ticks.values.reduce(((t,e)=>t+e.textMetrics.height),0)>this.state.legend.length())return r;n+=e.ticks.length}else{if(e.ticks.length>this.state.legend.length())return r;n+=Math.max(...e.ticks.values.map((t=>t.textMetrics.height)))}return n+=this.stgns.tick.padding,this.stgns.title.show&&(n="left"===e.title.anchor||"right"===e.title.anchor?Math.max(e.title.textBounds.height+i,n):Math.max(n,e.title.requiredWidth()+i)),this.state.preferredSize=n,n},created(){this.stgns=this.settings.settings,this.state=qh(this)},beforeUpdate(t){this.stgns=t.settings.settings,this.state=qh(this)},beforeRender(t){if(this.state.nodes=[],this.state.rect=Ch(this,t.size),this.stgns.title.show){const t=function(t){const e=t.state,n=t.stgns,i="left"===e.ticks.anchor,r="top"===e.ticks.anchor;let o=e.rect.x,a=e.rect.y,s="start";"left"===e.title.anchor?(o+=e.title.requiredWidth()-n.title.padding,a+=e.title.textMetrics.height,a+=r?e.rect.height-e.title.textBounds.height:0,s="end"):"right"===e.title.anchor?(o+=e.legend.length(),o+=n.title.padding,a+=e.title.textMetrics.height,a+=r?e.rect.height-e.title.textBounds.height:0):"top"===e.title.anchor&&(o+=i?e.rect.width:0,a+=e.title.textMetrics.height,s=i?"end":"start");const l={tag:"legend-title",type:"text",x:o,y:Math.min(a,e.rect.y+e.rect.height),text:n.title.text,fill:n.title.fill,fontSize:n.title.fontSize,fontFamily:n.title.fontFamily,maxWidth:n.title.maxLengthPx,maxLines:n.title.maxLines,wordBreak:n.title.wordBreak,hyphens:n.title.hyphens,lineHeight:n.title.lineHeight,anchor:s,title:n.title.text};return _h(t,l),l}(this);this.state.nodes.push(t)}const e=function(t,e){const n=t.state,i=t.stgns,r=n.rect;let o=r.x,a=r.y,s=n.isVertical?i.size:n.legend.length(),l=n.isVertical?n.legend.length():i.size;"left"===n.ticks.anchor?o+=n.rect.width-i.size:"top"===n.ticks.anchor&&(a+=n.rect.height-i.size),"top"===n.title.anchor?a+=n.title.requiredHeight():"left"===n.title.anchor&&(o+=n.title.requiredWidth());const c={type:"rect",x:o,y:a,width:s,height:l,fill:{type:"gradient",stops:e,degree:n.isVertical?90:180}};return _h(t,c),c}(this,function(t){const e=t.state.legend.fillScale,n=t.state.legend.majorScale;return e.domain().map((t=>({type:"stop",color:e(t),offset:Math.min(1,Math.max(0,n.norm(t)))}))).sort(((t,e)=>t.offset-e.offset))}(this)),n={id:"legend-seq-target",type:"container",children:[e,function(t,e){const n=t.state,i=t.stgns;let r="start";const o={type:"rect",x:e.x,y:e.y,width:n.isVertical?0:e.width,height:n.isVertical?e.height:0,fill:"transparent"};return{type:"container",id:"legend-seq-ticks",children:[...n.ticks.values.map((a=>{let s=0,l=0,c=0,u="alphabetical";return n.isVertical?(l=e.y+e.height*a.pos,u=0===a.pos?"text-before-edge":"text-after-edge"):s=e.x+e.width*a.pos,"right"===n.ticks.anchor?(s=e.x+i.size+i.tick.padding,o.x=e.x+e.width):"left"===n.ticks.anchor?(s=e.x-i.tick.padding,r="end"):"top"===n.ticks.anchor?(l=e.y-i.tick.padding,c-=.25*a.textMetrics.height,r=0===a.pos?"start":"end"):"bottom"===n.ticks.anchor&&(l=e.y+e.height+i.tick.padding,c=.8*a.textMetrics.height,r=0===a.pos?"start":"end",o.y=e.y+e.height),{type:"text",x:s,y:l,dx:0,dy:c,text:a.label,fontSize:i.tick.fontSize,fontFamily:i.tick.fontFamily,fill:i.tick.fill,maxWidth:n.isVertical?i.tick.maxLengthPx:Math.min(i.tick.maxLengthPx,n.legend.length()/2),anchor:r,textBoundsFn:t.renderer.textBounds,title:a.label,baseline:u}})),o]}}(this,e)]};this.state.nodes.push(n)},render(){return this.state.nodes}};const Rh={coordinates:{minor:.5,major:.5,layerId:0,defined:!0},connect:!1,orientation:"horizontal",layers:{curve:"linear",show:!0,sort:void 0,line:{stroke:"#ccc",strokeWidth:1,strokeLinejoin:"miter",strokeDasharray:void 0,opacity:1,show:!0,showMinor0:!0},area:{fill:"#ccc",opacity:.8,show:!0}}};function Ah(t,e){let{generatorType:n,item:i,data:r,major:o,minor:a,layerObj:s,stngs:l}=e,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const u={type:"path",points:t,generatorType:n,major:o,minor:a,layerObj:s,stngs:l,opacity:i.opacity,stroke:i.stroke,strokeWidth:i.strokeWidth,strokeLinejoin:i.strokeLinejoin,fill:c||i.fill,data:r};return i.strokeDasharray&&(u.strokeDasharray=i.strokeDasharray),u}function Oh(t){const{metaLayers:e,coordinates:n,layers:i,lines:r,areas:o}=function(t){let{data:e,stngs:n,rect:i,resolver:r,style:o,domain:a}=t;const{width:s,height:l}=i,c=r.resolve({data:e,defaults:Rh.coordinates,settings:n.coordinates||{},scaled:{major:"vertical"===n.orientation?l:s,minor:"vertical"===n.orientation?s:l}}),u=!n.connect&&a.length>2&&("function"==typeof n.coordinates.layerId||"object"==typeof n.coordinates.layerId),h={};let d=0;for(let t=0;t<c.items.length;t++){let e=c.items[t],n=e.layerId;if(u){const t=h[n]?h[n].items[h[n].items.length-1]:null,i=t?a.indexOf(t.data.major?t.data.major.value:t.data.value):null;t&&a.indexOf(e.data.major?e.data.major.value:e.data.value)-1!==i&&h[n].items.push({dummy:!0})}h[n]=h[n]||{order:d++,id:n,items:[],dataItems:[],consumableData:{}},h[n].dataItems.push(e.data),h[n].items.push(e)}const f=Object.keys(h).map((t=>(h[t].consumableData=C({points:h[t].dataItems},h[t].dataItems[0]),h[t]))),p={items:f.map((t=>t.consumableData))},g=n.layers||{};return{coordinates:c,metaLayers:f,layers:r.resolve({data:p,defaults:{curve:Rh.layers.curve,show:Rh.layers.show},settings:{curve:g.curve,show:g.show}}),lines:r.resolve({data:p,defaults:_({},Rh.layers.line,o.line),settings:g.line}),areas:r.resolve({data:p,defaults:_({},Rh.layers.area,o.area),settings:g.area})}}(t),a=[];return e.forEach(((e,s)=>{const l=i.items[s];if(!1===l.show)return;l.datum=l.data,l.data=[],l.id=e.id;const c=[],u=[];let h,d;for(let i=0;i<e.items.length;i++){if(h=e.items[i],d=h.data,!h.dummy){if(isNaN(h.major))continue;t.missingMinor0&&(h.minor0=n.settings.minor.scale?n.settings.minor.scale(d.minor0?d.minor0.value:0):0),isNaN(h.minor)||c.push(h.minor),l.data.push(h.data)}u.push(h)}const f=c.sort(((t,e)=>t-e))[Math.floor((c.length-1)/2)];a.push({layerObj:l,lineObj:r.items[s],areaObj:o.items[s],median:f,points:u,consumableData:e.consumableData})})),a}const Dh={require:["chart","resolver"],defaultSettings:{style:{area:"$shape",line:"$shape-outline"}},created(){},render(t){let{data:e}=t;const{width:n,height:i}=this.rect;this.stngs=this.settings.settings||{};const r=!this.stngs.coordinates||void 0===this.stngs.coordinates.minor0,o=Oh({data:e,stngs:this.stngs,rect:this.rect,resolver:this.resolver,style:this.style,missingMinor0:r,domain:this.stngs.coordinates&&this.stngs.coordinates.major&&this.stngs.coordinates.major.scale?this.chart.scale(this.stngs.coordinates.major.scale).domain():[]});if(this.stngs.layers&&this.stngs.layers.sort){const t=o.map((t=>({id:t.layerObj.id,data:t.layerObj.data}))).sort(this.stngs.layers.sort).map((t=>t.id));o.sort(((e,n)=>t.indexOf(e.layerObj.id)-t.indexOf(n.layerObj.id)))}else o.sort(((t,e)=>t.median-e.median));return function(t,e){let{width:n,height:i,missingMinor0:r,stngs:o}=e;const a=[],s=o.layers||{};return t.forEach((t=>{const{lineObj:e,layerObj:l,areaObj:c,points:u}=t;let h={size:i,p:"y"},d={size:n,p:"x"};if("vertical"===o.orientation){const t=_(!0,{},d);d=_(!0,{},h),h=_(!0,{},t)}s.area&&!1!==c.show&&a.push(Ah(u,{data:t.consumableData,item:c,generatorType:"area",major:d,minor:h,layerObj:l,stngs:o})),e&&!1!==e.show&&(a.push(Ah(u,{data:t.consumableData,item:e,generatorType:"line".concat(h.p.toUpperCase(),"1"),major:d,minor:h,layerObj:l,stngs:o},"none")),!r&&s.area&&!1!==c.show&&!1!==e.showMinor0&&a.push(Ah(u,{data:t.consumableData,item:e,generatorType:"line".concat(h.p.toUpperCase(),"0"),major:d,minor:h,layerObj:l,stngs:o},"none")))})),a}(o,{width:n,height:i,missingMinor0:r,stngs:this.stngs})}};function Eh(t,e){let n,i,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"object"==typeof e.center?(n=e.center.x,i=e.center.y):(n=e.clientX,i=e.clientY);const o=n-t.state.boundingRect.left,a=i-t.state.boundingRect.top;return{x:r?Math.max(0,Math.min(o,t.rect.width)):o,y:r?Math.max(0,Math.min(a,t.rect.height)):a}}function Ih(t,e){return{x:e.x+t.rect.x,y:e.y+t.rect.y}}function Th(t,e){const n=Math.min(t.x,e.x),i=Math.min(t.y,e.y);return{x:n,y:i,width:Math.max(t.x,e.x)-n,height:Math.max(t.y,e.y)-i}}const jh={require:["chart","renderer"],defaultSettings:{layout:{displayOrder:99},settings:{brush:{components:[]}},style:{area:"$selection-area-target"}},on:{areaStart(t){this.start(t)},areaMove(t){this.move(t)},areaEnd(t){this.end(t)},areaCancel(){this.cancel()}},created(){this.state={start:{x:0,y:0},end:{x:0,y:0},active:!1}},preferredSize:()=>0,render(){},start(t){this.state.boundingRect=this.renderer.element().getBoundingClientRect();const e=Eh(this,t,!1);gs({x:0,y:0,width:this.rect.width,height:this.rect.height},e)&&(this.state.brushConfig=function(t){return t.settings.brush.components.map((t=>({key:t.key,contexts:t.contexts,data:t.data,action:t.action||"set"})))}(this.settings),this.state.start=Eh(this,t),this.state.active=!0)},move(t){var e;this.state.active&&(this.state.end=Eh(this,t),function(t){if(t.state.active){const e=Ih(t,t.state.start),n=Ih(t,t.state.end),i=t.chart.shapesAt(Th(e,n),{components:t.state.brushConfig});t.chart.brushFromShapes(i,{components:t.state.brushConfig})}}(this),(e=this).renderer.render([_({type:"rect"},Th(e.state.start,e.state.end),e.style.area)]))},end(){this.state.active&&(this.state={start:{x:0,y:0},end:{x:0,y:0},active:!1},this.renderer.render([]))},cancel(){var t,e;this.state.active&&(t=this.state,e=this.chart,t.brushConfig.forEach((t=>{Array.isArray(t.contexts)&&t.contexts.forEach((t=>{e.brush(t).end()}))})),this.state={start:{x:0,y:0},end:{x:0,y:0},active:!1},this.renderer.render([]))}};function Ph(t,e,n){let{renderer:i,style:r,props:o,h:a}=n;const s=function(t,e){return{tooltip:"function"==typeof t.tooltipClass?t.tooltipClass({dock:e.dock}):t.tooltipClass,content:"function"==typeof t.contentClass?t.contentClass({dock:e.dock}):t.contentClass,arrow:"function"==typeof t.arrowClass?t.arrowClass({dock:e.dock}):t.arrowClass}}(o,e),l=function(t,e,n,i){return i.content({h:t,style:n,data:e})}(a,t,r,o),c=a("div",{dir:o.direction,class:ph(_({"pic-tooltip":!0},s.tooltip)),style:_({position:"relative",display:"inline-block"},e.computedTooltipStyle)},a("div",{style:r.content,class:ph(_({"pic-tooltip-content":!0},s.content))},l),a("div",{class:ph(_({"pic-tooltip-arrow":!0},s.arrow)),style:_({},r.arrow,r["arrow-".concat(e.dock)],e.computedArrowStyle)}));return i.render(c),i.element().children[0]}function zh(t){let{defaultDuration:e,defaultDelay:n}=t,i=null,r=null,o=!1;const a=function(){const t=function(){},e={pending:[],debounced:[],active:[],cancelled:[],rejected:[],fulfilled:[]};let n;return t.set=t=>{n=t,e[n].forEach((e=>e(t)))},t.on=(t,n)=>{Array.isArray(t)?t.forEach((t=>e[t].push(n))):e[t].push(n)},t.destroy=()=>{Object.keys(e).forEach((t=>{e[t].length=0}))},t}(),s=function(){},l=()=>{i=null,r=null,o=!1,a.set("fulfilled")};return s.invoke=function(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n;i&&(clearTimeout(i),a.set("debounced")),a.set("pending"),i=setTimeout((()=>{t(),o=!0,i=null,a.set("active")}),c),s>0&&(r&&clearTimeout(r),r=setTimeout(l,s+Math.max(c,0)))},s.clear=()=>{o?a.set("cancelled"):i&&(clearTimeout(i),a.set("rejected")),r&&clearTimeout(r),i=null,r=null,o=!1},s.on=(t,e)=>{a.on(t,e)},s.destroy=()=>{s.clear(),a.destroy()},s}function Fh(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return{left:"translate(-100%,-50%) translateX(".concat(-t,"px)"),right:"translate(".concat(t,"px, -50%)"),top:"translate(-50%, -100%) translateY(".concat(-t,"px)"),bottom:"translate(-50%, ".concat(t,"px)")}}function Lh(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{left:{x:-t-n,y:-e/2},right:{x:n,y:-e/2},top:{x:-t/2,y:-e-n},bottom:{x:-t/2,y:n}}}function $h(t){return{left:{left:"100%",top:"calc(50% - ".concat(t,"px)"),borderWidth:"".concat(t,"px")},right:{left:"".concat(2*-t,"px"),top:"calc(50% - ".concat(t,"px)"),borderWidth:"".concat(t,"px")},top:{left:"calc(50% - ".concat(t,"px)"),top:"100%",borderWidth:"".concat(t,"px")},bottom:{left:"calc(50% - ".concat(t,"px)"),top:"".concat(2*-t,"px"),borderWidth:"".concat(t,"px")}}}function Bh(t,e,n,i,r,o){const a=e+o.x,s=n+o.y,l=r;return!(a<0||s<0)&&!(a+i>t.width||s+l>t.height)}function Hh(t){let{area:e,vx:n,vy:i,width:r,height:o,offset:a}=t;const s=n+a.x,l=i+a.y,c=r,u=o;let h=s<0?-s:0,d=l<0?-l:0;return h+=s+c>e.width?-(s+c-e.width):0,d+=l+u>e.height?-(l+u-e.height):0,{x:h,y:d}}function Vh(t){let{options:e,pointer:n,width:i,height:r,dockOrder:o,x:a,y:s}=t;const{targetBounds:l}=n,c=Fh(e.offset),u=c[e.dock];if(u)return{computedTooltipStyle:{left:"".concat(a,"px"),top:"".concat(s,"px"),transform:u},computedArrowStyle:$h(e.offset)[e.dock],dock:e.dock};const h={width:"target"===e.area?l.width:window.innerWidth,height:"target"===e.area?l.height:window.innerHeight},d=Lh(i,r,e.offset),f=[],p="target"===e.area?a:l.left+a,g="target"===e.area?s:l.top+s;for(let t=0;t<o.length;t+=1){const n=o[t],l=Hh({area:h,vx:p,vy:g,width:i,height:r,offset:d[n]}),u={left:"".concat(a,"px"),top:"".concat(s,"px"),transform:c[n]},m=$h(e.offset)[n];0!==l.x&&(u.width="".concat(i-20-Math.abs(l.x),"px"),"top"!==n&&"bottom"!==n||(u.left="".concat(a+l.x,"px"),m.left="calc(50% ".concat(l.x>0?"-":"+"," ").concat(Math.abs(l.x),"px)")));const y={computedTooltipStyle:u,computedArrowStyle:m,dock:n,rect:{width:i,height:r}};if(0===l.x&&0===l.y)return y;y.offset=l,f.push(y)}return f.sort(((t,e)=>Math.abs(t.offset.x)-Math.abs(e.offset.x))),f[0]}function Wh(t,e,n){const i=t.key?n.component(t.key):n.componentsFromPoint({x:e.clientX,y:e.clientY})[0];if(!i)return{x:0,y:0,width:0,height:0,scaleRatio:{x:1,y:1}};const r=i.rect;return _({scaleRatio:r.scaleRatio},r.computedInner)}const Uh={bounds:function(t){let{resources:e,nodes:n,pointer:i,width:r,height:o,options:a}=t;const{targetBounds:s}=i,{x:l,y:c,width:u,height:h}=e.getNodeBoundsRelativeToTarget(n[0]),d={left:{x:l,y:c+h/2},right:{x:l+u,y:c+h/2},top:{x:l+u/2,y:c},bottom:{x:l+u/2,y:c+h}},f=Fh(a.offset),p=f[a.dock];if(p)return{computedTooltipStyle:{left:"".concat(d[a.dock].x,"px"),top:"".concat(d[a.dock].y,"px"),transform:p},computedArrowStyle:$h(a.offset)[a.dock],dock:a.dock};const g={width:"target"===a.area?s.width:window.innerWidth,height:"target"===a.area?s.height:window.innerHeight},m=Lh(r,o,a.offset),y=["top","left","right","bottom"];for(let t=0;t<y.length;t+=1){const e=y[t];if(Bh(g,"target"===a.area?d[e].x:s.left+d[e].x,"target"===a.area?d[e].y:s.top+d[e].y,r,o,m[e]))return{computedTooltipStyle:{left:"".concat(d[e].x,"px"),top:"".concat(d[e].y,"px"),transform:f[e]},computedArrowStyle:$h(a.offset)[e],dock:e}}return{computedTooltipStyle:{left:"".concat(d.top.x,"px"),top:"".concat(d.top.y,"px"),transform:f.top},computedArrowStyle:$h(a.offset).top,dock:"top"}},pointer:function(t){let{options:e,pointer:n,width:i,height:r}=t;const{x:o,y:a}=n;return Vh({x:o,y:a,pointer:n,width:i,height:r,options:e,dockOrder:["top","left","right","bottom"]})},slice:function(t){let{options:e,pointer:n,width:i,height:r,nodes:o,resources:a}=t;const s=o[0],{dx:l,dy:c}=n,u=a.getComponentBoundsFromNode(s),h=l+u.x+u.width/2,d=c+u.y+u.height/2,{start:f,end:p,outerRadius:g}=s.desc.slice,m=(f+p)/2-Math.PI/2,y=2*Math.PI,v=(m%y+y)%y;let x=["top","left","right","bottom"];return"auto"===e.dock&&(x=v<=Math.PI/4||v>=7*Math.PI/4?["right","top","bottom","left"]:v<=3*Math.PI/4?["bottom","left","right","top"]:v<=5*Math.PI/4?["left","top","bottom","right"]:["top","left","right","bottom"]),Vh({x:h+g*u.scaleRatio.x*Math.cos(v),y:d+g*u.scaleRatio.y*Math.sin(v),pointer:n,width:i,height:r,options:e,dockOrder:x})}};function Yh(t,e){let{width:n,height:i}=t,{chart:r,state:o,props:a}=e;const s={resources:{formatter:r.formatter,scale:r.scale,component:r.component,getComponentBoundsFromNode:t=>Wh(t,o.pointer,r),getNodeBoundsRelativeToTarget:t=>function(t,e,n){const i=Wh(t,e,n),r=t.bounds;return{x:i.x+e.dx+r.x,y:i.y+e.dy+r.y,width:r.width,height:r.height}}(t,o.pointer,r)},nodes:o.activeNodes,pointer:o.pointer,width:n,height:i},l=typeof a.placement;if("object"===l&&"function"==typeof a.placement.fn)return a.placement.fn(s);let c={type:"pointer",offset:8,dock:"auto",area:"viewport"};"function"===l&&(c=_(c,a.placement(s))),"object"===l&&Uh[a.placement.type]?c=_(c,a.placement):"string"===l&&Uh[a.placement]&&(c=_(c,{type:a.placement})),s.options=c;const u=Uh[c.type](s);let{x:h,y:d,width:f,height:p}=s.resources.getComponentBoundsFromNode(s.nodes[0]);return h+=s.pointer.dx,f+=h,d+=s.pointer.dy,p+=d,u.computedTooltipStyle.left="".concat(Math.min(Math.max(0,h,parseFloat(u.computedTooltipStyle.left)),f),"px"),u.computedTooltipStyle.top="".concat(Math.min(Math.max(0,d,parseFloat(u.computedTooltipStyle.top)),p),"px"),u}let Xh;function Kh(){Xh=null}const Gh={require:["chart","renderer"],defaultSettings:{settings:{duration:8e3,delay:500,filter:t=>t.filter((t=>t.data&&void 0!==t.data.value)),extract:t=>t.node.data.value,content:t=>{let{h:e,data:n}=t;return n.map((t=>e("div",{},t)))},isEqual:(t,e)=>t.length&&t.length===e.length&&t.every(((t,n)=>e[n]&&JSON.stringify(t.data)===JSON.stringify(e[n].data))),placement:{type:"pointer",dock:"auto",offset:8,area:"viewport"},tooltipClass:{},contentClass:{},arrowClass:{},direction:"ltr",appendTo:void 0,beforeShow:void 0,afterShow:void 0,beforeHide:void 0,onHide:void 0,afterHide:void 0},style:{tooltip:{},content:{backgroundColor:"$gray-25",color:"$font-color--inverted",fontFamily:"$font-family",fontSize:"$font-size",lineHeight:"$line-height",borderRadius:"4px",padding:"8px",opacity:.9},arrow:{position:"absolute",width:"0px",height:"0px",borderStyle:"solid",color:"$gray-25",opacity:.9},"arrow-bottom":{borderTopColor:"transparent",borderLeftColor:"transparent",borderRightColor:"transparent"},"arrow-top":{borderBottomColor:"transparent",borderLeftColor:"transparent",borderRightColor:"transparent"},"arrow-right":{borderTopColor:"transparent",borderLeftColor:"transparent",borderBottomColor:"transparent"},"arrow-left":{borderTopColor:"transparent",borderBottomColor:"transparent",borderRightColor:"transparent"}}},renderer:"dom",on:{hide(){this.hide()},show(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.show(t,e)},prevent(t){this.prevent(t)}},hide(){this.dispatcher.clear(),this.state.activeNodes=[],this.state.pointer={}},show(t){let e,{nodes:n,duration:i,delay:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!this.state.prevent&&this.state.targetElement&&(this.state.pointer=function(t,e){let{chart:n,state:i}=e,r=0,o=0;t.center?(r+=t.center.x,o+=t.center.y):(r+=t.clientX,o+=t.clientY);const a=n.element.getBoundingClientRect(),s=i.targetElement.getBoundingClientRect(),l=r,c=o,u=a.left-s.left,h=a.top-s.top,d=r-a.left,f=o-a.top;return r-=s.left,o-=s.top,{x:r,y:o,dx:u,dy:h,cx:d,cy:f,clientX:l,clientY:c,targetBounds:s,chartBounds:a}}(t,this),e=Array.isArray(n)?this.props.filter(n):this.props.filter(this.chart.shapesAt({x:this.state.pointer.cx,y:this.state.pointer.cy})),this.props.isEqual(this.state.activeNodes,e)||(this.dispatcher.clear(),this.state.activeNodes=e,this.state.activeNodes.length&&this.dispatcher.invoke((()=>this.invokeRenderer(this.state.activeNodes)),i,r)))},prevent(t){this.state.prevent=!!t},init(t){this.state={activeNodes:[],pointer:{},targetElement:null,prevent:!1},this.props=t.settings,this.dispatcher=zh({defaultDuration:this.props.duration,defaultDelay:this.props.delay});const e=this.dispatcher.clear;this.dispatcher.on("pending",(()=>{!function(t){Xh&&Xh!==t&&Xh()}(e),Xh=e,"function"==typeof this.props.beforeShow&&this.props.beforeShow.call(void 0,{resources:{formatter:this.chart.formatter,scale:this.chart.scale}})})),this.dispatcher.on(["cancelled","fulfilled"],(()=>{const t={resources:{formatter:this.chart.formatter,scale:this.chart.scale}};"function"==typeof this.props.beforeHide&&this.props.beforeHide.call(void 0,_({element:this.state.tooltipElm},t)),"function"==typeof this.props.onHide?this.props.onHide.call(void 0,_({element:this.state.tooltipElm},t)):this.renderer.clear([]),"function"==typeof this.props.afterHide&&this.props.afterHide.call(void 0,t),Xh===e&&(Xh=null),this.state.tooltipElm=void 0})),this.dispatcher.on("active",(()=>{"function"==typeof this.props.afterShow&&this.props.afterShow.call(void 0,{element:this.state.tooltipElm,resources:{formatter:this.chart.formatter,scale:this.chart.scale}})}))},created(){this.init(this.settings)},beforeUpdate(t){let{settings:e}=t;this.dispatcher&&(this.dispatcher.destroy(),Kh()),this.init(e)},render(t){return this.h=t,[]},beforeDestroy(){this.dispatcher.destroy(),Kh()},appendTo(){if(this.props.appendTo){this.state.targetElement="function"==typeof this.props.appendTo?this.props.appendTo({resources:{formatter:this.chart.formatter,scale:this.chart.scale}}):this.props.appendTo;const{width:t,height:e}=this.state.targetElement.getBoundingClientRect();this.renderer.destroy(),this.renderer.size({width:t,height:e}),this.renderer.appendTo(this.state.targetElement)}else this.state.targetElement=this.renderer.element()},mounted(){this.appendTo()},updated(){this.appendTo()},invokeRenderer(t){const e=function(t,e){let{chart:n,scale:i,props:r,h:o}=e;const a={resources:{dataset:n.dataset,scale:n.scale,formatter:n.formatter},scale:i,h:o},s=[];return t.forEach((t=>{if("function"==typeof r.extract){const e=_({node:t},a);s.push(r.extract(e))}})),s}(t,this),n=Yh(Ph(e,{style:{left:"0px",top:"0px",visibility:"hidden"}},this).getBoundingClientRect(),this);this.state.tooltipElm=Ph(e,n,this)}};const Zh={require:["renderer","chart"],defaultSettings:{settings:{target:"",selector:"*",fill:"rgba(0, 255, 0, 0.1)",stroke:"lime",opacity:1,useOuterRect:!1}},on:{update(){this.draw()}},draw(){const t=this.chart.findShapes(this.props.selector).filter((t=>t.key===this.props.target)).filter((t=>t.collider)).map((t=>t.collider));t.forEach((t=>{t.fill=this.props.fill,t.stroke=this.props.stroke,t.opacity=this.props.opacity,t.collider={type:null}})),this.renderer.render(t)},created(){this.props=this.settings.settings},resize(t){let{outer:e,inner:n}=t;return this.props.useOuterRect?e:n},render(){},mounted(){this.draw()},updated(){this.props=this.settings.settings,this.draw()}},Jh=2*Math.PI;function Qh(t,e,n,i){return Math.abs(t.x+n.x-(e.x+e.x))+Math.abs(t.y+n.y-(e.y+e.y))+Math.abs(e.x+i.x-(n.x+n.x))+Math.abs(e.y+i.y-(n.y+n.y))}function td(t,e){return{x:.5*(t.x+e.x),y:.5*(t.y+e.y)}}function ed(t,e,n,i,r){const o=1-t;return o**3*e+3*o**2*t*n+3*o*t**2*i+t**3*r}function nd(t,e,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:8;if(o<1||Qh(t,e,n,i)<=10)return r[r.length-1]!==t&&r.push(t),r.push(i),r;const a=.5,s=td(t,e),l=td(e,n),c=td(n,i),u={x:ed(a,t.x,e.x,n.x,i.x),y:ed(a,t.y,e.y,n.y,i.y)},h=td(s,l),d=td(l,c);return nd(t,s,h,u,r,o-1),nd(u,d,c,i,r,o-1),r}function id(t,e,n){const{cp1:i,cp2:r}=function(t,e,n){return{cp1:{x:t.x+2/3*(e.x-t.x),y:t.y+2/3*(e.y-t.y)},cp2:{x:n.x+2/3*(e.x-n.x),y:n.y+2/3*(e.y-n.y)}}}(t,e,n);return nd(t,i,r,n)}function rd(t,e,n){const i=[],r=!!t[4],o=!!t[5],a=t[3];let s,l,c,u,h=t[6],d=t[7],f=t[1],p=t[2];if("a"===t[0]&&(h+=e,d+=n),e===d&&n===d)return i;if(!f||!p)return i.push({x:h,y:d}),i;({cx:s,cy:l,rx:f,ry:p,sweepAngle:c,startAngle:u}=function(t,e,n,i,r,o,a,s,l){let c,u,h,d,f,p;const g=Ra(n%360),m=Math.cos(g),y=Math.sin(g),v=(s-o)/2,x=(l-a)/2,b=m*v+y*x,w=m*x-y*v;p=b**2/(t=Math.abs(t))**2+w**2/(e=Math.abs(e))**2,p>1&&(p=Math.sqrt(p),t*=p,e*=p);const k=t*w,_=e*b,M=k**2+_**2,S=(t*e)**2-M;let C=Math.sqrt(Math.max(S/M,0));i===r&&(C=-C);const q=C*(k/e),N=C*(-_/t);d=m*q-y*N+(s+o)/2,f=y*q+m*N+(l+a)/2;const R=(b-q)/t,A=(w-N)/e,O=(-b-q)/t,D=(-w-N)/e;return c=Math.atan2(A,R),c+=c<0?Jh:0,u=Math.atan2(D,O),u+=u<0?Jh:0,h=u-c,!r&&c<u?h-=Jh:r&&u<c&&(h+=Jh),h%=Jh,{startAngle:c,sweepAngle:h,cx:d,cy:f,rx:t,ry:e}}(f,p,a,r,o,h,d,e,n));const g=Math.abs(c*Math.sqrt((f**2+p**2)/2)),m=Math.ceil(g/10),y=c/m;for(let t=1;t<=m;t++){const e=(u+y*t)%Jh,n=Math.cos(e),r=Math.sin(e);i.push({x:s+n*f+-r*n,y:l+r*p+n*r})}return i}function od(t){const e=p.parsePath(t),n=[],i=[];let r=0,o=0,a=null,s=null,l=null,c=null;for(let t=0;t<e.length;++t){const u=e[t],h=u[0];switch("S"!==h&&"s"!==h&&"C"!==h&&"c"!==h&&(a=null,s=null),"T"!==h&&"t"!==h&&"Q"!==h&&"q"!==h&&(l=null,c=null),h){case"m":i.length&&n.push(i.splice(0));case"l":r+=u[1],o+=u[2],i.push({x:r,y:o});break;case"M":i.length&&n.push(i.splice(0));case"L":r=u[1],o=u[2],i.push({x:r,y:o});break;case"H":r=u[1],i.push({x:r,y:o});break;case"h":r+=u[1],i.push({x:r,y:o});break;case"V":o=u[1],i.push({x:r,y:o});break;case"v":o+=u[1],i.push({x:r,y:o});break;case"a":i.push(...rd(u,r,o)),r+=u[6],o+=u[7];break;case"A":i.push(...rd(u,r,o)),r=u[6],o=u[7];break;case"c":i.push(...nd({x:r,y:o},{x:u[1]+r,y:u[2]+o},{x:u[3]+r,y:u[4]+o},{x:u[5]+r,y:u[6]+o})),a=u[3]+r,s=u[4]+o,r+=u[5],o+=u[6];break;case"C":i.push(...nd({x:r,y:o},{x:u[1],y:u[2]},{x:u[3],y:u[4]},{x:u[5],y:u[6]})),a=u[3],s=u[4],r=u[5],o=u[6];break;case"s":null!==a&&null!==a||(a=r,s=o),i.push(...nd({x:r,y:o},{x:2*r-a,y:2*o-s},{x:u[1]+r,y:u[2]+o},{x:u[3]+r,y:u[4]+o})),a=u[1]+r,s=u[2]+o,r+=u[3],o+=u[4];break;case"S":null!==a&&null!==a||(a=r,s=o),i.push(...nd({x:r,y:o},{x:2*r-a,y:2*o-s},{x:u[1],y:u[2]},{x:u[3],y:u[4]})),a=u[1],s=u[2],r=u[3],o=u[4];break;case"Q":i.push(...id({x:r,y:o},{x:u[1],y:u[2]},{x:u[3],y:u[4]})),l=u[1],c=u[2],r=u[3],o=u[4];break;case"q":i.push(...id({x:r,y:o},{x:u[1]+r,y:u[2]+o},{x:u[3]+r,y:u[4]+o})),l=u[1]+r,c=u[2]+o,r+=u[3],o+=u[4];break;case"T":null!==l&&null!==l||(l=r,c=o),l=2*r-l,c=2*o-c,i.push(...id({x:r,y:o},{x:l,y:c},{x:u[1],y:u[2]})),r=u[1],o=u[2];break;case"t":null!==l&&null!==l||(l=r,c=o),l=2*r-l,c=2*o-c,i.push(...id({x:r,y:o},{x:l,y:c},{x:u[1]+r,y:u[2]+o})),r+=u[1],o+=u[2];break;case"z":case"Z":i.length&&i.push({x:i[0].x,y:i[0].y})}}return function(t){for(let e=0;e<t.length-1;e++){const n=t[e],i=t[e+1];Math.abs(n.x-i.x)<1e-12&&Math.abs(n.y-i.y)<1e-12&&(t.splice(e,1),e--)}}(i),n.push(i.splice(0)),n}const ad={require:["renderer","chart"],defaultSettings:{settings:{target:"",fill:"transparent",stroke:"lime",opacity:1,radius:2,useOuterRect:!1}},on:{update(){this.draw()}},draw(){const t=this.chart.findShapes("path").filter((t=>t.key===this.props.target)),e=[];t.forEach((t=>{od(t.attrs.d).forEach((t=>{t.forEach((t=>{e.push({type:"circle",cx:t.x,cy:t.y,r:this.props.radius,fill:this.props.fill,stroke:this.props.stroke,opacity:this.props.opacity,collider:{type:null}})}))}))})),this.renderer.render(e)},created(){this.props=this.settings.settings},resize(t){let{outer:e,inner:n}=t;return this.props.useOuterRect?e:n},render(){},mounted(){this.draw()},updated(){this.props=this.settings.settings,this.draw()}};var sd=[function(t){t.component("box",vl),t.component("box-marker",vl)},function(t){t.component("point",Sl),t.component("point-marker",Sl)},function(t){t.component("pie",Rl)},function(t){t.component("grid-line",Il)},function(t){t.component("ref-line",$l)},function(t){t.component("axis",cc)},function(t){t.component("container",uc)},function(t){t.component("text",fc)},function(t){t.component("scrollbar",mc)},function(t){t.component("brush-range",Oc),t.component("brush-area-dir",Tc)},function(t){t.component("range",Fc)},function(t){t.component("brush-lasso",Wc)},function(t){t.component("labels",ch)},function(t){t.component("legend-cat",kh)},function(t){t.component("legend-seq",Nh)},function(t){t.component("line",Dh)},function(t){t.component("brush-area",jh)},function(t){t.component("tooltip",Gh)},function(t){t.component("debug-collider",Zh)},function(t){t.component("debug-path-to-points",ad)}];class ld{constructor(t){this._parent=null,this._children=[],this._ancestors=null,this.type=t,this.data=null}detach(){return this._parent&&this._parent.removeChild(this),this}get parent(){return this._parent}get isBranch(){return this._children&&this._children.length}get children(){return this._children}get ancestors(){return this._ancestors||(this._ancestors=[],this.parent&&this._ancestors.push(this.parent,...this.parent.ancestors)),this._ancestors}get descendants(){let t=[];const e=this.children.length;let n,i;for(n=0;n<e;n++)i=this.children[n],t.push(i),i.children.length&&(t=[...t,...i.descendants]);return t}equals(t){const e=this.children,n=t.children;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(!e[t].equals(n[t]))return!1;return!0}toJSON(){return{type:this.type,children:this.children.map((t=>t.toJSON()))}}}class cd{constructor(){let{x:t=0,y:e=0,width:n=0,height:i=0,minWidth:r=0,minHeight:o=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({x:t,y:e,width:n,height:i,minWidth:r,minHeight:o})}set(){let{x:t=0,y:e=0,width:n=0,height:i=0,minWidth:r=0,minHeight:o=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="rect",n>=0?(this.x=t,this.width=Math.max(n,r)):(this.x=t+Math.min(n,-r),this.width=-Math.min(n,-r)),i>=0?(this.y=e,this.height=Math.max(i,o)):(this.y=e+Math.min(i,-o),this.height=-Math.min(i,-o))}containsPoint(t){return gs(this,t)}intersectsLine(t){return ms(this,T(t))}intersectsRect(t){return fs(this,I(t))}intersectsCircle(t){return ss(t,this)}intersectsPolygon(t){return ds(t,this)}intersectsGeoPolygon(t){return Ms(t,this)}points(){return[{x:this.x,y:this.y},{x:this.x+this.width,y:this.y},{x:this.x+this.width,y:this.y+this.height},{x:this.x,y:this.y+this.height}]}}class ud{constructor(){let{cx:t=0,cy:e=0,r:n=0,minRadius:i=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({cx:t,cy:e,r:n,minRadius:i})}set(){let{cx:t=0,cy:e=0,r:n=0,minRadius:i=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="circle",this.cx=t,this.cy=e,this.r=Math.max(n,i),this.vector={x:this.cx,y:this.cy}}containsPoint(t){return as(this,t)}intersectsLine(t){return ls(this,T(t))}intersectsRect(t){return ss(this,I(t))}intersectsCircle(t){return n=t,!ns(e=this)&&!ns(n)&&(e.cx-n.cx)**2+(e.cy-n.cy)**2<=(e.r+n.r)**2;var e,n}intersectsPolygon(t){return cs(this,t)}intersectsGeoPolygon(t){return ws(this,t)}points(){return[{x:this.cx,y:this.cy}]}}class hd{constructor(){let{x1:t=0,y1:e=0,x2:n=0,y2:i=0,tolerance:r=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({x1:t,y1:e,x2:n,y2:i,tolerance:r})}set(){let{x1:t=0,y1:e=0,x2:n=0,y2:i=0,tolerance:r=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="line",this.x1=t,this.y1=e,this.x2=n,this.y2=i,this.tolerance=Math.max(0,Math.round(r)),this.vectors=this.points(),this.zeroSize=t===n&&e===i}containsPoint(t){if(this.tolerance>0){return ls({cx:t.x,cy:t.y,r:this.tolerance},this)}return vs(this,t)}intersectsLine(t){return ys(this,T(t))}intersectsRect(t){return ms(I(t),this)}intersectsCircle(t){return ls(t,this)}intersectsPolygon(t){return hs(t,this)}intersectsGeoPolygon(t){return _s(t,this)}points(){return[{x:this.x1,y:this.y1},{x:this.x2,y:this.y2}]}}class dd{constructor(){let{vertices:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({vertices:t})}set(){let{vertices:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.type="polygon",this.vertices=t.slice(),this.edges=[],function(t){for(let e=0;e<t.length-1;e++){const n=t[e],i=t[e+1];n.x===i.x&&n.y===i.y&&(t.splice(e,1),e--)}}(this.vertices),!(this.vertices.length<=2)){!function(t){const e=t[0],n=t[t.length-1];e.x===n.x&&e.y===n.y||t.push(e)}(this.vertices),this.xMin=NaN,this.yMin=NaN,this.xMax=NaN,this.yMax=NaN;for(let t=0;t<this.vertices.length;t++)t<this.vertices.length-1&&this.edges.push([this.vertices[t],this.vertices[t+1]]),this.xMin=isNaN(this.xMin)?this.vertices[t].x:Math.min(this.xMin,this.vertices[t].x),this.xMax=isNaN(this.xMax)?this.vertices[t].x:Math.max(this.xMax,this.vertices[t].x),this.yMin=isNaN(this.yMin)?this.vertices[t].y:Math.min(this.yMin,this.vertices[t].y),this.yMax=isNaN(this.yMax)?this.vertices[t].y:Math.max(this.yMax,this.vertices[t].y);this._bounds=null,this._boundingRect=null}}containsPoint(t){return us(this,t)}intersectsCircle(t){return cs(t,this)}intersectsLine(t){return hs(this,T(t))}intersectsRect(t){return ds(this,I(t))}intersectsPolygon(t){return xs(this,t)}intersectsGeoPolygon(t){return bs(t,this)}points(){return this.vertices}bounds(){return this._bounds||(this._bounds=[{x:this.xMin,y:this.yMin},{x:this.xMax,y:this.yMin},{x:this.xMax,y:this.yMax},{x:this.xMin,y:this.yMax}]),this._bounds}boundingRect(){return this._boundingRect||(this._boundingRect={x:this.xMin,y:this.yMin,width:this.xMax-this.xMin,height:this.yMax-this.yMin}),this._boundingRect}}function fd(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new dd(...e)}function pd(t){const e=t[0],n=t[t.length-1];e.x===n.x&&e.y===n.y||t.push(e)}function gd(t){for(let e=0;e<t.length-1;e++){const n=t[e],i=t[e+1];n.x===i.x&&n.y===i.y&&(t.splice(e,1),e--)}}class md{constructor(){let{vertices:t=[[]]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({vertices:t})}set(){let{vertices:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.type="geopolygon",this.vertices=t.slice(),this.numPolygons=this.vertices.length,this.polygons=[],this.xMin=NaN,this.yMin=NaN,this.xMax=NaN,this.yMax=NaN;for(let t=0;t<this.numPolygons;t++)gd(this.vertices[t]),this.vertices[t].length>2&&pd(this.vertices[t]),this.polygons[t]=fd({vertices:this.vertices[t]}),this.xMin=isNaN(this.xMin)?this.polygons[t].xMin:Math.min(this.xMin,this.polygons[t].xMin),this.xMax=isNaN(this.xMax)?this.polygons[t].xMax:Math.max(this.xMax,this.polygons[t].xMax),this.yMin=isNaN(this.yMin)?this.polygons[t].yMin:Math.min(this.yMin,this.polygons[t].yMin),this.yMax=isNaN(this.yMax)?this.polygons[t].yMax:Math.max(this.yMax,this.polygons[t].yMax);this._bounds=null,this._boundingRect=null}containsPoint(t){return ks(this,t)}intersectsCircle(t){return ws(t,this)}intersectsLine(t){return _s(this,T(t))}intersectsRect(t){return Ms(this,I(t))}intersectsPolygon(t){return bs(this,t)}intersectsGeoPolygon(t){return function(t,e){const n=t.boundingRect(),i=e.boundingRect();return!!fs(n,i)&&(ps(i,n)?os(e,t):os(t,e))}(this,t)}points(){return this.vertices}bounds(){return this._bounds||(this._bounds=[{x:this.xMin,y:this.yMin},{x:this.xMax,y:this.yMin},{x:this.xMax,y:this.yMax},{x:this.xMin,y:this.yMax}]),this._bounds}boundingRect(){return this._boundingRect||(this._boundingRect={x:this.xMin,y:this.yMin,width:this.xMax-this.xMin,height:this.yMax-this.yMin}),this._boundingRect}}function yd(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new md(...e)}class vd{constructor(){let{points:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.set({points:t})}set(){let{points:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.type="polyline",this.segments=[],this._points=t.slice(),this._points.length>1)for(let t=0,i=this._points.length-1;t<i;t++)e=this._points[t],n=this._points[t+1],(e.x!==n.x||e.y!==n.y)&&this.segments.push({x1:this._points[t].x,y1:this._points[t].y,x2:this._points[t+1].x,y2:this._points[t+1].y});var e,n}containsPoint(t){return this.segments.some((e=>vs(e,t)))}intersectsCircle(t){return this.segments.some((e=>ls(t,e)))}intersectsLine(t){const e=T(t);return this.segments.some((t=>ys(t,e)))}intersectsRect(t){const e=I(t);return this.segments.some((t=>ms(e,t)))}intersectsPolygon(t){return this.segments.some((e=>hs(t,e)))}intersectsGeoPolygon(t){return this.segments.some((e=>_s(t,e)))}points(){return this._points}}const xd=Ht();function bd(t,e){return xd.get(t)(e)}xd.add("rect",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new cd(...e)})),xd.add("circle",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new ud(...e)})),xd.add("line",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new hd(...e)})),xd.add("polygon",fd),xd.add("geopolygon",yd),xd.add("polyline",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new vd(...e)}));class wd{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.set(t)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.geometries=[],t.forEach((t=>{const e=bd(t.type,t);e&&this.geometries.push(e)}))}containsPoint(t){return this.geometries.some((e=>e.containsPoint(t)))}intersectsLine(t){return this.geometries.some((e=>e.intersectsLine(t)))}intersectsRect(t){return this.geometries.some((e=>e.intersectsRect(t)))}intersectsCircle(t){return this.geometries.some((e=>e.intersectsCircle(t)))}intersectsPolygon(t){return this.geometries.some((e=>e.intersectsPolygon(t)))}intersectsGeoPolygon(t){return this.geometries.some((e=>e.intersectsGeoPolygon(t)))}}class kd{constructor(){this._elements=[[1,0,0],[0,1,0],[0,0,1]],this._stack=[]}clone(){return(new kd).multiply(this)}set(t){return this._elements=t,this}save(){return this._stack.push(this.elements),this}restore(){return this._stack.length&&(this._elements=this._stack.pop()),this}add(t){let e,n;for(e=0;e<this._elements.length;e++)for(n=0;n<this._elements[e].length;n++)this._elements[e][n]+=t;return this}translate(t,e){return this.multiply([[1,0,t],[0,1,e],[0,0,1]]),this}rotate(t){let e=Math.cos(-t),n=Math.sin(-t);return this.multiply([[e,n,0],[-n,e,0],[0,0,1]]),this}multiply(t){let e,n,i,r;if(t instanceof kd&&(t=t._elements),Array.isArray(t)){for(i=[[0,0,0],[0,0,0],[0,0,0]],e=0;e<this._elements.length;e++)for(n=0;n<this._elements[e].length;n++)for(r=0;r<3;r++)i[e][n]+=this._elements[e][r]*t[r][n];this._elements=i}else for(e=0;e<this._elements.length;e++)for(n=0;n<this._elements[e].length;n++)this._elements[e][n]*=t;return this}scale(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return this.multiply([[t,0,0],[0,e,0],[0,0,1]]),this}transform(t,e,n,i,r,o){return this.multiply([[t,n,r],[e,i,o],[0,0,1]]),this}determinant(){let t=this._elements[0][0],e=this._elements[0][1],n=this._elements[0][2],i=this._elements[1][0],r=this._elements[1][1],o=this._elements[1][2],a=this._elements[2][0],s=this._elements[2][1],l=this._elements[2][2],c=0;return c=t*r*l+e*o*a+n*i*s-n*r*a-e*i*l-t*o*s,c}invert(){let t=this.determinant(),e=this._elements[0][0],n=this._elements[0][1],i=this._elements[0][2],r=this._elements[1][0],o=this._elements[1][1],a=this._elements[1][2],s=this._elements[2][0],l=this._elements[2][1],c=this._elements[2][2];return this._elements=[[o*c-a*l,i*l-n*c,n*a-i*o],[a*s-r*c,e*c-i*s,i*r-e*a],[r*l-o*s,s*n-e*l,e*o-n*r]],this.multiply(1/t),this}transpose(){const t=Object.create(this._elements);return this._elements=[[t[0][0],t[1][0],t[2][0]],[t[0][1],t[1][1],t[2][1]],[t[0][2],t[1][2],t[2][2]]],this}identity(){return this._elements=[[1,0,0],[0,1,0],[0,0,1]],this}toString(){return"".concat(this._elements.map((t=>t.join("\t"))).join("\n"))}isIdentity(){const t=this._elements;return 1===t[0][0]&&0===t[0][1]&&0===t[0][2]&&0===t[1][0]&&1===t[1][1]&&0===t[1][2]&&0===t[2][0]&&0===t[2][1]&&1===t[2][2]}transformPoint(t){let e,n,i=[t.x,t.y,1],r=this._elements,o=[0,0,0];for(e=0;e<this._elements.length;e++)for(n=0;n<this._elements[e].length;n++)o[e]+=i[n]*r[e][n];return{x:o[0],y:o[1]}}transformPoints(t){let e,n,i,r,o,a=this._elements,s=[];for(r=0;r<t.length;r++){for(e=[t[r].x,t[r].y,1],o=[0,0,0],n=0;n<this._elements.length;n++)for(i=0;i<this._elements[n].length;i++)o[n]+=e[i]*a[n][i];s.push({x:o[0],y:o[1]})}return s}get elements(){const t=this._elements;return[[t[0][0],t[0][1],t[0][2]],[t[1][0],t[1][1],t[1][2]],[t[2][0],t[2][1],t[2][2]]]}}const _d=/(translate|scale|rotate|matrix)\(([0-9,.eE+-\s]+)(?:,|\s?)+\)/g;function Md(t,e){const n=e.args[0]*(Math.PI/180);if(e.args.length>2){const i=e.args[1],r=e.args[2];t.translate(i,r),t.rotate(n),t.translate(-i,-r)}else 1===e.args.length&&t.rotate(n)}function Sd(t,e){const n=e.args[0],i=isNaN(e.args[1])?e.args[0]:e.args[1];t.scale(n,i)}function Cd(t,e){const n=e.args[0],i=isNaN(e.args[1])?0:e.args[1];t.translate(n,i)}function qd(t,e){e.args.length>=6&&t.transform(...e.args)}function Nd(t,e){const n=function(t){let e,n=[];for(;null!==(e=_d.exec(t));){const t=e[2].trim(),i=-1===t.indexOf(",")?t.split(" "):t.split(",");n.push({cmd:e[1],args:i.filter((t=>t.trim().length>0)).map((t=>Number(t)))})}return n}(t);let i;for(let t=0,r=n.length;t<r;t++)i=n[t],"rotate"===i.cmd?Md(e,i):"scale"===i.cmd?Sd(e,i):"matrix"===i.cmd?qd(e,i):"translate"===i.cmd&&Cd(e,i)}const Rd={type:/^\w[\w-]+/,attr:/^\[\w(?:[\w\._-]+)?(?:[!]?=['\"][\w\s*#_-]*['\"])?\]/,universal:/^(\*)/,tag:/^\.(\w+)/},Ad={type:(t,e)=>e.filter((e=>{const n=e.type;return!!n&&n.toLowerCase()===t.toLowerCase()})),attr:(t,e,n,i)=>i.filter((i=>{const r=i.attrs[t];if(!e)return void 0!==r;if(void 0===r)return!1;switch(e){case"=":return n===String(r);case"!=":return n!==String(r);default:return!1}})),universal:t=>t,tag:(t,e)=>e.filter((e=>{const n=e.tag;return!!n&&-1!==n.trim().split(/\s+/).indexOf(t.replace(".",""))}))};function Od(t,e){if(!e||!e.length||!t||"function"!=typeof Ad[t.type])return[];switch(t.type){case"type":return Ad[t.type](t.value,e);case"attr":return Ad[t.type](t.attribute,t.operator,t.attributeValue,e);case"universal":return Ad[t.type](e);case"tag":return Ad[t.type](t.value,e);default:return[]}}var Dd={find:function(t,e){const n=[],i=[];let r,o;if(e.isBranch){let a;r=function(t){const e=[];let n,i,r,o;return t.split(/\s*,\s*/).forEach((t=>{t=t.trim(),n=[];const a=e=>{r=t.match(Rd[e]),r&&(o=!0,t=t.slice(r[0].length),i={type:e,value:r[0]},"attr"===e&&(r=r[0].match(/\[(\w[\w\._-]+)?(?:([!]?=)['\"]([\w\s#_-]*)['\"])?\]/),i.attribute=r[1],i.operator=r[2],i.attributeValue=r[3]),n.push(i))};for(;t&&(o=!1,r=t.match(/^\s*([>+~]|\s)\s*/),r&&(o=!0,n.push({type:" ",value:r[0]}),t=t.slice(r[0].length)),Object.keys(Rd).forEach(a),n&&n.length&&e.indexOf(n)<0&&e.push(n),o););})),e}(t),o=e.descendants;for(let t=0,e=r.length;t<e;t++){a=r[t];const e=[];let n=o.slice(),s=!1;a.reverse().forEach((t=>{if(" "===t.type)return e.push(n),n=o.slice(),void(s=!1);n=Od(t,n),s=!0})),s&&e.push(n);const l=e[0].filter((t=>{let n,i=t.parent;for(let t=1;t<e.length;t++){for(n=e[t].indexOf(i);i&&n<0;)i=i.parent,n=e[t].indexOf(i);if(n<0)return!1}return!0}));i.push(l)}for(let t=0,e=i.length;t<e;t++)for(let e=0,r=i[t].length;e<r;e++)n.indexOf(i[t][e])<0&&n.push(i[t][e])}return n||[]}};function Ed(t,e,n){const i=t.type;let r=t.points();n&&(r=r.every((t=>Array.isArray(t)))?r.map((t=>n.transformPoints(t))):n.transformPoints(r)),function(t,e){for(let n=0,i=t.length;n<i;n++)t[n].x/=e,t[n].y/=e}(r,e);let o=null;if("rect"===i||"bounds"===i)o=I(r),o.type=i;else if("circle"===i)o=function(t,e){return{cx:t[0].x,cy:t[0].y,r:e}}(r,t.r),o.type=i;else if("line"===i)o=T(r),o.type=i;else if("polygon"===i||"polyline"===i){o={type:"path",d:qa(r,"polygon"===i)}}else if("geopolygon"===i){let t="";for(let e=0;e<r.length;e++)t+=qa(r[e],!0);o={type:"path",d:t}}return o}class Id{constructor(t){this._bounds=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{x:n,y:i,width:r,height:o}=t.boundingRect?t.boundingRect(e):{x:0,y:0,width:0,height:0};return{x:n,y:i,width:r,height:o}},this._attrs=t.attrs,this._type=t.type,this._data=t.data,this._dpi=t.stage?t.stage.dpi:1,this._collider=()=>function(t,e){if(t.collider){const n=t.modelViewMatrix;return"collection"===t.colliderType?{type:"container",children:t.collider.geometries.map((t=>Ed(t,e,n)))}:Ed(t.collider,e,n)}return null}(t,this._dpi),this._desc=t.desc,this._tag=t.tag,this._children=()=>t.children.map((t=>new Id(t))),this._parent=()=>t.parent?new Id(t.parent):null,this._cache={elementBoundingRect:null},this._getElementBoundingRect=()=>(!this._cache.elementBoundingRect&&this.element&&(this._cache.elementBoundingRect=this.element.getBoundingClientRect()),this._cache.elementBoundingRect||{left:0,top:0})}get children(){return this._children()}get parent(){return this._parent()}get type(){return this._type}get data(){return this._data}get attrs(){return this._attrs}set element(t){this._cache.elementBoundingRect=null,this._element=t}get element(){return this._element}set key(t){this._key=t}get key(){return this._key}get bounds(){const t=this._bounds();return t.x/=this._dpi,t.y/=this._dpi,t.width/=this._dpi,t.height/=this._dpi,t}get localBounds(){return this._bounds(!1)}boundsRelativeTo(t){const e=typeof t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?this.bounds:this.localBounds,i=this._getElementBoundingRect();let r=i.left,o=i.top;if("object"===e&&null!==t&&"function"==typeof t.getBoundingClientRect){const{left:e=0,top:n=0}=t.getBoundingClientRect();r-=e,o-=n}return n.x+=r,n.y+=o,n}get collider(){return this._collider()}get desc(){return this._desc}get tag(){return this._tag}}function Td(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Id(...e)}class jd{constructor(t){this._node=Td(t),this._parent=null,this._input=null}get node(){return this._node}set parent(t){this._parent=t}get parent(){return this._parent}set input(t){this._input=t}get input(){return this._input}}function Pd(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new jd(...e)}function zd(t,e){const n=t.parent;if(n&&"stage"!==n.type){e.parent=Pd(n);const t=n.parent;t&&"stage"!==t.type&&zd(t,e.parent)}}function Fd(t,e,n){if(null===t.colliderType)return null;const i=function(t,e){let n={};if(t.modelViewMatrix)if(Array.isArray(e))n=t.inverseModelViewMatrix.transformPoints(e);else if(isNaN(e.r))Array.isArray(e.vertices)?n.vertices=t.inverseModelViewMatrix.transformPoints(e.vertices):n=t.inverseModelViewMatrix.transformPoint(e);else{const i={x:e.cx,y:e.cy};({x:n.cx,y:n.cy}=t.inverseModelViewMatrix.transformPoint(i)),n.r=e.r}else n=e;return Array.isArray(n.vertices)&&(n=n.vertices.every((t=>Array.isArray(t)))?yd(n):fd(n)),n}(t,n);return"frontChild"===t.colliderType?function(t,e,n){for(let i=t.descendants.length-1;i>=0;i--){const r=t.descendants[i];if(null!==r.collider&&r.collider[e](n)){const t=Pd(r);return zd(r,t),t}}return null}(t,e,i):function(t,e,n){if(t.collider[e](n)){const e=Pd(t);return zd(t,e),e}return null}(t,e,i)}function Ld(t,e,n,i){const r=t.length;for(let o=0;o<r;o++){const r=t[o],a=Fd(r,e,i);a&&n.push(a),!r.children||a||r.collider||Ld(r.children,e,n,i)}}function $d(t,e,n){const i=t.length;for(let r=0;r<i;r++){const i=t[r];if(null!==Fd(i,e,n))return!0;if(i.children&&!i.collider)return $d(i.children,e,n)}return!1}function Bd(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=j(t);let i={};switch(n){case"circle":return i.cx=t.cx*e,i.cy=t.cy*e,i.r=t.r,["intersectsCircle",i];case"rect":return i=E(t).map((t=>Ea(t,e))),["intersectsRect",i];case"line":return i=D(t).map((t=>Ea(t,e))),["intersectsLine",i];case"point":return i=Ea(t,e),["containsPoint",i];case"polygon":return i.vertices=t.vertices.map((t=>Ea(t,e))),["intersectsPolygon",i];case"geopolygon":return i.vertices=t.vertices.map((t=>t.map((t=>Ea(t,e))))),["intersectsGeoPolygon",i];default:return[]}}function Hd(t,e){const[n,i]=Bd(e,t.dpi),r=[];return n&&(Ld([t],n,r,i),function(t,e){for(let n=0,i=e.length;n<i;n++)e[n].input=t}(e,r)),r}function Vd(t,e){const[n,i]=Bd(e,t.dpi);return $d([t],n,i)}class Wd extends ld{constructor(t){super(t),this._stage=null,this._collider={type:null,definition:null,fn:null},this._attrs={},this._node=null}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.node=t;const{data:e,desc:n,tag:i,strokeReference:r,fillReference:o}=t;var a,s;a=this.attrs,s=t,Object.keys(Ca).forEach((t=>{const e=s[t];void 0!==e&&(a[Ca[t]]=e)})),void 0!==e&&(this.data=e),"object"==typeof n&&(this.desc=_(!0,{},n)),"string"==typeof i&&(this.tag=i),"string"==typeof r&&(this.strokeReference=r),"string"==typeof o&&(this.fillReference=o)}findShapes(t){return Dd.find(t,this).map((t=>Td(t)))}getItemsFrom(t){return Hd(this,t)}containsPoint(t){return Vd(this,t)}intersectsLine(t){return Vd(this,t)}intersectsRect(t){return Vd(this,t)}intersectsCircle(t){return Vd(this,t)}intersectsPolygon(t){return Vd(this,t)}intersectsGeoPolygon(t){return Vd(this,t)}resolveLocalTransform(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new kd;void 0!==this.attrs.transform&&Nd(this.attrs.transform,t),this.modelViewMatrix=t.clone()}resolveGlobalTransform(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new kd;const e=this.ancestors;if(e.length>0)for(let n=e.length-1;n>=0;n--)e[n].resolveLocalTransform(t),t=e[n].modelViewMatrix;this.resolveLocalTransform(t)}attr(t){return this.attrs[t]}equals(t){const e=this.attrs,n=Object.keys(e),i=t.attrs,r=Object.keys(i);if(n.length!==r.length)return!1;for(let t=0;t<n.length;t++){const r=n[t];if(!Object.hasOwnProperty.call(i,r))return!1;if(e[r]!==i[r])return!1}return super.equals(t)}toJSON(){const t=super.toJSON();return t.attrs=this.attrs,t}get attrs(){return this._attrs}get stage(){return this._parent&&!this._stage?this._stage=this._parent.stage:this._parent||this._stage===this||(this._stage=null),this._stage}set modelViewMatrix(t){this._mvm=t,this._imvm=null}get modelViewMatrix(){return this._mvm}get inverseModelViewMatrix(){return this._imvm=this._imvm?this._imvm:this._mvm.clone().invert(),this._imvm}set node(t){this._node=t}get node(){return this._node}set collider(t){const e=Array.isArray(t)?"collection":t&&t.type;return"string"!=typeof e?(this._collider.type=null,this._collider.definition=null,void(this._collider.fn=null)):null!==this._collider&&this._collider.type===e&&null!==this._collider.fn?(this._collider.fn.set(t),void(this._collider.definition=t)):(this._collider.type=e,void(this._collider.definition=t))}get collider(){if(null!==this._collider.fn)return this._collider.fn;switch(this._collider.type){case"collection":this._collider.fn=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new wd(...e)}(this._collider.definition);break;case"frontChild":return!0;case"bounds":this._collider.fn=bd("rect",this.boundingRect());break;case"line":case"rect":case"circle":case"polygon":case"geopolygon":case"polyline":this._collider.fn=bd(this._collider.type,this._collider.definition);break;default:return null}return this._collider.fn}get colliderType(){return this._collider.type}}class Ud extends ld{addChild(t){if(!(t&&t instanceof ld))throw new TypeError("Expecting a Node as argument, but got ".concat(t));if(t===this)throw new Error("Can not add itself as child!");if(t._children&&t._children.length&&this.ancestors.indexOf(t)>=0)throw new Error("Can not add an ancestor as child!");return t._parent&&t._parent!==this&&t._parent.removeChild(t),this._children.push(t),t._parent=this,t._ancestors=null,this}addChildren(t){let e,n=t?t.length:0;for(e=0;e<n;e++)this.addChild(t[e]);return this}removeChild(t){const e=this._children.indexOf(t);return e>=0&&(this._children.splice(e,1),t._parent=null,t._ancestors=null),this}removeChildren(t){let e,n;if(!this._children)return this;if(t)for(n=t.length,e=0;e<n;e++)this.removeChild(t[e]);else for(;this._children.length;)this.removeChild(this._children[0]);return this}}const Yd=Ud.prototype;class Xd extends Wd{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:e="container"}=t;super(e),this.set(t)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super.set(t);const{collider:e}=t,n=_({type:null},e);this.collider=n,this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}appendChildRect(t,e){if(void 0!==t.bounds){const n=this.__boundingRect[e]||{},[i,,r]=t.bounds(e),{x:o,y:a}=i,{x:s,y:l}=r,c=isNaN(n.width)?s:Math.max(s,n.width+n.x),u=isNaN(n.height)?l:Math.max(l,n.height+n.y);n.x=isNaN(n.x)?o:Math.min(o,n.x),n.y=isNaN(n.y)?a:Math.min(a,n.y),n.width=c-n.x,n.height=u-n.y,this.__boundingRect[e]=n}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];const e=this.children.length;for(let n=0;n<e;n++)this.appendChildRect(this.children[n],t);return this.__boundingRect[t]=_({x:0,y:0,width:0,height:0},this.__boundingRect[t]),this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}addChild(t){const e=Yd.addChild.call(this,t);if(this._collider&&"bounds"===this._collider.type){this.appendChildRect(t,!0);const e=_({type:"bounds",x:0,y:0,width:0,height:0},this.__boundingRect.true);this.collider=e}return e}addChildren(t){const e=Yd.addChildren.call(this,t),n=t.length;if(this._collider&&"bounds"===this._collider.type&&n>0){for(let e=0;e<n;e++)this.appendChildRect(t[e],!0);const e=_({type:"bounds",x:0,y:0,width:0,height:0},this.__boundingRect.true);this.collider=e}return e}removeChild(t){t._stage=null;let e,n=t.descendants,i=n?n.length:0;for(e=0;e<i;e++)n[e]._stage=null;if(Yd.removeChild.call(this,t),this._collider&&"bounds"===this._collider.type){this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null};const t=_(this.boundingRect(!0),{type:"bounds"});this.collider=t}return this}removeChildren(t){if(Yd.removeChildren.call(this,t),this._collider&&"bounds"===this._collider.type){this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null};const t=_(this.boundingRect(!0),{type:"bounds"});this.collider=t}return this}}function Kd(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Xd(...e)}class Gd extends Xd{constructor(t){super("stage"),this._stage=this,this._dpiRatio=t||1}get dpi(){return this._dpiRatio}}const Zd=Ud.prototype,Jd=["x1","x2","y1","y2","id","offset","style"];class Qd extends Wd{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:e="container"}=t;super(e),this.set(t),this._boundingRect={}}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super.set(t);const e=this.attrs;let n="";for(let i=0,r=Jd.length;i!==r;i++)n=Jd[i],void 0!==t[n]&&(e[n]=t[n])}addChild(t){return Zd.addChild.call(this,t)}addChildren(t){return Zd.addChildren.call(this,t)}removeChild(t){t._stage=null;let e,n=t.descendants,i=n?n.length:0;for(e=0;e<i;e++)n[e]._stage=null;return Zd.removeChild.call(this,t),this}removeChildren(t){return Zd.removeChildren.call(this,t),this}}function tf(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Qd(...e)}const ef=Ud.prototype,nf=["patternUnits","x","y","width","height","id"];class rf extends Wd{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:e="container"}=t;super(e),this.set(t),this._boundingRect={}}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super.set(t);const e=this.attrs;let n="";for(let i=0,r=nf.length;i!==r;i++)n=nf[i],void 0!==t[n]&&(e[n]=t[n])}addChild(t){return ef.addChild.call(this,t)}addChildren(t){return ef.addChildren.call(this,t)}removeChild(t){t._stage=null;let e,n=t.descendants,i=n?n.length:0;for(e=0;e<i;e++)n[e]._stage=null;return ef.removeChild.call(this,t),this}removeChildren(t){return ef.removeChildren.call(this,t),this}}class of extends Wd{constructor(){super("rect"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{x:e=0,y:n=0,width:i=0,height:r=0,rx:o=0,ry:a=0,collider:s}=t,l=_({type:"rect",x:e,y:n,width:i,height:r},s);super.set(t),i>=0?(this.attrs.x=e,this.attrs.width=i):(this.attrs.x=e+i,this.attrs.width=-i),r>=0?(this.attrs.y=n,this.attrs.height=r):(this.attrs.y=n+r,this.attrs.height=-r),o>0&&(this.attrs.rx=o),a>0&&(this.attrs.ry=a),this.collider=l,this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];const e=E(this.attrs),n=t&&this.modelViewMatrix?this.modelViewMatrix.transformPoints(e):e,[i,r,o,a]=O(n);return this.__boundingRect[t]={x:i,y:r,width:o-i,height:a-r},this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}}class af extends Wd{constructor(){super("circle"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{cx:e=0,cy:n=0,r:i=0,collider:r}=t,o=_({type:"circle",cx:e,cy:n,r:i},r);super.set(t),this.attrs.cx=e,this.attrs.cy=n,this.attrs.r=i,this.collider=o,this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];const e=this.bounds(t);return this.__boundingRect[t]={x:e[0].x,y:e[0].y,width:e[2].x-e[0].x,height:e[2].y-e[0].y},this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const{cx:e,cy:n,r:i,r:r}=this.attrs,o=e-i,a=n-r;let s=2*i,l=2*r,c=[{x:o,y:a},{x:o+s,y:a},{x:o+s,y:a+l},{x:o,y:a+l}];if(t&&this.modelViewMatrix){c=this.modelViewMatrix.transformPoints(c);const[e,n,i,r]=O(c);s=i-e,l=r-n,this.__bounds[t]=[{x:e,y:n},{x:e+s,y:n},{x:e+s,y:n+l},{x:e,y:n+l}]}else this.__bounds[t]=c;return this.__bounds[t]}}class sf extends Wd{constructor(){super("line"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{x1:e=0,y1:n=0,x2:i=0,y2:r=0,collider:o}=t;super.set(t),this.attrs.x1=e,this.attrs.y1=n,this.attrs.x2=i,this.attrs.y2=r;const a={type:"line",x1:e,y1:n,x2:i,y2:r};this.collider=_(a,o),this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];let e=D(this.attrs);t&&this.modelViewMatrix&&(e=this.modelViewMatrix.transformPoints(e));const[n,i,r,o]=O(e),a=n!==r||i!==o;return this.__boundingRect[t]={x:n,y:i,width:a?Math.max(1,r-n):0,height:a?Math.max(1,o-i):0},this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}}const lf=Math.PI/2;function cf(t,e){const n=Math.atan2(e.y-t.y,e.x-t.x);return n<0?n+2*Math.PI:n}function uf(t,e,n){return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}}const hf={step:function(t){return new Pt(t,.5)},stepAfter:function(t){return new Pt(t,1)},stepBefore:function(t){return new Pt(t,0)},linear:pt,basis:function(t){return new kt(t)},cardinal:St.tension(0),catmullRom:qt,monotonex:function(t){return new Dt(t)},monotoney:function(t){return new Et(t)},natural:function(t){return new Tt(t)}};function df(t){if(t.length<2)return!1;const e=t[0],n=t[t.length-1];return Math.abs(e.x-n.x)<1e-12&&Math.abs(e.y-n.y)<1e-12}class ff extends Wd{constructor(){super("path"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(super.set(t),this.segments=[],this.points=[],t.arcDatum){const e=dt();e.innerRadius(t.desc.slice.innerRadius),e.outerRadius(t.desc.slice.outerRadius),e.cornerRadius(t.desc.slice.cornerRadius);const n=e(t.arcDatum);this.attrs.d=n}else if(t.points){const{major:e,minor:n,layerObj:i,points:r,stngs:o,generatorType:a}=t,s=yt(),l=o.coordinates?o.coordinates.defined:null;s[e.p]((t=>t.major*e.size))["".concat(n.p,"1")]((t=>t.minor*n.size))["".concat(n.p,"0")]((t=>t.minor0*n.size)).curve(hf["monotone"===i.curve?"monotone".concat(e.p):i.curve]),l?s.defined((t=>!t.dummy&&"number"==typeof t.minor&&!isNaN(t.minor)&&t.defined)):s.defined((t=>!t.dummy&&"number"==typeof t.minor&&!isNaN(t.minor)));const c=o.connect?r.filter(s.defined()):r,u=("area"===a?s:s[a]())(c);this.attrs.d=u}else t.d&&(this.attrs.d=t.d);if(this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null},Array.isArray(t.collider)||"object"==typeof t.collider&&void 0!==t.collider.type)this.collider=t.collider;else if(this.attrs.d){if(this.segments=od(this.attrs.d),this.segments.length>1&&this.segments.every((t=>df(t))))return void(this.collider=_({type:"geopolygon",vertices:this.segments},t.collider));this.segments.forEach((e=>{if(e.length<=1);else if(df(e))this.collider=_({type:"polygon",vertices:e},t.collider);else if("object"==typeof t.collider&&t.collider.visual){const n=this.attrs["stroke-width"]/2;this.collider=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=[],r=[];if("h"===n.forceOrientation){const e=t[0].x<t[1].x?-1:1,n=t[t.length-1].x>t[t.length-2].x?1:-1;t.unshift({x:t[0].x+e,y:t[0].y}),t.push({x:t[t.length-1].x+n,y:t[t.length-1].y})}else if("v"===n.forceOrientation){const e=t[0].y<t[1].y?-1:1,n=t[t.length-1].y>t[t.length-2].y?1:-1;t.unshift({x:t[0].x,y:t[0].y+e}),t.push({x:t[t.length-1].x,y:t[t.length-1].y+n})}const o=t.length-1;for(let n=1;n<o;n++){const a=t[n-1],s=t[n],l=t[n+1],c=cf(s,a),u=cf(s,l),h=(c+u)/2,d=h+Math.PI,f=Math.max(h,d),p=Math.min(h,d),g=c>u;if(1===n){const t=cf(a,s);i.push(uf(a,t-lf,e)),r.unshift(uf(a,t+lf,e))}const m=g?f:p,y=g?p:f;if(i.push(uf(s,m,e)),r.unshift(uf(s,y,e)),n===o-1){const t=cf(l,s);i.push(uf(l,t+lf,e)),r.unshift(uf(l,t-lf,e))}}return{type:"polygon",vertices:[...i,...r]}}(e,n,t.collider)}else this.collider=_({type:"polyline",points:e},t.collider)}))}}boundingRect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[t])return this.__boundingRect[t];this.points.length||(this.segments=this.segments.length?this.segments:od(this.attrs.d),this.points=function(t){const e=[];let n,i=t.length;for(let r=0;r<i;r++){n=t[r];for(let t=0;t<n.length;t++)e.push(n[t])}return e}(this.segments));const e=t&&this.modelViewMatrix?this.modelViewMatrix.transformPoints(this.points):this.points,[n,i,r,o]=O(e);return this.__boundingRect[t]={x:n||0,y:i||0,width:r-n||0,height:o-i||0},this.__boundingRect[t]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}}function pf(t){let{data:e,_boundingRect:n,_textBoundsFn:i}=t;return null!=e&&(n||i)}class gf extends Wd{constructor(){super("text"),this.set(...arguments)}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{x:e=0,y:n=0,dx:i=0,dy:r=0,textBoundsFn:o,text:a,title:s,collider:l,boundingRect:c,ellipsed:u}=t;super.set(t),this.attrs.x=e,this.attrs.y=n,this.attrs.dx=i,this.attrs.dy=r,this.attrs.text=a,void 0!==s&&(this.attrs.title=String(s)),"object"==typeof c?this._textBoundsFn=()=>c:"function"==typeof o&&(this._textBoundsFn=o),"string"==typeof u&&(this.ellipsed=u),this.collider=_({type:pf(this)?"bounds":null},l),this.__boundingRect={true:null,false:null},this.__bounds={true:null,false:null}}boundingRect(){let t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__boundingRect[e])return this.__boundingRect[e];if("function"!=typeof this._textBoundsFn)return{x:0,y:0,width:0,height:0};t=this._textBoundsFn(this.attrs);const n=E(t),i=e&&this.modelViewMatrix?this.modelViewMatrix.transformPoints(n):n,[r,o,a,s]=O(i);return this.__boundingRect[e]={x:r,y:o,width:a-r,height:s-o},this.__boundingRect[e]}bounds(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null!==this.__bounds[t])return this.__bounds[t];const e=this.boundingRect(t);return this.__bounds[t]=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],this.__bounds[t]}}const mf=Ht();function yf(t,e){return mf.get(t)(e)}mf.add("rect",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new of(...e)})),mf.add("circle",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new af(...e)})),mf.add("text",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new gf(...e)})),mf.add("line",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new sf(...e)})),mf.add("path",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new ff(...e)})),mf.add("stage",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new Gd(...e)})),mf.add("container",Kd),mf.add("defs",Kd),mf.add("linearGradient",tf),mf.add("radialGradient",tf),mf.add("stop",tf),mf.add("pattern",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new rf(...e)}));const vf=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=[{}];function n(){return e[e.length-1]}return n.save=function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=n(),o={};let a="";for(let e=0;e<t.length;e++)a=t[e],void 0!==r[a]&&(o[a]=r[a]);return _(o,i),e.push(o),n()},n.restore=function(){e.splice(e.length-1,1)},n}(["stroke","fill","strokeWidth","opacity","fontFamily","fontSize","baseline"]);function xf(t,e){if(Array.isArray(e))for(let n=0,i=e.length;n<i;n++)e[n](t)}function bf(t,e,n){t.node=n[e],t.index=e}function wf(t,e,n,i){let r=!1;const o={siblings:t,node:null,index:0};for(let a=0,s=t.length;a<s;a++){if(bf(o,a,t),xf(o,i.create),r="function"==typeof o.node.disabled?o.node.disabled():o.node.disabled,r)continue;o.node=vf.save(o.node);const s=yf(o.node.type,o.node);s&&(o.node.transform&&(n.save(),Nd(o.node.transform,n)),n.isIdentity()||(s.modelViewMatrix=n.clone()),e.addChild(s),o.node.children&&wf(o.node.children,s,n,i),o.node.transform&&n.restore()),vf.restore()}}function kf(t){let{items:e,stage:n,dpi:i,on:r={}}=t;return n||(n=yf("stage",i)),wf(e,n,new kd,r),n}function _f(t,e,n){const{orientation:i,degree:r,stops:o=[]}=n;let a=null;if("radial"===i){const n=e.boundingRect();a=t.createRadialGradient(n.x+n.width/2,n.y+n.height/2,1e-5,n.x+n.width/2,n.y+n.height/2,Math.max(n.width,n.height)/2)}else{const i=Aa(r);["x1","x2","y1","y2"].forEach((t=>{t in n&&(i[t]=n[t])}));const o=e.boundingRect();a=t.createLinearGradient(o.x+i.x1*o.width,o.y+i.y1*o.height,o.x+i.x2*o.width,o.y+i.y2*o.height)}for(let t=0,e=o.length;t<e;t++){let e=o[t];a.addColorStop(e.offset,e.color)}return a}function Mf(t,e,n){return e.width=t.width,e.height=t.height,n.save(),n.fillStyle=t.fill,t.shapes.forEach((t=>{switch(t.type){case"rect":n.rect(t.x,t.y,t.width,t.height)}})),n.fill(),n.restore(),n.createPattern(e,"repeat")}function Sf(t){const e=t.createElement("canvas"),n=e.getContext("2d");let i={};return{create(t){const r=t.key;return r?(i[r]=i[r]||Mf(t,e,n),i[r]):Mf(t,e,n)},clear(){i={}}}}function Cf(){let{x:t,y:e,width:n,height:i,scaleRatio:r,margin:o,edgeBleed:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s={x:0,y:0,width:0,height:0,scaleRatio:{x:1,y:1},margin:{left:0,top:0},edgeBleed:{left:0,right:0,top:0,bottom:0,bool:!1}};return s.x=isNaN(t)?s.x:t,s.y=isNaN(e)?s.y:e,s.width=isNaN(n)?s.width:n,s.height=isNaN(i)?s.height:i,void 0!==r&&(s.scaleRatio.x=isNaN(r.x)?s.scaleRatio.x:r.x,s.scaleRatio.y=isNaN(r.y)?s.scaleRatio.y:r.y),void 0!==o&&(s.margin.left=isNaN(o.left)?0:o.left,s.margin.top=isNaN(o.top)?0:o.top),"object"==typeof a&&["left","right","top","bottom"].forEach((t=>{!isNaN(a[t])&&a[t]>0&&(s.edgeBleed[t]=a[t],s.edgeBleed.bool=!0)})),s.computedPhysical={x:Math.round(s.margin.left+(s.x-s.edgeBleed.left)*s.scaleRatio.x),y:Math.round(s.margin.top+(s.y-s.edgeBleed.top)*s.scaleRatio.y),width:Math.round((s.width+s.edgeBleed.left+s.edgeBleed.right)*s.scaleRatio.x),height:Math.round((s.height+s.edgeBleed.top+s.edgeBleed.bottom)*s.scaleRatio.y)},s}function qf(){const t={element:()=>{},root:()=>{},settings:()=>{},appendTo:()=>{},getScene:()=>[],render:()=>!1,itemsAt:()=>[],findShapes:()=>[],clear:()=>{},destory:()=>{},size:()=>{},measureText:th,textBounds:nh,setKey:e=>{t.element().setAttribute("data-key",e)}};return t}function Nf(t){return e=>{let{node:n}=e;"text"===n.type&&function(t){return null!=t}(n.data)&&!n.textBoundsFn&&(n.textBoundsFn=t.textBounds)}}const Rf=200,Af=200;class Of{constructor(t){this.targetCanvas=t,this.bufferCanvas=t.cloneNode()}updateSize(t){let e,{rect:n,dpiRatio:i,canvasBufferSize:r}=t;e=r?"function"==typeof r?r(n):r:{width:n.computedPhysical.width+2*Rf,height:n.computedPhysical.height+2*Af},this.bufferCanvas.style.width="".concat(e.width,"px"),this.bufferCanvas.style.height="".concat(e.height,"px"),this.bufferCanvas.width=Math.round(e.width*i),this.bufferCanvas.height=Math.round(e.height*i)}apply(){this.targetCanvas.getContext("2d").drawImage(this.bufferCanvas,0,0)}clear(){this.bufferCanvas.width=this.bufferCanvas.width}getContext(){return this.bufferCanvas.getContext("2d")}}const Df=Ht();function Ef(t){return Array.isArray(t)?t:"string"==typeof t?-1!==t.indexOf(",")?t.split(","):t.split(" "):[]}function If(t){return("undefined"==typeof window?1:window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)}function Tf(t,e){e.setTransform(t[0][0],t[1][0],t[0][1],t[1][1],t[0][2],t[1][2])}function jf(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=Object.keys(i);for(let r=0,o=n.length;r<o;r++){let o=n[r];const a=o[0],s=o[1],l=o[2];if(a in e.attrs&&!(s in i)&&t[s]!==e.attrs[a]){const n=l?l(e.attrs[a]):e.attrs[a];"function"==typeof t[s]?t[s](n):t[s]=n}}for(let e=0,n=r.length;e<n;e++){const n=r[e];t[n]=i[n]}}function Pf(t,e,n,i){for(let r=0,o=t.length;r<o;r++){let o=t[r],a={};e.save(),o.attrs&&(o.attrs.fill||o.attrs.stroke)&&(o.attrs.fill&&"object"==typeof o.attrs.fill&&"gradient"===o.attrs.fill.type?a.fillStyle=_f(e,o,o.attrs.fill):o.attrs.fill&&"object"==typeof o.attrs.fill&&"pattern"===o.attrs.fill.type&&(a.fillStyle=i.patterns.create(o.attrs.fill)),o.attrs.stroke&&"object"==typeof o.attrs.stroke&&"gradient"===o.attrs.stroke.type?a.strokeStyle=_f(e,o,o.attrs.stroke):o.attrs.stroke&&"object"==typeof o.attrs.stroke&&"pattern"===o.attrs.stroke.type&&(a.strokeStyle=i.patterns.create(o.attrs.stroke))),jf(e,o,n,a),o.modelViewMatrix&&Tf(o.modelViewMatrix.elements,e),Df.has(o.type)&&Df.get(o.type)(o.attrs,{g:e,doFill:"fill"in o.attrs&&"none"!==o.attrs.fill,doStroke:"stroke"in o.attrs&&0!==o.attrs["stroke-width"],ellipsed:o.ellipsed}),o.children&&Pf(o.children,e,n,i),e.restore()}}function zf(t){let{el:e,dpiRatio:n,transform:i}=t;if("object"==typeof i){const t=[i.horizontalScaling,i.horizontalSkewing,i.verticalSkewing,i.verticalScaling,i.horizontalMoving*n,i.verticalMoving*n];e.getContext("2d").setTransform(...t)}}function Ff(){let t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:kf;const i={transform:void 0,canvasBufferSize:void 0,progressive:void 0};let r,o=!1,a=Cf();const s=[["fill","fillStyle"],["stroke","strokeStyle"],["opacity","globalAlpha"],["globalAlpha","globalAlpha"],["stroke-width","lineWidth"],["stroke-linejoin","lineJoin"],["stroke-dasharray","setLineDash",Ef]];let l;const c=qf();return c.element=()=>t,c.root=()=>t,c.settings=t=>(t&&Object.keys(i).forEach((e=>{void 0!==t[e]&&(i[e]=t[e])})),i),c.appendTo=n=>(t||(t=n.ownerDocument.createElement("canvas"),t.style.position="absolute",t.style["-webkit-font-smoothing"]="antialiased",t.style["-moz-osx-font-smoothing"]="antialiased",t.style.pointerEvents="none"),"function"!=typeof i.transform||e||(e=new Of(t)),n.appendChild(t),t),c.getScene=i=>{const r=If(e&&e.getContext()||t.getContext("2d")),o=a.scaleRatio.x,s=a.scaleRatio.y,l={type:"container",children:i,transform:a.edgeBleed.bool?"translate(".concat(a.edgeBleed.left*r*o,", ").concat(a.edgeBleed.top*r*s,")"):""};return 1===r&&1===o&&1===s||(l.transform+="scale(".concat(r*o,", ").concat(r*s,")")),n({items:[l],dpi:r,on:{create:[Wu(c.measureText),Nf(c)]}})},c.render=n=>{if(!t)return!1;l||(l=Sf(t.ownerDocument));const u=e&&e.getContext()||t.getContext("2d"),h=If(u),d=e&&i.transform();if(d)return t.width=t.width,zf({el:t,dpiRatio:h,transform:d}),e.apply(),!0;o&&(t.style.left="".concat(a.computedPhysical.x,"px"),t.style.top="".concat(a.computedPhysical.y,"px"),t.style.width="".concat(a.computedPhysical.width,"px"),t.style.height="".concat(a.computedPhysical.height,"px"),t.width=Math.round(a.computedPhysical.width*h),t.height=Math.round(a.computedPhysical.height*h),e&&e.updateSize({rect:a,dpiRatio:h,canvasBufferSize:i.canvasBufferSize}));const f=c.getScene(n),p=!r||!f.equals(r);l.clear();const g=o||p,m="function"==typeof i.progressive&&i.progressive();return g&&(m&&!m.isFirst||c.clear(),Pf(f.children,u,s,{patterns:l})),e&&(t.width=t.width,e.apply()),o=!1,m&&!m.isFirst&&f.children.unshift(...r.children),r=f,g},c.itemsAt=t=>r?r.getItemsFrom(t):[],c.findShapes=t=>r?r.findShapes(t):[],c.clear=()=>(t&&(t.width=t.width),e&&e.clear(),r=null,c),c.size=t=>{if(t){const e=Cf(t);JSON.stringify(a)!==JSON.stringify(e)&&(o=!0,a=e)}return a},c.destroy=()=>{t&&(t.parentElement&&t.parentElement.removeChild(t),t=null),e&&(e=null),r=null},c}function Lf(t,e){Df.add(t,e)}function $f(t,e){return Math.max(0,Math.min(t,e))}const Bf=new RegExp("[A-Za-zªµºÀ-ÖØ-öø-ʸʻ-ˁː-ˑˠ-ˤˮͰ-ͳͶ-ͽΆΈ-ϵϷ-҂Ҋ-։ः-हऻऽ-ीॉ-ौॎ-ॐक़-ॡ।-ॿং-হঽ-ীে-ৌৎ-ৡ০-ৱ৴-৺ਃ-ਹਾ-ੀਖ਼-੯ੲ-ੴઃ-હઽ-ીૉ-ૌૐ-ૡ૦-૯ଂ-ହଽ-ାୀେ-ୌୗ-ୡ୦-୷ஃ-ிு-ௌௐ-௲ఁ-ఽు-ౄౘ-ౡ౦-౯౿-ಹಽ-ೋೕ-ೡ೦-ീെ-ൌൎ-ൡ൦-ෆා-ෑෘ-ะา-ำเ-ๆ๏-ະາ-ຳຽ-ໆ໐-༗༚-༴༶༸༾-ཬཿ྅ྈ-ྌ྾-࿅࿇-ာေးျ-ြဿ-ၗၚ-ၝၡ-ၰၵ-ႁႃ-ႄႇ-ႌႎ-ႜ႞-ፚ፠-ᎏᎠ-Ᏼᐁ-ᙿᚁ-ᚚᚠ-ᜑᜠ-ᜱ᜵-ᝑᝠ-ᝰក-ាើ-ៅះ-ៈ។-៚ៜ០-៩᠐-ᢨᢪ-ᤜᤣ-ᤦᤩ-ᤱᤳ-ᤸ᥆-᧚ᨀ-ᨖᨙ-ᩕᩗᩡᩣ-ᩤᩭ-ᩲ᪀-᪭ᬄ-ᬳᬵᬻᬽ-ᭁᭃ-᭪᭴-᭼ᮂ-ᮡᮦ-ᮧ᮪-ᯥᯧᯪ-ᯬᯮ᯲-ᰫᰴ-ᰵ᰻-᱿᳓᳡ᳩ-ᳬᳮ-ᶿḀ-ᾼιῂ-ῌῐ-Ίῠ-Ῥῲ-ῼ‎ⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎ-⅏Ⅰ-ↈ⌶-⍺⎕⒜-ⓩ⚬⠀-⣿Ⰰ-ⳤⳫ-ⳮⴀ-⵰ⶀ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ㆺㇰ-㈜㈠-㉏㉠-㉻㉿-㊰㋀-㋋㋐-㍶㍻-㏝㏠-㏾㐀-䶵一-ꒌꓐ-ꘌꘐ-ꙮꚀ-ꛯ꛲-꛷Ꜣ-ꞇ꞉-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠤꠧ꠰-꠷ꡀ-ꡳꢀ-ꣃ꣎-꣙ꣲ-ꤥ꤮-ꥆꥒ-ꥼꦃ-ꦲꦴ-ꦵꦺ-ꦻꦽ-ꨨꨯ-ꨰꨳ-ꨴꩀ-ꩂꩄ-ꩋꩍ-ꪯꪱꪵ-ꪶꪹ-ꪽꫀꫂ-ꯤꯦ-ꯧꯩ-꯬꯰-ﬗA-Za-zヲ-ᅵ]"),Hf=new RegExp("[־׀׃׆א-״߀-ߪߴ-ߵߺ-ࠕࠚࠤࠨ࠰-ࡘ࡞‏יִײַ-ﬨשׁ-ﭏ]"),Vf=new RegExp("[؈؋؍؛-ي٭-ٯٱ-ەۥ-ۦۮ-ۯۺ-܍ܐܒ-ܯݍ-ޥޱﭐ-ﴽﵐ-﷼ﹰ-ﻼ]");function Wf(t){return Bf.test(t)}function Uf(t){return Hf.test(t)||Vf.test(t)}function Yf(t){let e,n,i=t?t.length:0;for(e=0;e<i;e++){if(n=t[e],Wf(n))return"ltr";if(Uf(n))return"rtl"}return"ltr"}const Xf={start:"end",end:"start",center:"center",middle:"middle"};function Kf(t,e){return"rtl"===e?Xf[t]:t}function Gf(t,e){const n=[];let i;const r=[],o=[],a=[];let s,l;const c=t=>t.id,u=(t,e)=>{let n;return n="object"==typeof t?"id"in t?t.id:e:t,{content:t,id:"".concat(n,"__").concat(t.type||"")}};t.isTree||(t=t.map(u)),e=e.map(u),s=t.map(c),l=e.map(c);for(let t=0,i=e.length;t<i;t++){-1===s.indexOf(e[t].id)?n.push(e[t]):o.push(e[t])}for(let e=0,n=t.length;e<n;e++){-1===l.indexOf(t[e].id)?r.push(t[e]):a.push(t[e])}for(let t=0,e=n.length;t<e;t++)n[t].content.children&&(n[t].diff=Gf([],n[t].content.children),n[t].children=n[t].diff.updatedNew.concat(n[t].diff.added),n[t].children.isTree=!0);for(let t=0,e=o.length;t<e;t++)o[t].diff=Gf(a[t].children||[],o[t].content.children||[]),o[t].object=a[t].object,o[t].children=o[t].diff.items;return i=o.concat(n),n.isTree=!0,r.isTree=!0,o.isTree=!0,a.isTree=!0,i.isTree=!0,{added:n,updatedNew:o,updatedOld:a,removed:r,items:i}}function Zf(t,e,n){for(let i=0,r=t.length;i<r;i++)t[i].object=n(t[i].content.type,e)}function Jf(t,e){for(let n=0,i=t.length;n<i;n++)null!==t[n].object&&void 0!==t[n].object&&(e(t[n].object),t[n].object=null)}function Qf(t,e,n,i){let r;for(let o=0,a=t.length;o<a;o++)r=t[o],null!==r.object&&void 0!==r.object&&(n(r.object,r.content),r.diff&&(Zf(r.diff.added,r.object,e),Jf(r.diff.removed,i),Qf(r.diff.items,e,n,i)))}function tp(t,e,n,i,r,o){const a=Gf(t,e);return Zf(a.added,n,i),Jf(a.removed,o),Qf(a.items,i,r,o),a.items}Lf("rect",(function(t,e){let{g:n,doFill:i,doStroke:r}=e;n.beginPath(),t.rx>0||t.ry>0?function(t,e,n,i,r,o,a){o=$f(i/2,o>0?o:a),a=$f(r/2,a>0?a:o),t.moveTo(e,n+a),t.lineTo(e,n+r-a),t.quadraticCurveTo(e,n+r,e+o,n+r),t.lineTo(e+i-o,n+r),t.quadraticCurveTo(e+i,n+r,e+i,n+r-a),t.lineTo(e+i,n+a),t.quadraticCurveTo(e+i,n,e+i-o,n),t.lineTo(e+o,n),t.quadraticCurveTo(e,n,e,n+a)}(n,t.x,t.y,t.width,t.height,t.rx,t.ry):n.rect(t.x,t.y,t.width,t.height),i&&n.fill(),r&&n.stroke()})),Lf("circle",(function(t,e){let{g:n,doFill:i,doStroke:r}=e;n.beginPath(),n.moveTo(t.cx+t.r,t.cy),n.arc(t.cx,t.cy,t.r,0,2*Math.PI,!1),i&&n.fill(),r&&n.stroke()})),Lf("line",(function(t,e){let{g:n,doStroke:i}=e;n.beginPath(),n.moveTo(t.x1,t.y1),n.lineTo(t.x2,t.y2),i&&n.stroke()})),Lf("path",(function(t,e){let{g:n,doStroke:i,doFill:r}=e;const o=new Path2D(t.d);r&&n.fill(o),i&&n.stroke(o)})),Lf("text",(function(t,e){let{g:n,ellipsed:i,doStroke:r}=e;const o=i||Uu(t,th);t["font-weight"]?n.font="".concat(t["font-weight"]," ").concat(t["font-size"]," ").concat(t["font-family"]):n.font="".concat(t["font-size"]," ").concat(t["font-family"]);const a=Yf(t.text);n.canvas.dir!==a&&(n.canvas.dir=a);const s=Kf("middle"===t["text-anchor"]?"center":t["text-anchor"],n.canvas.dir);s&&n.textAlign!==s&&(n.textAlign=s);const l=Yu(t);n.fillText(o,t.x+t.dx,t.y+t.dy+l),r&&n.strokeText(o,t.x+t.dx,t.y+t.dy+l)}));const ep="http://www.w3.org/2000/svg",np=(t,e)=>{if(!t||"string"!=typeof t)throw new Error("Invalid type: ".concat(t));const n=e.ownerDocument.createElementNS(ep,"container"===t?"g":t);return e.appendChild(n),n},ip=t=>{t.parentNode&&t.parentNode.removeChild(t)},rp=(t,e)=>{if((t=>{switch(t.type){case"circle":return!isNaN(t.attrs.cx)&&!isNaN(t.attrs.cy)&&!isNaN(t.attrs.r);case"line":return!(isNaN(t.attrs.x1)||isNaN(t.attrs.y1)||isNaN(t.attrs.x2)||isNaN(t.attrs.y2));case"rect":return!(isNaN(t.attrs.x)||isNaN(t.attrs.y)||isNaN(t.attrs.width)||isNaN(t.attrs.height));case"text":return!isNaN(t.attrs.x)&&!isNaN(t.attrs.y);default:return!0}})(e)){for(const n in e.attrs)if("stroke"===n&&e.strokeReference)t.setAttribute("stroke",e.strokeReference);else if("fill"===n&&e.fillReference)t.setAttribute("fill",e.fillReference);else if("text"===n){t.setAttribute("style","white-space: pre"),t.textContent=e.ellipsed||Uu(e.attrs,th);const n=Yf(e.attrs.text);"rtl"===n&&(t.setAttribute("direction","rtl"),t.setAttribute("dir","rtl"),t.setAttribute("text-anchor",Kf(t.getAttribute("text-anchor"),n)))}else if("text"!==e.type||"dy"!==n&&"dominant-baseline"!==n)if("text"===e.type&&"title"===n&&e.attrs.title){const n=t.ownerDocument.createElementNS(ep,"title");n.textContent=e.attrs.title,t.appendChild(n)}else t.setAttribute(n,e.attrs[n]);else{const i=+t.getAttribute(n)||0;let r=0;r="dominant-baseline"===n?Yu(e.attrs):e.attrs[n],t.setAttribute("dy",r+i)}if("string"==typeof e.data||"number"==typeof e.data||"boolean"==typeof e.data)t.setAttribute("data",e.data);else if("object"==typeof e.data&&null!==e.data)for(const n in e.data)"string"!=typeof e.data[n]&&"number"!=typeof e.data[n]&&"boolean"!=typeof e.data[n]||t.setAttribute("data-".concat(n),e.data[n])}};class op{constructor(t,e,n,i){this.create=t,this.nodeCreator=e,this.nodeMaintainer=n,this.nodeDestroyer=i}render(t,e){return this.create([],t,e,this.nodeCreator,this.nodeMaintainer,this.nodeDestroyer)}}function ap(){return new op(tp,np,rp,ip)}function sp(t){let e,n,i,r=0;if(0===(t=JSON.stringify(t)).length)return r;for(e=0,i=t.length;e<i;e++)n=t.charCodeAt(e),r=(r<<5)-r+n,r&=r;return r}function lp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sp,n={},i=Date.now();const r={getOrCreateGradient(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fill",a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=e(r[o]),l="picasso-gradient-".concat(i,"-").concat(s);if(!n[s]){let{orientation:e,degree:i,stops:a=[]}=r[o],c={};void 0===i&&(i=90),"radial"===e?c.type="radialGradient":(c=Aa(i),["x1","x2","y1","y2"].forEach((t=>{t in r[o]&&(c[t]=r[o][t])})),c.type="linearGradient"),c.id=l,c.children=a.map((t=>{let{offset:e,color:n,opacity:i}=t;return{type:"stop",offset:"".concat(100*e,"%"),style:"stop-color:".concat(n,";stop-opacity:").concat(void 0!==i?i:1)}})),t.push(c),n[s]=l}return"url('".concat(a,"#").concat(l,"')")},onCreate(t){let e="";"undefined"!=typeof window&&(e=window.location.href.split("#")[0]);const n=t.node;n.fill&&"object"==typeof n.fill&&"gradient"===n.fill.type&&(n.fillReference=r.getOrCreateGradient(n,"fill",e)),n.stroke&&"object"==typeof n.stroke&&"gradient"===n.stroke.type&&(n.strokeReference=r.getOrCreateGradient(n,"stroke",e))},clear(){n={}}};return r}function cp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sp,n={},i=Date.now();const r={onCreate(r){let o={};r.node&&"object"==typeof r.node.fill&&"pattern"===r.node.fill.type&&r.node.fill.shapes&&(o.fill=r.node.fill),r.node&&"object"==typeof r.node.stroke&&"pattern"===r.node.stroke.type&&r.node.stroke.shapes&&(o.stroke=r.node.stroke),Object.keys(o).forEach((a=>{let s="";const l=o[a],c=e(l),u="picasso-pattern-".concat(i,"-").concat(c);if("undefined"!=typeof window&&(s=window.location.href.split("#")[0]),!n[c]){const e={patternUnits:"userSpaceOnUse",x:0,y:0,width:l.width,height:l.height,type:"pattern",id:u,children:[],fill:l.fill};l.shapes.forEach((t=>{e.children.push(t)})),t.push(e),n[c]=!0}r.node["".concat(a,"Reference")]="url('".concat(s,"#").concat(u,"')")}))},clear(){n={}}};return r}function up(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ap,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ep,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:kf;const i=t();let r,o,a,s=!1,l=Cf();const c={transform:void 0},u=qf(),h={type:"defs",children:[]},d=cp(h.children),f=lp(h.children);return u.element=()=>r,u.root=()=>o,u.settings=t=>(t&&Object.keys(c).forEach((e=>{void 0!==t[e]&&(c[e]=t[e])})),c),u.appendTo=t=>(r||(r=t.ownerDocument.createElementNS(e,"svg"),r.style.position="absolute",r.style["-webkit-font-smoothing"]="antialiased",r.style["-moz-osx-font-smoothing"]="antialiased",r.style.pointerEvents="none",r.setAttribute("xmlns",e),o=t.ownerDocument.createElementNS(e,"g"),o.style.pointerEvents="auto",r.appendChild(o)),t.appendChild(r),r),u.getScene=t=>{const e=l.scaleRatio.x,i=l.scaleRatio.y,r={type:"container",children:Array.isArray(t)?[...t,h]:t,transform:l.edgeBleed.bool?"translate(".concat(l.edgeBleed.left*e,", ").concat(l.edgeBleed.top*i,")"):""};return 1===e&&1===i||(r.transform+="scale(".concat(e,", ").concat(i,")")),n({items:[r],on:{create:[t=>{t.node.fillReference=void 0,t.node.strokeReference=void 0},f.onCreate,d.onCreate,Wu(u.measureText),Nf(u)]}})},u.render=t=>{if(!r)return!1;const e="function"==typeof c.transform&&c.transform();if(e){const{a:t,b:n,c:i,d:r,e:a,f:s}=e;return o.style.transform="matrix(".concat(t,", ").concat(n,", ").concat(i,", ").concat(r,", ").concat(a,", ").concat(s,")"),!0}o.style.transform="",s&&(r.style.left="".concat(l.computedPhysical.x,"px"),r.style.top="".concat(l.computedPhysical.y,"px"),r.setAttribute("width",l.computedPhysical.width),r.setAttribute("height",l.computedPhysical.height)),f.clear(),d.clear(),h.children.length=0;const n=u.getScene(t),p=!a||!n.equals(a),g=s||p;return g&&(u.clear(),i.render(n.children,o)),s=!1,a=n,g},u.itemsAt=t=>a?a.getItemsFrom(t):[],u.findShapes=t=>a?a.findShapes(t):[],u.clear=()=>{if(!o)return u;a=null;const t=o.cloneNode(!1);return r.replaceChild(t,o),o=t,u},u.destroy=()=>{r&&r.parentNode&&r.parentNode.removeChild(r),r=null,o=null},u.size=t=>{if(t){const e=Cf(t);JSON.stringify(l)!==JSON.stringify(e)&&(s=!0,l=e)}return l},u}var hp,dp,fp,pp,gp,mp={},yp=[],vp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function xp(t,e){for(var n in e)t[n]=e[n];return t}function bp(t){var e=t.parentNode;e&&e.removeChild(t)}function wp(t,e,n){var i,r,o,a={};for(o in e)"key"==o?i=e[o]:"ref"==o?r=e[o]:a[o]=e[o];if(arguments.length>2&&(a.children=arguments.length>3?hp.call(arguments,2):n),"function"==typeof t&&null!=t.defaultProps)for(o in t.defaultProps)void 0===a[o]&&(a[o]=t.defaultProps[o]);return kp(t,a,i,r,null)}function kp(t,e,n,i,r){var o={type:t,props:e,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++fp:r};return null==r&&null!=dp.vnode&&dp.vnode(o),o}function _p(t){return t.children}function Mp(t,e){this.props=t,this.context=e}function Sp(t,e){if(null==e)return t.__?Sp(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?Sp(t):null}function Cp(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return Cp(t)}}function qp(t){(!t.__d&&(t.__d=!0)&&pp.push(t)&&!Np.__r++||gp!==dp.debounceRendering)&&((gp=dp.debounceRendering)||setTimeout)(Np)}function Np(){for(var t;Np.__r=pp.length;)t=pp.sort((function(t,e){return t.__v.__b-e.__v.__b})),pp=[],t.some((function(t){var e,n,i,r,o,a;t.__d&&(o=(r=(e=t).__v).__e,(a=e.__P)&&(n=[],(i=xp({},r)).__v=r.__v+1,jp(a,r,i,e.__n,void 0!==a.ownerSVGElement,null!=r.__h?[o]:null,n,null==o?Sp(r):o,r.__h),Pp(n,r),r.__e!=o&&Cp(r)))}))}function Rp(t,e,n,i,r,o,a,s,l,c){var u,h,d,f,p,g,m,y=i&&i.__k||yp,v=y.length;for(n.__k=[],u=0;u<e.length;u++)if(null!=(f=n.__k[u]=null==(f=e[u])||"boolean"==typeof f?null:"string"==typeof f||"number"==typeof f||"bigint"==typeof f?kp(null,f,null,null,f):Array.isArray(f)?kp(_p,{children:f},null,null,null):f.__b>0?kp(f.type,f.props,f.key,f.ref?f.ref:null,f.__v):f)){if(f.__=n,f.__b=n.__b+1,null===(d=y[u])||d&&f.key==d.key&&f.type===d.type)y[u]=void 0;else for(h=0;h<v;h++){if((d=y[h])&&f.key==d.key&&f.type===d.type){y[h]=void 0;break}d=null}jp(t,f,d=d||mp,r,o,a,s,l,c),p=f.__e,(h=f.ref)&&d.ref!=h&&(m||(m=[]),d.ref&&m.push(d.ref,null,f),m.push(h,f.__c||p,f)),null!=p?(null==g&&(g=p),"function"==typeof f.type&&f.__k===d.__k?f.__d=l=Ap(f,l,t):l=Op(t,f,d,y,p,l),"function"==typeof n.type&&(n.__d=l)):l&&d.__e==l&&l.parentNode!=t&&(l=Sp(d))}for(n.__e=g,u=v;u--;)null!=y[u]&&Fp(y[u],y[u]);if(m)for(u=0;u<m.length;u++)zp(m[u],m[++u],m[++u])}function Ap(t,e,n){for(var i,r=t.__k,o=0;r&&o<r.length;o++)(i=r[o])&&(i.__=t,e="function"==typeof i.type?Ap(i,e,n):Op(n,i,i,r,i.__e,e));return e}function Op(t,e,n,i,r,o){var a,s,l;if(void 0!==e.__d)a=e.__d,e.__d=void 0;else if(null==n||r!=o||null==r.parentNode)t:if(null==o||o.parentNode!==t)t.appendChild(r),a=null;else{for(s=o,l=0;(s=s.nextSibling)&&l<i.length;l+=1)if(s==r)break t;t.insertBefore(r,o),a=o}return void 0!==a?a:r.nextSibling}function Dp(t,e,n){"-"===e[0]?t.setProperty(e,n):t[e]=null==n?"":"number"!=typeof n||vp.test(e)?n:n+"px"}function Ep(t,e,n,i,r){var o;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||Dp(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||Dp(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])o=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?i||t.addEventListener(e,o?Tp:Ip,o):t.removeEventListener(e,o?Tp:Ip,o);else if("dangerouslySetInnerHTML"!==e){if(r)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==e&&"list"!==e&&"form"!==e&&"tabIndex"!==e&&"download"!==e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&-1==e.indexOf("-")?t.removeAttribute(e):t.setAttribute(e,n))}}function Ip(t){this.l[t.type+!1](dp.event?dp.event(t):t)}function Tp(t){this.l[t.type+!0](dp.event?dp.event(t):t)}function jp(t,e,n,i,r,o,a,s,l){var c,u,h,d,f,p,g,m,y,v,x,b,w,k,_,M=e.type;if(void 0!==e.constructor)return null;null!=n.__h&&(l=n.__h,s=e.__e=n.__e,e.__h=null,o=[s]),(c=dp.__b)&&c(e);try{t:if("function"==typeof M){if(m=e.props,y=(c=M.contextType)&&i[c.__c],v=c?y?y.props.value:c.__:i,n.__c?g=(u=e.__c=n.__c).__=u.__E:("prototype"in M&&M.prototype.render?e.__c=u=new M(m,v):(e.__c=u=new Mp(m,v),u.constructor=M,u.render=Lp),y&&y.sub(u),u.props=m,u.state||(u.state={}),u.context=v,u.__n=i,h=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=M.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=xp({},u.__s)),xp(u.__s,M.getDerivedStateFromProps(m,u.__s))),d=u.props,f=u.state,h)null==M.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==M.getDerivedStateFromProps&&m!==d&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(m,v),!u.__e&&null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(m,u.__s,v)||e.__v===n.__v){for(u.props=m,u.state=u.__s,e.__v!==n.__v&&(u.__d=!1),u.__v=e,e.__e=n.__e,e.__k=n.__k,e.__k.forEach((function(t){t&&(t.__=e)})),x=0;x<u._sb.length;x++)u.__h.push(u._sb[x]);u._sb=[],u.__h.length&&a.push(u);break t}null!=u.componentWillUpdate&&u.componentWillUpdate(m,u.__s,v),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(d,f,p)}))}if(u.context=v,u.props=m,u.__v=e,u.__P=t,b=dp.__r,w=0,"prototype"in M&&M.prototype.render){for(u.state=u.__s,u.__d=!1,b&&b(e),c=u.render(u.props,u.state,u.context),k=0;k<u._sb.length;k++)u.__h.push(u._sb[k]);u._sb=[]}else do{u.__d=!1,b&&b(e),c=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++w<25);u.state=u.__s,null!=u.getChildContext&&(i=xp(xp({},i),u.getChildContext())),h||null==u.getSnapshotBeforeUpdate||(p=u.getSnapshotBeforeUpdate(d,f)),_=null!=c&&c.type===_p&&null==c.key?c.props.children:c,Rp(t,Array.isArray(_)?_:[_],e,n,i,r,o,a,s,l),u.base=e.__e,e.__h=null,u.__h.length&&a.push(u),g&&(u.__E=u.__=null),u.__e=!1}else null==o&&e.__v===n.__v?(e.__k=n.__k,e.__e=n.__e):e.__e=function(t,e,n,i,r,o,a,s){var l,c,u,h=n.props,d=e.props,f=e.type,p=0;if("svg"===f&&(r=!0),null!=o)for(;p<o.length;p++)if((l=o[p])&&"setAttribute"in l==!!f&&(f?l.localName===f:3===l.nodeType)){t=l,o[p]=null;break}if(null==t){if(null===f)return document.createTextNode(d);t=r?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,d.is&&d),o=null,s=!1}if(null===f)h===d||s&&t.data===d||(t.data=d);else{if(o=o&&hp.call(t.childNodes),c=(h=n.props||mp).dangerouslySetInnerHTML,u=d.dangerouslySetInnerHTML,!s){if(null!=o)for(h={},p=0;p<t.attributes.length;p++)h[t.attributes[p].name]=t.attributes[p].value;(u||c)&&(u&&(c&&u.__html==c.__html||u.__html===t.innerHTML)||(t.innerHTML=u&&u.__html||""))}if(function(t,e,n,i,r){var o;for(o in n)"children"===o||"key"===o||o in e||Ep(t,o,null,n[o],i);for(o in e)r&&"function"!=typeof e[o]||"children"===o||"key"===o||"value"===o||"checked"===o||n[o]===e[o]||Ep(t,o,e[o],n[o],i)}(t,d,h,r,s),u)e.__k=[];else if(p=e.props.children,Rp(t,Array.isArray(p)?p:[p],e,n,i,r&&"foreignObject"!==f,o,a,o?o[0]:n.__k&&Sp(n,0),s),null!=o)for(p=o.length;p--;)null!=o[p]&&bp(o[p]);s||("value"in d&&void 0!==(p=d.value)&&(p!==t.value||"progress"===f&&!p||"option"===f&&p!==h.value)&&Ep(t,"value",p,h.value,!1),"checked"in d&&void 0!==(p=d.checked)&&p!==t.checked&&Ep(t,"checked",p,h.checked,!1))}return t}(n.__e,e,n,i,r,o,a,l);(c=dp.diffed)&&c(e)}catch(t){e.__v=null,(l||null!=o)&&(e.__e=s,e.__h=!!l,o[o.indexOf(s)]=null),dp.__e(t,e,n)}}function Pp(t,e){dp.__c&&dp.__c(e,t),t.some((function(e){try{t=e.__h,e.__h=[],t.some((function(t){t.call(e)}))}catch(t){dp.__e(t,e.__v)}}))}function zp(t,e,n){try{"function"==typeof t?t(e):t.current=e}catch(t){dp.__e(t,n)}}function Fp(t,e,n){var i,r;if(dp.unmount&&dp.unmount(t),(i=t.ref)&&(i.current&&i.current!==t.__e||zp(i,null,e)),null!=(i=t.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){dp.__e(t,e)}i.base=i.__P=null,t.__c=void 0}if(i=t.__k)for(r=0;r<i.length;r++)i[r]&&Fp(i[r],e,n||"function"!=typeof t.type);n||null==t.__e||bp(t.__e),t.__=t.__e=t.__d=void 0}function Lp(t,e,n){return this.constructor(t,n)}function $p(t,e,n){var i,r,o;dp.__&&dp.__(t,e),r=(i="function"==typeof n)?null:n&&n.__k||e.__k,o=[],jp(e,t=(!i&&n||e).__k=wp(_p,null,[t]),r||mp,mp,void 0!==e.ownerSVGElement,!i&&n?[n]:r?null:e.firstChild?hp.call(e.childNodes):null,o,!i&&n?n:r?r.__e:e.firstChild,i),Pp(o,t)}function Bp(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{createElement:e=document.createElement.bind(document)}=t;let n,i,r=Cf();const o={transform:void 0},a=qf();return a.element=()=>n,a.root=()=>n,a.settings=t=>(t&&Object.keys(o).forEach((e=>{void 0!==t[e]&&(o[e]=t[e])})),o),a.appendTo=t=>(n||(n=e("div"),n.style.position="absolute",n.style["-webkit-font-smoothing"]="antialiased",n.style["-moz-osx-font-smoothing"]="antialiased",n.style.pointerEvents="none"),t.appendChild(n),n),a.render=t=>{if(!n)return!1;const e="function"==typeof o.transform&&o.transform();if(e){const{a:t,b:i,c:r,d:o,e:a,f:s}=e;return n.style.transform="matrix(".concat(t,", ").concat(i,", ").concat(r,", ").concat(o,", ").concat(a,", ").concat(s,")"),!0}let a;return n.style.transform="",n.style.left="".concat(r.computedPhysical.x,"px"),n.style.top="".concat(r.computedPhysical.y,"px"),n.style.width="".concat(r.computedPhysical.width,"px"),n.style.height="".concat(r.computedPhysical.height,"px"),a=Array.isArray(t)?wp("div",null,t):t,i=$p(a,n,i),!0},a.renderArgs=[wp],a.clear=()=>{if(n){let t=n.firstChild;for(;t;)n.removeChild(t),t=n.firstChild;i=null}return a},a.destroy=()=>{n&&n.parentElement&&n.parentElement.removeChild(n),n=null,i=null},a.size=t=>(t&&(r=Cf(t)),r),a}hp=yp.slice,dp={__e:function(t,e,n,i){for(var r,o,a;e=e.__;)if((r=e.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(t)),a=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(t,i||{}),a=r.__d),a)return r.__E=r}catch(e){t=e}throw t}},fp=0,Mp.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=xp({},this.state),"function"==typeof t&&(t=t(xp({},n),this.props)),t&&xp(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),qp(this))},Mp.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),qp(this))},Mp.prototype.render=_p,pp=[],Np.__r=0;var Hp=[function(t){t.renderer("svg",up)},function(t){t.renderer("canvas",Ff)},function(t){t.renderer("dom",Bp)}];const Vp={OFF:0,ERROR:1,WARN:2,INFO:3,DEBUG:4},Wp=function(){let{level:t=Vp.OFF,pipe:e=console}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t;const i={[Vp.OFF]:()=>{},[Vp.ERROR]:function(){return e.error(...arguments)},[Vp.WARN]:function(){return e.warn(...arguments)},[Vp.INFO]:function(){return e.info(...arguments)},[Vp.DEBUG]:function(){return e.log(...arguments)}},r=function(t){if(t&&!(n<t)){for(var e=arguments.length,r=new Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];(i[t]||i[Vp.DEBUG])(...r)}};return{log:r,error:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r(Vp.ERROR,...e)},warn:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r(Vp.WARN,...e)},info:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r(Vp.INFO,...e)},debug:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r(Vp.DEBUG,...e)},level:t=>("number"==typeof t&&(n=t),n),LOG_LEVEL:Vp}};function Up(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;t(n,e)}const Yp=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=Wp(e.logger),r={component:Ht(n.component,"component",i),data:Ht(n.data,"data",i),formatter:Ht(n.formatter,"formatter",i),interaction:Ht(n.interaction,"interaction",i),renderer:el(n.renderer),scale:Ht(n.scale,"scale",i),symbol:Ht(n.symbol,"symbol",i),logger:i};function o(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i={palettes:e.palettes.concat(n.palettes||[]),style:_({},e.style,n.style),logger:n.logger||e.logger,renderer:n.renderer||e.renderer};return t(i,r)}return e.renderer&&e.renderer.prio&&r.renderer.default(e.renderer.prio[0]),o.use=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Up(t,e,r)},o.chart=t=>tl(t,{registries:r,logger:i,style:e.style,palettes:e.palettes}),o.config=()=>e,Object.keys(r).forEach((t=>{o[t]=r[t]})),o.version=M,o}({renderer:{prio:["svg","canvas"]},logger:{level:0},style:{"$font-family":"'Source Sans Pro', Arial, sans-serif","$font-size":"12px","$line-height":"16px","$font-size--l":"16px","$font-weight":"normal","$gray-100":"#ffffff","$gray-98":"#f9f9f9","$gray-95":"#f2f2f2","$gray-90":"#e6e6e6","$gray-35":"#595959","$gray-30":"#4d4d4d","$gray-25":"#404040","$gray-20":"#333333","$border-95":"rgba(255, 255, 255, 0.05)","$border-90":"rgba(255, 255, 255, 0.1)","$border-80":"rgba(255, 255, 255, 0.2)","$border-20":"rgba(0, 0, 0, 0.2)","$border-10":"rgba(0, 0, 0, 0.1)","$border-5":"rgba(0, 0, 0, 0.05)","$primary-blue":"#3F8AB3","$primary-green":"#6CB33F","$primary-red":"#DC423F","$primary-orange":"#EF960F","$spacing--s":4,$spacing:8,"$spacing--l":12,"$font-color":"$gray-35","$font-color--inverted":"$gray-90","$guide-color":"$gray-90","$guide-color--inverted":"$gray-35",$border:"$border-80","$border--inverted":"$border-10",$shape:{fill:"$primary-blue",strokeWidth:1,stroke:"$border"},"$shape-outline":{stroke:"$primary-blue",strokeWidth:2},"$shape-guide":{stroke:"$guide-color",strokeWidth:1},"$shape-guide--inverted":{"@extend":"$shape-guide",stroke:"$guide-color--inverted"},$label:{fontSize:"$font-size",fontFamily:"$font-family",fill:"$font-color"},"$label--inverted":{$extend:"$label",fill:"$font-color--inverted"},"$label-overlay":{fontSize:"$font-size--l",fontFamily:"$font-family",fill:"$gray-100",color:"$font-color",stroke:"$guide-color--inverted",strokeWidth:1,borderRadius:4},$title:{"@extend":"$label",fontSize:"$font-size--l",fontWeight:"$font-weight",stroke:"$guide-color--inverted",strokeWidth:0},"$guide-line":{strokeWidth:1,stroke:"$guide-color"},"$guide-line--minor":{strokeWidth:1,stroke:"$gray-95"},"$padding--s":{left:"$spacing--s",right:"$spacing--s",top:"$spacing--s",bottom:"$spacing--s"},$padding:{left:"$spacing",right:"$spacing",top:"$spacing",bottom:"$spacing"},"$selection-area-target":{fill:"$primary-green",strokeWidth:0,opacity:.2}},palettes:[{key:"categorical",colors:[["#a54343","#d76c6c","#ec983d","#ecc43d","#f9ec86","#cbe989","#70ba6e","#578b60","#79d69f","#26a0a7","#138185","#65d3da"]]},{key:"diverging",colors:[["#3d52a1","#3a89c9","#77b7e5","#b4ddf7","#e6f5fe","#ffe3aa","#f9bd7e","#ed875e","#d24d3e","#ae1c3e"]]},{key:"sequential",colors:[["rgb(180,221,212)","rgb(34, 83, 90)"]]}]},{component:nl,data:ll,formatter:pi,interaction:cl,renderer:el(),scale:Ao,symbol:Ba});function Xp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function Kp(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Xp(Object(n),!0).forEach((function(e){Gp(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xp(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Gp(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;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:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}sd.forEach(Yp.use),Hp.forEach(Yp.use),[].forEach(Yp.use);var Zp=Object.prototype.hasOwnProperty,Jp=Object.prototype.toString,Qp=Object.defineProperty,tg=Object.getOwnPropertyDescriptor,eg=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===Jp.call(t)},ng=function(t){if(!t||"[object Object]"!==Jp.call(t))return!1;var e,n=Zp.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&Zp.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;for(e in t);return void 0===e||Zp.call(t,e)},ig=function(t,e){Qp&&"__proto__"===e.name?Qp(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},rg=function(t,e){if("__proto__"===e){if(!Zp.call(t,e))return;if(tg)return tg(t,e).value}return t[e]},og=function t(){var e,n,i,r,o,a,s=arguments[0],l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),(null==s||"object"!=typeof s&&"function"!=typeof s)&&(s={});l<c;++l)if(null!=(e=arguments[l]))for(n in e)i=rg(s,n),s!==(r=rg(e,n))&&(u&&r&&(ng(r)||(o=eg(r)))?(o?(o=!1,a=i&&eg(i)?i:[]):a=i&&ng(i)?i:{},ig(s,{name:n,newValue:t(u,a,r)})):void 0!==r&&ig(s,{name:n,newValue:r}));return s};function ag(t,e,n){if(!t)return-1;const i=n.cache,r=t.origin?t.origin():null;r&&(t=r);let o=i.fields.indexOf(t),a=-1,s=-1;if(-1===o)for(let e=0;e<i.wrappedFields.length;e++)if(s=i.wrappedFields[e].attrDims.map((t=>t.instance)).indexOf(t),a=i.wrappedFields[e].attrExps.map((t=>t.instance)).indexOf(t),-1!==s||-1!==a){o=e;break}return o-=e.qArea.qLeft,o<0||o>=e.qArea.qWidth?-1:s>=0?t=>t[o].qAttrDims.qValues[s]:a>=0?t=>t[o].qAttrExps.qValues[a]:t=>t[o]}function sg(t,e,n){let{key:i}=n;const r={value:"function"==typeof t.value?t.value(e):void 0!==t.value?t.value:e};return r.label="function"==typeof t.label?t.label(e):void 0!==t.label?String(t.label):String(r.value),t.field&&(r.source={key:i,field:t.field.key()}),r}function lg(t){let{cache:e,f:n,mainCell:i,p:r,prop:o,page:a,rowIdx:s,row:l,sourceKey:c,target:u,targetProp:h}=t,d=i;if(r.field&&r.field!==n){const t=ag(r.field,a,{cache:e});if(-1===t)return;d=og({qRow:s},t(l))}u[h]=sg(r,d,{key:c})}function cg(t,e,n,i){const r=Array.isArray(t)?t:[t];let o=[];for(let t=0;t<r.length;t++)if(void 0!==r[t].field){const a=e.raw(),s=e.key(),l="object"==typeof r[t].field?r[t].field:e.field(r[t].field),{props:c,main:u}=i.normalizeConfig(r[t],e),h=Object.keys(c),d=!!r[t].trackBy,f=typeof r[t].trackBy,p={},g=[],m=[];for(let e=0;e<a.qDataPages.length;e++){const o=ag(l,a.qDataPages[e],{cache:n});if(-1!==o)for(let y=0;y<a.qDataPages[e].qMatrix.length;y++){const v=a.qDataPages[e].qArea.qTop+y,x=og({qRow:v},o(a.qDataPages[e].qMatrix[y])),b=sg(u,x,{key:s});if(!(u.filter&&!u.filter(x))){for(let t=0;t<h.length;t++){const i=c[h[t]];let r=i.fields||[i];i.fields&&(b[h[t]]=[]);for(let o=0;o<r.length;o++)lg({cache:n,f:l,mainCell:x,p:r[o],prop:h[t],props:c,page:a.qDataPages[e],rowIdx:v,row:a.qDataPages[e].qMatrix[y],sourceKey:s,target:i.fields?b[h[t]]:b,targetProp:i.fields?o:h[t]});if(i.fields){const e=b[h[t]].map((t=>t.value)),n=b[h[t]].map((t=>t.label));b[h[t]]={value:"function"==typeof i.value?i.value(e):void 0!==i.value?i.value:e,label:"function"==typeof i.label?i.label(n):void 0!==i.label?String(i.label):String(b[h[t]].value)}}}d&&i.track({cfg:r[t],itemData:x,obj:b,target:g,tracker:p,trackType:f}),m.push(b)}}}const y=d?i.collect(g,{main:u,propsArr:h,props:c}):m;o=[...o,...y]}return o}function ug(t){var e=0,n=t.children,i=n&&n.length;if(i)for(;--i>=0;)e+=n[i].value;else e=1;t.value=e}function hg(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=fg)):void 0===e&&(e=dg);for(var n,i,r,o,a,s=new mg(t),l=[s];n=l.pop();)if((r=e(n.data))&&(a=(r=Array.from(r)).length))for(n.children=r,o=a-1;o>=0;--o)l.push(i=r[o]=new mg(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(gg)}function dg(t){return t.children}function fg(t){return Array.isArray(t)?t[1]:null}function pg(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function gg(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function mg(t){this.data=t,this.depth=this.height=0,this.parent=null}function yg(t){return null==t?null:function(t){if("function"!=typeof t)throw new Error;return t}(t)}mg.prototype=hg.prototype={constructor:mg,count:function(){return this.eachAfter(ug)},each:function(t,e){let n=-1;for(const i of this)t.call(e,i,++n,this);return this},eachAfter:function(t,e){for(var n,i,r,o=this,a=[o],s=[],l=-1;o=a.pop();)if(s.push(o),n=o.children)for(i=0,r=n.length;i<r;++i)a.push(n[i]);for(;o=s.pop();)t.call(e,o,++l,this);return this},eachBefore:function(t,e){for(var n,i,r=this,o=[r],a=-1;r=o.pop();)if(t.call(e,r,++a,this),n=r.children)for(i=n.length-1;i>=0;--i)o.push(n[i]);return this},find:function(t,e){let n=-1;for(const i of this)if(t.call(e,i,++n,this))return i},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,i=e.children,r=i&&i.length;--r>=0;)n+=i[r].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),i=e.ancestors(),r=null;t=n.pop(),e=i.pop();for(;t===e;)r=t,t=n.pop(),e=i.pop();return r}(e,t),i=[e];e!==n;)e=e.parent,i.push(e);for(var r=i.length;t!==n;)i.splice(r,0,t),t=t.parent;return i},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return hg(this).eachBefore(pg)},[Symbol.iterator]:function*(){var t,e,n,i,r=this,o=[r];do{for(t=o.reverse(),o=[];r=t.pop();)if(yield r,e=r.children)for(n=0,i=e.length;n<i;++n)o.push(e[n])}while(o.length)}};var vg={depth:-1},xg={},bg={};function wg(t){return t.id}function kg(t){return t.parentId}function _g(){var t,e=wg,n=kg;function i(i){var r,o,a,s,l,c,u,h,d=Array.from(i),f=e,p=n,g=new Map;if(null!=t){const e=d.map(((e,n)=>function(t){let e=(t=""+t).length;Sg(t,e-1)&&!Sg(t,e-2)&&(t=t.slice(0,-1));return"/"===t[0]?t:"/"+t}(t(e,n,i)))),n=e.map(Mg),r=new Set(e).add("");for(const t of n)r.has(t)||(r.add(t),e.push(t),n.push(Mg(t)),d.push(bg));f=(t,n)=>e[n],p=(t,e)=>n[e]}for(a=0,r=d.length;a<r;++a)o=d[a],c=d[a]=new mg(o),null!=(u=f(o,a,i))&&(u+="")&&(h=c.id=u,g.set(h,g.has(h)?xg:c)),null!=(u=p(o,a,i))&&(u+="")&&(c.parent=u);for(a=0;a<r;++a)if(u=(c=d[a]).parent){if(!(l=g.get(u)))throw new Error("missing: "+u);if(l===xg)throw new Error("ambiguous: "+u);l.children?l.children.push(c):l.children=[c],c.parent=l}else{if(s)throw new Error("multiple roots");s=c}if(!s)throw new Error("no root");if(null!=t){for(;s.data===bg&&1===s.children.length;)s=s.children[0],--r;for(let t=d.length-1;t>=0&&(c=d[t]).data===bg;--t)c.data=null}if(s.parent=vg,s.eachBefore((function(t){t.depth=t.parent.depth+1,--r})).eachBefore(gg),s.parent=null,r>0)throw new Error("cycle");return s}return i.id=function(t){return arguments.length?(e=yg(t),i):e},i.parentId=function(t){return arguments.length?(n=yg(t),i):n},i.path=function(e){return arguments.length?(t=yg(e),i):t},i}function Mg(t){let e=t.length;if(e<2)return"";for(;--e>1&&!Sg(t,e););return t.slice(0,e)}function Sg(t,e){if("/"===t[e]){let n=0;for(;e>0&&"\\"===t[--e];)++n;if(0==(1&n))return!0}return!1}function Cg(t,e){"/"===t.charAt(0)&&(t=t.substring(1));const n=t.split("/");let i,r=e;for(let t=0;t<n.length;t++){if("*"===n[t]&&Array.isArray(r)){const e=[];i=n.slice(t+1).join("/");for(let t=0;t<r.length;t++){let n=Cg(i,r[t]);Array.isArray(n)?e.push(...n):e.push(n)}return e}if(!n[t]&&Array.isArray(r)){const e=new Array(r.length);i=n.slice(t+1).join("/");for(let t=0;t<r.length;t++)e[t]=Cg(i,r[t]);return e}n[t]in r&&(r=r[n[t]])}return r}function qg(t,e,n){let i=[];if(!t||!t.length)return i;if(e<=0){const e=n>=0?[t[n]]:t;i=[...i,...e]}else for(let r=0;r<t.length;r++)t[r].children&&t[r].children.length&&(i=[...i,...qg(t[r].children,e-1,n)]);return i}function Ng(t,e,n){if(t===e)return t=>t;if(t>e){const n=Math.max(0,Math.min(100,t-e));return t=>{let e=t;for(let t=0;t<n;++t)e=e.parent;return e}}if(e>t){const i=Math.max(0,Math.min(100,e-t));return t=>qg(t.children,i-1,n)}return!1}function Rg(t,e){let{cache:n}=e;if("number"==typeof t)return n.fields[t];const i=n.allFields;if("function"==typeof t){for(let e=0;e<i.length;e++)if(t(i[e]))return i[e];return!1}if("string"==typeof t){for(let e=0;e<i.length;e++)if(i[e].key()===t||i[e].title()===t)return i[e]}else if(t&&-1!==i.indexOf(t))return t;throw Error("Field not found: ".concat(t))}const Ag=/^qDimensionInfo(?:\/(\d+))?/,Og=/^\/?qMeasureInfo\/(\d+)/,Dg=/\/qAttrExprInfo\/(\d+)/,Eg=/\/qAttrDimInfo\/(\d+)/;function Ig(t){return(t.qColumnOrder&&t.qColumnOrder.length?t.qColumnOrder:t.qDimensionInfo.map(((t,e)=>e))).filter((e=>e<t.qDimensionInfo.length))}function Tg(t,e){let{cube:n}=e;if(!t)return-1;let i=t.origin&&t.origin()?t.origin().key():t.key(),r=!1,o=-1,a=-1,s=-1,l=-1,c=-1,u=-1,h=i;const d=n.qEffectiveInterColumnSortOrder,f=Ig(n);return Ag.test(h)&&(r=!0,o=+Ag.exec(h)[1],h=i.replace(Ag,"")),Og.test(h)&&("K"===n.qMode?c=+Og.exec(h)[1]:d&&-1!==d.indexOf(-1)?(c=+Og.exec(h)[1],u=0):u=+Og.exec(h)[1],h=h.replace(Og,"")),h&&(Eg.exec(h)?s=+Eg.exec(h)[1]:Dg.exec(h)&&(a=+Dg.exec(h)[1])),l=r?"S"===n.qMode?f[o]:d?d.indexOf(o):o:d&&-1!==d.indexOf(-1)?d.indexOf(-1):n.qDimensionInfo.length-("K"===n.qMode?0:1),{fieldDepth:l+1,pseudoMeasureIndex:c,measureIdx:u,attrDimIdx:s,attrIdx:a}}function jg(t,e){let n,i,r=Ng(t.fieldDepth,e.fieldDepth,e.pseudoMeasureIndex);return n=e.measureIdx>=0?t=>t.data.qValues[e.measureIdx]:t=>t.data,e.attrDimIdx>=0?i=t=>{var n;return null==t||null===(n=t.qAttrDims)||void 0===n?void 0:n.qValues[e.attrDimIdx]}:e.attrIdx>=0&&(i=t=>{var n;return null==t||null===(n=t.qAttrExps)||void 0===n?void 0:n.qValues[e.attrIdx]}),{nodeFn:r,attrFn:i,valueFn:n}}function Pg(t,e,n){let{key:i}=n;const r={value:"function"==typeof t.value?t.value(e):void 0!==t.value?t.value:e};return r.label="function"==typeof t.label?t.label(e):void 0!==t.label?String(t.label):String(r.value),t.field&&(r.source={key:i,field:t.field.key()}),r}function zg(t){let{propsArr:e,props:n,item:i,itemData:r,ret:o,sourceKey:a}=t;for(let t=0;t<e.length;t++){const s=n[e[t]],l=s.fields||[s];let c,u;s.fields&&(c=[],u=[]);for(let n=0;n<l.length;n++){const h=l[n];let d,f,p,g,m,y;if("primitive"===h.type?(p=h.value,y=String(h.value)):("function"==typeof h.value&&(d=t=>h.value(t,i)),"function"==typeof h.label&&(f=t=>h.label(t,i)),h.accessor?(g=h.accessor(i),Array.isArray(g)?(m=g.map(h.valueAccessor),h.attrAccessor&&(m=m.map(h.attrAccessor)),d&&(p=m.map(d),d=null),f&&(y=m.map(f),f=null),p=h.reduce?h.reduce(p):p,y=h.reduceLabel?h.reduceLabel(y,p):String(p)):(p=h.attrAccessor?h.attrAccessor(h.valueAccessor(g)):h.valueAccessor(g),y=p)):(p=r,y=r)),s.fields){const t=d?d(p):p;c.push(t),u.push(f&&null!=y?f(y):null!=y?y:String(t))}else{const n=d?d(p):p;o[e[t]]={value:n,label:f?f(y):null!=y?y:String(n)},h.field&&(o[e[t]].source={field:h.field.key(),key:a})}}c&&(o[e[t]]={value:"function"==typeof s.value?s.value(c,i):c,label:"function"==typeof s.label?s.label(u,i):u})}}const Fg=(t,e,n)=>{const i="K"===t.qMode?"/qStackedDataPages/*/qData":"/qTreeDataPages/*",r="K"===t.qMode?"qSubNodes":"qNodes",o=Cg(i,t);return o&&o[0]?(e.tree=hg(o[0],n.children||(t=>t[r])),e.tree):null};function Lg(t){const e=t.raw().qDataPages.length?t.raw().qDataPages[0].qMatrix:[],n=function(t){const e=t.raw().qColumnOrder,n=t.fields();return e&&e.length===n.length?e:n.map(((t,e)=>e))}(t),i=t.fields(),r=t.fields().filter((t=>"dimension"===t.type())).map((t=>n.indexOf(i.indexOf(t)))),o=t.fields().filter((t=>"measure"===t.type())).map((t=>n.indexOf(i.indexOf(t)))),a={__root:{__id:"__root",qValues:[]}};for(let t=0;t<e.length;t++){const n=e[t];let i="__root",l=!1;for(let t=0;t<r.length;t++){var s;const e=n[r[t]],o="".concat(i,"__").concat(null!==(s=e.qElemNumber)&&void 0!==s?s:e.qElemNo);a[o]||(a[o]=Kp({__id:o,__parent:i,qValues:[]},e),l=!0),i=o}if(l)for(let t=0;t<o.length;t++){const e=n[o[t]];a[i].qValues.push(e)}}const l=Object.keys(a).map((t=>a[t]));return _g().id((t=>t.__id)).parentId((t=>t.__parent))(l)}const $g=t=>{let{propsArr:e,props:n,cube:i,cache:r,itemDepthObject:o,f:a}=t;for(let t=0;t<e.length;t++){const s=n[e[t]],l=s.fields?s.fields:[s];for(let t=0;t<l.length;t++){const e=l[t];if(e.field!==a){const t=jg(o,Tg(e.field,{cube:i,cache:r}));e.accessor=t.nodeFn,e.valueAccessor=t.valueFn,e.attrAccessor=t.attrFn}}}};function Bg(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;const r=e.raw(),o=e.key(),a="S"===r.qMode?Lg(e):Fg(r,n,t);if(!a)return null;const s=a.height,l=[];for(let o=0;o<=s;o++){let a=null;if(o>0)if("S"===r.qMode){let t=Ig(r)[o-1];a=n.fields[t]}else{let t=r.qEffectiveInterColumnSortOrder[o-1];o>r.qEffectiveInterColumnSortOrder.length&&(t=r.qDimensionInfo.length),a=n.fields[t]}const{props:s,main:c}=i.normalizeConfig(Kp(Kp({},t),{},{field:a?a.key():void 0}),e),u=Object.keys(s);l[o]={propsArr:u,props:s,main:c};const h=a?Tg(a,{cube:r,cache:n}):{fieldDepth:0};$g({propsArr:u,props:s,cube:r,cache:n,itemDepthObject:h,f:a})}const c=a.copy(),u=c.descendants(),h=a.descendants();for(let t=0;t<h.length;t++){const e=l[h[t].depth].propsArr,n=l[h[t].depth].props,i=l[h[t].depth].main,r=u[t],a=r.data,s=Pg(i,a,{key:o});zg({propsArr:e,props:n,item:r,itemData:a,ret:s,sourceKey:o,isTree:!0}),h[t].data=s}return a}function Hg(t,e,n,i){const r=Array.isArray(t)?t:[t];let o=[];for(let a=0;a<r.length;a++)if(void 0!==r[a].field){const s=e.raw(),l=e.key();if(!Fg(s,n,t))continue;const c="object"==typeof r[a].field?r[a].field:e.field(r[a].field),{props:u,main:h}=i.normalizeConfig(r[a],e),d=Object.keys(u),f=Tg(c,{cube:s,cache:n}),{nodeFn:p,attrFn:g,valueFn:m}=jg({fieldDepth:0},f);$g({propsArr:d,props:u,cube:s,cache:n,itemDepthObject:f,f:c});const y=!!r[a].trackBy,v=typeof r[a].trackBy,x={},b=[],w=p(n.tree),k=[];for(let t=0;t<w.length;t++){const e=w[t],n=g?g(m(e)):m(e);if(h.filter&&!h.filter(n))continue;const o=Pg(h,n,{key:l});zg({propsArr:d,props:u,item:e,itemData:n,ret:o,sourceKey:l}),y&&i.track({cfg:r[a],itemData:n,obj:o,target:b,tracker:x,trackType:v}),k.push(o)}const _=y?i.collect(b,{main:h,propsArr:d,props:u}):k;o=[...o,..._]}return o}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var Vg=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){
8
8
  /*! javascript-number-formatter - v1.1.11 - http://mottie.github.com/javascript-number-formatter/ * © ecava */
9
- t.exports=function(t,e){if(!t||isNaN(+e))return e;var n,i,r,o,a,s,l,c,u,h,d=t.length,f=t.search(/[0-9\-\+#]/),p=f>0?t.substring(0,f):"",g=t.split("").reverse().join(""),m=g.search(/[0-9\-\+#]/),y=d-m,v=t.substring(y,y+1),x=y+("."===v||","===v?1:0),b=m>0?t.substring(x,d):"";if(n=(e="-"===(t=t.substring(f,x)).charAt(0)?-e:+e)<0?e=-e:0,r=(i=t.match(/[^\d\-\+#]/g))&&i[i.length-1]||".",o=i&&i[1]&&i[0]||",",t=t.split(r),e=+(e=e.toFixed(t[1]&&t[1].length))+"",s=t[1]&&t[1].lastIndexOf("0"),(!(c=e.split("."))[1]||c[1]&&c[1].length<=s)&&(e=(+e).toFixed(s+1)),u=t[0].split(o),t[0]=u.join(""),(a=t[0]&&t[0].indexOf("0"))>-1)for(;c[0].length<t[0].length-a;)c[0]="0"+c[0];else 0==+c[0]&&(c[0]="");if((e=e.split("."))[0]=c[0],l=u[1]&&u[u.length-1].length){for(g="",y=(h=e[0]).length%l,d=h.length,x=0;x<d;x++)g+=h.charAt(x),!((x-y+1)%l)&&x<d-l&&(g+=o);e[0]=g}return e[1]=t[1]&&e[1]?r+e[1]:"","0"!==(i=e.join(""))&&""!==i||(n=!1),p+(n?"-":"")+i+b}}));function Wg(t){return t.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}const Ug={3:"k",6:"M",9:"G",12:"T",15:"P",18:"E",21:"Z",24:"Y","-3":"m","-6":"μ","-9":"n","-12":"p","-15":"f","-18":"a","-21":"z","-24":"y"},Yg=/%\)?$/,Xg=/^\(r(0[2-9]|[12]\d|3[0-6])\)/i,Kg=/^\(oct\)/i,Gg=/^\(dec\)/i,Zg=/^\(hex\)/i,Jg=/^\(bin\)/i,Qg=/^\(rom\)/i,tm=/^(\(rom\)|\(bin\)|\(hex\)|\(dec\)|\(oct\)|\(r(0[2-9]|[12]\d|3[0-6])\))/i,em=/#|0/g;function nm(t,e,n,i){return t=t.toString(e),n[1]===n[1].toUpperCase()&&(t=t.toUpperCase()),t.length-t.indexOf(".")>10&&(t=t.slice(0,t.indexOf(".")+11)),t.replace(".",i||".")}function im(t,e,n){let i;return Xg.test(e)?t=nm(t,Number(/\d{2}/.exec(e)[0]),e,n):Kg.test(e)?t=nm(t,8,e,n):Gg.test(e)?t=nm(t,10,e,n):Zg.test(e)?t=nm(t,16,e,n):Jg.test(e)?t=nm(t,2,e,n):Qg.test(e)&&(i="",t<0&&(i="-",t=-t),t=0===(t=Math.floor(t))?"0":t<=5e5?i+(t=function(t,e){let n,i="",r=Number(String(t).slice(-3)),o=(t-r)/1e3,a=[0,1,4,5,9,10,40,50,90,100,400,500,900].reverse(),s=["0","I","IV","V","IX","X","XL","L","XC","C","CD","D","CM"].reverse();for(;r>0;)for(n=0;n<a.length;n++)if(a[n]<=r){i+=s[n],r-=a[n];break}for(n=0;n<o;n++)i="M".concat(i);return e[1]!==e[1].toUpperCase()&&(i=i.toLowerCase()),i}(t,e)):e+i+t.toExponential(0)),t}function rm(t,e,n){const i=Wg(t);return n?i:new RegExp(i||"",e)}function om(t,e,n,i){let r,o,a,s,l,c,u,h,d,f=t.pattern;var p,g;i&&(t.abbreviate=!0),p=e,(g=n)&&(g=Wg(g)),p&&(p=Wg(p)),d=new RegExp("(?:[#0]+".concat(p,")?[#0]+(?:").concat(g,"[#0]+)?")),a=f.match(d),a=a?a[0]:"",s=a?f.substr(0,f.indexOf(a)):f,l=a?f.substring(f.indexOf(a)+a.length):"",a||(a=f?"#":"##########"),e&&e===n&&(r=a.split(n),o=r.pop(),a=r.join("")+n+o,e=""),c=e,e=/,/.test(n)?"¤":",",c&&(a=a.replace(rm(c,"g"),e)),u=n,n=".",u&&(a=a.replace(rm(u,"g"),n)),h=a.match(/#/g),h=h?h.length:0;const m=f.split(u);let y;m[1]&&(y=m[1].match(em)),t.prefix=s||"",t.postfix=l||"",t.pattern=f,t.maxPrecision=y?y.length:2,t.percentage=Yg.test(f),t.numericPattern=a||"",t.numericRegex=new RegExp("".concat(rm(e,null,!0),"|").concat(rm(n,null,!0)),"g"),t.groupTemp=c,t.decTemp=u,t.t=e,t.d=n,t.temp=h}class am{constructor(t,e,n,i,r){this.localeInfo=t,this.pattern=e,this.thousandDelimiter=n||",",this.decimalDelimiter=i||".",this.type=r||"numeric",this.patternSeparator=";",this.abbreviations=function(t,e){if(!t||!t.qNumericalAbbreviation)return Ug;const n={};return t.qNumericalAbbreviation.split(e).forEach((t=>{let e=t.split(":");2===e.length&&(n[e[0]]=e[1])})),n}(t,this.patternSeparator),this.prepare()}clone(){const t=new am(this.localeInfo,this.pattern,this.thousandDelimiter,this.decimalDelimiter,this.type);return t.subtype=this.subtype,t}format(t,e,n,i){return this.prepare(e,n,i),this.formatValue(t)}prepare(t,e,n){let i;if(void 0===t&&(t=this.pattern),void 0===e&&(e=this.thousandDelimiter),void 0===n&&(n=this.decimalDelimiter),!t)return void(this._prepared={pattern:!1});this._prepared={positive:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""},negative:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""},zero:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""}},i=this._prepared,t=t.split(this.patternSeparator),i.positive.pattern=t[0],i.negative.pattern=t[1],i.zero.pattern=t[2],tm.test(t[0])&&(i.positive.isFunctional=!0),t[1]?tm.test(t[1])&&(i.negative.isFunctional=!0):i.negative=!1,t[2]?tm.test(t[2])&&(i.zero.isFunctional=!0):i.zero=!1;const r="U"===this.type;i.positive.isFunctional||om(i.positive,e,n,r),i.negative&&!i.negative.isFunctional&&om(i.negative,e,n,r),i.zero&&!i.zero.isFunctional&&om(i.zero,e,n,r)}formatValue(t){let e,n,i,r,o,a,s,l,c,u=this._prepared,h="",d="",f=t;if(isNaN(t))return"".concat(f);if(t=+t,!1===u.pattern)return t.toString();if(0===t&&u.zero)return u=u.zero,u.pattern;if(t<0&&u.negative?(u=u.negative,t=-t):u=u.positive,o=u.d,a=u.t,u.isFunctional)t=im(t,u.pattern,o);else{if(u.percentage&&(t*=100),u.abbreviate){const e=Object.keys(this.abbreviations).map((t=>parseInt(t,10))).sort(((t,e)=>t-e));let i,r,o=e[0];for(s=0,n=Number(Number(t).toExponential().split("e")[1]);o<=n&&s<e.length;)s++,o=e[s];s>0&&(i=e[s-1]),i&&n>0&&i>0?r=i:(n<0&&i<0||!i)&&(o<0&&o-n<=u.maxPrecision?r=o:i<=n&&!(o>0&&-n<=u.maxPrecision)&&(r=i)),r&&(h=this.abbreviations[r],t/=10**r)}if(i=Math.abs(t),e=u.temp,l=u.numericPattern,c=l.split(o)[1],"I"===this.type&&(t=Math.round(t)),r=t,c||"#"!==l.slice(-1)[0])if(i>=1e15||i>0&&i<=1e-14)t=i?i.toExponential(15).replace(/\.?0+(?=e)/,""):"0";else{const e=Number(t.toFixed(Math.min(20,c?c.length:0)).split(".")[0]);let n=l.split(o)[0];if(n+=o,t=Vg(n,e)||"0",c){const e=Math.max(0,Math.min(14,c.length)),n=c.replace(/#+$/,"").length;let r=("I"===this.type?0:i%1).toFixed(e).slice(2).replace(/0+$/,"");for(s=r.length;s<n;s++)r+="0";r&&(t+=o+r)}else 0===e&&(r=0)}else if(i>=10**e||i<1||i<1e-4)0===t?t="0":i<1e-4||i>=1e20?(t=(t=r.toExponential(Math.max(1,Math.min(14,e))-1)).replace(/\.?0+(?=e)/,""),d=""):(t=t.toPrecision(Math.max(1,Math.min(14,e)))).indexOf(".")>=0&&(t=(t=t.replace(t.indexOf("e")<0?/0+$/:/\.?0+(?=e)/,"")).replace(".",o));else{for(l+=o,e=Math.max(0,Math.min(20,e-Math.ceil(Math.log(i)/Math.log(10)))),s=0;s<e;s++)l+="#";t=Vg(l,t)}t=t.replace(u.numericRegex,(t=>t===a?u.groupTemp:t===o?u.decTemp:"")),r<0&&!/^-/.test(t)&&(t="-".concat(t))}return u.prefix+t+d+h+u.postfix}static getStaticFormatter(){return{prepare(){},formatValue:t=>"".concat(t)}}}function sm(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{size:n=5e3,multipleArguments:i=!1,toKey:r=(t=>t)}=e;let o,a,s=Object.create(null),l=Object.create(null),c=0,u=0;return o=i?function(){return a=r(...arguments),o.has(a)?o.get(a):o.set(a,t(...arguments))}:e=>(a=r(e),o.has(a)?o.get(a):o.set(a,t(e))),o.set=(t,e)=>(c>=n&&(delete s[l[u]],delete l[u],c--,u++),s[t]=e,l[c]=t,c++,e),o.get=t=>s[t],o.has=t=>t in s,o.clear=()=>{s=Object.create(null),l=Object.create(null),c=0,u=0},o.size=()=>c,o}function lm(t,e,n,i,r){const o=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new am(...e)}(r,t,e,n,i),a=sm(o.formatValue.bind(o),{toKey:t=>isNaN(t)?t:+t});function s(t){return a(t)}return s.format=function(t,e,n,i){return a.clear(),o.format(e,t,n,i)},s.pattern=function(t){return t&&(a.clear(),o.pattern=t,o.prepare()),o.pattern},s}const cm="D",um="T",hm="TS",dm="IV",fm=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],pm=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],gm=["January","February","March","April","May","June","July","August","September","October","November","December"],mm=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ym(t,e){for(let n=t.length;n<e;n++)t="0".concat(t);return t}function vm(t){let e=t.toString().split(".");return e[1]?(e=Number("0.".concat(e[1])),e):0}function xm(t,e){let n,i=function(t){const e=t,n=24*vm(e),i=60*vm(n),r=60*vm(i),o=1e3*vm(r);return{d:Math.floor(e),h:Math.floor(n),m:Math.floor(i),s:Math.floor(r),f:Math.round(o)}}(t),r=i.d,o=i.h,a=i.m,s=i.s,l=i.f,c=0;/w+|t+/gi.test(e)&&(n=new Date(Date.UTC(1899,11,30+Math.floor(t),0,0,Math.round(86400*(t-Math.floor(t))))),isNaN(n.getTime())&&(n=null)),/D+/gi.test(e)||(o+=24*r),/h+/gi.test(e)||(a+=60*o),/m+/gi.test(e)||(s+=60*a),/w+/gi.test(e)&&(c=n?n.getDay()-1:0,c<0&&(c=6));let u="";return n&&(u=n.getUTCHours()>=12?"pm":"am"),{year:0,month:0,day:c,date:r,h:o,m:a,s:s,f:l,t:u}}class bm{constructor(t,e,n){const i=t||{};if(i.qCalendarStrings||(i.qCalendarStrings={qLongDayNames:fm,qDayNames:pm,qLongMonthNames:gm,qMonthNames:mm}),this.localeInfo=i,this.locale_days=i.qCalendarStrings.qLongDayNames.slice(),this.locale_days_abbr=i.qCalendarStrings.qDayNames.slice(),this.locale_months=i.qCalendarStrings.qLongMonthNames.slice(),this.locale_months_abbr=i.qCalendarStrings.qMonthNames.slice(),!e){e={[um]:i.qTimeFmt||"hh:mm:ss",[cm]:i.qDateFmt||"YYYY-MM-DD",[hm]:i.qTimestampFmt||"YYYY-MM-DD hh:mm:ss"}[n]}this.pattern=e}clone(){const t=new bm(this.localeInfo,this.pattern);return t.subtype=this.subtype,t}format(t,e){e||(e=this.pattern?this.pattern:"YYYY-MM-DD hh:mm:ss"),e=e.replace(/\[.+]|\[|]/g,"");const n=/t+/gi.test(e);let i;t instanceof Date?i=function(t,e){let n=t.getUTCHours(),i=t.getUTCDay()-1;return e&&(n%=12,n||(n=12)),i<0&&(i=6),{year:t.getUTCFullYear(),month:t.getUTCMonth(),day:i,date:t.getUTCDate(),h:n,m:t.getUTCMinutes(),s:t.getUTCSeconds(),f:t.getUTCMilliseconds(),t:t.getUTCHours()>=12?"pm":"am"}}(t,n):(t<0&&(t=-t,e="-".concat(e)),i=xm(t,e));const r=function(t,e){return{"Y+|y+":{Y:"".concat(Number("".concat(e.year).slice(-2))),YY:ym("".concat(e.year).slice(-2),2),YYY:ym("".concat(e.year).slice(-3),3),def:t=>ym("".concat(e.year),t.length)},"M+":{M:e.month+1,MM:ym("".concat(e.month+1),2),MMM:t.locale_months_abbr[e.month],def:t.locale_months[e.month]},"W+|w+":{W:e.day,WW:ym("".concat(e.day),2),WWW:t.locale_days_abbr[e.day],def:t.locale_days[e.day]},"D+|d+":{D:e.date,def:t=>ym("".concat(e.date),t.length)},"h+|H+":{h:e.h,def:t=>ym("".concat(e.h),t.length)},"m+":{m:e.m,def:t=>ym("".concat(e.m),t.length)},"s+|S+":{s:e.s,def:t=>ym("".concat(e.s),t.length)},"f+|F+":{def(t){let n="".concat(e.f),i=t.length-n.length;if(i>0)for(let t=0;t<i;t++)n+="0";else i<0&&(n=n.slice(0,t.length));return n}},"t{1,2}|T{1,2}":{def(t){let n=e.t;return t[0].toUpperCase()===t[0]&&(n=n.toUpperCase()),n=n.slice(0,t.length),n}}}}(this,i),o=[];for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&o.push(t);const a=new RegExp(o.join("|"),"g");return e.replace(a,(t=>{let e,n,i;for(n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&(e=new RegExp(n),e.test(t)))break;if(!e)return"";for(const e in r[n])if(e===t||e.toLowerCase()===t){i=r[n][e],void 0===i&&(i=r[n][e.toLowerCase()]);break}return void 0===i&&(i=r[n].def),"function"==typeof i&&(i=i(t)),i}))}}function wm(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new bm(...e)}function km(t){return new Date(Date.UTC(1899,11,30+Math.floor(t),0,0,0,Math.round(864e5*(t-Math.floor(t)))))}function _m(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TS",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=wm(n,t,e),r=sm(i.format.bind(i),{toKey:t=>"object"==typeof t&&"function"==typeof t.getTime?t.getTime():t});function o(t){return e!==dm?km(t):t}function a(t){return t=o(t),r(t)}return a.format=function(t,e){return r.clear(),e=o(e),i.format(e,t)},a.locale=function(n){return i=wm(n,t,e),r=sm(i.format.bind(i),{toKey:t=>"object"==typeof t?t.getTime():t}),this},a.qtype=function(t){return void 0!==t&&(e=t,r.clear()),e},a}function Mm(t,e){if(t&&t.qNumFormat&&-1!==["D","T","TS","IV"].indexOf(t.qNumFormat.qType))return _m(t.qNumFormat.qFmt,t.qNumFormat.qType,e);let n="#",i=e&&void 0!==e.qThousandSep?e.qThousandSep:",",r=e&&void 0!==e.qDecimalSep?e.qDecimalSep:".",o="U",a=t&&!!t.qIsAutoFormat;return t&&t.qNumFormat?(n=t.qNumFormat.qFmt||n,i=t.qNumFormat.qThou||i,r=t.qNumFormat.qDec||r,o=t.qNumFormat.qType||o,a=a&&-1===["M"].indexOf(t.qNumFormat.qType)):a=!0,(a||"U"===o)&&(n="#".concat(r,"##"),o="U"),lm(n,i,r,o,e)}function Sm(){let t,{meta:e,id:n,key:i,localeInfo:r,fieldExtractor:o,value:a,type:s,sourceField:l}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const c=a||("dimension"===s?t=>t.qElemNo:t=>t.qValue),u=t=>t.qText||"",h="dimension"===s?"first":"avg",d=Mm(e,r),f="dimension"===s?"first":(t,e)=>d(e),p={id:()=>n,key:()=>i,raw:()=>e,title:()=>e.qFallbackTitle||e.label,type:()=>s,origin:()=>l,items:()=>(t||(t=o(p)),t),min:()=>e.qMin,max:()=>e.qMax,value:c,label:u,reduce:h,reduceLabel:f,formatter:()=>d,tags:()=>e.qTags};return p}function Cm(t,e,n,i,r){return(e[t]||[]).map(((e,o)=>{const a="".concat(i?"".concat(i,"/"):"").concat(t,"/").concat(o),s={instance:Sm(og({id:"".concat(n?"".concat(n,"/"):"").concat(a),key:a,meta:e},r))};return s.attrDims=Cm("qAttrDimInfo",e,n,a,og({},r,{value:t=>t.qElemNo,type:"dimension"})),s.attrExps=Cm("qAttrExprInfo",e,n,a,og({},r,{value:t=>t.qNum,type:"measure"})),s.measures=Cm("qMeasureInfo",e,n,a,og({},r,{value:t=>t.qValue,type:"measure"})),s}))}function Nm(){let{key:t,data:e,config:n={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const i={fields:[],wrappedFields:[],allFields:[],virtualFields:[]},r=e;if(!r)throw new Error('Missing "data" input');if(!r.qDimensionInfo)throw new Error('The "data" input is not recognized as a hypercube');const o=Nm.util,a={cache:i,cube:r,localeInfo:n.localeInfo,fieldExtractor:null,pages:null,hierarchy:()=>null,virtualFields:n.virtualFields},s={key:()=>t,raw:()=>r,field:t=>qg(t,a),fields:()=>i.fields.slice(),extract:t=>a.extractor(t,s,i,o),hierarchy:t=>a.hierarchy(t,s,i,o),_cache:()=>i};"K"===r.qMode||"T"===r.qMode||!r.qMode&&r.qNodesOnDim?(a.extractor=$g,a.hierarchy=Hg,a.pages="K"===r.qMode?r.qStackedDataPages:r.qTreeDataPages):"S"===r.qMode?(a.extractor=cg,a.pages=r.qDataPages,a.hierarchy=Hg):a.extractor=()=>[],a.fieldExtractor=t=>a.extractor({field:t},s,i,o);const l="S"===r.qMode?t=>t.qElemNumber:void 0,c="S"===r.qMode?t=>t.qNum:void 0;i.wrappedFields.push(...Cm("qDimensionInfo",r,t,"",og({},a,{value:l,type:"dimension"}))),i.wrappedFields.push(...Cm("qMeasureInfo",r,t,"",og({},a,{value:c,type:"measure"}))),i.fields=i.wrappedFields.map((t=>t.instance));const u=t=>{t.forEach((t=>{i.allFields.push(t.instance),u(t.measures),u(t.attrDims),u(t.attrExps)}))};return u(i.wrappedFields),(n.virtualFields||[]).forEach((e=>{const n=s.field(e.from),r=Sm(Kp({meta:n.raw(),id:"".concat(t,"/").concat(e.key),sourceField:n,fieldExtractor:t=>a.extractor({field:t},s,i,o),key:e.key,type:n.type(),localeInfo:a.localeInfo,value:n.value},e.override||{}));i.virtualFields.push(r)})),i.allFields.push(...i.virtualFields),s}const Rm=[["qHyperCube","qHyperCubeDef"],["qTreeData","qTreeDataDef"],["qDimensionInfo","qDimensions"],["qMeasureInfo","qMeasures"],["qAttrDimInfo","qAttributeDimensions"],["qAttrExprInfo","qAttributeExpressions"]],qm=/\/qDimensionInfo(?:\/(\d+))?/,Am=/\/qMeasureInfo\/(\d+)/,Dm=/\/qAttrDimInfo\/(\d+)(?:\/(\d+))?/,Em=/\/qAttrExprInfo\/(\d+)/,Om=/\/?qHyperCube/,Im=/\/?qTreeData/,Tm=t=>"".concat(t.substr(0,t.indexOf("/qHyperCubeDef")+14)),jm=t=>"".concat(t.substr(0,t.indexOf("/qTreeDataDef")+13));function Pm(t,e){let n=t,i=-1,r=-1,o="",a=t=>t;Om.test(t)?(o="".concat(n.substr(0,n.indexOf("qHyperCube")+10)),a=Tm):Im.test(t)&&(o="".concat(n.substr(0,n.indexOf("qTreeData")+9)),a=jm);let s=!0;if(qm.test(t)&&(i=+qm.exec(t)[1]),Am.test(t)&&(r=+Am.exec(t)[1]),Dm.test(t)){r=-1,i=0;const t=+Dm.exec(n)[2];isNaN(t)||(i=t,n=n.replace(/\/\d+$/,"")),s=!1}if(Em.test(t)){const t=r;if(e){r=0;const a=Cg(o,e);r+=(a.qMeasureInfo||[]).length,i>-1?(r=a.qDimensionInfo.slice(0,i).reduce(((t,e)=>t+e.qAttrExprInfo.length),r),i=-1):(r=a.qDimensionInfo.reduce(((t,e)=>t+e.qAttrExprInfo.length),r),r=a.qMeasureInfo.slice(0,t).reduce(((t,e)=>t+e.qAttrExprInfo.length),r)),r+=+Em.exec(n)[1]}else i>-1?(i=-1,r=+Em.exec(n)[1]):r+=+Em.exec(n)[1]+1}return Rm.forEach((t=>{let[e,i]=t;n=n.replace(e,i)})),s&&(n=a(n)),n&&"/"!==n[0]&&(n="/".concat(n)),{measureIdx:r,dimensionIdx:i,path:n}}function zm(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const i=e.byCells,r=e.primarySource,o=[],a={},s=t.isActive();let l=!1;if(t.brushes().forEach((t=>{const e=Pm(t.id,n);if("range"===t.type&&e.measureIdx>-1&&e.dimensionIdx>-1){const n=t.brush.ranges();n.length&&(l=!0,a.multiRangeSelectTreeDataValues||(a.multiRangeSelectTreeDataValues={path:e.path,ranges:[]}),n.forEach((t=>a.multiRangeSelectTreeDataValues.ranges.push({qMeasureIx:e.measureIdx,qDimensionIx:e.dimensionIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!0}}))))}else{if("range"===t.type&&e.measureIdx>-1){const n=t.brush.ranges();n.length&&(l=!0,a.rangeSelectHyperCubeValues||(a.rangeSelectHyperCubeValues={path:e.path,ranges:[]}),n.forEach((t=>a.rangeSelectHyperCubeValues.ranges.push({qMeasureIx:e.measureIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!0}}))))}if("range"===t.type&&e.dimensionIdx>-1){const n=t.brush.ranges();n.length&&(l=!0,a.selectHyperCubeContinuousRange||(a.selectHyperCubeContinuousRange={path:e.path,ranges:[]}),n.forEach((t=>a.selectHyperCubeContinuousRange.ranges.push({qDimIx:e.dimensionIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!1}}))))}if("value"===t.type&&e.dimensionIdx>-1)if(i)if(n&&n.qHyperCube&&("P"===n.qHyperCube.qMode||"T"===n.qHyperCube.qMode||"K"===n.qHyperCube.qMode)){const i=n.qHyperCube,o=i.qNoOfLeftDims,s=i.qEffectiveInterColumnSortOrder.indexOf(e.dimensionIdx);if(a.selectPivotCells||(a.selectPivotCells={path:e.path,cells:[]}),t.id===r||!r){const n=t.brush.values().map((t=>+t)).filter((t=>!isNaN(t)));(0===o||s>=o)&&o>-1?n.forEach((t=>{a.selectPivotCells.cells.push({qType:"T",qCol:t,qRow:s-o})})):n.forEach((t=>{a.selectPivotCells.cells.push({qType:"L",qCol:e.dimensionIdx,qRow:t})})),l=!!a.selectPivotCells.cells.length}}else a.selectHyperCubeCells||(a.selectHyperCubeCells={path:e.path,cols:[]}),a.selectHyperCubeCells.cols.push(e.dimensionIdx),t.id!==r&&(r||a.selectHyperCubeCells.values)||(a.selectHyperCubeCells.values=t.brush.values().map((t=>+t)).filter((t=>!isNaN(t))),l=!!a.selectHyperCubeCells.values.length);else{const n=t.brush.values().map((t=>+t)).filter((t=>!isNaN(t)));l=!!n.length,o.push({params:[e.path,e.dimensionIdx,n,!1],method:"selectHyperCubeValues"})}}})),!l&&s)return[{method:"resetMadeSelections",params:[]}];var c;a.rangeSelectHyperCubeValues&&o.push({method:"rangeSelectHyperCubeValues",params:[a.rangeSelectHyperCubeValues.path,a.rangeSelectHyperCubeValues.ranges,[],null===(c=e.orMode)||void 0===c||c]});return a.selectHyperCubeContinuousRange&&o.push({method:"selectHyperCubeContinuousRange",params:[a.selectHyperCubeContinuousRange.path,a.selectHyperCubeContinuousRange.ranges]}),a.selectHyperCubeCells&&o.push({method:"selectHyperCubeCells",params:[a.selectHyperCubeCells.path,a.selectHyperCubeCells.values,a.selectHyperCubeCells.cols]}),a.selectPivotCells&&o.push({method:"selectPivotCells",params:[a.selectPivotCells.path,a.selectPivotCells.cells]}),a.multiRangeSelectTreeDataValues&&o.push({method:"multiRangeSelectTreeDataValues",params:[a.multiRangeSelectTreeDataValues.path,a.multiRangeSelectTreeDataValues.ranges]}),o}function Fm(t){Nm.util=t.data("matrix").util,t.data("q",Nm),t.formatter("q-number",lm),t.formatter("q-time",_m)}Fm.qBrushHelper=zm,Fm.selections=zm;const Lm={fill:"steelblue",num:1},Bm=.9,Hm=150,$m=(t,e,n)=>{let i=0,r=0,o=0,a={},s=0;if("labelCenter"===t)i=e.bottomLeft.x,r=e.topRight.y,o=e.bottomRight.x-e.bottomLeft.x,s=e.bottomRight.y-e.topRight.y,a={share:n.share,fill:n.fill};else{const t=180/Math.PI*Math.atan((e.bottomRight.y-e.topRight.y)/(e.topRight.x-e.bottomRight.x));i=t<15&&t>=0?e.topRight.x:t>-15&&t<0?e.bottomRight.x:t<-15?(e.bottomRight.x-e.topRight.x)/2+e.topRight.x+15:(e.topRight.x-e.bottomRight.x)/2+e.bottomRight.x+15,r=e.topRight.y,o=e.width-i,s=e.bottomRight.y-e.topRight.y,a={fill:n.fill}}return{tag:t,type:"rect",x:i,y:r,width:o,height:s,data:n.data,desc:a,fill:"none"}},Vm=(t,e)=>{const n=(t=>{const e=(t=>{let e=0;return t.forEach((t=>{t.num>e&&(e=t.num)})),e})(t);let n=0;return t.slice().reverse().map((t=>{const i={datum:t,s:n/e,e:t.num/e};return n=t.num,i})).reverse()})(t),i=e.width*Bm,r=e.height*Bm,o=(e.width-i)/2,a=(e.height-r)/2,s=i-(i>Hm&&r>Hm?100:0),l=(r-1*(n.length-1))/n.length,c=[];return n.forEach(((t,i)=>{const r=(u=t.e,h=i<n.length-1?t.s:t.e,[.5-.5*u,.5+.5*u,.5+.5*h,.5-.5*h]).map((t=>Math.round(t*s+o)));var u,h;const d=l*i+1*i+a,f={bottomRight:{x:r[2],y:Math.round(d+l)},bottomLeft:{x:r[3],y:Math.round(d+l)},topRight:{x:r[1],y:Math.round(d)},topLeft:{x:r[0],y:Math.round(d)},width:e.width},p=`M${f.topLeft.x},${f.topLeft.y} L${f.topRight.x},${f.topRight.y} ${f.bottomRight.x},${f.bottomRight.y} ${f.bottomLeft.x},${f.bottomLeft.y}Z`;c.push({tag:"section",type:"path",d:p,data:t.datum.data,fill:t.datum.fill});const g={share:t.e,fill:t.datum.fill,data:t.datum.data};l>12&&(f.bottomRight.x-f.bottomLeft.x>32&&c.push($m("labelCenter",f,g)),c.push($m("labelLeft",f,g)))})),c},Wm=(t,e,n,i)=>(i-t)/i*(e-n)+n,Um=(t,e,n)=>{const i=t.filter((t=>"NaN"!==t.num&&t.num>0)),r=i.length,o=n.width*Bm,a=n.height*Bm,s=Math.round((n.width-o)/2),l=Math.round((n.height-a)/2),c=o-(o>Hm&&a>Hm?100:0),u=a-1*(r-1),h=[],d=i[0].data.num.value;let f=l;return i.forEach(((t,i)=>{const r=e[i]*u,o=Math.round(Wm(f-l,c,.2*c,a)/2),p=Math.round(Wm(f-l+r,c,.2*c,a)/2),g=s+Math.round(c/2),m={bottomRight:{x:g+p,y:Math.round(f+r)},bottomLeft:{x:g-p,y:Math.round(f+r)},topRight:{x:g+o,y:f},topLeft:{x:g-o,y:f},width:n.width},y=`M${m.topLeft.x},${m.topLeft.y} L${m.topRight.x},${m.topRight.y} ${m.bottomRight.x},${m.bottomRight.y} ${m.bottomLeft.x},${m.bottomLeft.y}Z`;h.push({tag:"section",type:"path",d:y,data:t.data,fill:t.fill});const v={share:t.data.num.value/d,fill:t.fill,data:t.data};r>2&&(m.bottomRight.x-m.bottomLeft.x>32&&h.push($m("labelCenter",m,v)),h.push($m("labelLeft",m,v))),f+=r+1})),h},Ym=(t,e,n)=>{const i=t.filter((t=>"NaN"!==t.num&&t.num>0));if(i&&i.length>0)switch(e){case"WIDTH":return Vm(i,n);case"ORDER":return Um(i,i.map((()=>1/i.length)),n);case"HEIGHT":return Um(i,(t=>{const e=t.reduce(((t,e)=>t+e.data.num.value),0);return t.map((t=>t.data.num.value/e))})(i),n);case"AREA":return Um(i,((t,e,n)=>{const i=t.reduce(((t,e)=>t+e.data.num.value),0),r=e.width*Bm,o=e.height*Bm,a=r*n,s=o*(r+a)/2,l=(r-a)/2/o,c=[];let u=0;for(let e=t.length-1;e>=0;e--){const n=t[e].data.num.value/i,r=2*l*u+a,h=-r/(2*l)+Math.sqrt(r*r/(4*l*l)+n*s/l);c[e]=h/o,u+=h}return c})(i,n,.2),n);default:return Vm(i,n)}return[]};var Xm={require:["resolver"],defaultSettings:{settings:{},data:{},style:{item:"$shape"}},render({data:t}){const e=this.resolver.resolve({data:t,defaults:{...Lm,...this.style.item},settings:this.settings.settings});return Ym(e.items,this.settings.settings.mode,this.rect)}};const Km={version:"1.6.0",color:{auto:!0,autoMinMax:!0,byDimDef:void 0,byMeasureDef:void 0,colorExpression:void 0,dimensionScheme:"12",expressionIsColor:!0,expressionLabel:"",measureMin:void 0,measureMax:void 0,measureScheme:"sg",mode:"primary",paletteColor:{index:6},persistent:!1,reverseScheme:!1,singleColor:void 0,useBaseColors:"off",useDimColVal:!0,useMeasureGradient:!0},dataPoint:{auto:!0,labelMode:"share"},footnote:"",funnel:{mode:"WIDTH"},qHyperCubeDef:{qDimensions:[],qMeasures:[],qInterColumnSortOrder:[],qInitialDataFetch:[{qWidth:2,qHeight:5e3}],qSuppressMissing:!0,qSuppressZero:!1},showDimensionTitle:!0,showTitles:!0,subtitle:"",title:""};var Gm={definition:{type:"items",component:"accordion",items:{data:{uses:"data",items:{dimensions:{uses:"dimensions",items:{others:{items:{suppressOther:{defaultValue:!0,show:!1}}}},disabledRef:""},measures:{uses:"measures",disabledRef:""}}},sorting:{uses:"sorting"},settings:{uses:"settings",items:{presentation:{type:"items",label:"Presentation",grouped:!0,items:{funnelmode:{ref:"funnel.mode",label:"Funnel Mode",type:"string",component:"dropdown",options:[{value:"AREA",label:"Area"},{value:"HEIGHT",label:"Height"},{value:"WIDTH",label:"Width"},{value:"ORDER",label:"Ordering"}],defaultValue:"WIDTH"},dimensionTitle:{ref:"showDimensionTitle",type:"boolean",component:"switch",label:"Dimension title",defaultValue:!0,options:[{value:!0,label:"Auto"},{value:!1,label:"Off"}]},valuesAuto:{ref:"dataPoint.auto",type:"boolean",label:"Value labels",component:"switch",defaultValue:!0,options:[{value:!0,label:"Auto"},{value:!1,label:"Custom"}]},labelMode:{ref:"dataPoint.labelMode",type:"string",component:"dropdown",options:[{value:"none",label:"None"},{value:"share",label:"Share"},{value:"value",label:"Values"}],defaultValue:"share",show:t=>!t.dataPoint.auto}}},colorsAndLegend:{uses:"colorsAndLegend",translation:"Colors",items:{colors:{items:{colorByLabel:{show:!1},expressionLabel:{show:!1}}},legend:{show:!1}}}}}}},support:{export:!0,exportData:!0,snapshot:!0,viewData:!1},importProperties:null,exportProperties:null};const Zm=[{path:"/qHyperCubeDef",dimensions:{min:1,max:1,description:()=>"Segments"},measures:{min:1,max:1,description(t){switch(t.funnel.mode){case"WIDTH":return"Width";case"AREA":return"Area";case"HEIGHT":return"Height";case"ORDER":return"Order";default:return""}},added(t,e){2===e.qHyperCubeDef.qInterColumnSortOrder.length&&1!==e.qHyperCubeDef.qInterColumnSortOrder[0]&&(e.qHyperCubeDef.qInterColumnSortOrder=[1,0])}}}];function Jm(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function Qm(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Jm(Object(n),!0).forEach((function(e){ry(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Jm(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function ty(){ty=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",s=r.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var o=e&&e.prototype instanceof d?e:d,a=Object.create(o.prototype),s=new S(r||[]);return i(a,"_invoke",{value:w(t,n,s)}),a}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h={};function d(){}function f(){}function p(){}var g={};l(g,o,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(C([])));y&&y!==e&&n.call(y,o)&&(g=y);var v=p.prototype=d.prototype=Object.create(g);function x(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(i,o,a,s){var l=u(t[i],t,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(h).then((function(t){c.value=t,a(c)}),(function(t){return r("throw",t,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function w(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return{value:void 0,done:!0}}for(n.method=r,n.arg=o;;){var a=n.delegate;if(a){var s=k(a,n);if(s){if(s===h)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=u(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function k(t,e){var n=e.method,i=t.iterator[n];if(void 0===i)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var r=u(i,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,h;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function C(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i<t.length;)if(n.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:N}}function N(){return{value:void 0,done:!0}}return f.prototype=p,i(v,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:f,configurable:!0}),f.displayName=l(p,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,l(t,s,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},x(b.prototype),l(b.prototype,a,(function(){return this})),t.AsyncIterator=b,t.async=function(e,n,i,r,o){void 0===o&&(o=Promise);var a=new b(c(e,n,i,r),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(v),l(v,s,"Generator"),l(v,o,(function(){return this})),l(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var i in e)n.push(i);return n.reverse(),function t(){for(;n.length;){var i=n.pop();if(i in e)return t.value=i,t.done=!1,t}return t.done=!0,t}},t.values=C,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(M),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function i(n,i){return a.type="throw",a.arg=t,e.next=n,i&&(e.method="next",e.arg=void 0),!!i}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;M(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:C(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function ey(t){return(ey="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ny(t,e,n,i,r,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(i,r)}function iy(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){ny(o,i,r,a,s,"next",t)}function s(t){ny(o,i,r,a,s,"throw",t)}a(void 0)}))}}function ry(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function oy(t,e){if(null==t)return{};var n,i,r=function(t,e){if(null==t)return{};var n,i,r={},o=Object.keys(t);for(i=0;i<o.length;i++)n=o[i],e.indexOf(n)>=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)n=o[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function ay(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=o.call(n)).done)&&(s.push(i.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}(t,e)||ly(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 sy(t){return function(t){if(Array.isArray(t))return cy(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ly(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 ly(t,e){if(t){if("string"==typeof t)return cy(t,e);var n=Object.prototype.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)?cy(t,e):void 0}}function cy(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var uy=Object.prototype.hasOwnProperty,hy=Object.prototype.toString,dy=Object.defineProperty,fy=Object.getOwnPropertyDescriptor,py=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===hy.call(t)},gy=function(t){if(!t||"[object Object]"!==hy.call(t))return!1;var e,n=uy.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&uy.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;for(e in t);return void 0===e||uy.call(t,e)},my=function(t,e){dy&&"__proto__"===e.name?dy(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},yy=function(t,e){if("__proto__"===e){if(!uy.call(t,e))return;if(fy)return fy(t,e).value}return t[e]},vy=function t(){var e,n,i,r,o,a,s=arguments[0],l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),(null==s||"object"!=typeof s&&"function"!=typeof s)&&(s={});l<c;++l)if(null!=(e=arguments[l]))for(n in e)i=yy(s,n),s!==(r=yy(e,n))&&(u&&r&&(gy(r)||(o=py(r)))?(o?(o=!1,a=i&&py(i)?i:[]):a=i&&gy(i)?i:{},my(s,{name:n,newValue:t(u,a,r)})):void 0!==r&&my(s,{name:n,newValue:r}));return s};function xy(t,e){return{range:function(t){var n=t.resources,i=t.data,r=n.theme.palette("categorical",0===e?i.items.length:e);return i.items.map((function(t){return r[t.value%r.length]}))},valueAccessor:t.value}}function by(t,e){return{range:function(t){var n=t.resources,i=t.data,r=n.theme.palette("categorical",0===e?i.items.length:e);return i.items.map((function(t){return r[t.row.value%r.length]}))},valueAccessor:t.value}}function wy(t,e,n,i,r){var o,a,s=r.byRow,l=r.byElemNo;if(i&&(e.input.persistent||t.hc.qDimensionInfo.length>1||void 0===n.activeDimensionIndex&&t.hc.qSize.qcy>((null===(a=(o=t.hc).qDataPages[0]||o.qStackedDataPages[0])||void 0===a?void 0:a.qArea.qHeight)||0)))return l(i,i.raw().qCardinal);if(i){var c=e.pic.extract({field:i.key(),trackBy:i.value}).length;return s(i,c)}return{}}function ky(t,e){var n=t.hc.qDimensionInfo,i=e.input.byDimDef||{activeDimensionIndex:n.length-1};if(i.activeDimensionIndex>=0){var r=n[i.activeDimensionIndex];i=r.coloring&&r.coloring.colorMapRef?{type:"libraryItem",key:r.coloring.colorMapRef,activeDimensionIndex:i.activeDimensionIndex}:{activeDimensionIndex:i.activeDimensionIndex}}return i}function _y(t,e){var n;return e.activeDimensionIndex>=0?n=t.pic.fields().filter((function(t){return"dimension"===t.type()}))[e.activeDimensionIndex]:"libraryItem"===e.type?!1===(n=e.key?t.pic.field((function(t){return t.raw().colorMapRef===e.key})):void 0)&&(n=t.pic.field((function(t){return"colorByAlternative"===t.raw().id}))):"expression"===e.type&&(n=t.pic.field((function(t){return"colorByAlternative"===t.raw().id}))),n}function My(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Sy(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Cy(){}var Ny=1/.7,Ry="\\s*([+-]?\\d+)\\s*",qy="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ay="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Dy=/^#([0-9a-f]{3,8})$/,Ey=new RegExp("^rgb\\("+[Ry,Ry,Ry]+"\\)$"),Oy=new RegExp("^rgb\\("+[Ay,Ay,Ay]+"\\)$"),Iy=new RegExp("^rgba\\("+[Ry,Ry,Ry,qy]+"\\)$"),Ty=new RegExp("^rgba\\("+[Ay,Ay,Ay,qy]+"\\)$"),jy=new RegExp("^hsl\\("+[qy,Ay,Ay]+"\\)$"),Py=new RegExp("^hsla\\("+[qy,Ay,Ay,qy]+"\\)$"),zy={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Fy(){return this.rgb().formatHex()}function Ly(){return this.rgb().formatRgb()}function By(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Dy.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Hy(e):3===n?new Uy(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?$y(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?$y(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Ey.exec(t))?new Uy(e[1],e[2],e[3],1):(e=Oy.exec(t))?new Uy(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Iy.exec(t))?$y(e[1],e[2],e[3],e[4]):(e=Ty.exec(t))?$y(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=jy.exec(t))?Gy(e[1],e[2]/100,e[3]/100,1):(e=Py.exec(t))?Gy(e[1],e[2]/100,e[3]/100,e[4]):zy.hasOwnProperty(t)?Hy(zy[t]):"transparent"===t?new Uy(NaN,NaN,NaN,0):null}function Hy(t){return new Uy(t>>16&255,t>>8&255,255&t,1)}function $y(t,e,n,i){return i<=0&&(t=e=n=NaN),new Uy(t,e,n,i)}function Vy(t){return t instanceof Cy||(t=By(t)),t?new Uy((t=t.rgb()).r,t.g,t.b,t.opacity):new Uy}function Wy(t,e,n,i){return 1===arguments.length?Vy(t):new Uy(t,e,n,null==i?1:i)}function Uy(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function Yy(){return"#"+Ky(this.r)+Ky(this.g)+Ky(this.b)}function Xy(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Ky(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Gy(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Jy(t,e,n,i)}function Zy(t){if(t instanceof Jy)return new Jy(t.h,t.s,t.l,t.opacity);if(t instanceof Cy||(t=By(t)),!t)return new Jy;if(t instanceof Jy)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=e===o?(n-i)/s+6*(n<i):n===o?(i-e)/s+2:(e-n)/s+4,s/=l<.5?o+r:2-o-r,a*=60):s=l>0&&l<1?0:a,new Jy(a,s,l,t.opacity)}function Jy(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function Qy(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function tv(t){return function(){return t}}function ev(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):tv(isNaN(t)?e:t)}My(Cy,By,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Fy,formatHex:Fy,formatHsl:function(){return Zy(this).formatHsl()},formatRgb:Ly,toString:Ly}),My(Uy,Wy,Sy(Cy,{brighter:function(t){return t=null==t?Ny:Math.pow(Ny,t),new Uy(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Uy(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Yy,formatHex:Yy,formatRgb:Xy,toString:Xy})),My(Jy,(function(t,e,n,i){return 1===arguments.length?Zy(t):new Jy(t,e,n,null==i?1:i)}),Sy(Cy,{brighter:function(t){return t=null==t?Ny:Math.pow(Ny,t),new Jy(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Jy(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new Uy(Qy(t>=240?t-240:t+120,r,i),Qy(t,r,i),Qy(t<120?t+240:t-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var nv=function t(e){var n=function(t){return 1==(t=+t)?ev:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):tv(isNaN(e)?n:e)}}(e);function i(t,e){var i=n((t=Wy(t)).r,(e=Wy(e)).r),r=n(t.g,e.g),o=n(t.b,e.b),a=ev(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=r(e),t.b=o(e),t.opacity=a(e),t+""}}return i.gamma=t,i}(1),iv=/^class(-pyramid)?/,rv=function(t,e,n,i){var r=void 0!==n.min?n.min:i.min(),o=void 0!==n.max?n.max:i.max(),a=r,s=o,l=e.limits,c={},u="percent"===e.limitType?l.map((function(t){return r+(o-r)*t})):l,h=e.colors.map((function(e){return t.resolveUIColor(e)}));if(r=Math.min.apply(Math,[r].concat(sy(u))),o=Math.max.apply(Math,[o].concat(sy(u))),c.min=r,c.max=o,e.breakTypes&&-1===e.breakTypes.indexOf(!0))c.type="categorical",Object.assign(c,function(t){var e=t.min,n=t.max,i=t.limits,r=t.range,o=[],a=[];if(i.length)if(i[i.length-1]<e)a.push(e,n),o.push(r[r.length-1],r[r.length-1],r[r.length-1]);else if(i[0]>n)a.push(e,n),o.push(r[0],r[0],r[0]);else{if(i[0]>e)a.push(e),o.push(r[0]);else{a.push(e);for(var s=0;s<i.length;s++)if(e<i[s]){o.push(r[s]);break}}for(var l=0;l<i.length;l++)e<i[l]&&i[l]<n&&(a.push(i[l]),o.push(r[l]));if(i[i.length-1]<n)a.push(n),o.push(r[i.length]),o.push(r[i.length]);else{a.push(n);for(var c=0;c<i.length;c++)if(i[c]>n){o.push(r[c]),o.push(r[c]);break}}}else o.push(r[0]);return{min:e,max:n,range:o,domain:a}}({min:"percent"===e.limitType?r:a,max:"percent"===e.limitType?o:s,range:h,limits:"percent"===e.limitType?u:l}));else if(e.breakTypes){var d=e.breakTypes;c.type="continuous",c.domain=[r],c.range=[h[0]];for(var f=0;f<u.length;f+=1)if(d[f]){var p=h[f],g=h[f+1],m=nv(p,g)(.5);c.range.push(m),c.domain.push(u[f]),f<u.length-1&&d[f+1]&&(c.range.push(h[f+1]),c.domain.push((u[f]+u[f+1])/2))}else c.range.push(h[f]),c.range.push(h[f+1]),c.domain.push(u[f]),c.domain.push(u[f]+Math.min(1e-6,(o-r)/1e6));c.range.push(h[h.length-1]),c.domain.push(o)}else c.domain=u,c.range=h;return c};function ov(t,e,n,i,r){var o,a,s,l=0,c=[],u=(t-e)/(i+1);if(0===u)return 1;for(o=0;o<n.length;o+=1)a=.99*(n[o]-e),s=n[o]>t?Math.floor(t/u):n[o]<e?0:Math.floor(a/u),Number.isNaN(s)||(c[s]?c[s]+=1:c[s]=1);for(o=0;o<c.length;o+=1)c[o]&&(l+=1);return l<=i||l>=r?Math.max(l,i):ov(t,e,n,i+1,r)}var av=function(t,e,n,i){var r,o,a=e.theme,s=e.hc,l=i.f,c={mode:"field",fieldType:"measure",field:l?l.key():void 0,reverse:n.input.reverseScheme||!1,type:"continuous",range:function(t){return t.resources.theme.palette("quant")}},u=[],h=!0;if(l){if(Number.isNaN(+l.min())||Number.isNaN(+l.max()))return{invalid:!0};(h=!("S"===(r=n.pic.raw()).qMode&&(r.qDataPages[0]&&r.qSize.qcy>r.qDataPages[0].qArea.qHeight||!r.qDataPages.length&&r.qSize.qcy>0)||"K"===r.qMode&&r.qStackedDataPages[0]&&r.qSize.qcy>r.qStackedDataPages[0].qArea.qHeight||"T"===r.qMode&&r.qSize.qcy>r.qTreeDataPages[0].qGroupSize))&&(u=n.pic.extract({field:0,props:{num:{field:l.key()},exclude:{fields:s.qDimensionInfo.map((function(t,e){return{field:"qDimensionInfo/".concat(e)}})),value:function(t){return Math.min.apply(Math,sy(t))<0}}}}).filter((function(t){return t.value>=0&&!t.exclude.value})).map((function(t){return t.num.value})).filter((function(t){return"number"==typeof t})))}if(!1===n.input.autoMinMax){if(c.min=n.input.measureMin,c.max=n.input.measureMax,c.max<c.min)return{invalid:!0}}else if(l&&!h)c.min=l.min(),c.max=l.max();else if(l){if(!u.length)return{invalid:!0};c.min=Math.min.apply(Math,sy(u)),c.max=Math.max.apply(Math,sy(u))}if(n.input.measureScheme&&(c.palettes={quant:n.input.measureScheme}),a){var d=a.getDataColorScales().filter((function(t){return t.key===n.input.measureScheme}))[0];c.type=d&&iv.test(d.type)?"categorical":"continuous","categorical"===c.type&&(o=d.colors.some((function(t){return Array.isArray(t)}))?Math.max.apply(Math,sy(d.colors.map((function(t){return t?t.length:0})))):d.colors.length)}if("categorical"===c.type){for(var f=h?ov(c.max,c.min,u,1,o):o,p=(c.max-c.min)/f,g=[],m=0;m<f+1;m+=1)g.push(c.min+p*m);c.domain=g,c.range=function(t){for(var e=t.resources.theme.palette("quant",f),n=Math.max(1,Math.floor(e.length/f)),i=[],r=0;r<f;r+=1)i.push(e[r*n]);return[i[0]].concat(i,[i[i.length-1]])}}return c};function sv(t,e){var n;return e.activeMeasureIndex>=0?n=t.pic.fields().filter((function(t){return"measure"===t.type()}))[e.activeMeasureIndex]:"libraryItem"===e.type?n=t.pic.field((function(t){return t.raw().colorMapRef===e.key&&void 0!==e.key})):"expression"===e.type&&(n=t.pic.field((function(t){return"colorByAlternative"===t.raw().id}))),n||(n=t.pic.field((function(t){return void 0!==t.raw().matchMeasure})))&&(n=t.pic.fields().filter((function(t){return"measure"===t.type()}))[n.raw().matchMeasure]),n}function lv(t){var e,n=t.cm,i=t.defaults,r=t.index,o=t.input,a=t.pic;if(!o||!o.on)return null;var s=null!==(e=o.mode)&&void 0!==e?e:"primary";return"primary"===s?function(t,e,n){var i=n.primary;return void 0!==e.paletteColor&&e.paletteColor&&(i=t.resolveUIColor(e.paletteColor)),Qm(Qm({},n),{},{mode:"constant",type:"constant",primary:i})}(n,o,i):"byExpression"===s?function(t,e,n){var i="qMeasureInfo/".concat(t,"/"),r=e.field((function(t){return t.id().startsWith(i)&&"colorByMeasureExpression"===t.raw().id})),o=r;return Qm(Qm({},n),{},o?{mode:"field",fieldType:"expression",field:r?r.key():void 0,type:"color"}:{mode:"constant",type:"constant",primary:n.nil})}(r,a,i):null}function cv(t){t.measureOverrides.every((function(t){return!t}))&&(t.measureOverrides=null)}function uv(t,e){for(var n=(null==e?void 0:e.domain)||[],i=(null==e?void 0:e.range)||[],r=[],o=0;o<t.length;++o){var a=t[o];if("constant"===(null==a?void 0:a.mode)){var s=n.indexOf(o);-1===s?(n.push(o),i.push(a.primary)):i[s]=a.primary,t[o]=null}else if(a){r.push(o);var l=n.indexOf(o);-1!==l&&(n.splice(l,1),i.splice(l,1))}}return{domain:n,range:i,exclude:r}}function hv(t,e,n,i){var r,o=function(t,e,n,i){if(e.input&&!e.input.auto){if("byMeasure"===e.input.mode)return function(t,e,n){var i=e.theme,r=e.hc,o=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).getCField,a=void 0===o?sv:o,s=n.input.byMeasureDef||{activeMeasureIndex:0},l=a(n,s),c=av(0,{theme:i,hc:r},n,{f:l});if(c.invalid)return c;"expression"===s.type&&(s.activeMeasureIndex<0||void 0===s.activeMeasureIndex)&&(c.label=s.label,l&&"color.altLabel"===l.raw().labelExpRef&&(c.label=n.input.altLabel)),!c.label&&l&&(c.label=l.title());var u=s.activeMeasureIndex>=0?l:null;if(!u&&l&&void 0!==l.raw().matchMeasure&&l.raw().matchMeasure>-1&&(u=n.pic.fields().filter((function(t){return"measure"===t.type()}))[l.raw().matchMeasure]),n.input.useMeasureGradient&&"libraryItem"===s.type)if(u){var h=u.raw().coloring;h&&h.gradient&&vy(c,rv(t,h.gradient,c,u))}else c.auxiliary=s;return c}(t,n,e);if("byDimension"===e.input.mode)return function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=i.getCDef,o=void 0===r?ky:r,a=i.getCByField,s=void 0===a?_y:a,l=i.getPersistence,c=void 0===l?wy:l,u=o(e,n),h=s(n,u),d=h?h.raw():{},f=n&&n.pic?n.pic.raw():{};if(d.qError||d.qSize&&0===d.qSize.qcy&&!f.qHasOtherValues)return{invalid:!0};var p={mode:"field",fieldType:"dimension",type:"categorical",field:h?h.key():void 0,isFieldLocked:d.qLocked};return("expression"===u.type||u.activeDimensionIndex<0)&&(p.label=u.label,"color.altLabel"===d.labelExpRef&&(p.label=n.input.altLabel)),!p.label&&h&&(p.label=h.title()),n.input.dimensionScheme&&(p.palettes={categorical:n.input.dimensionScheme}),n.input.useDimColVal&&"libraryItem"===u.type&&(p.auxiliary=u),vy(p,c(e,n,u,h,{byRow:by,byElemNo:xy})),p}(t,n,e);if("byExpression"===e.input.mode)return function(t,e,n,i){var r=e.hc,o=e.theme,a=e.translator,s=n.pic.field((function(t){return"colorByExpression"===t.raw().id}));if(!s||!s.raw().qFallbackTitle&&!n.input.colorExpression||!(Number.isFinite(s.raw().qMin)&&Number.isFinite(s.raw().qMax)||n.input.expressionIsColor))return{mode:"constant",type:"constant",primary:i.nil};if(n.input.expressionIsColor)return{mode:"field",fieldType:"expression",field:s?s.key():void 0,type:"color"};var l=av(0,{hc:r,theme:o},n,{f:s});return l.invalid||(l.label=n.input.expressionLabel||a.get("Object.ChartTooltip.ColorExpression")),l}(0,n,e,i);if("byMultiple"===e.input.mode||"primary"===e.input.mode)return function(t,e,n,i){var r=e.hc,o=e.theme,a=e.translator,s=n.input.useBaseColors;if(("byMultiple"===n.input.mode||"primary"===n.input.mode&&"measure"===n.input.useBaseColors)&&r.qMeasureInfo.length>1&&(s="measure"),"measure"===s){var l=[],c=[];"measure"===n.input.useBaseColors&&r.qMeasureInfo.forEach((function(e,n){if(e.baseColor||e.coloring&&e.coloring.baseColor){l.push(n);var r=t.resolveUIColor(e.baseColor||e.coloring.baseColor);"none"===r?c.push(i.primary):c.push(r)}}));var u=n.input.dimensionScheme?{categorical:n.input.dimensionScheme}:void 0,h=o?o.getDataColorPalettes()[0]:void 0;return"measure"===n.input.useBaseColors&&h&&(u={categorical:h.key}),{mode:"measure",type:"categorical",palettes:u,label:a?a.get("Common.Measures"):void 0,explicit:l.length?{domain:l,range:c}:void 0}}if("dimension"===s){var d=[],f=[];return r.qDimensionInfo.forEach((function(e,n){if(e.baseColor||e.coloring&&e.coloring.baseColor){d.push(n);var r=t.resolveUIColor(e.baseColor||e.coloring.baseColor);"none"===r?f.push(i.primary):f.push(r)}})),{mode:"dimension",type:"categorical",field:d.length?d[0]:void 0,explicit:d.length?{domain:d,range:f}:void 0}}var p=i.primary;if(void 0!==n.input.paletteColor)n.input.paletteColor&&(p=t.resolveUIColor(n.input.paletteColor));else{var g=n.input.singleColor;"number"!=typeof g||Number.isNaN(g)||(p=["#b0afae","#7b7a78","#545352","#4477aa","#7db8da","#b6d7ea","#46c646","#f93f17","#ffcf02","#276e27","#ffffff","#000000"][g])}return{mode:"constant",type:"constant",primary:p}}(t,n,e,i)}return{}}(t,e,n,i);return null!==(r=e.input)&&void 0!==r&&r.measureOverrides?(o.measureOverrides=e.input.measureOverrides.map((function(n,r){return lv({cm:t,input:n,defaults:i,index:r,pic:e.pic})})),function(t,e){var n,i,r,o=e.translator;if(cv(t),1===(null===(n=t.measureOverrides)||void 0===n?void 0:n.length))return t.measureOverrides[0];if("measure"===t.mode&&t.measureOverrides&&(t.explicit=uv(t.measureOverrides,t.explicit),cv(t)),null!==(i=t.measureOverrides)&&void 0!==i&&i.every((function(t){return"constant"===(null==t?void 0:t.mode)}))){var a={mode:"measure",type:"categorical",label:null==o?void 0:o.get("Common.Measures")};return a.explicit=uv(t.measureOverrides),a}return null!==(r=t.measureOverrides)&&void 0!==r&&r.every((function(t){return t}))?{invalid:!0,measureOverrides:t.measureOverrides}:t}(o,n)):o}function dv(t){var e=Qm({hc:null,colorProps:null,layout:null,theme:null},t),n={},i={auto:function(){return{mode:"primary"}},getDimensionColorMap:function(){return Promise.reject()},getMeasure:function(){return Promise.reject()},getAttributeDimension:function(){return Promise.reject()}},r={auto:function(t){return t?(i.auto=t,r):i.auto},getDimensionColorMap:function(t){return t?(i.getDimensionColorMap=t,r):i.getDimensionColorMap},getAttributeDimension:function(t){return t?(i.getAttributeDimension=t,r):i.getAttributeDimension},getMeasure:function(t){return t?(i.getMeasure=t,r):i.getMeasure},set:function(t){var r;if(!t.colorProps)throw new Error('Missing "colorProps"');if(vy(e,t),(n={pic:e.picasso.data("q")({data:e.hc,config:{localeInfo:e.localeInfo}}),input:e.colorProps}).input.auto){var o=i.auto(t.layout);n.input=vy(!0,{},n.input,o,{auto:!1});var a=e.theme?e.theme.getDataColorPalettes():[];a[0]&&(n.input.dimensionScheme=a[0].key);var s=0;n.input.byDimDef&&+n.input.byDimDef.activeDimensionIndex>=0&&(s=+n.input.byDimDef.activeDimensionIndex),e.hc&&e.hc.qDimensionInfo[s]&&e.hc.qDimensionInfo[s].coloring&&e.hc.qDimensionInfo[s].coloring.colorMapRef&&n.input.byDimDef&&(n.input.byDimDef.type="libraryItem",n.input.byDimDef.key=e.hc.qDimensionInfo[s].coloring.colorMapRef)}null!==(r=n.input.measureOverrides)&&void 0!==r&&r.every((function(t){return!t||!t.on}))&&(n.input=vy(!1,{},n.input,{measureOverrides:null}))},palettes:function(){if(!n.palettes){var t=e.theme,i=[];(t&&t.getDataColorPickerPalettes()||[]).forEach((function(t){i.push({key:"ui",colors:t.colors})})),n.palettes=i}return n.palettes},getAuxiliaryData:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/qHyperCubeDef";if(!t.auxiliary&&!/qAttrDimInfo/.test(t.field))return Promise.resolve();var r=t.auxiliary||{},o=r.key;if("measure"===t.fieldType)return i.getMeasure(o,e).catch((function(){}));if("dimension"===t.fieldType){var a="".concat(n,"/").concat(t.field).replace("qDimensionInfo","qDimensions").replace("qAttrDimInfo","qAttributeDimensions");return Promise.all([/qAttrDimInfo/.test(t.field)?i.getAttributeDimension(a,e).catch((function(){})):Promise.resolve(),o?i.getDimensionColorMap(o,e).catch((function(){})):Promise.resolve()])}return Promise.resolve()},getAuxiliarySettings:function(t,i){var r=this;return t.auxiliary||/qAttrDimInfo/.test(t.field)?(this.palettes(),this.getAuxiliaryData(t,i).then((function(i){if(!i)return{};if("measure"===t.fieldType){if(i.coloring&&i.coloring.gradient){var o=n.pic.field(t.field);return rv(r,i.coloring.gradient,t,o)}return{}}if("dimension"===t.fieldType){var a={nil:t.nil,others:t.others},s=i[0],l=i[1]?i[1].colorMap:null;if(s){var c=e.picasso.data("q")({data:{qDimensionInfo:[n.pic.field(t.field).raw(),n.pic.field(t.field).raw()],qMeasureInfo:[],qDataPages:s,qInterColumnSortOrder:[0,1],qMode:"S"}});a.legendDataset=c}return l?function(t,e,n,i){var r=i.external,o=i.field,a=Qm({},t);vy(a,xy(o,o.raw().qCardinal));var s=r.theme?r.theme.getDataColorPalettes()[0]:null;return e.nul&&(a.nil=n.resolveUIColor(e.nul)),e.oth&&(a.others=n.resolveUIColor(e.oth)),e.usePal?(a.palettes={categorical:e.pal},s&&!e.pal&&(a.palettes.categorical=s.key,vy(a,xy(o)))):!1===e.autoFill&&e.single?a.range=[n.resolveUIColor(e.single)]:e.autoFill&&(s&&(a.palettes={categorical:s.key}),vy(a,xy(o))),e.colors&&e.colors.length&&(a.explicit=function(t,e,n){for(var i={},r=0;r<t.length;r+=1)i[t[r].value]=t[r].baseColor;var o=[];return{domain:function(t){var r=t.data,a=[];o=[];for(var s=0;s<r.items.length;s++){var l=r.items[s],c=(l.text||l).label;i[c]&&-1===a.indexOf(l.value)&&(a.push(l.value),o.push(e.resolveUIColor(i[c])))}return a.push(-3,-2),o.push(n.others),o.push(n.nil),a},range:function(){return o}}}(e.colors,n,a)),a}(a,l,r,{external:e,field:n.pic.field(t.field)}):a}return{}}))):Promise.resolve()},resolveUIColor:function(t){if(t.index<0||void 0===t.index)return t.color;if(void 0===n.uiPalette&&(n.uiPalette=this.palettes().filter((function(t){return"ui"===t.key}))[0]||!1),!n.uiPalette)return t.color;var e="none"===n.uiPalette.colors[0]?t.index:t.index-1;return void 0===n.uiPalette.colors[e]?t.color:n.uiPalette.colors[e]},settings:function(){if(this.palettes(),!n.settings){var t={primary:"steelblue",others:"#aaa",nil:"#ddd"},i=e.theme;i&&(t=Qm(Qm({},t),i.getDataColorSpecials())),n.settings=vy(t,hv(this,n,e,t))}return n.settings}};return r}var fv=function(t,e){var n=t.fieldType,i={};if(e)if("measure"===n){var r=e.coloring;r&&(i.measureGradient=r.gradient)}else if("dimension"===n){var o=e[0],a=e[1];o&&(i.legendDataPage=o),a&&(i.dimValsData=a.colorMap)}return i},pv=function(t){throw t.isHandled=!0,t},gv=function(t,e){var n=e.layout,i=e.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.dimValsData?Promise.resolve({colorMap:n.snapshotData.content.chartData.dimValsData}):Promise.reject():i&&i.getObject?i.getObject("ColorMapModel_".concat(t)).then((function(t){return t.getLayout()})):Promise.reject()},mv=function(t,e){var n=e.layout,i=e.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.measureGradient?Promise.resolve({coloring:{gradient:n.snapshotData.content.chartData.measureGradient}}):Promise.reject():i&&i.getMeasure?i.getMeasure(t).then((function(t){return t.getMeasure()})):Promise.reject()},yv=function(t,e){var n=e.layout,i=e.model,r=e.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.legendDataPage?Promise.resolve(n.snapshotData.content.chartData.legendDataPage):Promise.reject():i&&i.session&&r?i.getHyperCubeData(t,[{qHeight:100,qLeft:0,qTop:0,qWidth:2}]).catch(pv):Promise.reject()};function vv(t){var e=t.hc,n=t.source,i=t.coloring,r={data:{extract:[{source:"dummy",field:0,filter:function(){return r.expando=e.qDataPages[0]?e.qDataPages[0].qArea.qTop:0,!1}},{source:n,field:i.field,trackBy:i.valueAccessor,reduce:"first",props:{row:{reduce:function(){return r.expando++}},text:{value:function(t){return t.qText},reduce:"first"}}}]},expando:0};return r}function xv(t){return function(e){return"object"===ey(e.datum[t])?e.datum[t].value:void 0}}function bv(t){return"object"===ey(t.datum.isNull)?t.datum.isNull.value:-2===t.datum.value}function wv(t){return-3===t.datum.value}var kv=function(t,e,n){var i=t&&t.dock||void 0;if("auto"!==i)return i||"right";if(e){var r=e.element.getBoundingClientRect();if(r.height>r.width)return"bottom"}return n?"left":"right"},_v=function(t,e,n){return!(n.invalid||"color"===n.type||"measure"===n.mode&&e.qMeasureInfo.length<=1||"dimension"===n.mode)&&("function"==typeof t.show?t.show():!1!==t.show)};function Mv(t,e){var n=t.styleReference,i=t.chart,r=t.rtl,o=e.legendProps,a=e.coloring,s=e.theme,l=e.hc;return{layout:{minimumLayoutMode:"MEDIUM",dock:kv(o,i,r)},show:"function"==typeof o.show?function(){return _v(o,l,a)}:_v(o,l,a),renderer:"svg",mounted:function(t){t.childNodes[0].style.pointerEvents="none",t.style.overflow="hidden"},settings:{title:{show:!1!==o.showTitle,wordBreak:"break-word",maxLines:2,lineHeight:1.2,text:a.label||"",fill:s?s.getStyle(n,"legend.title","color"):void 0,fontSize:s?s.getStyle(n,"legend.title","fontSize"):"16px",fontFamily:s?s.getStyle(n,"legend.title","fontFamily"):"'Source Sans Pro', 'Arial', 'sans-serif'"}}}}function Sv(t,e,n){return"categorical"===e.coloring.type?function(t,e,n){var i=Mv(t,e);if(!i.show)return!1;var r,o=t.key,a=t.styleReference,s=t.viewState,l=t.rtl,c=t.settings,u=t.style,h=e.scaleKey,d=e.theme,f=e.scales,p=i.layout.dock,g="left"===p||"right"===p?{maxLines:3,wordBreak:"break-word"}:{},m={up:"M13.6,11 L2.4,11 C2.28954305,11 2.2,10.9104569 2.2,10.8 C2.2,10.756726 2.21403557,10.7146192 2.24,10.68 L7.84,3.21333333 C7.90627417,3.12496777 8.03163444,3.10705916 8.12,3.17333333 C8.13516113,3.18470418 8.14862915,3.1981722 8.16,3.21333333 L13.76,10.68 C13.8262742,10.7683656 13.8083656,10.8937258 13.72,10.96 C13.6853808,10.9859644 13.643274,11 13.6,11 Z",down:"M2.4,4 L13.6,4 C13.7104569,4 13.8,4.08954305 13.8,4.2 C13.8,4.24327404 13.7859644,4.28538077 13.76,4.32 L8.16,11.7866667 C8.09372583,11.8750322 7.96836556,11.8929408 7.88,11.8266667 C7.86483887,11.8152958 7.85137085,11.8018278 7.84,11.7866667 L2.24,4.32 C2.17372583,4.23163444 2.19163444,4.10627417 2.28,4.04 C2.31461923,4.01403557 2.35672596,4 2.4,4 Z",left:"M11,2.4 L11,13.6 C11,13.7104569 10.9104569,13.8 10.8,13.8 C10.756726,13.8 10.7146192,13.7859644 10.68,13.76 L3.21333333,8.16 C3.12496777,8.09372583 3.10705916,7.96836556 3.17333333,7.88 C3.18470418,7.86483887 3.1981722,7.85137085 3.21333333,7.84 L10.68,2.24 C10.7683656,2.17372583 10.8937258,2.19163444 10.96,2.28 C10.9859644,2.31461923 11,2.35672596 11,2.4 Z",right:"M4,13.6 L4,2.4 C4,2.28954305 4.08954305,2.2 4.2,2.2 C4.24327404,2.2 4.28538077,2.21403557 4.32,2.24 L11.7866667,7.84 C11.8750322,7.90627417 11.8929408,8.03163444 11.8266667,8.12 C11.8152958,8.13516113 11.8018278,8.14862915 11.7866667,8.16 L4.32,13.76 C4.23163444,13.8262742 4.10627417,13.8083656 4.04,13.72 C4.01403557,13.6853808 4,13.643274 4,13.6 Z"};"dimension"===e.coloring.fieldType&&(r=function(t){return t.datum.value>=0||-3===t.datum.value});var y="".concat(h,"Legend");return vy(!0,i,{type:"legend-cat",key:"".concat(o,"-cat"),scale:y in f?y:h,settings:{layout:{scrollOffset:function(){return s?s.get("legendScrollOffset"):void 0},size:-1!==["top","bottom"].indexOf(i.layout.dock)?2:1,direction:l?"rtl":"ltr",horizontal:20},item:{show:r,label:Qm({fill:d?d.getStyle(a,"legend.label","color"):void 0,fontSize:d?d.getStyle(a,"legend.label","fontSize"):void 0,fontFamily:d?d.getStyle(a,"legend.label","fontFamily"):"'Source Sans Pro', 'Arial', 'sans-serif'"},g)},navigation:{disabled:n,button:{content:function(t,e){var n=e.direction;return t("i",{style:{"pointer-events":"none",fontSize:"12px",display:"inline-block",fontStyle:"normal",lineHeight:"0",textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizelegibility",margin:"0px"}},[t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor"},[t("path",{d:m[n]})])])}}}},brush:{consume:[{context:"selection",data:["",o],style:{inactive:{opacity:.3}}}]}},{settings:c,style:u})}(t,e,n):"continuous"===e.coloring.type&&function(t,e){var n,i=t.key,r=t.styleReference,o=t.rtl,a=t.settings,s=t.style,l=e.scaleKey,c=e.theme,u="".concat(l,"Range"),h=Mv(t,e);if(!h.show)return!1;var d=h.layout.dock,f="right"===d||"left"===d,p=null===(n=e.scales)||void 0===n?void 0:n[u];return f&&p&&(p.invert=!0),vy(!0,h,{type:"legend-seq",key:"".concat(i,"-seq"),settings:{fill:l,major:u,length:1,tick:{fill:c?c.getStyle(r,"legend.label","color"):void 0,fontSize:c?c.getStyle(r,"legend.label","fontSize"):void 0,fontFamily:c?c.getStyle(r,"legend.label","fontFamily"):"'Source Sans Pro', 'Arial', 'sans-serif'"},title:{anchor:!o||"top"!==h.layout.dock&&"bottom"!==h.layout.dock?void 0:"right",padding:parseFloat(h.settings.title.fontSize)||16}}},{settings:a,style:s})}(t,e)}function Cv(t,e,n){var i=[],r=[],o=Sv(t,e,n&&n.navigationDisabled);return i.push(o),o&&"legend-cat"===o.type&&(r.push(function(t){var e=t.key,n=t.requireFailure,i=t.recognizeWith,r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).actions;return{key:"event:tap-".concat(e),type:"Tap",requireFailure:n,recognizeWith:i,options:{event:"legendtap",interval:10,pointers:1,enable:function(t,n){var i;if(!n)return!0;if(null!=r&&null!==(i=r.interact)&&void 0!==i&&i.enabled&&!r.interact.enabled())return!1;if(!this.chart.componentsFromPoint({x:n.center.x,y:n.center.y}).some((function(t){return t.key==="".concat(e,"-cat")})))return!1;var o=n.srcEvent.target;return!!(o&&o.hasAttribute("data-action")&&o.hasAttribute("data-component-key"))||!(!o||!o.childNodes[0]||"BUTTON"!==o.childNodes[0].nodeName)}},events:{legendtap:function(t){t.preventDefault();var e=t.srcEvent.target;e&&e.hasAttribute("data-action")&&e.hasAttribute("data-component-key")&&this.chart.component(e.getAttribute("data-component-key")).emit(e.getAttribute("data-action"))}}}}(t,n)),r.push(function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.eventName,i=e.key,r=e.requireFailure,o=e.recognizeWith,a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).actions;return{key:"event:pan-".concat(i),type:"Pan",requireFailure:r,recognizeWith:o,options:{event:n,pointers:1,threshold:10,enable:function(t,e){var r;return this.started===n||!e||!(null!=a&&null!==(r=a.interact)&&void 0!==r&&r.enabled&&!a.interact.enabled())&&this.chart.componentsFromPoint({x:e.center.x,y:e.center.y}).some((function(t){return t.key==="".concat(i,"-cat")}))}},events:(t={},ry(t,"".concat(n,"start"),(function(t){t.preventDefault(),this.started!==n&&(this.started=n,this.chart.component("".concat(i,"-cat")).emit("panstart",t))})),ry(t,"".concat(n,"move"),(function(t){t.preventDefault(),this.chart.component("".concat(i,"-cat")).emit("panmove",t)})),ry(t,"".concat(n,"end"),(function(t){t.preventDefault(),this.chart.component("".concat(i,"-cat")).emit("panend",t),this.started=!1})),t)}}(t,n))),{interactions:r,components:i}}function Nv(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Rv(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function qv(){}var Av=1/.7,Dv="\\s*([+-]?\\d+)\\s*",Ev="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ov="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Iv=/^#([0-9a-f]{3,8})$/,Tv=new RegExp(`^rgb\\(${Dv},${Dv},${Dv}\\)$`),jv=new RegExp(`^rgb\\(${Ov},${Ov},${Ov}\\)$`),Pv=new RegExp(`^rgba\\(${Dv},${Dv},${Dv},${Ev}\\)$`),zv=new RegExp(`^rgba\\(${Ov},${Ov},${Ov},${Ev}\\)$`),Fv=new RegExp(`^hsl\\(${Ev},${Ov},${Ov}\\)$`),Lv=new RegExp(`^hsla\\(${Ev},${Ov},${Ov},${Ev}\\)$`),Bv={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Hv(){return this.rgb().formatHex()}function $v(){return this.rgb().formatRgb()}function Vv(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Iv.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Wv(e):3===n?new Xv(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Uv(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Uv(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Tv.exec(t))?new Xv(e[1],e[2],e[3],1):(e=jv.exec(t))?new Xv(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Pv.exec(t))?Uv(e[1],e[2],e[3],e[4]):(e=zv.exec(t))?Uv(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Fv.exec(t))?tx(e[1],e[2]/100,e[3]/100,1):(e=Lv.exec(t))?tx(e[1],e[2]/100,e[3]/100,e[4]):Bv.hasOwnProperty(t)?Wv(Bv[t]):"transparent"===t?new Xv(NaN,NaN,NaN,0):null}function Wv(t){return new Xv(t>>16&255,t>>8&255,255&t,1)}function Uv(t,e,n,i){return i<=0&&(t=e=n=NaN),new Xv(t,e,n,i)}function Yv(t){return t instanceof qv||(t=Vv(t)),t?new Xv((t=t.rgb()).r,t.g,t.b,t.opacity):new Xv}function Xv(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function Kv(){return`#${Qv(this.r)}${Qv(this.g)}${Qv(this.b)}`}function Gv(){const t=Zv(this.opacity);return`${1===t?"rgb(":"rgba("}${Jv(this.r)}, ${Jv(this.g)}, ${Jv(this.b)}${1===t?")":`, ${t})`}`}function Zv(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Jv(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Qv(t){return((t=Jv(t))<16?"0":"")+t.toString(16)}function tx(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new nx(t,e,n,i)}function ex(t){if(t instanceof nx)return new nx(t.h,t.s,t.l,t.opacity);if(t instanceof qv||(t=Vv(t)),!t)return new nx;if(t instanceof nx)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=e===o?(n-i)/s+6*(n<i):n===o?(i-e)/s+2:(e-n)/s+4,s/=l<.5?o+r:2-o-r,a*=60):s=l>0&&l<1?0:a,new nx(a,s,l,t.opacity)}function nx(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function ix(t){return(t=(t||0)%360)<0?t+360:t}function rx(t){return Math.max(0,Math.min(1,t||0))}function ox(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Nv(qv,Vv,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Hv,formatHex:Hv,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ex(this).formatHsl()},formatRgb:$v,toString:$v}),Nv(Xv,(function(t,e,n,i){return 1===arguments.length?Yv(t):new Xv(t,e,n,null==i?1:i)}),Rv(qv,{brighter(t){return t=null==t?Av:Math.pow(Av,t),new Xv(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new Xv(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Xv(Jv(this.r),Jv(this.g),Jv(this.b),Zv(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Kv,formatHex:Kv,formatHex8:function(){return`#${Qv(this.r)}${Qv(this.g)}${Qv(this.b)}${Qv(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Gv,toString:Gv})),Nv(nx,(function(t,e,n,i){return 1===arguments.length?ex(t):new nx(t,e,n,null==i?1:i)}),Rv(qv,{brighter(t){return t=null==t?Av:Math.pow(Av,t),new nx(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new nx(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new Xv(ox(t>=240?t-240:t+120,r,i),ox(t,r,i),ox(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new nx(ix(this.h),rx(this.s),rx(this.l),Zv(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Zv(this.opacity);return`${1===t?"hsl(":"hsla("}${ix(this.h)}, ${100*rx(this.s)}%, ${100*rx(this.l)}%${1===t?")":`, ${t})`}`}}));const ax=Math.PI/180,sx=180/Math.PI,lx=4/29,cx=6/29,ux=3*cx*cx;function hx(t){if(t instanceof dx)return new dx(t.l,t.a,t.b,t.opacity);if(t instanceof vx)return xx(t);t instanceof Xv||(t=Yv(t));var e,n,i=mx(t.r),r=mx(t.g),o=mx(t.b),a=fx((.2225045*i+.7168786*r+.0606169*o)/1);return i===r&&r===o?e=n=a:(e=fx((.4360747*i+.3850649*r+.1430804*o)/.96422),n=fx((.0139322*i+.0971045*r+.7141733*o)/.82521)),new dx(116*a-16,500*(e-a),200*(a-n),t.opacity)}function dx(t,e,n,i){this.l=+t,this.a=+e,this.b=+n,this.opacity=+i}function fx(t){return t>.008856451679035631?Math.pow(t,1/3):t/ux+lx}function px(t){return t>cx?t*t*t:ux*(t-lx)}function gx(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function mx(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function yx(t){if(t instanceof vx)return new vx(t.h,t.c,t.l,t.opacity);if(t instanceof dx||(t=hx(t)),0===t.a&&0===t.b)return new vx(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*sx;return new vx(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function vx(t,e,n,i){this.h=+t,this.c=+e,this.l=+n,this.opacity=+i}function xx(t){if(isNaN(t.h))return new dx(t.l,0,0,t.opacity);var e=t.h*ax;return new dx(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}Nv(dx,(function(t,e,n,i){return 1===arguments.length?hx(t):new dx(t,e,n,null==i?1:i)}),Rv(qv,{brighter(t){return new dx(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new dx(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Xv(gx(3.1338561*(e=.96422*px(e))-1.6168667*(t=1*px(t))-.4906146*(n=.82521*px(n))),gx(-.9787684*e+1.9161415*t+.033454*n),gx(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),Nv(vx,(function(t,e,n,i){return 1===arguments.length?yx(t):new vx(t,e,n,null==i?1:i)}),Rv(qv,{brighter(t){return new vx(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new vx(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return xx(this).rgb()}}));var bx=function(t){return"rgba(".concat([(16711680&t)>>16,(65280&t)>>8,255&t,((4278190080&t)>>>24)/255].join(","),")")};function wx(t){var e=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.auto,n=dv(t.resources).auto(e||function(){return{mode:"byDimension",persistent:!1,useDimColVal:!0,byDimDef:{activeDimensionIndex:0,type:"expression",label:""}}}).getDimensionColorMap((function(t,e){var n=e.layout,i=e.app;return gv(t,{layout:n,app:i})})).getMeasure((function(t,e){var n=e.layout,i=e.app;return mv(t,{layout:n,app:i})})).getAttributeDimension((function(t,e){var n=e.layout,i=e.model,r=e.app;return yv(t,{layout:n,model:i,app:r})}));return n.getSnapshotData=fv,n}({resources:t}),n={},i={},r=function(t){return i.settings||(t||console.warn("settings() called before auxiliarySettings()"),i.settings=e.settings()),i.settings},o={config:function(r){if(n=Qm({},r),i={},!n.key)throw new Error("Missing key");e.set(Qm(Qm({},t),n))},auto:function(t){return t?(e.auto(t),o):e.auto()},getAuxiliarySettings:function(t){return i.auxiliarySettings?Promise.resolve(i.auxiliarySettings):e.getAuxiliarySettings(r(!0),t).then((function(t){return i.auxiliarySettings=t||{},i.settings=Qm(Qm({},i.settings),i.auxiliarySettings),i.scales=void 0,i.color=void 0,i.auxiliarySettings}))},getAuxiliaryData:function(){return e.getAuxiliaryData(r())},getSnapshotData:function(t){var n=r();return e.getAuxiliaryData(n,t).then((function(t){return e.getSnapshotData(n,t)}))},resolveUIColor:function(t){return e.resolveUIColor(t)},settings:function(){var t=r();return{mode:t.mode,type:t.type,label:t.label,field:t.field,fieldType:t.fieldType,nil:t.nil,others:t.others,primary:t.primary}},settingsForMeasure:function(t){var e;return(null===(e=r().measureOverrides)||void 0===e?void 0:e[t])||this.settings()},isSelectionLocked:function(t){var e=t.isMeasureSelectionLocked;return function(t,e){var n=e.isMeasureSelectionLocked;return"field"!==t.mode||("dimension"===t.fieldType?t.isFieldLocked:"measure"!==t.fieldType||n)}(r(),{isMeasureSelectionLocked:e})},palettes:function(){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.colorProps,n=t.coloring,i=t.theme,r=[];if(n&&n.palettes&&i){var o=n.palettes.categorical||e.dimensionScheme,a=i.getDataColorPalettes().filter((function(t){return t.key===o}))[0]||i.getDataColorPalettes()[0];o&&a&&r.push({key:"categorical",colors:a.colors});var s=n.palettes.metric||e.measureScheme,l=i.getDataColorScales().filter((function(t){return t.key===s}))[0];if(l){var c=l.colors[0]?l.colors:[[]].concat(sy(l.colors.slice(1)));c=Array.isArray(c[0])?c.map((function(t){return t.slice().reverse()})):c.slice().reverse(),r.push({key:"quant",colors:c})}}return r}({coloring:r(),colorProps:n.colorProps,theme:n.theme})},scales:function(){return i.scales=i.scales||function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.hc,n=t.coloring,i=t.rtl,r=t.key,o=t.source,a=t.picasso,s={},l=r;if(n){var c={override:!0,domain:n.explicit&&"function"==typeof n.explicit.domain?n.explicit.domain:[].concat(sy((n.explicit||{}).domain||[]),[-3,-2]),range:n.explicit&&"function"==typeof n.explicit.range?n.explicit.range:[].concat(sy((n.explicit||{}).range||[]),[n.others,n.nil])};if("field"===n.mode){if("dimension"===n.fieldType){var u,h=vv({hc:e,source:o,coloring:n}).data;if(n.legendDataset){var d=0,f={};a.data("q")({data:e}).extract({field:n.field,trackBy:n.valueAccessor,reduce:function(t){var e=t[0];return f[e]=d++,t[0]}}),u={source:"attrDim",extract:{field:"qDimensionInfo/0",filter:function(t){return t.qElemNumber>=0},props:{row:{value:function(t){return f[t.qElemNumber]}}}}}}var p={data:h,range:n.range,domain:n.domain,explicit:c,type:"categorical-color",label:function(t){return t.datum.text&&t.datum.text.value?t.datum.text.value:t.datum.label}};s[l]=p,u&&(s["".concat(l,"Legend")]=Qm(Qm({},p),{},{data:u})),e&&e.qHasOtherValues&&u&&((u||p.data).amend=[{label:e.qDimensionInfo[0].othersLabel,source:{key:"qHyperCube",field:"qDimensionInfo/0"},row:{value:-3},value:-3}])}else if("measure"===n.fieldType){var g={data:{field:n.field},min:n.min,max:n.max};s[l]=vy({},g,{type:"categorical"===n.type?"threshold-color":"sequential-color",range:n.range,domain:n.domain,invert:n.reverse}),"sequential-color"===s[l].type&&(s["".concat(l,"Range")]=vy({},g,{invert:!!i}))}else if("color"!==n.type)throw new Error("UNUSED FIELD")}else if("dimension"===n.mode){var m={data:e.qDimensionInfo.map((function(t,e){return e})),label:function(t){return e.qDimensionInfo[t.datum.value].qFallbackTitle},explicit:c,type:"categorical-color"};s[l]=m}else if("measure"===n.mode){var y={data:e.qMeasureInfo.map((function(t,e){return e})).filter((function(t){var e,i;return!(null!==(e=n.explicit)&&void 0!==e&&null!==(i=e.exclude)&&void 0!==i&&i.includes(t))})),label:function(t){return e.qMeasureInfo[t.datum.value].qFallbackTitle},explicit:c,type:"categorical-color"};s[l]=y}}return s}({hc:n.hc,coloring:r(),key:n.key,source:n.source,picasso:t.picasso}),i.scales},color:function(){return i.color=i.color||function(t){var e=t.coloring,n=t.scales,i=t.key,r=xv(i),o=xv("".concat(i,"IsAnOther")),a=function(t,e){var i=t.fieldType,a=t.invalid,s=t.mode,l=t.nil,c=t.others,u=t.primary,h=t.type;return a?function(t){return wv(t)||o(t)?c:l}:n[e]?function(t){return wv(t)?c:bv(t)||-2===r(t)&&"dimension"===i||"NaN"===r(t)?l:o(t)?c:t.resources.scale(e)(r(t))||c}:"constant"===s?function(t){return wv(t)||o(t)?c:bv(t)?l:u}:"color"===h?function(t){return wv(t)||o(t)?c:bv(t)?l:r(t)||c}:null},s=a(e,i);if(e.measureOverrides){var l=xv("".concat(i,"MeasureIdx")),c=e.measureOverrides.map((function(t){return t&&a(t)}));return function(t){var e=l(t);return c[e]?c[e](t):s(t)}}return s}({coloring:r(),scales:this.scales(),key:n.key}),i.color},datumProps:function(t){return function(t){var e,n,i=t.hc,r=t.coloring,o=t.scales,a=t.key,s=t.addMeasureIx,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,c=a,u=r.nil;"field"===r.mode&&r.field?e=r.field:o[a]&&"field"===r.mode&&(e=o[a].data.field||r.field),e?(n={field:e,reduce:"first"},"color"===r.type&&(n.value=function(t){return"NaN"!==t.qNum?bx(t.qNum):t.qText&&Vv(t.qText)?t.qText:u})):"dimension"===r.mode?n=void 0!==r.field?r.field:i.qDimensionInfo.length-1:"measure"===r.mode&&(n=l);var h=ry({},c,n);return i.qDimensionInfo.length>1&&(h["".concat(c,"IsAnOther")]={fields:i.qDimensionInfo.map((function(t,e){return{field:"qDimensionInfo/".concat(e)}})),value:function(t){return-1!==t.indexOf(-3)}}),s&&(h["".concat(c,"MeasureIdx")]=l),h}({coloring:this.settingsForMeasure(t),scales:this.scales(),key:n.key,hc:n.hc,addMeasureIx:r().measureOverrides},t)},data:function(){var t=r(),e={key:"dummy",data:[["field"],["a"]]};return t.legendDataset?[e,{type:"q",key:"attrDim",data:t.legendDataset.raw(),config:{localeInfo:n.localeInfo}}]:[e]},legend:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.eventName,i=t.key,o=t.viewState,a=t.chart,s=t.rtl,l=t.styleReference,c=void 0===l?"object.legend":l,u=t.settings,h=void 0===u?{}:u,d=t.style,f=void 0===d?{}:d,p=arguments.length>1?arguments[1]:void 0;return Cv({eventName:e,key:i,rtl:s,viewState:o,chart:a,styleReference:c,settings:h,style:f},{legendProps:n.legendProps,scaleKey:n.key,coloring:r(),theme:n.theme,hc:n.hc,scales:this.scales()},p)}};return o}var kx=function(t){return t.baseColor||t.coloring&&t.coloring.baseColor};function _x(t){var e=t.qHyperCube,n=e.qDimensionInfo,i=e.qMeasureInfo,r=n.some(kx),o=i.some(kx),a=t.color.useBaseColors;return"measure"===a&&!o||"dimension"===a&&!r?"off":a}function Mx(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Qm(Qm(Qm({},t),e),{},{colorProps:Qm(Qm({},t.colorProps),e.colorProps||{})});return n}var Sx=function(t){return t.baseColor||t.coloring&&t.coloring.baseColor};function Cx(t){var e,n=t.qHyperCube.qDimensionInfo.some(Sx),i=t.qHyperCube.qMeasureInfo.some(Sx),r=n?"dimension":void 0;return{mode:"primary",useBaseColors:null!==(e=null!=r?r:i?"measure":void 0)&&void 0!==e?e:"off",paletteColor:null}}var Nx=function(){};function Rx(t){var e=t.originalArray,n=t.newArray,i=t.matchKey;return Array.isArray(e)&&e.length?(n.forEach((function(t){var n=-1;e.some((function(e,r){return e[i]&&e[i]===t[i]&&(n=r),n})),n>-1?e[n]=t:e.push(t)})),e):n}function qx(t){return(qx="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ax(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Dx(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Ex(t,e,n){return e&&Dx(t.prototype,e),n&&Dx(t,n),t}function Ox(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ix(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function Tx(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ix(Object(n),!0).forEach((function(e){Ox(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ix(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function jx(t,e){return(jx=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Px(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function zx(t,e,n){return(zx=Px()?Reflect.construct:function(t,e,n){var i=[null];i.push.apply(i,e);var r=new(Function.bind.apply(t,i));return n&&jx(r,n.prototype),r}).apply(null,arguments)}function Fx(t){return function(t){if(Array.isArray(t))return Bx(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||Lx(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 Lx(t,e){if(t){if("string"==typeof t)return Bx(t,e);var n=Object.prototype.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)?Bx(t,e):void 0}}function Bx(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var Hx=Object.prototype.hasOwnProperty,$x=Object.prototype.toString,Vx=Object.defineProperty,Wx=Object.getOwnPropertyDescriptor,Ux=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===$x.call(t)},Yx=function(t){if(!t||"[object Object]"!==$x.call(t))return!1;var e,n=Hx.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&Hx.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;for(e in t);return void 0===e||Hx.call(t,e)},Xx=function(t,e){Vx&&"__proto__"===e.name?Vx(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},Kx=function(t,e){if("__proto__"===e){if(!Hx.call(t,e))return;if(Wx)return Wx(t,e).value}return t[e]},Gx=function t(){var e,n,i,r,o,a,s=arguments[0],l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),(null==s||"object"!=typeof s&&"function"!=typeof s)&&(s={});l<c;++l)if(null!=(e=arguments[l]))for(n in e)i=Kx(s,n),s!==(r=Kx(e,n))&&(u&&r&&(Yx(r)||(o=Ux(r)))?(o?(o=!1,a=i&&Ux(i)?i:[]):a=i&&Yx(i)?i:{},Xx(s,{name:n,newValue:t(u,a,r)})):void 0!==r&&Xx(s,{name:n,newValue:r}));return s};function Zx(t,e,n){if(!t)return-1;var i=n.cache,r=t.origin?t.origin():null;r&&(t=r);var o=i.fields.indexOf(t),a=-1,s=-1;if(-1===o)for(var l=0;l<i.wrappedFields.length;l++)if(s=i.wrappedFields[l].attrDims.map((function(t){return t.instance})).indexOf(t),a=i.wrappedFields[l].attrExps.map((function(t){return t.instance})).indexOf(t),-1!==s||-1!==a){o=l;break}return(o-=e.qArea.qLeft)<0||o>=e.qArea.qWidth?-1:s>=0?function(t){return t[o].qAttrDims.qValues[s]}:a>=0?function(t){return t[o].qAttrExps.qValues[a]}:function(t){return t[o]}}function Jx(t,e,n){var i=n.key,r={value:"function"==typeof t.value?t.value(e):void 0!==t.value?t.value:e};return r.label="function"==typeof t.label?t.label(e):void 0!==t.label?String(t.label):String(r.value),t.field&&(r.source={key:i,field:t.field.key()}),r}function Qx(t){var e=t.cache,n=t.f,i=t.mainCell,r=t.p;t.prop;var o=t.page,a=t.rowIdx,s=t.row,l=t.sourceKey,c=t.target,u=t.targetProp,h=i;if(r.field&&r.field!==n){var d=Zx(r.field,o,{cache:e});if(-1===d)return;h=Gx({qRow:a},d(s))}c[u]=Jx(r,h,{key:l})}function tb(t,e,n,i){for(var r=Array.isArray(t)?t:[t],o=[],a=0;a<r.length;a++)if(void 0!==r[a].field){for(var s=e.raw(),l=e.key(),c="object"===qx(r[a].field)?r[a].field:e.field(r[a].field),u=i.normalizeConfig(r[a],e),h=u.props,d=u.main,f=Object.keys(h),p=!!r[a].trackBy,g=qx(r[a].trackBy),m={},y=[],v=[],x=0;x<s.qDataPages.length;x++){var b=Zx(c,s.qDataPages[x],{cache:n});if(-1!==b)for(var w=0;w<s.qDataPages[x].qMatrix.length;w++){var k=s.qDataPages[x].qArea.qTop+w,_=Gx({qRow:k},b(s.qDataPages[x].qMatrix[w])),M=Jx(d,_,{key:l});if(!d.filter||d.filter(_)){for(var S=0;S<f.length;S++){var C=h[f[S]],N=C.fields||[C];C.fields&&(M[f[S]]=[]);for(var R=0;R<N.length;R++)Qx({cache:n,f:c,mainCell:_,p:N[R],prop:f[S],props:h,page:s.qDataPages[x],rowIdx:k,row:s.qDataPages[x].qMatrix[w],sourceKey:l,target:C.fields?M[f[S]]:M,targetProp:C.fields?R:f[S]});if(C.fields){var q=M[f[S]].map((function(t){return t.value})),A=M[f[S]].map((function(t){return t.label}));M[f[S]]={value:"function"==typeof C.value?C.value(q):void 0!==C.value?C.value:q,label:"function"==typeof C.label?C.label(A):void 0!==C.label?String(C.label):String(M[f[S]].value)}}}p&&i.track({cfg:r[a],itemData:_,obj:M,target:y,tracker:m,trackType:g}),v.push(M)}}}p?o.push.apply(o,Fx(i.collect(y,{main:d,propsArr:f,props:h}))):o.push.apply(o,v)}return o}function eb(t){var e=0,n=t.children,i=n&&n.length;if(i)for(;--i>=0;)e+=n[i].value;else e=1;t.value=e}function nb(t,e){var n,i,r,o,a,s=new ab(t),l=+t.value&&(s.value=t.value),c=[s];for(null==e&&(e=ib);n=c.pop();)if(l&&(n.value=+n.data.value),(r=e(n.data))&&(a=r.length))for(n.children=new Array(a),o=a-1;o>=0;--o)c.push(i=n.children[o]=new ab(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(ob)}function ib(t){return t.children}function rb(t){t.data=t.data.data}function ob(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function ab(t){this.data=t,this.depth=this.height=0,this.parent=null}function sb(t){if("function"!=typeof t)throw new Error;return t}ab.prototype=nb.prototype={constructor:ab,count:function(){return this.eachAfter(eb)},each:function(t){var e,n,i,r,o=this,a=[o];do{for(e=a.reverse(),a=[];o=e.pop();)if(t(o),n=o.children)for(i=0,r=n.length;i<r;++i)a.push(n[i])}while(a.length);return this},eachAfter:function(t){for(var e,n,i,r=this,o=[r],a=[];r=o.pop();)if(a.push(r),e=r.children)for(n=0,i=e.length;n<i;++n)o.push(e[n]);for(;r=a.pop();)t(r);return this},eachBefore:function(t){for(var e,n,i=this,r=[i];i=r.pop();)if(t(i),e=i.children)for(n=e.length-1;n>=0;--n)r.push(e[n]);return this},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,i=e.children,r=i&&i.length;--r>=0;)n+=i[r].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),i=e.ancestors(),r=null;for(t=n.pop(),e=i.pop();t===e;)r=t,t=n.pop(),e=i.pop();return r}(e,t),i=[e];e!==n;)e=e.parent,i.push(e);for(var r=i.length;t!==n;)i.splice(r,0,t),t=t.parent;return i},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each((function(e){t.push(e)})),t},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return nb(this).eachBefore(rb)}};var lb={depth:-1},cb={};function ub(t){return t.id}function hb(t){return t.parentId}function db(t,e){"/"===t.charAt(0)&&(t=t.substring(1));for(var n,i=t.split("/"),r=e,o=0;o<i.length;o++){if("*"===i[o]&&Array.isArray(r)){var a=[];n=i.slice(o+1).join("/");for(var s=0;s<r.length;s++){var l=db(n,r[s]);Array.isArray(l)?a.push.apply(a,Fx(l)):a.push(l)}return a}if(!i[o]&&Array.isArray(r)){var c=new Array(r.length);n=i.slice(o+1).join("/");for(var u=0;u<r.length;u++)c[u]=db(n,r[u]);return c}i[o]in r&&(r=r[i[o]])}return r}function fb(t,e,n){var i=[];if(!t||!t.length)return i;if(e<=0){var r=n>=0?[t[n]]:t;i.push.apply(i,Fx(r))}else for(var o=0;o<t.length;o++)t[o].children&&t[o].children.length&&i.push.apply(i,Fx(fb(t[o].children,e-1,n)));return i}function pb(t,e,n){if(t===e)return function(t){return t};if(t>e){var i=Math.max(0,Math.min(100,t-e)),r=Fx(Array(i)).map(String.prototype.valueOf,"parent").join(".");return Function("node","return node.".concat(r,";"))}if(e>t){var o=Math.max(0,Math.min(100,e-t));return function(t){return fb(t.children,o-1,n)}}return!1}function gb(t,e){var n=e.cache;if("number"==typeof t)return n.fields[t];var i=n.allFields;if("function"==typeof t){for(var r=0;r<i.length;r++)if(t(i[r]))return i[r];return!1}if("string"==typeof t){for(var o=0;o<i.length;o++)if(i[o].key()===t||i[o].title()===t)return i[o]}else if(t&&-1!==i.indexOf(t))return t;throw Error("Field not found: ".concat(t))}var mb=/^qDimensionInfo(?:\/(\d+))?/,yb=/^\/?qMeasureInfo\/(\d+)/,vb=/\/qAttrExprInfo\/(\d+)/,xb=/\/qAttrDimInfo\/(\d+)/;function bb(t){return(t.qColumnOrder&&t.qColumnOrder.length?t.qColumnOrder:t.qDimensionInfo.map((function(t,e){return e}))).filter((function(e){return e<t.qDimensionInfo.length}))}function wb(t,e){var n=e.cube;if(!t)return-1;var i=t.origin&&t.origin()?t.origin().key():t.key(),r=!1,o=-1,a=-1,s=-1,l=-1,c=-1,u=i,h=n.qEffectiveInterColumnSortOrder,d=bb(n);return mb.test(u)&&(r=!0,o=+mb.exec(u)[1],u=i.replace(mb,"")),yb.test(u)&&("K"===n.qMode?l=+yb.exec(u)[1]:h&&-1!==h.indexOf(-1)?(l=+yb.exec(u)[1],c=0):c=+yb.exec(u)[1],u=u.replace(yb,"")),u&&(xb.exec(u)?s=+xb.exec(u)[1]:vb.exec(u)&&(a=+vb.exec(u)[1])),{fieldDepth:(r?"S"===n.qMode?d[o]:h?h.indexOf(o):o:h&&-1!==h.indexOf(-1)?h.indexOf(-1):n.qDimensionInfo.length-("K"===n.qMode?0:1))+1,pseudoMeasureIndex:l,measureIdx:c,attrDimIdx:s,attrIdx:a}}function kb(t,e){var n,i,r=pb(t.fieldDepth,e.fieldDepth,e.pseudoMeasureIndex);return n=e.measureIdx>=0?function(t){return t.data.qValues[e.measureIdx]}:function(t){return t.data},e.attrDimIdx>=0?i=function(t){var n;return null==t||null===(n=t.qAttrDims)||void 0===n?void 0:n.qValues[e.attrDimIdx]}:e.attrIdx>=0&&(i=function(t){var n;return null==t||null===(n=t.qAttrExps)||void 0===n?void 0:n.qValues[e.attrIdx]}),{nodeFn:r,attrFn:i,valueFn:n}}function _b(t,e,n){var i=n.key,r={value:"function"==typeof t.value?t.value(e):void 0!==t.value?t.value:e};return r.label="function"==typeof t.label?t.label(e):void 0!==t.label?String(t.label):String(r.value),t.field&&(r.source={key:i,field:t.field.key()}),r}function Mb(t){for(var e=t.propsArr,n=t.props,i=t.item,r=t.itemData,o=t.ret,a=t.sourceKey,s=0;s<e.length;s++){var l=n[e[s]],c=l.fields||[l],u=void 0,h=void 0;l.fields&&(u=[],h=[]);for(var d=function(t){var n=c[t],d=void 0,f=void 0,p=void 0,g=void 0,m=void 0,y=void 0;if("primitive"===n.type?(p=n.value,y=String(n.value)):("function"==typeof n.value&&(d=function(t){return n.value(t,i)}),"function"==typeof n.label&&(f=function(t){return n.label(t,i)}),n.accessor?(g=n.accessor(i),Array.isArray(g)?(m=g.map(n.valueAccessor),n.attrAccessor&&(m=m.map(n.attrAccessor)),d&&(p=m.map(d),d=null),f&&(y=m.map(f),f=null),p=n.reduce?n.reduce(p):p,y=n.reduceLabel?n.reduceLabel(y,p):String(p)):y=p=n.attrAccessor?n.attrAccessor(n.valueAccessor(g)):n.valueAccessor(g)):(p=r,y=r)),l.fields){var v=d?d(p):p;u.push(v),h.push(f&&null!=y?f(y):null!=y?y:String(v))}else{var x=d?d(p):p;o[e[s]]={value:x,label:f?f(y):null!=y?y:String(x)},n.field&&(o[e[s]].source={field:n.field.key(),key:a})}},f=0;f<c.length;f++)d(f);u&&(o[e[s]]={value:"function"==typeof l.value?l.value(u,i):u,label:"function"==typeof l.label?l.label(h,i):h})}}var Sb=function(t,e,n){var i="K"===t.qMode?"/qStackedDataPages/*/qData":"/qTreeDataPages/*",r="K"===t.qMode?"qSubNodes":"qNodes",o=db(i,t);return o&&o[0]?(e.tree=nb(o[0],n.children||function(t){return t[r]}),e.tree):null};function Cb(t){for(var e=t.raw().qDataPages.length?t.raw().qDataPages[0].qMatrix:[],n=function(t){var e=t.raw().qColumnOrder,n=t.fields();return e&&e.length===n.length?e:n.map((function(t,e){return e}))}(t),i=t.fields(),r=t.fields().filter((function(t){return"dimension"===t.type()})).map((function(t){return n.indexOf(i.indexOf(t))})),o=t.fields().filter((function(t){return"measure"===t.type()})).map((function(t){return n.indexOf(i.indexOf(t))})),a={__root:{__id:"__root",qValues:[]}},s=0;s<e.length;s++){for(var l=e[s],c="__root",u=!1,h=0;h<r.length;h++){var d=l[r[h]],f="".concat(c,"__").concat(d.qText);a[f]||(a[f]=Tx({__id:f,__parent:c,qValues:[]},d),u=!0),c=f}if(u)for(var p=0;p<o.length;p++){var g=l[o[p]];a[c].qValues.push(g)}}var m=Object.keys(a).map((function(t){return a[t]}));return function(){var t=ub,e=hb;function n(n){var i,r,o,a,s,l,c,u=n.length,h=new Array(u),d={};for(r=0;r<u;++r)i=n[r],s=h[r]=new ab(i),null!=(l=t(i,r,n))&&(l+="")&&(d[c="$"+(s.id=l)]=c in d?cb:s);for(r=0;r<u;++r)if(s=h[r],null!=(l=e(n[r],r,n))&&(l+="")){if(!(a=d["$"+l]))throw new Error("missing: "+l);if(a===cb)throw new Error("ambiguous: "+l);a.children?a.children.push(s):a.children=[s],s.parent=a}else{if(o)throw new Error("multiple roots");o=s}if(!o)throw new Error("no root");if(o.parent=lb,o.eachBefore((function(t){t.depth=t.parent.depth+1,--u})).eachBefore(ob),o.parent=null,u>0)throw new Error("cycle");return o}return n.id=function(e){return arguments.length?(t=sb(e),n):t},n.parentId=function(t){return arguments.length?(e=sb(t),n):e},n}().id((function(t){return t.__id})).parentId((function(t){return t.__parent}))(m)}var Nb=function(t){for(var e=t.propsArr,n=t.props,i=t.cube,r=t.cache,o=t.itemDepthObject,a=t.f,s=0;s<e.length;s++)for(var l=n[e[s]],c=l.fields?l.fields:[l],u=0;u<c.length;u++){var h=c[u];if(h.field!==a){var d=kb(o,wb(h.field,{cube:i,cache:r}));h.accessor=d.nodeFn,h.valueAccessor=d.valueFn,h.attrAccessor=d.attrFn}}};function Rb(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,r=e.raw(),o=e.key(),a="S"===r.qMode?Cb(e):Sb(r,n,t);if(!a)return null;for(var s=a.height,l=[],c=0;c<=s;c++){var u=null;if(c>0)if("S"===r.qMode){var h=bb(r),d=h[c-1];u=n.fields[d]}else{var f=r.qEffectiveInterColumnSortOrder[c-1];c>r.qEffectiveInterColumnSortOrder.length&&(f=r.qDimensionInfo.length),u=n.fields[f]}var p=i.normalizeConfig(Tx(Tx({},t),{},{field:u?u.key():void 0}),e),g=p.props,m=p.main,y=Object.keys(g);l[c]={propsArr:y,props:g,main:m};var v=u?wb(u,{cube:r,cache:n}):{fieldDepth:0};Nb({propsArr:y,props:g,cube:r,cache:n,itemDepthObject:v,f:u})}for(var x=a.copy(),b=x.descendants(),w=a.descendants(),k=0;k<w.length;k++){var _=l[w[k].depth].propsArr,M=l[w[k].depth].props,S=l[w[k].depth].main,C=b[k],N=C.data,R=_b(S,N,{key:o});Mb({propsArr:_,props:M,item:C,itemData:N,ret:R,sourceKey:o,isTree:!0}),w[k].data=R}return a}function qb(t,e,n,i){for(var r=Array.isArray(t)?t:[t],o=[],a=0;a<r.length;a++)if(void 0!==r[a].field){var s=e.raw(),l=e.key();if(!Sb(s,n,t))continue;var c="object"===qx(r[a].field)?r[a].field:e.field(r[a].field),u=i.normalizeConfig(r[a],e),h=u.props,d=u.main,f=Object.keys(h),p=wb(c,{cube:s,cache:n}),g=kb({fieldDepth:0},p),m=g.nodeFn,y=g.attrFn,v=g.valueFn;Nb({propsArr:f,props:h,cube:s,cache:n,itemDepthObject:p,f:c});for(var x=!!r[a].trackBy,b=qx(r[a].trackBy),w={},k=[],_=m(n.tree),M=[],S=0;S<_.length;S++){var C=_[S],N=y?y(v(C)):v(C);if(!d.filter||d.filter(N)){var R=_b(d,N,{key:l});Mb({propsArr:f,props:h,item:C,itemData:N,ret:R,sourceKey:l}),x&&i.track({cfg:r[a],itemData:N,obj:R,target:k,tracker:w,trackType:b}),M.push(R)}}x?o.push.apply(o,Fx(i.collect(k,{main:d,propsArr:f,props:h}))):o.push.apply(o,M)}return o}var Ab,Db=(function(t){
9
+ t.exports=function(t,e){if(!t||isNaN(+e))return e;var n,i,r,o,a,s,l,c,u,h,d=t.length,f=t.search(/[0-9\-\+#]/),p=f>0?t.substring(0,f):"",g=t.split("").reverse().join(""),m=g.search(/[0-9\-\+#]/),y=d-m,v=t.substring(y,y+1),x=y+("."===v||","===v?1:0),b=m>0?t.substring(x,d):"";if(n=(e="-"===(t=t.substring(f,x)).charAt(0)?-e:+e)<0?e=-e:0,r=(i=t.match(/[^\d\-\+#]/g))&&i[i.length-1]||".",o=i&&i[1]&&i[0]||",",t=t.split(r),e=+(e=e.toFixed(t[1]&&t[1].length))+"",s=t[1]&&t[1].lastIndexOf("0"),(!(c=e.split("."))[1]||c[1]&&c[1].length<=s)&&(e=(+e).toFixed(s+1)),u=t[0].split(o),t[0]=u.join(""),(a=t[0]&&t[0].indexOf("0"))>-1)for(;c[0].length<t[0].length-a;)c[0]="0"+c[0];else 0==+c[0]&&(c[0]="");if((e=e.split("."))[0]=c[0],l=u[1]&&u[u.length-1].length){for(g="",y=(h=e[0]).length%l,d=h.length,x=0;x<d;x++)g+=h.charAt(x),!((x-y+1)%l)&&x<d-l&&(g+=o);e[0]=g}return e[1]=t[1]&&e[1]?r+e[1]:"","0"!==(i=e.join(""))&&""!==i||(n=!1),p+(n?"-":"")+i+b}}));function Wg(t){return t.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}const Ug={3:"k",6:"M",9:"G",12:"T",15:"P",18:"E",21:"Z",24:"Y","-3":"m","-6":"μ","-9":"n","-12":"p","-15":"f","-18":"a","-21":"z","-24":"y"},Yg=/%\)?$/,Xg=/^\(r(0[2-9]|[12]\d|3[0-6])\)/i,Kg=/^\(oct\)/i,Gg=/^\(dec\)/i,Zg=/^\(hex\)/i,Jg=/^\(bin\)/i,Qg=/^\(rom\)/i,tm=/^(\(rom\)|\(bin\)|\(hex\)|\(dec\)|\(oct\)|\(r(0[2-9]|[12]\d|3[0-6])\))/i,em=/#|0/g;function nm(t,e,n,i){return t=t.toString(e),n[1]===n[1].toUpperCase()&&(t=t.toUpperCase()),t.length-t.indexOf(".")>10&&(t=t.slice(0,t.indexOf(".")+11)),t.replace(".",i||".")}function im(t,e,n){let i;return Xg.test(e)?t=nm(t,Number(/\d{2}/.exec(e)[0]),e,n):Kg.test(e)?t=nm(t,8,e,n):Gg.test(e)?t=nm(t,10,e,n):Zg.test(e)?t=nm(t,16,e,n):Jg.test(e)?t=nm(t,2,e,n):Qg.test(e)&&(i="",t<0&&(i="-",t=-t),t=0===(t=Math.floor(t))?"0":t<=5e5?i+(t=function(t,e){let n,i="",r=Number(String(t).slice(-3)),o=(t-r)/1e3,a=[0,1,4,5,9,10,40,50,90,100,400,500,900].reverse(),s=["0","I","IV","V","IX","X","XL","L","XC","C","CD","D","CM"].reverse();for(;r>0;)for(n=0;n<a.length;n++)if(a[n]<=r){i+=s[n],r-=a[n];break}for(n=0;n<o;n++)i="M".concat(i);return e[1]!==e[1].toUpperCase()&&(i=i.toLowerCase()),i}(t,e)):e+i+t.toExponential(0)),t}function rm(t,e,n){const i=Wg(t);return n?i:new RegExp(i||"",e)}function om(t,e,n,i){let r,o,a,s,l,c,u,h,d,f=t.pattern;var p,g;i&&(t.abbreviate=!0),p=e,(g=n)&&(g=Wg(g)),p&&(p=Wg(p)),d=new RegExp("(?:[#0]+".concat(p,")?[#0]+(?:").concat(g,"[#0]+)?")),a=f.match(d),a=a?a[0]:"",s=a?f.substr(0,f.indexOf(a)):f,l=a?f.substring(f.indexOf(a)+a.length):"",a||(a=f?"#":"##########"),e&&e===n&&(r=a.split(n),o=r.pop(),a=r.join("")+n+o,e=""),c=e,e=/,/.test(n)?"¤":",",c&&(a=a.replace(rm(c,"g"),e)),u=n,n=".",u&&(a=a.replace(rm(u,"g"),n)),h=a.match(/#/g),h=h?h.length:0;const m=f.split(u);let y;m[1]&&(y=m[1].match(em)),t.prefix=s||"",t.postfix=l||"",t.pattern=f,t.maxPrecision=y?y.length:2,t.percentage=Yg.test(f),t.numericPattern=a||"",t.numericRegex=new RegExp("".concat(rm(e,null,!0),"|").concat(rm(n,null,!0)),"g"),t.groupTemp=c,t.decTemp=u,t.t=e,t.d=n,t.temp=h}class am{constructor(t,e,n,i,r){this.localeInfo=t,this.pattern=e,this.thousandDelimiter=n||",",this.decimalDelimiter=i||".",this.type=r||"numeric",this.patternSeparator=";",this.abbreviations=function(t,e){if(!t||!t.qNumericalAbbreviation)return Ug;const n={};return t.qNumericalAbbreviation.split(e).forEach((t=>{let e=t.split(":");2===e.length&&(n[e[0]]=e[1])})),n}(t,this.patternSeparator),this.prepare()}clone(){const t=new am(this.localeInfo,this.pattern,this.thousandDelimiter,this.decimalDelimiter,this.type);return t.subtype=this.subtype,t}format(t,e,n,i){return this.prepare(e,n,i),this.formatValue(t)}prepare(t,e,n){let i;if(void 0===t&&(t=this.pattern),void 0===e&&(e=this.thousandDelimiter),void 0===n&&(n=this.decimalDelimiter),!t)return void(this._prepared={pattern:!1});this._prepared={positive:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""},negative:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""},zero:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""}},i=this._prepared,t=t.split(this.patternSeparator),i.positive.pattern=t[0],i.negative.pattern=t[1],i.zero.pattern=t[2],tm.test(t[0])&&(i.positive.isFunctional=!0),t[1]?tm.test(t[1])&&(i.negative.isFunctional=!0):i.negative=!1,t[2]?tm.test(t[2])&&(i.zero.isFunctional=!0):i.zero=!1;const r="U"===this.type;i.positive.isFunctional||om(i.positive,e,n,r),i.negative&&!i.negative.isFunctional&&om(i.negative,e,n,r),i.zero&&!i.zero.isFunctional&&om(i.zero,e,n,r)}formatValue(t){let e,n,i,r,o,a,s,l,c,u=this._prepared,h="",d="",f=t;if(isNaN(t))return"".concat(f);if(t=+t,!1===u.pattern)return t.toString();if(0===t&&u.zero)return u=u.zero,u.pattern;if(t<0&&u.negative?(u=u.negative,t=-t):u=u.positive,o=u.d,a=u.t,u.isFunctional)t=im(t,u.pattern,o);else{if(u.percentage&&(t*=100),u.abbreviate){const e=Object.keys(this.abbreviations).map((t=>parseInt(t,10))).sort(((t,e)=>t-e));let i,r,o=e[0];for(s=0,n=Number(Number(t).toExponential().split("e")[1]);o<=n&&s<e.length;)s++,o=e[s];s>0&&(i=e[s-1]),i&&n>0&&i>0?r=i:(n<0&&i<0||!i)&&(o<0&&o-n<=u.maxPrecision?r=o:i<=n&&!(o>0&&-n<=u.maxPrecision)&&(r=i)),r&&(h=this.abbreviations[r],t/=10**r)}if(i=Math.abs(t),e=u.temp,l=u.numericPattern,c=l.split(o)[1],"I"===this.type&&(t=Math.round(t)),r=t,c||"#"!==l.slice(-1)[0])if(i>=1e15||i>0&&i<=1e-14)t=i?i.toExponential(15).replace(/\.?0+(?=e)/,""):"0";else{const e=Number(t.toFixed(Math.min(20,c?c.length:0)).split(".")[0]);let n=l.split(o)[0];if(n+=o,t=Vg(n,e)||"0",c){const e=Math.max(0,Math.min(14,c.length)),n=c.replace(/#+$/,"").length;let r=("I"===this.type?0:i%1).toFixed(e).slice(2).replace(/0+$/,"");for(s=r.length;s<n;s++)r+="0";r&&(t+=o+r)}else 0===e&&(r=0)}else if(i>=10**e||i<1||i<1e-4)0===t?t="0":i<1e-4||i>=1e20?(t=(t=r.toExponential(Math.max(1,Math.min(14,e))-1)).replace(/\.?0+(?=e)/,""),d=""):(t=t.toPrecision(Math.max(1,Math.min(14,e)))).indexOf(".")>=0&&(t=(t=t.replace(t.indexOf("e")<0?/0+$/:/\.?0+(?=e)/,"")).replace(".",o));else{for(l+=o,e=Math.max(0,Math.min(20,e-Math.ceil(Math.log(i)/Math.log(10)))),s=0;s<e;s++)l+="#";t=Vg(l,t)}t=t.replace(u.numericRegex,(t=>t===a?u.groupTemp:t===o?u.decTemp:"")),r<0&&!/^-/.test(t)&&(t="-".concat(t))}return u.prefix+t+d+h+u.postfix}static getStaticFormatter(){return{prepare(){},formatValue:t=>"".concat(t)}}}function sm(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{size:n=5e3,multipleArguments:i=!1,toKey:r=(t=>t)}=e;let o,a,s=Object.create(null),l=Object.create(null),c=0,u=0;return o=i?function(){return a=r(...arguments),o.has(a)?o.get(a):o.set(a,t(...arguments))}:e=>(a=r(e),o.has(a)?o.get(a):o.set(a,t(e))),o.set=(t,e)=>(c>=n&&(delete s[l[u]],delete l[u],c--,u++),s[t]=e,l[c]=t,c++,e),o.get=t=>s[t],o.has=t=>t in s,o.clear=()=>{s=Object.create(null),l=Object.create(null),c=0,u=0},o.size=()=>c,o}function lm(t,e,n,i,r){const o=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new am(...e)}(r,t,e,n,i),a=sm(o.formatValue.bind(o),{toKey:t=>isNaN(t)?t:+t});function s(t){return a(t)}return s.format=function(t,e,n,i){return a.clear(),o.format(e,t,n,i)},s.pattern=function(t){return t&&(a.clear(),o.pattern=t,o.prepare()),o.pattern},s}const cm="D",um="T",hm="TS",dm="IV",fm=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],pm=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],gm=["January","February","March","April","May","June","July","August","September","October","November","December"],mm=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ym(t,e){for(let n=t.length;n<e;n++)t="0".concat(t);return t}function vm(t){let e=t.toString().split(".");return e[1]?(e=Number("0.".concat(e[1])),e):0}function xm(t,e){let n,i=function(t){const e=t,n=24*vm(e),i=60*vm(n),r=60*vm(i),o=1e3*vm(r);return{d:Math.floor(e),h:Math.floor(n),m:Math.floor(i),s:Math.floor(r),f:Math.round(o)}}(t),r=i.d,o=i.h,a=i.m,s=i.s,l=i.f,c=0;/w+|t+/gi.test(e)&&(n=new Date(Date.UTC(1899,11,30+Math.floor(t),0,0,Math.round(86400*(t-Math.floor(t))))),isNaN(n.getTime())&&(n=null)),/D+/gi.test(e)||(o+=24*r),/h+/gi.test(e)||(a+=60*o),/m+/gi.test(e)||(s+=60*a),/w+/gi.test(e)&&(c=n?n.getDay()-1:0,c<0&&(c=6));let u="";return n&&(u=n.getUTCHours()>=12?"pm":"am"),{year:0,month:0,day:c,date:r,h:o,m:a,s:s,f:l,t:u}}class bm{constructor(t,e,n){const i=t||{};if(i.qCalendarStrings||(i.qCalendarStrings={qLongDayNames:fm,qDayNames:pm,qLongMonthNames:gm,qMonthNames:mm}),this.localeInfo=i,this.locale_days=i.qCalendarStrings.qLongDayNames.slice(),this.locale_days_abbr=i.qCalendarStrings.qDayNames.slice(),this.locale_months=i.qCalendarStrings.qLongMonthNames.slice(),this.locale_months_abbr=i.qCalendarStrings.qMonthNames.slice(),!e){e={[um]:i.qTimeFmt||"hh:mm:ss",[cm]:i.qDateFmt||"YYYY-MM-DD",[hm]:i.qTimestampFmt||"YYYY-MM-DD hh:mm:ss"}[n]}this.pattern=e}clone(){const t=new bm(this.localeInfo,this.pattern);return t.subtype=this.subtype,t}format(t,e){e||(e=this.pattern?this.pattern:"YYYY-MM-DD hh:mm:ss"),e=e.replace(/\[.+]|\[|]/g,"");const n=/t+/gi.test(e);let i;t instanceof Date?i=function(t,e){let n=t.getUTCHours(),i=t.getUTCDay()-1;return e&&(n%=12,n||(n=12)),i<0&&(i=6),{year:t.getUTCFullYear(),month:t.getUTCMonth(),day:i,date:t.getUTCDate(),h:n,m:t.getUTCMinutes(),s:t.getUTCSeconds(),f:t.getUTCMilliseconds(),t:t.getUTCHours()>=12?"pm":"am"}}(t,n):(t<0&&(t=-t,e="-".concat(e)),i=xm(t,e));const r=function(t,e){return{"Y+|y+":{Y:"".concat(Number("".concat(e.year).slice(-2))),YY:ym("".concat(e.year).slice(-2),2),YYY:ym("".concat(e.year).slice(-3),3),def:t=>ym("".concat(e.year),t.length)},"M+":{M:e.month+1,MM:ym("".concat(e.month+1),2),MMM:t.locale_months_abbr[e.month],def:t.locale_months[e.month]},"W+|w+":{W:e.day,WW:ym("".concat(e.day),2),WWW:t.locale_days_abbr[e.day],def:t.locale_days[e.day]},"D+|d+":{D:e.date,def:t=>ym("".concat(e.date),t.length)},"h+|H+":{h:e.h,def:t=>ym("".concat(e.h),t.length)},"m+":{m:e.m,def:t=>ym("".concat(e.m),t.length)},"s+|S+":{s:e.s,def:t=>ym("".concat(e.s),t.length)},"f+|F+":{def(t){let n="".concat(e.f),i=t.length-n.length;if(i>0)for(let t=0;t<i;t++)n+="0";else i<0&&(n=n.slice(0,t.length));return n}},"t{1,2}|T{1,2}":{def(t){let n=e.t;return t[0].toUpperCase()===t[0]&&(n=n.toUpperCase()),n=n.slice(0,t.length),n}}}}(this,i),o=[];for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&o.push(t);const a=new RegExp(o.join("|"),"g");return e.replace(a,(t=>{let e,n,i;for(n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&(e=new RegExp(n),e.test(t)))break;if(!e)return"";for(const e in r[n])if(e===t||e.toLowerCase()===t){i=r[n][e],void 0===i&&(i=r[n][e.toLowerCase()]);break}return void 0===i&&(i=r[n].def),"function"==typeof i&&(i=i(t)),i}))}}function wm(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new bm(...e)}function km(t){return new Date(Date.UTC(1899,11,30+Math.floor(t),0,0,0,Math.round(864e5*(t-Math.floor(t)))))}function _m(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TS",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=wm(n,t,e),r=sm(i.format.bind(i),{toKey:t=>"object"==typeof t&&"function"==typeof t.getTime?t.getTime():t});function o(t){return e!==dm?km(t):t}function a(t){return t=o(t),r(t)}return a.format=function(t,e){return r.clear(),e=o(e),i.format(e,t)},a.locale=function(n){return i=wm(n,t,e),r=sm(i.format.bind(i),{toKey:t=>"object"==typeof t?t.getTime():t}),this},a.qtype=function(t){return void 0!==t&&(e=t,r.clear()),e},a}function Mm(t,e){if(t&&t.qNumFormat&&-1!==["D","T","TS","IV"].indexOf(t.qNumFormat.qType))return _m(t.qNumFormat.qFmt,t.qNumFormat.qType,e);let n="#",i=e&&void 0!==e.qThousandSep?e.qThousandSep:",",r=e&&void 0!==e.qDecimalSep?e.qDecimalSep:".",o="U",a=t&&!!t.qIsAutoFormat;return t&&t.qNumFormat?(n=t.qNumFormat.qFmt||n,i=t.qNumFormat.qThou||i,r=t.qNumFormat.qDec||r,o=t.qNumFormat.qType||o,a=a&&-1===["M"].indexOf(t.qNumFormat.qType)):a=!0,(a||"U"===o)&&(n="#".concat(r,"##"),o="U"),lm(n,i,r,o,e)}function Sm(){let t,{meta:e,id:n,key:i,localeInfo:r,fieldExtractor:o,value:a,type:s,sourceField:l}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const c=a||("dimension"===s?t=>t.qElemNo:t=>t.qValue),u=t=>t.qText||"",h="dimension"===s?"first":"avg",d=Mm(e,r),f="dimension"===s?"first":(t,e)=>d(e),p={id:()=>n,key:()=>i,raw:()=>e,title:()=>e.qFallbackTitle||e.label,type:()=>s,origin:()=>l,items:()=>(t||(t=o(p)),t),min:()=>e.qMin,max:()=>e.qMax,value:c,label:u,reduce:h,reduceLabel:f,formatter:()=>d,tags:()=>e.qTags};return p}function Cm(t,e,n,i,r){return(e[t]||[]).map(((e,o)=>{const a="".concat(i?"".concat(i,"/"):"").concat(t,"/").concat(o),s={instance:Sm(og({id:"".concat(n?"".concat(n,"/"):"").concat(a),key:a,meta:e},r))};return s.attrDims=Cm("qAttrDimInfo",e,n,a,og({},r,{value:t=>t.qElemNo,type:"dimension"})),s.attrExps=Cm("qAttrExprInfo",e,n,a,og({},r,{value:t=>t.qNum,type:"measure"})),s.measures=Cm("qMeasureInfo",e,n,a,og({},r,{value:t=>t.qValue,type:"measure"})),s}))}function qm(){let{key:t,data:e,config:n={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const i={fields:[],wrappedFields:[],allFields:[],virtualFields:[]},r=e;if(!r)throw new Error('Missing "data" input');if(!r.qDimensionInfo)throw new Error('The "data" input is not recognized as a hypercube');const o=qm.util,a={cache:i,cube:r,localeInfo:n.localeInfo,fieldExtractor:null,pages:null,hierarchy:()=>null,virtualFields:n.virtualFields},s={key:()=>t,raw:()=>r,field:t=>Rg(t,a),fields:()=>i.fields.slice(),extract:t=>a.extractor(t,s,i,o),hierarchy:t=>a.hierarchy(t,s,i,o),_cache:()=>i};"K"===r.qMode||"T"===r.qMode||!r.qMode&&r.qNodesOnDim?(a.extractor=Hg,a.hierarchy=Bg,a.pages="K"===r.qMode?r.qStackedDataPages:r.qTreeDataPages):"S"===r.qMode?(a.extractor=cg,a.pages=r.qDataPages,a.hierarchy=Bg):a.extractor=()=>[],a.fieldExtractor=t=>a.extractor({field:t},s,i,o);const l="S"===r.qMode?t=>t.qElemNumber:void 0,c="S"===r.qMode?t=>t.qNum:void 0;i.wrappedFields.push(...Cm("qDimensionInfo",r,t,"",og({},a,{value:l,type:"dimension"}))),i.wrappedFields.push(...Cm("qMeasureInfo",r,t,"",og({},a,{value:c,type:"measure"}))),i.fields=i.wrappedFields.map((t=>t.instance));const u=t=>{t.forEach((t=>{i.allFields.push(t.instance),u(t.measures),u(t.attrDims),u(t.attrExps)}))};return u(i.wrappedFields),(n.virtualFields||[]).forEach((e=>{const n=s.field(e.from),r=Sm(Kp({meta:n.raw(),id:"".concat(t,"/").concat(e.key),sourceField:n,fieldExtractor:t=>a.extractor({field:t},s,i,o),key:e.key,type:n.type(),localeInfo:a.localeInfo,value:n.value},e.override||{}));i.virtualFields.push(r)})),i.allFields.push(...i.virtualFields),s}const Nm=[["qHyperCube","qHyperCubeDef"],["qTreeData","qTreeDataDef"],["qDimensionInfo","qDimensions"],["qMeasureInfo","qMeasures"],["qAttrDimInfo","qAttributeDimensions"],["qAttrExprInfo","qAttributeExpressions"]],Rm=/\/qDimensionInfo(?:\/(\d+))?/,Am=/\/qMeasureInfo\/(\d+)/,Om=/\/qAttrDimInfo\/(\d+)(?:\/(\d+))?/,Dm=/\/qAttrExprInfo\/(\d+)/,Em=/\/?qHyperCube/,Im=/\/?qTreeData/,Tm=t=>"".concat(t.substr(0,t.indexOf("/qHyperCubeDef")+14)),jm=t=>"".concat(t.substr(0,t.indexOf("/qTreeDataDef")+13));function Pm(t,e){let n=t,i=-1,r=-1,o="",a=t=>t;Em.test(t)?(o="".concat(n.substr(0,n.indexOf("qHyperCube")+10)),a=Tm):Im.test(t)&&(o="".concat(n.substr(0,n.indexOf("qTreeData")+9)),a=jm);let s=!0;if(Rm.test(t)&&(i=+Rm.exec(t)[1]),Am.test(t)&&(r=+Am.exec(t)[1]),Om.test(t)){r=-1,i=0;const t=+Om.exec(n)[2];isNaN(t)||(i=t,n=n.replace(/\/\d+$/,"")),s=!1}if(Dm.test(t)){const t=r;if(e){r=0;const a=Cg(o,e);r+=(a.qMeasureInfo||[]).length,i>-1?(r=a.qDimensionInfo.slice(0,i).reduce(((t,e)=>t+e.qAttrExprInfo.length),r),i=-1):(r=a.qDimensionInfo.reduce(((t,e)=>t+e.qAttrExprInfo.length),r),r=a.qMeasureInfo.slice(0,t).reduce(((t,e)=>t+e.qAttrExprInfo.length),r)),r+=+Dm.exec(n)[1]}else i>-1?(i=-1,r=+Dm.exec(n)[1]):r+=+Dm.exec(n)[1]+1}return Nm.forEach((t=>{let[e,i]=t;n=n.replace(e,i)})),s&&(n=a(n)),n&&"/"!==n[0]&&(n="/".concat(n)),{measureIdx:r,dimensionIdx:i,path:n}}function zm(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const i=e.byCells,r=e.primarySource,o=[],a={},s=t.isActive();let l=!1;if(t.brushes().forEach((t=>{const e=Pm(t.id,n);if("range"===t.type&&e.measureIdx>-1&&e.dimensionIdx>-1){const n=t.brush.ranges();n.length&&(l=!0,a.multiRangeSelectTreeDataValues||(a.multiRangeSelectTreeDataValues={path:e.path,ranges:[]}),n.forEach((t=>a.multiRangeSelectTreeDataValues.ranges.push({qMeasureIx:e.measureIdx,qDimensionIx:e.dimensionIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!0}}))))}else{if("range"===t.type&&e.measureIdx>-1){const n=t.brush.ranges();n.length&&(l=!0,a.rangeSelectHyperCubeValues||(a.rangeSelectHyperCubeValues={path:e.path,ranges:[]}),n.forEach((t=>a.rangeSelectHyperCubeValues.ranges.push({qMeasureIx:e.measureIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!0}}))))}if("range"===t.type&&e.dimensionIdx>-1){const n=t.brush.ranges();n.length&&(l=!0,a.selectHyperCubeContinuousRange||(a.selectHyperCubeContinuousRange={path:e.path,ranges:[]}),n.forEach((t=>a.selectHyperCubeContinuousRange.ranges.push({qDimIx:e.dimensionIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!1}}))))}if("value"===t.type&&e.dimensionIdx>-1)if(i)if(n&&n.qHyperCube&&("P"===n.qHyperCube.qMode||"T"===n.qHyperCube.qMode||"K"===n.qHyperCube.qMode)){const i=n.qHyperCube,o=i.qNoOfLeftDims,s=i.qEffectiveInterColumnSortOrder.indexOf(e.dimensionIdx);if(a.selectPivotCells||(a.selectPivotCells={path:e.path,cells:[]}),t.id===r||!r){const n=t.brush.values().map((t=>+t)).filter((t=>!isNaN(t)));(0===o||s>=o)&&o>-1?n.forEach((t=>{a.selectPivotCells.cells.push({qType:"T",qCol:t,qRow:s-o})})):n.forEach((t=>{a.selectPivotCells.cells.push({qType:"L",qCol:e.dimensionIdx,qRow:t})})),l=!!a.selectPivotCells.cells.length}}else a.selectHyperCubeCells||(a.selectHyperCubeCells={path:e.path,cols:[]}),a.selectHyperCubeCells.cols.push(e.dimensionIdx),t.id!==r&&(r||a.selectHyperCubeCells.values)||(a.selectHyperCubeCells.values=t.brush.values().map((t=>+t)).filter((t=>!isNaN(t))),l=!!a.selectHyperCubeCells.values.length);else{const n=t.brush.values().map((t=>+t)).filter((t=>!isNaN(t)));l=!!n.length,o.push({params:[e.path,e.dimensionIdx,n,!1],method:"selectHyperCubeValues"})}}})),!l&&s)return[{method:"resetMadeSelections",params:[]}];var c;a.rangeSelectHyperCubeValues&&o.push({method:"rangeSelectHyperCubeValues",params:[a.rangeSelectHyperCubeValues.path,a.rangeSelectHyperCubeValues.ranges,[],null===(c=e.orMode)||void 0===c||c]});return a.selectHyperCubeContinuousRange&&o.push({method:"selectHyperCubeContinuousRange",params:[a.selectHyperCubeContinuousRange.path,a.selectHyperCubeContinuousRange.ranges]}),a.selectHyperCubeCells&&o.push({method:"selectHyperCubeCells",params:[a.selectHyperCubeCells.path,a.selectHyperCubeCells.values,a.selectHyperCubeCells.cols]}),a.selectPivotCells&&o.push({method:"selectPivotCells",params:[a.selectPivotCells.path,a.selectPivotCells.cells]}),a.multiRangeSelectTreeDataValues&&o.push({method:"multiRangeSelectTreeDataValues",params:[a.multiRangeSelectTreeDataValues.path,a.multiRangeSelectTreeDataValues.ranges]}),o}function Fm(t){qm.util=t.data("matrix").util,t.data("q",qm),t.formatter("q-number",lm),t.formatter("q-time",_m)}Fm.qBrushHelper=zm,Fm.selections=zm;const Lm={fill:"steelblue",num:1},$m=.9,Bm=150,Hm=(t,e,n)=>{let i=0,r=0,o=0,a={},s=0;if("labelCenter"===t)i=e.bottomLeft.x,r=e.topRight.y,o=e.bottomRight.x-e.bottomLeft.x,s=e.bottomRight.y-e.topRight.y,a={share:n.share,fill:n.fill};else{const t=180/Math.PI*Math.atan((e.bottomRight.y-e.topRight.y)/(e.topRight.x-e.bottomRight.x));i=t<15&&t>=0?e.topRight.x:t>-15&&t<0?e.bottomRight.x:t<-15?(e.bottomRight.x-e.topRight.x)/2+e.topRight.x+15:(e.topRight.x-e.bottomRight.x)/2+e.bottomRight.x+15,r=e.topRight.y,o=e.width-i,s=e.bottomRight.y-e.topRight.y,a={fill:n.fill}}return{tag:t,type:"rect",x:i,y:r,width:o,height:s,data:n.data,desc:a,fill:"none"}},Vm=(t,e)=>{const n=(t=>{const e=(t=>{let e=0;return t.forEach((t=>{t.num>e&&(e=t.num)})),e})(t);let n=0;return t.slice().reverse().map((t=>{const i={datum:t,s:n/e,e:t.num/e};return n=t.num,i})).reverse()})(t),i=e.width*$m,r=e.height*$m,o=(e.width-i)/2,a=(e.height-r)/2,s=i-(i>Bm&&r>Bm?100:0),l=(r-1*(n.length-1))/n.length,c=[];return n.forEach(((t,i)=>{const r=(u=t.e,h=i<n.length-1?t.s:t.e,[.5-.5*u,.5+.5*u,.5+.5*h,.5-.5*h]).map((t=>Math.round(t*s+o)));var u,h;const d=l*i+1*i+a,f={bottomRight:{x:r[2],y:Math.round(d+l)},bottomLeft:{x:r[3],y:Math.round(d+l)},topRight:{x:r[1],y:Math.round(d)},topLeft:{x:r[0],y:Math.round(d)},width:e.width},p=`M${f.topLeft.x},${f.topLeft.y} L${f.topRight.x},${f.topRight.y} ${f.bottomRight.x},${f.bottomRight.y} ${f.bottomLeft.x},${f.bottomLeft.y}Z`;c.push({tag:"section",type:"path",d:p,data:t.datum.data,fill:t.datum.fill});const g={share:t.e,fill:t.datum.fill,data:t.datum.data};l>12&&(f.bottomRight.x-f.bottomLeft.x>32&&c.push(Hm("labelCenter",f,g)),c.push(Hm("labelLeft",f,g)))})),c},Wm=(t,e,n,i)=>(i-t)/i*(e-n)+n,Um=(t,e,n)=>{const i=t.filter((t=>"NaN"!==t.num&&t.num>0)),r=i.length,o=n.width*$m,a=n.height*$m,s=Math.round((n.width-o)/2),l=Math.round((n.height-a)/2),c=o-(o>Bm&&a>Bm?100:0),u=a-1*(r-1),h=[],d=i[0].data.num.value;let f=l;return i.forEach(((t,i)=>{const r=e[i]*u,o=Math.round(Wm(f-l,c,.2*c,a)/2),p=Math.round(Wm(f-l+r,c,.2*c,a)/2),g=s+Math.round(c/2),m={bottomRight:{x:g+p,y:Math.round(f+r)},bottomLeft:{x:g-p,y:Math.round(f+r)},topRight:{x:g+o,y:f},topLeft:{x:g-o,y:f},width:n.width},y=`M${m.topLeft.x},${m.topLeft.y} L${m.topRight.x},${m.topRight.y} ${m.bottomRight.x},${m.bottomRight.y} ${m.bottomLeft.x},${m.bottomLeft.y}Z`;h.push({tag:"section",type:"path",d:y,data:t.data,fill:t.fill});const v={share:t.data.num.value/d,fill:t.fill,data:t.data};r>2&&(m.bottomRight.x-m.bottomLeft.x>32&&h.push(Hm("labelCenter",m,v)),h.push(Hm("labelLeft",m,v))),f+=r+1})),h},Ym=(t,e,n)=>{const i=t.filter((t=>"NaN"!==t.num&&t.num>0));if(i&&i.length>0)switch(e){case"WIDTH":return Vm(i,n);case"ORDER":return Um(i,i.map((()=>1/i.length)),n);case"HEIGHT":return Um(i,(t=>{const e=t.reduce(((t,e)=>t+e.data.num.value),0);return t.map((t=>t.data.num.value/e))})(i),n);case"AREA":return Um(i,((t,e,n)=>{const i=t.reduce(((t,e)=>t+e.data.num.value),0),r=e.width*$m,o=e.height*$m,a=r*n,s=o*(r+a)/2,l=(r-a)/2/o,c=[];let u=0;for(let e=t.length-1;e>=0;e--){const n=t[e].data.num.value/i,r=2*l*u+a,h=-r/(2*l)+Math.sqrt(r*r/(4*l*l)+n*s/l);c[e]=h/o,u+=h}return c})(i,n,.2),n);default:return Vm(i,n)}return[]};var Xm={require:["resolver"],defaultSettings:{settings:{},data:{},style:{item:"$shape"}},render({data:t}){const e=this.resolver.resolve({data:t,defaults:{...Lm,...this.style.item},settings:this.settings.settings});return Ym(e.items,this.settings.settings.mode,this.rect)}};const Km={version:"1.6.2",color:{auto:!0,autoMinMax:!0,byDimDef:void 0,byMeasureDef:void 0,colorExpression:void 0,dimensionScheme:"12",expressionIsColor:!0,expressionLabel:"",measureMin:void 0,measureMax:void 0,measureScheme:"sg",mode:"primary",paletteColor:{index:6},persistent:!1,reverseScheme:!1,singleColor:void 0,useBaseColors:"off",useDimColVal:!0,useMeasureGradient:!0},dataPoint:{auto:!0,labelMode:"share"},footnote:"",funnel:{mode:"WIDTH"},qHyperCubeDef:{qDimensions:[],qMeasures:[],qInterColumnSortOrder:[],qInitialDataFetch:[{qWidth:2,qHeight:5e3}],qSuppressMissing:!0,qSuppressZero:!1},showDimensionTitle:!0,showTitles:!0,subtitle:"",title:""};var Gm={definition:{type:"items",component:"accordion",items:{data:{uses:"data",items:{dimensions:{uses:"dimensions",items:{others:{items:{suppressOther:{defaultValue:!0,show:!1}}}},disabledRef:""},measures:{uses:"measures",disabledRef:""}}},sorting:{uses:"sorting"},settings:{uses:"settings",items:{presentation:{type:"items",label:"Presentation",grouped:!0,items:{funnelmode:{ref:"funnel.mode",label:"Funnel Mode",type:"string",component:"dropdown",options:[{value:"AREA",label:"Area"},{value:"HEIGHT",label:"Height"},{value:"WIDTH",label:"Width"},{value:"ORDER",label:"Ordering"}],defaultValue:"WIDTH"},dimensionTitle:{ref:"showDimensionTitle",type:"boolean",component:"switch",label:"Dimension title",defaultValue:!0,options:[{value:!0,label:"Auto"},{value:!1,label:"Off"}]},valuesAuto:{ref:"dataPoint.auto",type:"boolean",label:"Value labels",component:"switch",defaultValue:!0,options:[{value:!0,label:"Auto"},{value:!1,label:"Custom"}]},labelMode:{ref:"dataPoint.labelMode",type:"string",component:"dropdown",options:[{value:"none",label:"None"},{value:"share",label:"Share"},{value:"value",label:"Values"}],defaultValue:"share",show:t=>!t.dataPoint.auto}}},colorsAndLegend:{uses:"colorsAndLegend",translation:"Colors",items:{colors:{items:{colorByLabel:{show:!1},expressionLabel:{show:!1}}},legend:{show:!1}}}}}}},support:{export:!0,exportData:!0,snapshot:!0,viewData:!1},importProperties:null,exportProperties:null};const Zm=[{path:"/qHyperCubeDef",dimensions:{min:1,max:1,description:()=>"Segments"},measures:{min:1,max:1,description(t){switch(t.funnel.mode){case"WIDTH":return"Width";case"AREA":return"Area";case"HEIGHT":return"Height";case"ORDER":return"Order";default:return""}},added(t,e){2===e.qHyperCubeDef.qInterColumnSortOrder.length&&1!==e.qHyperCubeDef.qInterColumnSortOrder[0]&&(e.qHyperCubeDef.qInterColumnSortOrder=[1,0])}}}];var Jm=Object.prototype.hasOwnProperty,Qm=Object.prototype.toString,ty=Object.defineProperty,ey=Object.getOwnPropertyDescriptor,ny=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===Qm.call(t)},iy=function(t){if(!t||"[object Object]"!==Qm.call(t))return!1;var e,n=Jm.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&Jm.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;for(e in t);return void 0===e||Jm.call(t,e)},ry=function(t,e){ty&&"__proto__"===e.name?ty(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},oy=function(t,e){if("__proto__"===e){if(!Jm.call(t,e))return;if(ey)return ey(t,e).value}return t[e]},ay=function t(){var e,n,i,r,o,a,s=arguments[0],l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),(null==s||"object"!=typeof s&&"function"!=typeof s)&&(s={});l<c;++l)if(null!=(e=arguments[l]))for(n in e)i=oy(s,n),s!==(r=oy(e,n))&&(u&&r&&(iy(r)||(o=ny(r)))?(o?(o=!1,a=i&&ny(i)?i:[]):a=i&&iy(i)?i:{},ry(s,{name:n,newValue:t(u,a,r)})):void 0!==r&&ry(s,{name:n,newValue:r}));return s};function sy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function ly(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?sy(Object(n),!0).forEach((function(e){fy(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):sy(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function cy(){cy=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",s=r.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var o=e&&e.prototype instanceof d?e:d,a=Object.create(o.prototype),s=new S(r||[]);return i(a,"_invoke",{value:w(t,n,s)}),a}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h={};function d(){}function f(){}function p(){}var g={};l(g,o,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(C([])));y&&y!==e&&n.call(y,o)&&(g=y);var v=p.prototype=d.prototype=Object.create(g);function x(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(i,o,a,s){var l=u(t[i],t,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(h).then((function(t){c.value=t,a(c)}),(function(t){return r("throw",t,a,s)}))}s(l.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function w(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return{value:void 0,done:!0}}for(n.method=r,n.arg=o;;){var a=n.delegate;if(a){var s=k(a,n);if(s){if(s===h)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=u(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function k(t,e){var n=e.method,i=t.iterator[n];if(void 0===i)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var r=u(i,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,h;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function C(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i<t.length;)if(n.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:q}}function q(){return{value:void 0,done:!0}}return f.prototype=p,i(v,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:f,configurable:!0}),f.displayName=l(p,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,l(t,s,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},x(b.prototype),l(b.prototype,a,(function(){return this})),t.AsyncIterator=b,t.async=function(e,n,i,r,o){void 0===o&&(o=Promise);var a=new b(c(e,n,i,r),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(v),l(v,s,"Generator"),l(v,o,(function(){return this})),l(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var i in e)n.push(i);return n.reverse(),function t(){for(;n.length;){var i=n.pop();if(i in e)return t.value=i,t.done=!1,t}return t.done=!0,t}},t.values=C,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(M),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function i(n,i){return a.type="throw",a.arg=t,e.next=n,i&&(e.method="next",e.arg=void 0),!!i}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;M(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:C(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function uy(t){return(uy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function hy(t,e,n,i,r,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(i,r)}function dy(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){hy(o,i,r,a,s,"next",t)}function s(t){hy(o,i,r,a,s,"throw",t)}a(void 0)}))}}function fy(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function py(t,e){if(null==t)return{};var n,i,r=function(t,e){if(null==t)return{};var n,i,r={},o=Object.keys(t);for(i=0;i<o.length;i++)n=o[i],e.indexOf(n)>=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)n=o[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function gy(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=o.call(n)).done)&&(s.push(i.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}(t,e)||yy(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 my(t){return function(t){if(Array.isArray(t))return vy(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||yy(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 yy(t,e){if(t){if("string"==typeof t)return vy(t,e);var n=Object.prototype.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)?vy(t,e):void 0}}function vy(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var xy=Object.prototype.hasOwnProperty,by=Object.prototype.toString,wy=Object.defineProperty,ky=Object.getOwnPropertyDescriptor,_y=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===by.call(t)},My=function(t){if(!t||"[object Object]"!==by.call(t))return!1;var e,n=xy.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&xy.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;for(e in t);return void 0===e||xy.call(t,e)},Sy=function(t,e){wy&&"__proto__"===e.name?wy(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},Cy=function(t,e){if("__proto__"===e){if(!xy.call(t,e))return;if(ky)return ky(t,e).value}return t[e]},qy=function t(){var e,n,i,r,o,a,s=arguments[0],l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),(null==s||"object"!=typeof s&&"function"!=typeof s)&&(s={});l<c;++l)if(null!=(e=arguments[l]))for(n in e)i=Cy(s,n),s!==(r=Cy(e,n))&&(u&&r&&(My(r)||(o=_y(r)))?(o?(o=!1,a=i&&_y(i)?i:[]):a=i&&My(i)?i:{},Sy(s,{name:n,newValue:t(u,a,r)})):void 0!==r&&Sy(s,{name:n,newValue:r}));return s};function Ny(t,e){return{range:function(t){var n=t.resources,i=t.data,r=n.theme.palette("categorical",0===e?i.items.length:e);return i.items.map((function(t){return r[t.value%r.length]}))},valueAccessor:t.value}}function Ry(t,e){return{range:function(t){var n=t.resources,i=t.data,r=n.theme.palette("categorical",0===e?i.items.length:e);return i.items.map((function(t){return r[t.row.value%r.length]}))},valueAccessor:t.value}}function Ay(t,e,n,i,r){var o,a,s=r.byRow,l=r.byElemNo;if(i&&(e.input.persistent||t.hc.qDimensionInfo.length>1||void 0===n.activeDimensionIndex&&t.hc.qSize.qcy>((null===(a=(o=t.hc).qDataPages[0]||o.qStackedDataPages[0])||void 0===a?void 0:a.qArea.qHeight)||0)))return l(i,i.raw().qCardinal);if(i){var c=e.pic.extract({field:i.key(),trackBy:i.value}).length;return s(i,c)}return{}}function Oy(t,e){var n=t.hc.qDimensionInfo,i=e.input.byDimDef||{activeDimensionIndex:n.length-1};if(i.activeDimensionIndex>=0){var r=n[i.activeDimensionIndex];i=r.coloring&&r.coloring.colorMapRef?{type:"libraryItem",key:r.coloring.colorMapRef,activeDimensionIndex:i.activeDimensionIndex}:{activeDimensionIndex:i.activeDimensionIndex}}return i}function Dy(t,e){var n;return e.activeDimensionIndex>=0?n=t.pic.fields().filter((function(t){return"dimension"===t.type()}))[e.activeDimensionIndex]:"libraryItem"===e.type?!1===(n=e.key?t.pic.field((function(t){return t.raw().colorMapRef===e.key})):void 0)&&(n=t.pic.field((function(t){return"colorByAlternative"===t.raw().id}))):"expression"===e.type&&(n=t.pic.field((function(t){return"colorByAlternative"===t.raw().id}))),n}function Ey(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Iy(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Ty(){}var jy=1/.7,Py="\\s*([+-]?\\d+)\\s*",zy="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Fy="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ly=/^#([0-9a-f]{3,8})$/,$y=new RegExp("^rgb\\("+[Py,Py,Py]+"\\)$"),By=new RegExp("^rgb\\("+[Fy,Fy,Fy]+"\\)$"),Hy=new RegExp("^rgba\\("+[Py,Py,Py,zy]+"\\)$"),Vy=new RegExp("^rgba\\("+[Fy,Fy,Fy,zy]+"\\)$"),Wy=new RegExp("^hsl\\("+[zy,Fy,Fy]+"\\)$"),Uy=new RegExp("^hsla\\("+[zy,Fy,Fy,zy]+"\\)$"),Yy={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Xy(){return this.rgb().formatHex()}function Ky(){return this.rgb().formatRgb()}function Gy(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Ly.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Zy(e):3===n?new ev(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Jy(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Jy(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=$y.exec(t))?new ev(e[1],e[2],e[3],1):(e=By.exec(t))?new ev(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Hy.exec(t))?Jy(e[1],e[2],e[3],e[4]):(e=Vy.exec(t))?Jy(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Wy.exec(t))?ov(e[1],e[2]/100,e[3]/100,1):(e=Uy.exec(t))?ov(e[1],e[2]/100,e[3]/100,e[4]):Yy.hasOwnProperty(t)?Zy(Yy[t]):"transparent"===t?new ev(NaN,NaN,NaN,0):null}function Zy(t){return new ev(t>>16&255,t>>8&255,255&t,1)}function Jy(t,e,n,i){return i<=0&&(t=e=n=NaN),new ev(t,e,n,i)}function Qy(t){return t instanceof Ty||(t=Gy(t)),t?new ev((t=t.rgb()).r,t.g,t.b,t.opacity):new ev}function tv(t,e,n,i){return 1===arguments.length?Qy(t):new ev(t,e,n,null==i?1:i)}function ev(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function nv(){return"#"+rv(this.r)+rv(this.g)+rv(this.b)}function iv(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function rv(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ov(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new sv(t,e,n,i)}function av(t){if(t instanceof sv)return new sv(t.h,t.s,t.l,t.opacity);if(t instanceof Ty||(t=Gy(t)),!t)return new sv;if(t instanceof sv)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=e===o?(n-i)/s+6*(n<i):n===o?(i-e)/s+2:(e-n)/s+4,s/=l<.5?o+r:2-o-r,a*=60):s=l>0&&l<1?0:a,new sv(a,s,l,t.opacity)}function sv(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function lv(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function cv(t){return function(){return t}}function uv(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):cv(isNaN(t)?e:t)}Ey(Ty,Gy,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Xy,formatHex:Xy,formatHsl:function(){return av(this).formatHsl()},formatRgb:Ky,toString:Ky}),Ey(ev,tv,Iy(Ty,{brighter:function(t){return t=null==t?jy:Math.pow(jy,t),new ev(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new ev(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:nv,formatHex:nv,formatRgb:iv,toString:iv})),Ey(sv,(function(t,e,n,i){return 1===arguments.length?av(t):new sv(t,e,n,null==i?1:i)}),Iy(Ty,{brighter:function(t){return t=null==t?jy:Math.pow(jy,t),new sv(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new sv(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new ev(lv(t>=240?t-240:t+120,r,i),lv(t,r,i),lv(t<120?t+240:t-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var hv=function t(e){var n=function(t){return 1==(t=+t)?uv:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):cv(isNaN(e)?n:e)}}(e);function i(t,e){var i=n((t=tv(t)).r,(e=tv(e)).r),r=n(t.g,e.g),o=n(t.b,e.b),a=uv(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=r(e),t.b=o(e),t.opacity=a(e),t+""}}return i.gamma=t,i}(1),dv=/^class(-pyramid)?/,fv=function(t,e,n,i){var r=void 0!==n.min?n.min:i.min(),o=void 0!==n.max?n.max:i.max(),a=r,s=o,l=e.limits,c={},u="percent"===e.limitType?l.map((function(t){return r+(o-r)*t})):l,h=e.colors.map((function(e){return t.resolveUIColor(e)}));if(r=Math.min.apply(Math,[r].concat(my(u))),o=Math.max.apply(Math,[o].concat(my(u))),c.min=r,c.max=o,e.breakTypes&&-1===e.breakTypes.indexOf(!0))c.type="categorical",Object.assign(c,function(t){var e=t.min,n=t.max,i=t.limits,r=t.range,o=[],a=[];if(i.length)if(i[i.length-1]<e)a.push(e,n),o.push(r[r.length-1],r[r.length-1],r[r.length-1]);else if(i[0]>n)a.push(e,n),o.push(r[0],r[0],r[0]);else{if(i[0]>e)a.push(e),o.push(r[0]);else{a.push(e);for(var s=0;s<i.length;s++)if(e<i[s]){o.push(r[s]);break}}for(var l=0;l<i.length;l++)e<i[l]&&i[l]<n&&(a.push(i[l]),o.push(r[l]));if(i[i.length-1]<n)a.push(n),o.push(r[i.length]),o.push(r[i.length]);else{a.push(n);for(var c=0;c<i.length;c++)if(i[c]>n){o.push(r[c]),o.push(r[c]);break}}}else o.push(r[0]);return{min:e,max:n,range:o,domain:a}}({min:"percent"===e.limitType?r:a,max:"percent"===e.limitType?o:s,range:h,limits:"percent"===e.limitType?u:l}));else if(e.breakTypes){var d=e.breakTypes;c.type="continuous",c.domain=[r],c.range=[h[0]];for(var f=0;f<u.length;f+=1)if(d[f]){var p=h[f],g=h[f+1],m=hv(p,g)(.5);c.range.push(m),c.domain.push(u[f]),f<u.length-1&&d[f+1]&&(c.range.push(h[f+1]),c.domain.push((u[f]+u[f+1])/2))}else c.range.push(h[f]),c.range.push(h[f+1]),c.domain.push(u[f]),c.domain.push(u[f]+Math.min(1e-6,(o-r)/1e6));c.range.push(h[h.length-1]),c.domain.push(o)}else c.domain=u,c.range=h;return c};function pv(t,e,n,i,r){var o,a,s,l=0,c=[],u=(t-e)/(i+1);if(0===u)return 1;for(o=0;o<n.length;o+=1)a=.99*(n[o]-e),s=n[o]>t?Math.floor(t/u):n[o]<e?0:Math.floor(a/u),Number.isNaN(s)||(c[s]?c[s]+=1:c[s]=1);for(o=0;o<c.length;o+=1)c[o]&&(l+=1);return l<=i||l>=r?Math.max(l,i):pv(t,e,n,i+1,r)}var gv=function(t,e,n,i){var r,o,a=e.theme,s=e.hc,l=i.f,c={mode:"field",fieldType:"measure",field:l?l.key():void 0,reverse:n.input.reverseScheme||!1,type:"continuous",range:function(t){return t.resources.theme.palette("quant")}},u=[],h=!0;if(l){if(Number.isNaN(+l.min())||Number.isNaN(+l.max()))return{invalid:!0};(h=!("S"===(r=n.pic.raw()).qMode&&(r.qDataPages[0]&&r.qSize.qcy>r.qDataPages[0].qArea.qHeight||!r.qDataPages.length&&r.qSize.qcy>0)||"K"===r.qMode&&r.qStackedDataPages[0]&&r.qSize.qcy>r.qStackedDataPages[0].qArea.qHeight||"T"===r.qMode&&r.qSize.qcy>r.qTreeDataPages[0].qGroupSize))&&(u=n.pic.extract({field:0,props:{num:{field:l.key()},exclude:{fields:s.qDimensionInfo.map((function(t,e){return{field:"qDimensionInfo/".concat(e)}})),value:function(t){return Math.min.apply(Math,my(t))<0}}}}).filter((function(t){return t.value>=0&&!t.exclude.value})).map((function(t){return t.num.value})).filter((function(t){return"number"==typeof t})))}if(!1===n.input.autoMinMax){if(c.min=n.input.measureMin,c.max=n.input.measureMax,c.max<c.min)return{invalid:!0}}else if(l&&!h)c.min=l.min(),c.max=l.max();else if(l){if(!u.length)return{invalid:!0};c.min=Math.min.apply(Math,my(u)),c.max=Math.max.apply(Math,my(u))}if(n.input.measureScheme&&(c.palettes={quant:n.input.measureScheme}),a){var d=a.getDataColorScales().filter((function(t){return t.key===n.input.measureScheme}))[0];c.type=d&&dv.test(d.type)?"categorical":"continuous","categorical"===c.type&&(o=d.colors.some((function(t){return Array.isArray(t)}))?Math.max.apply(Math,my(d.colors.map((function(t){return t?t.length:0})))):d.colors.length)}if("categorical"===c.type){for(var f=h?pv(c.max,c.min,u,1,o):o,p=(c.max-c.min)/f,g=[],m=0;m<f+1;m+=1)g.push(c.min+p*m);c.domain=g,c.range=function(t){for(var e=t.resources.theme.palette("quant",f),n=Math.max(1,Math.floor(e.length/f)),i=[],r=0;r<f;r+=1)i.push(e[r*n]);return[i[0]].concat(i,[i[i.length-1]])}}return c};function mv(t,e){var n;return e.activeMeasureIndex>=0?n=t.pic.fields().filter((function(t){return"measure"===t.type()}))[e.activeMeasureIndex]:"libraryItem"===e.type?n=t.pic.field((function(t){return t.raw().colorMapRef===e.key&&void 0!==e.key})):"expression"===e.type&&(n=t.pic.field((function(t){return"colorByAlternative"===t.raw().id}))),n||(n=t.pic.field((function(t){return void 0!==t.raw().matchMeasure})))&&(n=t.pic.fields().filter((function(t){return"measure"===t.type()}))[n.raw().matchMeasure]),n}function yv(t){var e,n=t.cm,i=t.defaults,r=t.index,o=t.input,a=t.pic;if(!o||!o.on)return null;var s=null!==(e=o.mode)&&void 0!==e?e:"primary";return"primary"===s?function(t,e,n){var i=n.primary;return void 0!==e.paletteColor&&e.paletteColor&&(i=t.resolveUIColor(e.paletteColor)),ly(ly({},n),{},{mode:"constant",type:"constant",primary:i})}(n,o,i):"byExpression"===s?function(t,e,n){var i="qMeasureInfo/".concat(t,"/"),r=e.field((function(t){return t.id().startsWith(i)&&"colorByMeasureExpression"===t.raw().id})),o=r;return ly(ly({},n),{},o?{mode:"field",fieldType:"expression",field:r?r.key():void 0,type:"color"}:{mode:"constant",type:"constant",primary:n.nil})}(r,a,i):null}function vv(t){t.measureOverrides.every((function(t){return!t}))&&(t.measureOverrides=null)}function xv(t,e){for(var n=(null==e?void 0:e.domain)||[],i=(null==e?void 0:e.range)||[],r=[],o=0;o<t.length;++o){var a=t[o];if("constant"===(null==a?void 0:a.mode)){var s=n.indexOf(o);-1===s?(n.push(o),i.push(a.primary)):i[s]=a.primary,t[o]=null}else if(a){r.push(o);var l=n.indexOf(o);-1!==l&&(n.splice(l,1),i.splice(l,1))}}return{domain:n,range:i,exclude:r}}function bv(t,e,n,i){var r,o=function(t,e,n,i){if(e.input&&!e.input.auto){if("byMeasure"===e.input.mode)return function(t,e,n){var i=e.theme,r=e.hc,o=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).getCField,a=void 0===o?mv:o,s=n.input.byMeasureDef||{activeMeasureIndex:0},l=a(n,s),c=gv(0,{theme:i,hc:r},n,{f:l});if(c.invalid)return c;"expression"===s.type&&(s.activeMeasureIndex<0||void 0===s.activeMeasureIndex)&&(c.label=s.label,l&&"color.altLabel"===l.raw().labelExpRef&&(c.label=n.input.altLabel)),!c.label&&l&&(c.label=l.title());var u=s.activeMeasureIndex>=0?l:null;if(!u&&l&&void 0!==l.raw().matchMeasure&&l.raw().matchMeasure>-1&&(u=n.pic.fields().filter((function(t){return"measure"===t.type()}))[l.raw().matchMeasure]),n.input.useMeasureGradient&&"libraryItem"===s.type)if(u){var h=u.raw().coloring;h&&h.gradient&&qy(c,fv(t,h.gradient,c,u))}else c.auxiliary=s;return c}(t,n,e);if("byDimension"===e.input.mode)return function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=i.getCDef,o=void 0===r?Oy:r,a=i.getCByField,s=void 0===a?Dy:a,l=i.getPersistence,c=void 0===l?Ay:l,u=o(e,n),h=s(n,u),d=h?h.raw():{},f=n&&n.pic?n.pic.raw():{};if(d.qError||d.qSize&&0===d.qSize.qcy&&!f.qHasOtherValues)return{invalid:!0};var p={mode:"field",fieldType:"dimension",type:"categorical",field:h?h.key():void 0,isFieldLocked:d.qLocked};return("expression"===u.type||u.activeDimensionIndex<0)&&(p.label=u.label,"color.altLabel"===d.labelExpRef&&(p.label=n.input.altLabel)),!p.label&&h&&(p.label=h.title()),n.input.dimensionScheme&&(p.palettes={categorical:n.input.dimensionScheme}),n.input.useDimColVal&&"libraryItem"===u.type&&(p.auxiliary=u),qy(p,c(e,n,u,h,{byRow:Ry,byElemNo:Ny})),p}(t,n,e);if("byExpression"===e.input.mode)return function(t,e,n,i){var r=e.hc,o=e.theme,a=e.translator,s=n.pic.field((function(t){return"colorByExpression"===t.raw().id}));if(!s||!s.raw().qFallbackTitle&&!n.input.colorExpression||!(Number.isFinite(s.raw().qMin)&&Number.isFinite(s.raw().qMax)||n.input.expressionIsColor))return{mode:"constant",type:"constant",primary:i.nil};if(n.input.expressionIsColor)return{mode:"field",fieldType:"expression",field:s?s.key():void 0,type:"color"};var l=gv(0,{hc:r,theme:o},n,{f:s});return l.invalid||(l.label=n.input.expressionLabel||a.get("Object.ChartTooltip.ColorExpression")),l}(0,n,e,i);if("byMultiple"===e.input.mode||"primary"===e.input.mode)return function(t,e,n,i){var r=e.hc,o=e.theme,a=e.translator,s=n.input.useBaseColors;if(("byMultiple"===n.input.mode||"primary"===n.input.mode&&"measure"===n.input.useBaseColors)&&r.qMeasureInfo.length>1&&(s="measure"),"measure"===s){var l=[],c=[];"measure"===n.input.useBaseColors&&r.qMeasureInfo.forEach((function(e,n){if(e.baseColor||e.coloring&&e.coloring.baseColor){l.push(n);var r=t.resolveUIColor(e.baseColor||e.coloring.baseColor);"none"===r?c.push(i.primary):c.push(r)}}));var u=n.input.dimensionScheme?{categorical:n.input.dimensionScheme}:void 0,h=o?o.getDataColorPalettes()[0]:void 0;return"measure"===n.input.useBaseColors&&h&&(u={categorical:h.key}),{mode:"measure",type:"categorical",palettes:u,label:a?a.get("Common.Measures"):void 0,explicit:l.length?{domain:l,range:c}:void 0}}if("dimension"===s){var d=[],f=[];return r.qDimensionInfo.forEach((function(e,n){if(e.baseColor||e.coloring&&e.coloring.baseColor){d.push(n);var r=t.resolveUIColor(e.baseColor||e.coloring.baseColor);"none"===r?f.push(i.primary):f.push(r)}})),{mode:"dimension",type:"categorical",field:d.length?d[0]:void 0,explicit:d.length?{domain:d,range:f}:void 0}}var p=i.primary;if(void 0!==n.input.paletteColor)n.input.paletteColor&&(p=t.resolveUIColor(n.input.paletteColor));else{var g=n.input.singleColor;"number"!=typeof g||Number.isNaN(g)||(p=["#b0afae","#7b7a78","#545352","#4477aa","#7db8da","#b6d7ea","#46c646","#f93f17","#ffcf02","#276e27","#ffffff","#000000"][g])}return{mode:"constant",type:"constant",primary:p}}(t,n,e,i)}return{}}(t,e,n,i);return null!==(r=e.input)&&void 0!==r&&r.measureOverrides?(o.measureOverrides=e.input.measureOverrides.map((function(n,r){return yv({cm:t,input:n,defaults:i,index:r,pic:e.pic})})),function(t,e){var n,i,r,o=e.translator;if(vv(t),1===(null===(n=t.measureOverrides)||void 0===n?void 0:n.length))return t.measureOverrides[0];if("measure"===t.mode&&t.measureOverrides&&(t.explicit=xv(t.measureOverrides,t.explicit),vv(t)),null!==(i=t.measureOverrides)&&void 0!==i&&i.every((function(t){return"constant"===(null==t?void 0:t.mode)}))){var a={mode:"measure",type:"categorical",label:null==o?void 0:o.get("Common.Measures")};return a.explicit=xv(t.measureOverrides),a}return null!==(r=t.measureOverrides)&&void 0!==r&&r.every((function(t){return t}))?{invalid:!0,measureOverrides:t.measureOverrides}:t}(o,n)):o}function wv(t){var e=ly({hc:null,colorProps:null,layout:null,theme:null},t),n={},i={auto:function(){return{mode:"primary"}},getDimensionColorMap:function(){return Promise.reject()},getMeasure:function(){return Promise.reject()},getAttributeDimension:function(){return Promise.reject()}},r={auto:function(t){return t?(i.auto=t,r):i.auto},getDimensionColorMap:function(t){return t?(i.getDimensionColorMap=t,r):i.getDimensionColorMap},getAttributeDimension:function(t){return t?(i.getAttributeDimension=t,r):i.getAttributeDimension},getMeasure:function(t){return t?(i.getMeasure=t,r):i.getMeasure},set:function(t){var r;if(!t.colorProps)throw new Error('Missing "colorProps"');if(qy(e,t),(n={pic:e.picasso.data("q")({data:e.hc,config:{localeInfo:e.localeInfo}}),input:e.colorProps}).input.auto){var o=i.auto(t.layout);n.input=qy(!0,{},n.input,o,{auto:!1});var a=e.theme?e.theme.getDataColorPalettes():[];a[0]&&(n.input.dimensionScheme=a[0].key);var s=0;n.input.byDimDef&&+n.input.byDimDef.activeDimensionIndex>=0&&(s=+n.input.byDimDef.activeDimensionIndex),e.hc&&e.hc.qDimensionInfo[s]&&e.hc.qDimensionInfo[s].coloring&&e.hc.qDimensionInfo[s].coloring.colorMapRef&&n.input.byDimDef&&(n.input.byDimDef.type="libraryItem",n.input.byDimDef.key=e.hc.qDimensionInfo[s].coloring.colorMapRef)}null!==(r=n.input.measureOverrides)&&void 0!==r&&r.every((function(t){return!t||!t.on}))&&(n.input=qy(!1,{},n.input,{measureOverrides:null}))},palettes:function(){if(!n.palettes){var t=e.theme,i=[];(t&&t.getDataColorPickerPalettes()||[]).forEach((function(t){i.push({key:"ui",colors:t.colors})})),n.palettes=i}return n.palettes},getAuxiliaryData:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/qHyperCubeDef";if(!t.auxiliary&&!/qAttrDimInfo/.test(t.field))return Promise.resolve();var r=t.auxiliary||{},o=r.key;if("measure"===t.fieldType)return i.getMeasure(o,e).catch((function(){}));if("dimension"===t.fieldType){var a="".concat(n,"/").concat(t.field).replace("qDimensionInfo","qDimensions").replace("qAttrDimInfo","qAttributeDimensions");return Promise.all([/qAttrDimInfo/.test(t.field)?i.getAttributeDimension(a,e).catch((function(){})):Promise.resolve(),o?i.getDimensionColorMap(o,e).catch((function(){})):Promise.resolve()])}return Promise.resolve()},getAuxiliarySettings:function(t,i){var r=this;return t.auxiliary||/qAttrDimInfo/.test(t.field)?(this.palettes(),this.getAuxiliaryData(t,i).then((function(i){if(!i)return{};if("measure"===t.fieldType){if(i.coloring&&i.coloring.gradient){var o=n.pic.field(t.field);return fv(r,i.coloring.gradient,t,o)}return{}}if("dimension"===t.fieldType){var a={nil:t.nil,others:t.others},s=i[0],l=i[1]?i[1].colorMap:null;if(s){var c=e.picasso.data("q")({data:{qDimensionInfo:[n.pic.field(t.field).raw(),n.pic.field(t.field).raw()],qMeasureInfo:[],qDataPages:s,qInterColumnSortOrder:[0,1],qMode:"S"}});a.legendDataset=c}return l?function(t,e,n,i){var r=i.external,o=i.field,a=ly({},t);qy(a,Ny(o,o.raw().qCardinal));var s=r.theme?r.theme.getDataColorPalettes()[0]:null;return e.nul&&(a.nil=n.resolveUIColor(e.nul)),e.oth&&(a.others=n.resolveUIColor(e.oth)),e.usePal?(a.palettes={categorical:e.pal},s&&!e.pal&&(a.palettes.categorical=s.key,qy(a,Ny(o)))):!1===e.autoFill&&e.single?a.range=[n.resolveUIColor(e.single)]:e.autoFill&&(s&&(a.palettes={categorical:s.key}),qy(a,Ny(o))),e.colors&&e.colors.length&&(a.explicit=function(t,e,n){for(var i={},r=0;r<t.length;r+=1)i[t[r].value]=t[r].baseColor;var o=[];return{domain:function(t){var r=t.data,a=[];o=[];for(var s=0;s<r.items.length;s++){var l=r.items[s],c=(l.text||l).label;i[c]&&-1===a.indexOf(l.value)&&(a.push(l.value),o.push(e.resolveUIColor(i[c])))}return a.push(-3,-2),o.push(n.others),o.push(n.nil),a},range:function(){return o}}}(e.colors,n,a)),a}(a,l,r,{external:e,field:n.pic.field(t.field)}):a}return{}}))):Promise.resolve()},resolveUIColor:function(t){if(t.index<0||void 0===t.index)return t.color;if(void 0===n.uiPalette&&(n.uiPalette=this.palettes().filter((function(t){return"ui"===t.key}))[0]||!1),!n.uiPalette)return t.color;var e="none"===n.uiPalette.colors[0]?t.index:t.index-1;return void 0===n.uiPalette.colors[e]?t.color:n.uiPalette.colors[e]},settings:function(){if(this.palettes(),!n.settings){var t={primary:"steelblue",others:"#aaa",nil:"#ddd"},i=e.theme;i&&(t=ly(ly({},t),i.getDataColorSpecials())),n.settings=qy(t,bv(this,n,e,t))}return n.settings}};return r}var kv=function(t,e){var n=t.fieldType,i={};if(e)if("measure"===n){var r=e.coloring;r&&(i.measureGradient=r.gradient)}else if("dimension"===n){var o=e[0],a=e[1];o&&(i.legendDataPage=o),a&&(i.dimValsData=a.colorMap)}return i},_v=function(t){throw t.isHandled=!0,t},Mv=function(t,e){var n=e.layout,i=e.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.dimValsData?Promise.resolve({colorMap:n.snapshotData.content.chartData.dimValsData}):Promise.reject():i&&i.getObject?i.getObject("ColorMapModel_".concat(t)).then((function(t){return t.getLayout()})):Promise.reject()},Sv=function(t,e){var n=e.layout,i=e.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.measureGradient?Promise.resolve({coloring:{gradient:n.snapshotData.content.chartData.measureGradient}}):Promise.reject():i&&i.getMeasure?i.getMeasure(t).then((function(t){return t.getMeasure()})):Promise.reject()},Cv=function(t,e){var n=e.layout,i=e.model,r=e.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.legendDataPage?Promise.resolve(n.snapshotData.content.chartData.legendDataPage):Promise.reject():i&&i.session&&r?i.getHyperCubeData(t,[{qHeight:100,qLeft:0,qTop:0,qWidth:2}]).catch(_v):Promise.reject()};function qv(t){var e=t.hc,n=t.source,i=t.coloring,r={data:{extract:[{source:"dummy",field:0,filter:function(){return r.expando=e.qDataPages[0]?e.qDataPages[0].qArea.qTop:0,!1}},{source:n,field:i.field,trackBy:i.valueAccessor,reduce:"first",props:{row:{reduce:function(){return r.expando++}},text:{value:function(t){return t.qText},reduce:"first"}}}]},expando:0};return r}function Nv(t){return function(e){return"object"===uy(e.datum[t])?e.datum[t].value:void 0}}function Rv(t){return"object"===uy(t.datum.isNull)?t.datum.isNull.value:-2===t.datum.value}function Av(t){return-3===t.datum.value}var Ov={COLOR:void 0,FONT_SIZE:"16px",FONT_FAMILY:"'Source Sans Pro', 'Arial', 'sans-serif'"},Dv={COLOR:void 0,FONT_SIZE:void 0,FONT_FAMILY:"'Source Sans Pro', 'Arial', 'sans-serif'"};function Ev(t){var e=t.theme,n=t.key,i=t.styleOverrides,r={title:{color:Ov.COLOR,fontSize:Ov.FONT_SIZE,fontFamily:Ov.FONT_FAMILY},label:{color:Dv.COLOR,fontSize:Dv.FONT_SIZE,fontFamily:Dv.FONT_FAMILY}};if(!e&&!i)return r;var o=i||{},a=o.title,s=o.label,l=function(t){var e=t.theme,n=t.key;return function(t,i,r,o){return void 0!==t?t:e?e.getStyle(n,i,r):o}}({theme:e,key:n});return r.title.color=l(null==a?void 0:a.color,"legend.title","color",Ov.COLOR),r.title.fontSize=l(null==a?void 0:a.fontSize,"legend.title","fontSize",Ov.FONT_SIZE),r.title.fontFamily=l(null==a?void 0:a.fontFamily,"legend.title","fontFamily",Ov.FONT_FAMILY),r.label.color=l(null==s?void 0:s.color,"legend.label","color",Dv.COLOR),r.label.fontSize=l(null==s?void 0:s.fontSize,"legend.label","fontSize",Dv.FONT_SIZE),r.label.fontFamily=l(null==s?void 0:s.fontFamily,"legend.label","fontFamily",Dv.FONT_FAMILY),r}var Iv=function(t,e,n){var i=t&&t.dock||void 0;if("auto"!==i)return i||"right";if(e){var r=e.element.getBoundingClientRect();if(r.height>r.width)return"bottom"}return n?"left":"right"},Tv=function(t,e,n){return!(n.invalid||"color"===n.type||"measure"===n.mode&&e.qMeasureInfo.length<=1||"dimension"===n.mode)&&("function"==typeof t.show?t.show():!1!==t.show)};function jv(t,e){var n=t.styleReference,i=t.styleOverrides,r=t.chart,o=t.rtl,a=e.legendProps,s=e.coloring,l=e.theme,c=e.hc,u=Ev({theme:l,key:n,styleOverrides:i});return{layout:{minimumLayoutMode:"MEDIUM",dock:Iv(a,r,o)},show:"function"==typeof a.show?function(){return Tv(a,c,s)}:Tv(a,c,s),renderer:"svg",mounted:function(t){t.childNodes[0].style.pointerEvents="none",t.style.overflow="hidden"},settings:{title:{show:!1!==a.showTitle,wordBreak:"break-word",maxLines:2,lineHeight:1.2,text:s.label||"",fill:u.title.color,fontSize:u.title.fontSize,fontFamily:u.title.fontFamily}}}}function Pv(t,e,n){return"categorical"===e.coloring.type?function(t,e,n){var i=jv(t,e);if(!i.show)return!1;var r,o=t.key,a=t.styleReference,s=t.styleOverrides,l=t.viewState,c=t.rtl,u=t.settings,h=t.style,d=e.scaleKey,f=e.theme,p=e.scales,g=Ev({theme:f,key:a,styleOverrides:s}),m=i.layout.dock,y="left"===m||"right"===m?{maxLines:2,wordBreak:"break-word"}:{},v={up:"M13.6,11 L2.4,11 C2.28954305,11 2.2,10.9104569 2.2,10.8 C2.2,10.756726 2.21403557,10.7146192 2.24,10.68 L7.84,3.21333333 C7.90627417,3.12496777 8.03163444,3.10705916 8.12,3.17333333 C8.13516113,3.18470418 8.14862915,3.1981722 8.16,3.21333333 L13.76,10.68 C13.8262742,10.7683656 13.8083656,10.8937258 13.72,10.96 C13.6853808,10.9859644 13.643274,11 13.6,11 Z",down:"M2.4,4 L13.6,4 C13.7104569,4 13.8,4.08954305 13.8,4.2 C13.8,4.24327404 13.7859644,4.28538077 13.76,4.32 L8.16,11.7866667 C8.09372583,11.8750322 7.96836556,11.8929408 7.88,11.8266667 C7.86483887,11.8152958 7.85137085,11.8018278 7.84,11.7866667 L2.24,4.32 C2.17372583,4.23163444 2.19163444,4.10627417 2.28,4.04 C2.31461923,4.01403557 2.35672596,4 2.4,4 Z",left:"M11,2.4 L11,13.6 C11,13.7104569 10.9104569,13.8 10.8,13.8 C10.756726,13.8 10.7146192,13.7859644 10.68,13.76 L3.21333333,8.16 C3.12496777,8.09372583 3.10705916,7.96836556 3.17333333,7.88 C3.18470418,7.86483887 3.1981722,7.85137085 3.21333333,7.84 L10.68,2.24 C10.7683656,2.17372583 10.8937258,2.19163444 10.96,2.28 C10.9859644,2.31461923 11,2.35672596 11,2.4 Z",right:"M4,13.6 L4,2.4 C4,2.28954305 4.08954305,2.2 4.2,2.2 C4.24327404,2.2 4.28538077,2.21403557 4.32,2.24 L11.7866667,7.84 C11.8750322,7.90627417 11.8929408,8.03163444 11.8266667,8.12 C11.8152958,8.13516113 11.8018278,8.14862915 11.7866667,8.16 L4.32,13.76 C4.23163444,13.8262742 4.10627417,13.8083656 4.04,13.72 C4.01403557,13.6853808 4,13.643274 4,13.6 Z"};"dimension"===e.coloring.fieldType&&(r=function(t){return t.datum.value>=0||-3===t.datum.value});var x="".concat(d,"Legend");return qy(!0,i,{type:"legend-cat",key:"".concat(o,"-cat"),scale:x in p?x:d,settings:{layout:{scrollOffset:function(){return l?l.get("legendScrollOffset"):void 0},size:-1!==["top","bottom"].indexOf(i.layout.dock)?2:1,direction:c?"rtl":"ltr",horizontal:20},item:{show:r,label:ly({fill:g.label.color,fontSize:g.label.fontSize,fontFamily:g.label.fontFamily},y)},navigation:{disabled:n,button:{content:function(t,e){var n=e.direction;return t("i",{style:{"pointer-events":"none",fontSize:"12px",display:"inline-block",fontStyle:"normal",lineHeight:"0",textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizelegibility",margin:"0px"}},[t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor"},[t("path",{d:v[n]})])])}}}},brush:{consume:[{context:"selection",data:["",o],style:{inactive:{opacity:.3}}}]}},{settings:u,style:h})}(t,e,n):"continuous"===e.coloring.type&&function(t,e){var n,i=t.key,r=t.styleReference,o=t.styleOverrides,a=t.rtl,s=t.settings,l=t.style,c=e.scaleKey,u=e.theme,h="".concat(c,"Range"),d=jv(t,e);if(!d.show)return!1;var f=Ev({theme:u,key:r,styleOverrides:o}),p=d.layout.dock,g="right"===p||"left"===p,m=null===(n=e.scales)||void 0===n?void 0:n[h];return g&&m&&(m.invert=!0),qy(!0,d,{type:"legend-seq",key:"".concat(i,"-seq"),settings:{fill:c,major:h,length:1,tick:{fill:f.label.color,fontSize:f.label.fontSize,fontFamily:f.label.fontFamily},title:{anchor:!a||"top"!==d.layout.dock&&"bottom"!==d.layout.dock?void 0:"right",padding:parseFloat(d.settings.title.fontSize)||16}}},{settings:s,style:l})}(t,e)}function zv(t,e,n){var i=[],r=[],o=Pv(t,e,n&&n.navigationDisabled);return i.push(o),o&&"legend-cat"===o.type&&(r.push(function(t){var e=t.key,n=t.requireFailure,i=t.recognizeWith,r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).actions;return{key:"event:tap-".concat(e),type:"Tap",requireFailure:n,recognizeWith:i,options:{event:"legendtap",interval:10,pointers:1,enable:function(t,n){var i;if(!n)return!0;if(null!=r&&null!==(i=r.interact)&&void 0!==i&&i.enabled&&!r.interact.enabled())return!1;if(!this.chart.componentsFromPoint({x:n.center.x,y:n.center.y}).some((function(t){return t.key==="".concat(e,"-cat")})))return!1;var o=n.srcEvent.target;return!!(o&&o.hasAttribute("data-action")&&o.hasAttribute("data-component-key"))||!(!o||!o.childNodes[0]||"BUTTON"!==o.childNodes[0].nodeName)}},events:{legendtap:function(t){t.preventDefault();var e=t.srcEvent.target;e&&e.hasAttribute("data-action")&&e.hasAttribute("data-component-key")&&this.chart.component(e.getAttribute("data-component-key")).emit(e.getAttribute("data-action"))}}}}(t,n)),r.push(function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.eventName,i=e.key,r=e.requireFailure,o=e.recognizeWith,a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).actions;return{key:"event:pan-".concat(i),type:"Pan",requireFailure:r,recognizeWith:o,options:{event:n,pointers:1,threshold:10,enable:function(t,e){var r;return this.started===n||!e||!(null!=a&&null!==(r=a.interact)&&void 0!==r&&r.enabled&&!a.interact.enabled())&&this.chart.componentsFromPoint({x:e.center.x,y:e.center.y}).some((function(t){return t.key==="".concat(i,"-cat")}))}},events:(t={},fy(t,"".concat(n,"start"),(function(t){t.preventDefault(),this.started!==n&&(this.started=n,this.chart.component("".concat(i,"-cat")).emit("panstart",t))})),fy(t,"".concat(n,"move"),(function(t){t.preventDefault(),this.chart.component("".concat(i,"-cat")).emit("panmove",t)})),fy(t,"".concat(n,"end"),(function(t){t.preventDefault(),this.chart.component("".concat(i,"-cat")).emit("panend",t),this.started=!1})),t)}}(t,n))),{interactions:r,components:i}}function Fv(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Lv(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function $v(){}var Bv=1/.7,Hv="\\s*([+-]?\\d+)\\s*",Vv="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Wv="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Uv=/^#([0-9a-f]{3,8})$/,Yv=new RegExp(`^rgb\\(${Hv},${Hv},${Hv}\\)$`),Xv=new RegExp(`^rgb\\(${Wv},${Wv},${Wv}\\)$`),Kv=new RegExp(`^rgba\\(${Hv},${Hv},${Hv},${Vv}\\)$`),Gv=new RegExp(`^rgba\\(${Wv},${Wv},${Wv},${Vv}\\)$`),Zv=new RegExp(`^hsl\\(${Vv},${Wv},${Wv}\\)$`),Jv=new RegExp(`^hsla\\(${Vv},${Wv},${Wv},${Vv}\\)$`),Qv={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function tx(){return this.rgb().formatHex()}function ex(){return this.rgb().formatRgb()}function nx(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Uv.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?ix(e):3===n?new ax(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?rx(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?rx(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Yv.exec(t))?new ax(e[1],e[2],e[3],1):(e=Xv.exec(t))?new ax(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Kv.exec(t))?rx(e[1],e[2],e[3],e[4]):(e=Gv.exec(t))?rx(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Zv.exec(t))?dx(e[1],e[2]/100,e[3]/100,1):(e=Jv.exec(t))?dx(e[1],e[2]/100,e[3]/100,e[4]):Qv.hasOwnProperty(t)?ix(Qv[t]):"transparent"===t?new ax(NaN,NaN,NaN,0):null}function ix(t){return new ax(t>>16&255,t>>8&255,255&t,1)}function rx(t,e,n,i){return i<=0&&(t=e=n=NaN),new ax(t,e,n,i)}function ox(t){return t instanceof $v||(t=nx(t)),t?new ax((t=t.rgb()).r,t.g,t.b,t.opacity):new ax}function ax(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function sx(){return`#${hx(this.r)}${hx(this.g)}${hx(this.b)}`}function lx(){const t=cx(this.opacity);return`${1===t?"rgb(":"rgba("}${ux(this.r)}, ${ux(this.g)}, ${ux(this.b)}${1===t?")":`, ${t})`}`}function cx(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ux(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function hx(t){return((t=ux(t))<16?"0":"")+t.toString(16)}function dx(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new px(t,e,n,i)}function fx(t){if(t instanceof px)return new px(t.h,t.s,t.l,t.opacity);if(t instanceof $v||(t=nx(t)),!t)return new px;if(t instanceof px)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=e===o?(n-i)/s+6*(n<i):n===o?(i-e)/s+2:(e-n)/s+4,s/=l<.5?o+r:2-o-r,a*=60):s=l>0&&l<1?0:a,new px(a,s,l,t.opacity)}function px(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function gx(t){return(t=(t||0)%360)<0?t+360:t}function mx(t){return Math.max(0,Math.min(1,t||0))}function yx(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Fv($v,nx,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:tx,formatHex:tx,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return fx(this).formatHsl()},formatRgb:ex,toString:ex}),Fv(ax,(function(t,e,n,i){return 1===arguments.length?ox(t):new ax(t,e,n,null==i?1:i)}),Lv($v,{brighter(t){return t=null==t?Bv:Math.pow(Bv,t),new ax(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new ax(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ax(ux(this.r),ux(this.g),ux(this.b),cx(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:sx,formatHex:sx,formatHex8:function(){return`#${hx(this.r)}${hx(this.g)}${hx(this.b)}${hx(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:lx,toString:lx})),Fv(px,(function(t,e,n,i){return 1===arguments.length?fx(t):new px(t,e,n,null==i?1:i)}),Lv($v,{brighter(t){return t=null==t?Bv:Math.pow(Bv,t),new px(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new px(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new ax(yx(t>=240?t-240:t+120,r,i),yx(t,r,i),yx(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new px(gx(this.h),mx(this.s),mx(this.l),cx(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=cx(this.opacity);return`${1===t?"hsl(":"hsla("}${gx(this.h)}, ${100*mx(this.s)}%, ${100*mx(this.l)}%${1===t?")":`, ${t})`}`}}));const vx=Math.PI/180,xx=180/Math.PI,bx=4/29,wx=6/29,kx=3*wx*wx;function _x(t){if(t instanceof Mx)return new Mx(t.l,t.a,t.b,t.opacity);if(t instanceof Ax)return Ox(t);t instanceof ax||(t=ox(t));var e,n,i=Nx(t.r),r=Nx(t.g),o=Nx(t.b),a=Sx((.2225045*i+.7168786*r+.0606169*o)/1);return i===r&&r===o?e=n=a:(e=Sx((.4360747*i+.3850649*r+.1430804*o)/.96422),n=Sx((.0139322*i+.0971045*r+.7141733*o)/.82521)),new Mx(116*a-16,500*(e-a),200*(a-n),t.opacity)}function Mx(t,e,n,i){this.l=+t,this.a=+e,this.b=+n,this.opacity=+i}function Sx(t){return t>.008856451679035631?Math.pow(t,1/3):t/kx+bx}function Cx(t){return t>wx?t*t*t:kx*(t-bx)}function qx(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Nx(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Rx(t){if(t instanceof Ax)return new Ax(t.h,t.c,t.l,t.opacity);if(t instanceof Mx||(t=_x(t)),0===t.a&&0===t.b)return new Ax(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*xx;return new Ax(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function Ax(t,e,n,i){this.h=+t,this.c=+e,this.l=+n,this.opacity=+i}function Ox(t){if(isNaN(t.h))return new Mx(t.l,0,0,t.opacity);var e=t.h*vx;return new Mx(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}Fv(Mx,(function(t,e,n,i){return 1===arguments.length?_x(t):new Mx(t,e,n,null==i?1:i)}),Lv($v,{brighter(t){return new Mx(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new Mx(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new ax(qx(3.1338561*(e=.96422*Cx(e))-1.6168667*(t=1*Cx(t))-.4906146*(n=.82521*Cx(n))),qx(-.9787684*e+1.9161415*t+.033454*n),qx(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),Fv(Ax,(function(t,e,n,i){return 1===arguments.length?Rx(t):new Ax(t,e,n,null==i?1:i)}),Lv($v,{brighter(t){return new Ax(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new Ax(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return Ox(this).rgb()}}));var Dx=function(t){return"rgba(".concat([(16711680&t)>>16,(65280&t)>>8,255&t,((4278190080&t)>>>24)/255].join(","),")")};function Ex(t){var e=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.auto,n=wv(t.resources).auto(e||function(){return{mode:"byDimension",persistent:!1,useDimColVal:!0,byDimDef:{activeDimensionIndex:0,type:"expression",label:""}}}).getDimensionColorMap((function(t,e){var n=e.layout,i=e.app;return Mv(t,{layout:n,app:i})})).getMeasure((function(t,e){var n=e.layout,i=e.app;return Sv(t,{layout:n,app:i})})).getAttributeDimension((function(t,e){var n=e.layout,i=e.model,r=e.app;return Cv(t,{layout:n,model:i,app:r})}));return n.getSnapshotData=kv,n}({resources:t}),n={},i={},r=function(t){return i.settings||(t||console.warn("settings() called before auxiliarySettings()"),i.settings=e.settings()),i.settings},o={config:function(r){if(n=ly({},r),i={},!n.key)throw new Error("Missing key");e.set(ly(ly({},t),n))},auto:function(t){return t?(e.auto(t),o):e.auto()},getAuxiliarySettings:function(t){return i.auxiliarySettings?Promise.resolve(i.auxiliarySettings):e.getAuxiliarySettings(r(!0),t).then((function(t){return i.auxiliarySettings=t||{},i.settings=ly(ly({},i.settings),i.auxiliarySettings),i.scales=void 0,i.color=void 0,i.auxiliarySettings}))},getAuxiliaryData:function(){return e.getAuxiliaryData(r())},getSnapshotData:function(t){var n=r();return e.getAuxiliaryData(n,t).then((function(t){return e.getSnapshotData(n,t)}))},resolveUIColor:function(t){return e.resolveUIColor(t)},settings:function(){var t=r();return{mode:t.mode,type:t.type,label:t.label,field:t.field,fieldType:t.fieldType,nil:t.nil,others:t.others,primary:t.primary}},settingsForMeasure:function(t){var e;return(null===(e=r().measureOverrides)||void 0===e?void 0:e[t])||this.settings()},isSelectionLocked:function(t){var e=t.isMeasureSelectionLocked;return function(t,e){var n=e.isMeasureSelectionLocked;return"field"!==t.mode||("dimension"===t.fieldType?t.isFieldLocked:"measure"!==t.fieldType||n)}(r(),{isMeasureSelectionLocked:e})},palettes:function(){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.colorProps,n=t.coloring,i=t.theme,r=[];if(n&&n.palettes&&i){var o=n.palettes.categorical||e.dimensionScheme,a=i.getDataColorPalettes().filter((function(t){return t.key===o}))[0]||i.getDataColorPalettes()[0];o&&a&&r.push({key:"categorical",colors:a.colors});var s=n.palettes.metric||e.measureScheme,l=i.getDataColorScales().filter((function(t){return t.key===s}))[0];if(l){var c=l.colors[0]?l.colors:[[]].concat(my(l.colors.slice(1)));c=Array.isArray(c[0])?c.map((function(t){return t.slice().reverse()})):c.slice().reverse(),r.push({key:"quant",colors:c})}}return r}({coloring:r(),colorProps:n.colorProps,theme:n.theme})},scales:function(){return i.scales=i.scales||function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.hc,n=t.coloring,i=t.rtl,r=t.key,o=t.source,a=t.picasso,s={},l=r;if(n){var c={override:!0,domain:n.explicit&&"function"==typeof n.explicit.domain?n.explicit.domain:[].concat(my((n.explicit||{}).domain||[]),[-3,-2]),range:n.explicit&&"function"==typeof n.explicit.range?n.explicit.range:[].concat(my((n.explicit||{}).range||[]),[n.others,n.nil])};if("field"===n.mode){if("dimension"===n.fieldType){var u,h=qv({hc:e,source:o,coloring:n}).data;if(n.legendDataset){var d=0,f={};a.data("q")({data:e}).extract({field:n.field,trackBy:n.valueAccessor,reduce:function(t){var e=t[0];return f[e]=d++,t[0]}}),u={source:"attrDim",extract:{field:"qDimensionInfo/0",filter:function(t){return t.qElemNumber>=0},props:{row:{value:function(t){return f[t.qElemNumber]}}}}}}var p={data:h,range:n.range,domain:n.domain,explicit:c,type:"categorical-color",label:function(t){return t.datum.text&&t.datum.text.value?t.datum.text.value:t.datum.label}};s[l]=p,u&&(s["".concat(l,"Legend")]=ly(ly({},p),{},{data:u})),e&&e.qHasOtherValues&&u&&((u||p.data).amend=[{label:e.qDimensionInfo[0].othersLabel,source:{key:"qHyperCube",field:"qDimensionInfo/0"},row:{value:-3},value:-3}])}else if("measure"===n.fieldType){var g={data:{field:n.field},min:n.min,max:n.max};s[l]=qy({},g,{type:"categorical"===n.type?"threshold-color":"sequential-color",range:n.range,domain:n.domain,invert:n.reverse}),"sequential-color"===s[l].type&&(s["".concat(l,"Range")]=qy({},g,{invert:!!i}))}else if("color"!==n.type)throw new Error("UNUSED FIELD")}else if("dimension"===n.mode){var m={data:e.qDimensionInfo.map((function(t,e){return e})),label:function(t){return e.qDimensionInfo[t.datum.value].qFallbackTitle},explicit:c,type:"categorical-color"};s[l]=m}else if("measure"===n.mode){var y={data:e.qMeasureInfo.map((function(t,e){return e})).filter((function(t){var e,i;return!(null!==(e=n.explicit)&&void 0!==e&&null!==(i=e.exclude)&&void 0!==i&&i.includes(t))})),label:function(t){return e.qMeasureInfo[t.datum.value].qFallbackTitle},explicit:c,type:"categorical-color"};s[l]=y}}return s}({hc:n.hc,coloring:r(),key:n.key,source:n.source,picasso:t.picasso}),i.scales},color:function(){return i.color=i.color||function(t){var e=t.coloring,n=t.scales,i=t.key,r=Nv(i),o=Nv("".concat(i,"IsAnOther")),a=function(t,e){var i=t.fieldType,a=t.invalid,s=t.mode,l=t.nil,c=t.others,u=t.primary,h=t.type;return a?function(t){return Av(t)||o(t)?c:l}:n[e]?function(t){return Av(t)?c:Rv(t)||-2===r(t)&&"dimension"===i||"NaN"===r(t)?l:o(t)?c:t.resources.scale(e)(r(t))||c}:"constant"===s?function(t){return Av(t)||o(t)?c:Rv(t)?l:u}:"color"===h?function(t){return Av(t)||o(t)?c:Rv(t)?l:r(t)||c}:null},s=a(e,i);if(e.measureOverrides){var l=Nv("".concat(i,"MeasureIdx")),c=e.measureOverrides.map((function(t){return t&&a(t)}));return function(t){var e=l(t);return c[e]?c[e](t):s(t)}}return s}({coloring:r(),scales:this.scales(),key:n.key}),i.color},datumProps:function(t){return function(t){var e,n,i=t.hc,r=t.coloring,o=t.scales,a=t.key,s=t.addMeasureIx,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,c=a,u=r.nil;"field"===r.mode&&r.field?e=r.field:o[a]&&"field"===r.mode&&(e=o[a].data.field||r.field),e?(n={field:e,reduce:"first"},"color"===r.type&&(n.value=function(t){return"NaN"!==t.qNum?Dx(t.qNum):t.qText&&nx(t.qText)?t.qText:u})):"dimension"===r.mode?n=void 0!==r.field?r.field:i.qDimensionInfo.length-1:"measure"===r.mode&&(n=l);var h=fy({},c,n);return i.qDimensionInfo.length>1&&(h["".concat(c,"IsAnOther")]={fields:i.qDimensionInfo.map((function(t,e){return{field:"qDimensionInfo/".concat(e)}})),value:function(t){return-1!==t.indexOf(-3)}}),s&&(h["".concat(c,"MeasureIdx")]=l),h}({coloring:this.settingsForMeasure(t),scales:this.scales(),key:n.key,hc:n.hc,addMeasureIx:r().measureOverrides},t)},data:function(){var t=r(),e={key:"dummy",data:[["field"],["a"]]};return t.legendDataset?[e,{type:"q",key:"attrDim",data:t.legendDataset.raw(),config:{localeInfo:n.localeInfo}}]:[e]},legend:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.eventName,i=t.key,o=t.viewState,a=t.chart,s=t.rtl,l=t.styleReference,c=void 0===l?"object.legend":l,u=t.styleOverrides,h=t.settings,d=void 0===h?{}:h,f=t.style,p=void 0===f?{}:f,g=arguments.length>1?arguments[1]:void 0;return zv({eventName:e,key:i,rtl:s,viewState:o,chart:a,styleReference:c,styleOverrides:u,settings:d,style:p},{legendProps:n.legendProps,scaleKey:n.key,coloring:r(),theme:n.theme,hc:n.hc,scales:this.scales()},g)}};return o}var Ix=function(t){return t.baseColor||t.coloring&&t.coloring.baseColor};function Tx(t){var e=t.qHyperCube,n=e.qDimensionInfo,i=e.qMeasureInfo,r=n.some(Ix),o=i.some(Ix),a=t.color.useBaseColors;return"measure"===a&&!o||"dimension"===a&&!r?"off":a}function jx(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=ly(ly(ly({},t),e),{},{colorProps:ly(ly({},t.colorProps),e.colorProps||{})});return n}var Px=function(t){return t.baseColor||t.coloring&&t.coloring.baseColor};function zx(t){var e,n=t.qHyperCube.qDimensionInfo.some(Px),i=t.qHyperCube.qMeasureInfo.some(Px),r=n?"dimension":void 0;return{mode:"primary",useBaseColors:null!==(e=null!=r?r:i?"measure":void 0)&&void 0!==e?e:"off",paletteColor:null}}var Fx=function(){};function Lx(t,e,n){if(void 0===t||void 0===e)return n;for(var i=e.split("."),r=t,o=0;o<i.length;++o){var a=i[o];if(void 0===r[a])return n;r=r[a]}return r}function $x(t,e,n){if(void 0!==t&&void 0!==e){for(var i=e.split("."),r=i[i.length-1],o=t,a=0;a<i.length-1;++a){var s=i[a];void 0===o[s]&&(o[s]=Number.isNaN(+i[a+1])?{}:[]),o=o[s]}void 0!==n?o[r]=n:delete o[r]}}function Bx(t){var e=t.originalArray,n=t.newArray,i=t.matchKey;return Array.isArray(e)&&e.length?(n.forEach((function(t){var n=-1;e.some((function(e,r){return e[i]&&e[i]===t[i]&&(n=r),n})),n>-1?e[n]=t:e.push(t)})),e):n}function Hx(t){return(Hx="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Vx(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Wx(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Ux(t,e,n){return e&&Wx(t.prototype,e),n&&Wx(t,n),t}function Yx(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xx(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function Kx(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Xx(Object(n),!0).forEach((function(e){Yx(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xx(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Gx(t,e){return(Gx=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Zx(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function Jx(t,e,n){return(Jx=Zx()?Reflect.construct:function(t,e,n){var i=[null];i.push.apply(i,e);var r=new(Function.bind.apply(t,i));return n&&Gx(r,n.prototype),r}).apply(null,arguments)}function Qx(t){return function(t){if(Array.isArray(t))return eb(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||tb(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 tb(t,e){if(t){if("string"==typeof t)return eb(t,e);var n=Object.prototype.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)?eb(t,e):void 0}}function eb(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var nb=Object.prototype.hasOwnProperty,ib=Object.prototype.toString,rb=Object.defineProperty,ob=Object.getOwnPropertyDescriptor,ab=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===ib.call(t)},sb=function(t){if(!t||"[object Object]"!==ib.call(t))return!1;var e,n=nb.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&nb.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;for(e in t);return void 0===e||nb.call(t,e)},lb=function(t,e){rb&&"__proto__"===e.name?rb(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},cb=function(t,e){if("__proto__"===e){if(!nb.call(t,e))return;if(ob)return ob(t,e).value}return t[e]},ub=function t(){var e,n,i,r,o,a,s=arguments[0],l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),(null==s||"object"!=typeof s&&"function"!=typeof s)&&(s={});l<c;++l)if(null!=(e=arguments[l]))for(n in e)i=cb(s,n),s!==(r=cb(e,n))&&(u&&r&&(sb(r)||(o=ab(r)))?(o?(o=!1,a=i&&ab(i)?i:[]):a=i&&sb(i)?i:{},lb(s,{name:n,newValue:t(u,a,r)})):void 0!==r&&lb(s,{name:n,newValue:r}));return s};function hb(t,e,n){if(!t)return-1;var i=n.cache,r=t.origin?t.origin():null;r&&(t=r);var o=i.fields.indexOf(t),a=-1,s=-1;if(-1===o)for(var l=0;l<i.wrappedFields.length;l++)if(s=i.wrappedFields[l].attrDims.map((function(t){return t.instance})).indexOf(t),a=i.wrappedFields[l].attrExps.map((function(t){return t.instance})).indexOf(t),-1!==s||-1!==a){o=l;break}return(o-=e.qArea.qLeft)<0||o>=e.qArea.qWidth?-1:s>=0?function(t){return t[o].qAttrDims.qValues[s]}:a>=0?function(t){return t[o].qAttrExps.qValues[a]}:function(t){return t[o]}}function db(t,e,n){var i=n.key,r={value:"function"==typeof t.value?t.value(e):void 0!==t.value?t.value:e};return r.label="function"==typeof t.label?t.label(e):void 0!==t.label?String(t.label):String(r.value),t.field&&(r.source={key:i,field:t.field.key()}),r}function fb(t){var e=t.cache,n=t.f,i=t.mainCell,r=t.p;t.prop;var o=t.page,a=t.rowIdx,s=t.row,l=t.sourceKey,c=t.target,u=t.targetProp,h=i;if(r.field&&r.field!==n){var d=hb(r.field,o,{cache:e});if(-1===d)return;h=ub({qRow:a},d(s))}c[u]=db(r,h,{key:l})}function pb(t,e,n,i){for(var r=Array.isArray(t)?t:[t],o=[],a=0;a<r.length;a++)if(void 0!==r[a].field){for(var s=e.raw(),l=e.key(),c="object"===Hx(r[a].field)?r[a].field:e.field(r[a].field),u=i.normalizeConfig(r[a],e),h=u.props,d=u.main,f=Object.keys(h),p=!!r[a].trackBy,g=Hx(r[a].trackBy),m={},y=[],v=[],x=0;x<s.qDataPages.length;x++){var b=hb(c,s.qDataPages[x],{cache:n});if(-1!==b)for(var w=0;w<s.qDataPages[x].qMatrix.length;w++){var k=s.qDataPages[x].qArea.qTop+w,_=ub({qRow:k},b(s.qDataPages[x].qMatrix[w])),M=db(d,_,{key:l});if(!d.filter||d.filter(_)){for(var S=0;S<f.length;S++){var C=h[f[S]],q=C.fields||[C];C.fields&&(M[f[S]]=[]);for(var N=0;N<q.length;N++)fb({cache:n,f:c,mainCell:_,p:q[N],prop:f[S],props:h,page:s.qDataPages[x],rowIdx:k,row:s.qDataPages[x].qMatrix[w],sourceKey:l,target:C.fields?M[f[S]]:M,targetProp:C.fields?N:f[S]});if(C.fields){var R=M[f[S]].map((function(t){return t.value})),A=M[f[S]].map((function(t){return t.label}));M[f[S]]={value:"function"==typeof C.value?C.value(R):void 0!==C.value?C.value:R,label:"function"==typeof C.label?C.label(A):void 0!==C.label?String(C.label):String(M[f[S]].value)}}}p&&i.track({cfg:r[a],itemData:_,obj:M,target:y,tracker:m,trackType:g}),v.push(M)}}}p?o.push.apply(o,Qx(i.collect(y,{main:d,propsArr:f,props:h}))):o.push.apply(o,v)}return o}function gb(t){var e=0,n=t.children,i=n&&n.length;if(i)for(;--i>=0;)e+=n[i].value;else e=1;t.value=e}function mb(t,e){var n,i,r,o,a,s=new bb(t),l=+t.value&&(s.value=t.value),c=[s];for(null==e&&(e=yb);n=c.pop();)if(l&&(n.value=+n.data.value),(r=e(n.data))&&(a=r.length))for(n.children=new Array(a),o=a-1;o>=0;--o)c.push(i=n.children[o]=new bb(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(xb)}function yb(t){return t.children}function vb(t){t.data=t.data.data}function xb(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function bb(t){this.data=t,this.depth=this.height=0,this.parent=null}function wb(t){if("function"!=typeof t)throw new Error;return t}bb.prototype=mb.prototype={constructor:bb,count:function(){return this.eachAfter(gb)},each:function(t){var e,n,i,r,o=this,a=[o];do{for(e=a.reverse(),a=[];o=e.pop();)if(t(o),n=o.children)for(i=0,r=n.length;i<r;++i)a.push(n[i])}while(a.length);return this},eachAfter:function(t){for(var e,n,i,r=this,o=[r],a=[];r=o.pop();)if(a.push(r),e=r.children)for(n=0,i=e.length;n<i;++n)o.push(e[n]);for(;r=a.pop();)t(r);return this},eachBefore:function(t){for(var e,n,i=this,r=[i];i=r.pop();)if(t(i),e=i.children)for(n=e.length-1;n>=0;--n)r.push(e[n]);return this},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,i=e.children,r=i&&i.length;--r>=0;)n+=i[r].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),i=e.ancestors(),r=null;for(t=n.pop(),e=i.pop();t===e;)r=t,t=n.pop(),e=i.pop();return r}(e,t),i=[e];e!==n;)e=e.parent,i.push(e);for(var r=i.length;t!==n;)i.splice(r,0,t),t=t.parent;return i},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each((function(e){t.push(e)})),t},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return mb(this).eachBefore(vb)}};var kb={depth:-1},_b={};function Mb(t){return t.id}function Sb(t){return t.parentId}function Cb(t,e){"/"===t.charAt(0)&&(t=t.substring(1));for(var n,i=t.split("/"),r=e,o=0;o<i.length;o++){if("*"===i[o]&&Array.isArray(r)){var a=[];n=i.slice(o+1).join("/");for(var s=0;s<r.length;s++){var l=Cb(n,r[s]);Array.isArray(l)?a.push.apply(a,Qx(l)):a.push(l)}return a}if(!i[o]&&Array.isArray(r)){var c=new Array(r.length);n=i.slice(o+1).join("/");for(var u=0;u<r.length;u++)c[u]=Cb(n,r[u]);return c}i[o]in r&&(r=r[i[o]])}return r}function qb(t,e,n){var i=[];if(!t||!t.length)return i;if(e<=0){var r=n>=0?[t[n]]:t;i.push.apply(i,Qx(r))}else for(var o=0;o<t.length;o++)t[o].children&&t[o].children.length&&i.push.apply(i,Qx(qb(t[o].children,e-1,n)));return i}function Nb(t,e,n){if(t===e)return function(t){return t};if(t>e){var i=Math.max(0,Math.min(100,t-e)),r=Qx(Array(i)).map(String.prototype.valueOf,"parent").join(".");return Function("node","return node.".concat(r,";"))}if(e>t){var o=Math.max(0,Math.min(100,e-t));return function(t){return qb(t.children,o-1,n)}}return!1}function Rb(t,e){var n=e.cache;if("number"==typeof t)return n.fields[t];var i=n.allFields;if("function"==typeof t){for(var r=0;r<i.length;r++)if(t(i[r]))return i[r];return!1}if("string"==typeof t){for(var o=0;o<i.length;o++)if(i[o].key()===t||i[o].title()===t)return i[o]}else if(t&&-1!==i.indexOf(t))return t;throw Error("Field not found: ".concat(t))}var Ab=/^qDimensionInfo(?:\/(\d+))?/,Ob=/^\/?qMeasureInfo\/(\d+)/,Db=/\/qAttrExprInfo\/(\d+)/,Eb=/\/qAttrDimInfo\/(\d+)/;function Ib(t){return(t.qColumnOrder&&t.qColumnOrder.length?t.qColumnOrder:t.qDimensionInfo.map((function(t,e){return e}))).filter((function(e){return e<t.qDimensionInfo.length}))}function Tb(t,e){var n=e.cube;if(!t)return-1;var i=t.origin&&t.origin()?t.origin().key():t.key(),r=!1,o=-1,a=-1,s=-1,l=-1,c=-1,u=i,h=n.qEffectiveInterColumnSortOrder,d=Ib(n);return Ab.test(u)&&(r=!0,o=+Ab.exec(u)[1],u=i.replace(Ab,"")),Ob.test(u)&&("K"===n.qMode?l=+Ob.exec(u)[1]:h&&-1!==h.indexOf(-1)?(l=+Ob.exec(u)[1],c=0):c=+Ob.exec(u)[1],u=u.replace(Ob,"")),u&&(Eb.exec(u)?s=+Eb.exec(u)[1]:Db.exec(u)&&(a=+Db.exec(u)[1])),{fieldDepth:(r?"S"===n.qMode?d[o]:h?h.indexOf(o):o:h&&-1!==h.indexOf(-1)?h.indexOf(-1):n.qDimensionInfo.length-("K"===n.qMode?0:1))+1,pseudoMeasureIndex:l,measureIdx:c,attrDimIdx:s,attrIdx:a}}function jb(t,e){var n,i,r=Nb(t.fieldDepth,e.fieldDepth,e.pseudoMeasureIndex);return n=e.measureIdx>=0?function(t){return t.data.qValues[e.measureIdx]}:function(t){return t.data},e.attrDimIdx>=0?i=function(t){var n;return null==t||null===(n=t.qAttrDims)||void 0===n?void 0:n.qValues[e.attrDimIdx]}:e.attrIdx>=0&&(i=function(t){var n;return null==t||null===(n=t.qAttrExps)||void 0===n?void 0:n.qValues[e.attrIdx]}),{nodeFn:r,attrFn:i,valueFn:n}}function Pb(t,e,n){var i=n.key,r={value:"function"==typeof t.value?t.value(e):void 0!==t.value?t.value:e};return r.label="function"==typeof t.label?t.label(e):void 0!==t.label?String(t.label):String(r.value),t.field&&(r.source={key:i,field:t.field.key()}),r}function zb(t){for(var e=t.propsArr,n=t.props,i=t.item,r=t.itemData,o=t.ret,a=t.sourceKey,s=0;s<e.length;s++){var l=n[e[s]],c=l.fields||[l],u=void 0,h=void 0;l.fields&&(u=[],h=[]);for(var d=function(t){var n=c[t],d=void 0,f=void 0,p=void 0,g=void 0,m=void 0,y=void 0;if("primitive"===n.type?(p=n.value,y=String(n.value)):("function"==typeof n.value&&(d=function(t){return n.value(t,i)}),"function"==typeof n.label&&(f=function(t){return n.label(t,i)}),n.accessor?(g=n.accessor(i),Array.isArray(g)?(m=g.map(n.valueAccessor),n.attrAccessor&&(m=m.map(n.attrAccessor)),d&&(p=m.map(d),d=null),f&&(y=m.map(f),f=null),p=n.reduce?n.reduce(p):p,y=n.reduceLabel?n.reduceLabel(y,p):String(p)):y=p=n.attrAccessor?n.attrAccessor(n.valueAccessor(g)):n.valueAccessor(g)):(p=r,y=r)),l.fields){var v=d?d(p):p;u.push(v),h.push(f&&null!=y?f(y):null!=y?y:String(v))}else{var x=d?d(p):p;o[e[s]]={value:x,label:f?f(y):null!=y?y:String(x)},n.field&&(o[e[s]].source={field:n.field.key(),key:a})}},f=0;f<c.length;f++)d(f);u&&(o[e[s]]={value:"function"==typeof l.value?l.value(u,i):u,label:"function"==typeof l.label?l.label(h,i):h})}}var Fb=function(t,e,n){var i="K"===t.qMode?"/qStackedDataPages/*/qData":"/qTreeDataPages/*",r="K"===t.qMode?"qSubNodes":"qNodes",o=Cb(i,t);return o&&o[0]?(e.tree=mb(o[0],n.children||function(t){return t[r]}),e.tree):null};function Lb(t){for(var e=t.raw().qDataPages.length?t.raw().qDataPages[0].qMatrix:[],n=function(t){var e=t.raw().qColumnOrder,n=t.fields();return e&&e.length===n.length?e:n.map((function(t,e){return e}))}(t),i=t.fields(),r=t.fields().filter((function(t){return"dimension"===t.type()})).map((function(t){return n.indexOf(i.indexOf(t))})),o=t.fields().filter((function(t){return"measure"===t.type()})).map((function(t){return n.indexOf(i.indexOf(t))})),a={__root:{__id:"__root",qValues:[]}},s=0;s<e.length;s++){for(var l=e[s],c="__root",u=!1,h=0;h<r.length;h++){var d=l[r[h]],f="".concat(c,"__").concat(d.qText);a[f]||(a[f]=Kx({__id:f,__parent:c,qValues:[]},d),u=!0),c=f}if(u)for(var p=0;p<o.length;p++){var g=l[o[p]];a[c].qValues.push(g)}}var m=Object.keys(a).map((function(t){return a[t]}));return function(){var t=Mb,e=Sb;function n(n){var i,r,o,a,s,l,c,u=n.length,h=new Array(u),d={};for(r=0;r<u;++r)i=n[r],s=h[r]=new bb(i),null!=(l=t(i,r,n))&&(l+="")&&(d[c="$"+(s.id=l)]=c in d?_b:s);for(r=0;r<u;++r)if(s=h[r],null!=(l=e(n[r],r,n))&&(l+="")){if(!(a=d["$"+l]))throw new Error("missing: "+l);if(a===_b)throw new Error("ambiguous: "+l);a.children?a.children.push(s):a.children=[s],s.parent=a}else{if(o)throw new Error("multiple roots");o=s}if(!o)throw new Error("no root");if(o.parent=kb,o.eachBefore((function(t){t.depth=t.parent.depth+1,--u})).eachBefore(xb),o.parent=null,u>0)throw new Error("cycle");return o}return n.id=function(e){return arguments.length?(t=wb(e),n):t},n.parentId=function(t){return arguments.length?(e=wb(t),n):e},n}().id((function(t){return t.__id})).parentId((function(t){return t.__parent}))(m)}var $b=function(t){for(var e=t.propsArr,n=t.props,i=t.cube,r=t.cache,o=t.itemDepthObject,a=t.f,s=0;s<e.length;s++)for(var l=n[e[s]],c=l.fields?l.fields:[l],u=0;u<c.length;u++){var h=c[u];if(h.field!==a){var d=jb(o,Tb(h.field,{cube:i,cache:r}));h.accessor=d.nodeFn,h.valueAccessor=d.valueFn,h.attrAccessor=d.attrFn}}};function Bb(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,r=e.raw(),o=e.key(),a="S"===r.qMode?Lb(e):Fb(r,n,t);if(!a)return null;for(var s=a.height,l=[],c=0;c<=s;c++){var u=null;if(c>0)if("S"===r.qMode){var h=Ib(r),d=h[c-1];u=n.fields[d]}else{var f=r.qEffectiveInterColumnSortOrder[c-1];c>r.qEffectiveInterColumnSortOrder.length&&(f=r.qDimensionInfo.length),u=n.fields[f]}var p=i.normalizeConfig(Kx(Kx({},t),{},{field:u?u.key():void 0}),e),g=p.props,m=p.main,y=Object.keys(g);l[c]={propsArr:y,props:g,main:m};var v=u?Tb(u,{cube:r,cache:n}):{fieldDepth:0};$b({propsArr:y,props:g,cube:r,cache:n,itemDepthObject:v,f:u})}for(var x=a.copy(),b=x.descendants(),w=a.descendants(),k=0;k<w.length;k++){var _=l[w[k].depth].propsArr,M=l[w[k].depth].props,S=l[w[k].depth].main,C=b[k],q=C.data,N=Pb(S,q,{key:o});zb({propsArr:_,props:M,item:C,itemData:q,ret:N,sourceKey:o,isTree:!0}),w[k].data=N}return a}function Hb(t,e,n,i){for(var r=Array.isArray(t)?t:[t],o=[],a=0;a<r.length;a++)if(void 0!==r[a].field){var s=e.raw(),l=e.key();if(!Fb(s,n,t))continue;var c="object"===Hx(r[a].field)?r[a].field:e.field(r[a].field),u=i.normalizeConfig(r[a],e),h=u.props,d=u.main,f=Object.keys(h),p=Tb(c,{cube:s,cache:n}),g=jb({fieldDepth:0},p),m=g.nodeFn,y=g.attrFn,v=g.valueFn;$b({propsArr:f,props:h,cube:s,cache:n,itemDepthObject:p,f:c});for(var x=!!r[a].trackBy,b=Hx(r[a].trackBy),w={},k=[],_=m(n.tree),M=[],S=0;S<_.length;S++){var C=_[S],q=y?y(v(C)):v(C);if(!d.filter||d.filter(q)){var N=Pb(d,q,{key:l});zb({propsArr:f,props:h,item:C,itemData:q,ret:N,sourceKey:l}),x&&i.track({cfg:r[a],itemData:q,obj:N,target:k,tracker:w,trackType:b}),M.push(N)}}x?o.push.apply(o,Qx(i.collect(k,{main:d,propsArr:f,props:h}))):o.push.apply(o,M)}return o}var Vb,Wb=(function(t){
10
10
  /*! javascript-number-formatter - v1.1.11 - http://mottie.github.com/javascript-number-formatter/ * © ecava */
11
- t.exports=function(t,e){if(!t||isNaN(+e))return e;var n,i,r,o,a,s,l,c,u,h,d=t.length,f=t.search(/[0-9\-\+#]/),p=f>0?t.substring(0,f):"",g=t.split("").reverse().join(""),m=g.search(/[0-9\-\+#]/),y=d-m,v=t.substring(y,y+1),x=y+("."===v||","===v?1:0),b=m>0?t.substring(x,d):"";if(n=(e="-"===(t=t.substring(f,x)).charAt(0)?-e:+e)<0?e=-e:0,r=(i=t.match(/[^\d\-\+#]/g))&&i[i.length-1]||".",o=i&&i[1]&&i[0]||",",t=t.split(r),e=+(e=e.toFixed(t[1]&&t[1].length))+"",s=t[1]&&t[1].lastIndexOf("0"),(!(c=e.split("."))[1]||c[1]&&c[1].length<=s)&&(e=(+e).toFixed(s+1)),u=t[0].split(o),t[0]=u.join(""),(a=t[0]&&t[0].indexOf("0"))>-1)for(;c[0].length<t[0].length-a;)c[0]="0"+c[0];else 0==+c[0]&&(c[0]="");if((e=e.split("."))[0]=c[0],l=u[1]&&u[u.length-1].length){for(g="",y=(h=e[0]).length%l,d=h.length,x=0;x<d;x++)g+=h.charAt(x),!((x-y+1)%l)&&x<d-l&&(g+=o);e[0]=g}return e[1]=t[1]&&e[1]?r+e[1]:"","0"!==(i=e.join(""))&&""!==i||(n=!1),p+(n?"-":"")+i+b}}(Ab={exports:{}}),Ab.exports);function Eb(t){return t.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}var Ob={3:"k",6:"M",9:"G",12:"T",15:"P",18:"E",21:"Z",24:"Y","-3":"m","-6":"μ","-9":"n","-12":"p","-15":"f","-18":"a","-21":"z","-24":"y"},Ib=/%$/,Tb=/^\(r(0[2-9]|[12]\d|3[0-6])\)/i,jb=/^\(oct\)/i,Pb=/^\(dec\)/i,zb=/^\(hex\)/i,Fb=/^\(bin\)/i,Lb=/^\(rom\)/i,Bb=/^(\(rom\)|\(bin\)|\(hex\)|\(dec\)|\(oct\)|\(r(0[2-9]|[12]\d|3[0-6])\))/i,Hb=/#|0/g;function $b(t,e,n,i){return t=t.toString(e),n[1]===n[1].toUpperCase()&&(t=t.toUpperCase()),t.length-t.indexOf(".")>10&&(t=t.slice(0,t.indexOf(".")+11)),t.replace(".",i||".")}function Vb(t,e,n){var i=Eb(t);return n?i:new RegExp(i||"",e)}function Wb(t,e,n){var i,r,o,a,s,l,c,u,h,d,f,p=t.pattern;p.indexOf("A")>=0&&(p=p.replace("A",""),t.abbreviate=!0),d=e,(f=n)&&(f=Eb(f)),d&&(d=Eb(d)),h=new RegExp("(?:[#0]+".concat(d,")?[#0]+(?:").concat(f,"[#0]+)?")),a=(o=(o=p.match(h))?o[0]:"")?p.substr(0,p.indexOf(o)):p,s=o?p.substring(p.indexOf(o)+o.length):"",o||(o=p?"#":"##########"),e&&e===n&&(r=(i=o.split(n)).pop(),o=i.join("")+n+r,e=""),l=e,e=/,/.test(n)?"¤":",",l&&(o=o.replace(Vb(l,"g"),e)),c=n,n=".",c&&(o=o.replace(Vb(c,"g"),n)),u=(u=o.match(/#/g))?u.length:0;var g,m=p.split(c);m[1]&&(g=m[1].match(Hb)),t.prefix=a||"",t.postfix=s||"",t.pattern=p,t.maxPrecision=g?g.length:2,t.percentage=Ib.test(p),t.numericPattern=o||"",t.numericRegex=new RegExp("".concat(Vb(e,null,!0),"|").concat(Vb(n,null,!0)),"g"),t.groupTemp=l,t.decTemp=c,t.t=e,t.d=n,t.temp=u}var Ub=function(){function t(e,n,i,r,o){Ax(this,t),this.localeInfo=e,this.pattern=n,this.thousandDelimiter=i||",",this.decimalDelimiter=r||".",this.type=o||"numeric",this.patternSeparator=";",this.abbreviations=function(t,e){if(!t||!t.qNumericalAbbreviation)return Ob;var n={};return t.qNumericalAbbreviation.split(e).forEach((function(t){var e=t.split(":");2===e.length&&(n[e[0]]=e[1])})),n}(e,this.patternSeparator),this.prepare()}return Ex(t,[{key:"clone",value:function(){var e=new t(this.localeInfo,this.pattern,this.thousandDelimiter,this.decimalDelimiter,this.type);return e.subtype=this.subtype,e}},{key:"format",value:function(t,e,n,i){return this.prepare(e,n,i),this.formatValue(t)}},{key:"prepare",value:function(t,e,n){var i;void 0===t&&(t=this.pattern),void 0===e&&(e=this.thousandDelimiter),void 0===n&&(n=this.decimalDelimiter),t?(this._prepared={positive:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""},negative:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""},zero:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""}},i=this._prepared,t=t.split(this.patternSeparator),i.positive.pattern=t[0],i.negative.pattern=t[1],i.zero.pattern=t[2],Bb.test(t[0])&&(i.positive.isFunctional=!0),t[1]?Bb.test(t[1])&&(i.negative.isFunctional=!0):i.negative=!1,t[2]?Bb.test(t[2])&&(i.zero.isFunctional=!0):i.zero=!1,i.positive.isFunctional||Wb(i.positive,e,n),i.negative&&!i.negative.isFunctional&&Wb(i.negative,e,n),i.zero&&!i.zero.isFunctional&&Wb(i.zero,e,n)):this._prepared={pattern:!1}}},{key:"formatValue",value:function(t){var e,n,i,r,o,a,s,l,c,u=this._prepared,h="",d="",f=t;if(isNaN(t))return"".concat(f);if(t=+t,!1===u.pattern)return t.toString();if(0===t&&u.zero)return(u=u.zero).pattern;if(t<0&&u.negative?(u=u.negative,t=-t):u=u.positive,o=u.d,a=u.t,u.isFunctional)t=function(t,e,n){var i;return Tb.test(e)?t=$b(t,Number(/\d{2}/.exec(e)[0]),e,n):jb.test(e)?t=$b(t,8,e,n):Pb.test(e)?t=$b(t,10,e,n):zb.test(e)?t=$b(t,16,e,n):Fb.test(e)?t=$b(t,2,e,n):Lb.test(e)&&(i="",t<0&&(i="-",t=-t),0===(t=Math.floor(t))?t="0":t<=5e5?(t=function(t,e){for(var n,i="",r=Number(String(t).slice(-3)),o=(t-r)/1e3,a=[0,1,4,5,9,10,40,50,90,100,400,500,900].reverse(),s=["0","I","IV","V","IX","X","XL","L","XC","C","CD","D","CM"].reverse();r>0;)for(n=0;n<a.length;n++)if(a[n]<=r){i+=s[n],r-=a[n];break}for(n=0;n<o;n++)i="M".concat(i);return e[1]!==e[1].toUpperCase()&&(i=i.toLowerCase()),i}(t,e),t=i+t):t=e+i+t.toExponential(0)),t}(t,u.pattern,o);else{if(u.percentage&&(t*=100),u.abbreviate){var p,g,m=Object.keys(this.abbreviations).map((function(t){return parseInt(t,10)})).sort((function(t,e){return t-e})),y=m[0];for(s=0,n=Number(Number(t).toExponential().split("e")[1]);y<=n&&s<m.length;)y=m[++s];s>0&&(p=m[s-1]),p&&n>0&&p>0?g=p:(n<0&&p<0||!p)&&(y<0&&y-n<=u.maxPrecision?g=y:p<=n&&!(y>0&&-n<=u.maxPrecision)&&(g=p)),g&&(h=this.abbreviations[g],t/=Math.pow(10,g))}if(i=Math.abs(t),e=u.temp,c=(l=u.numericPattern).split(o)[1],"I"===this.type&&(t=Math.round(t)),r=t,c||"#"!==l.slice(-1)[0])if(i>=1e15||i>0&&i<=1e-14)t=i?i.toExponential(15).replace(/\.?0+(?=e)/,""):"0";else{var v=Number(t.toFixed(Math.min(20,c?c.length:0)).split(".")[0]),x=l.split(o)[0];if(t=Db(x+=o,v)||"0",c){var b=Math.max(0,Math.min(14,c.length)),w=c.replace(/#+$/,"").length,k=("I"===this.type?0:i%1).toFixed(b).slice(2).replace(/0+$/,"");for(s=k.length;s<w;s++)k+="0";k&&(t+=o+k)}else 0===v&&(r=0)}else if(i>=Math.pow(10,e)||i<1||i<1e-4)0===t?t="0":i<1e-4||i>=1e20?(t=(t=r.toExponential(Math.max(1,Math.min(14,e))-1)).replace(/\.?0+(?=e)/,""),d=""):(t=t.toPrecision(Math.max(1,Math.min(14,e)))).indexOf(".")>=0&&(t=(t=t.replace(t.indexOf("e")<0?/0+$/:/\.?0+(?=e)/,"")).replace(".",o));else{for(l+=o,e=Math.max(0,Math.min(20,e-Math.ceil(Math.log(i)/Math.log(10)))),s=0;s<e;s++)l+="#";t=Db(l,t)}t=t.replace(u.numericRegex,(function(t){return t===a?u.groupTemp:t===o?u.decTemp:""})),r<0&&!/^-/.test(t)&&(t="-".concat(t))}return u.prefix+t+d+h+u.postfix}}],[{key:"getStaticFormatter",value:function(){return{prepare:function(){},formatValue:function(t){return"".concat(t)}}}}]),t}();function Yb(t){var e,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.size,o=void 0===r?5e3:r,a=i.multipleArguments,s=void 0!==a&&a,l=i.toKey,c=void 0===l?function(t){return t}:l,u=Object.create(null),h=Object.create(null),d=0,f=0;return(e=s?function(){return n=c.apply(void 0,arguments),e.has(n)?e.get(n):e.set(n,t.apply(void 0,arguments))}:function(i){return n=c(i),e.has(n)?e.get(n):e.set(n,t(i))}).set=function(t,e){return d>=o&&(delete u[h[f]],delete h[f],d--,f++),u[t]=e,h[d]=t,d++,e},e.get=function(t){return u[t]},e.has=function(t){return t in u},e.clear=function(){u=Object.create(null),h=Object.create(null),d=0,f=0},e.size=function(){return d},e}function Xb(t,e,n,i,r){var o=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return zx(Ub,e)}(r,t,e,n,i),a=Yb(o.formatValue.bind(o),{toKey:function(t){return isNaN(t)?t:+t}});function s(t){return a(t)}return s.format=function(t,e,n,i){return a.clear(),o.format(e,t,n,i)},s.pattern=function(t){return t&&(a.clear(),o.pattern=t,o.prepare()),o.pattern},s}var Kb=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Gb=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Zb=["January","February","March","April","May","June","July","August","September","October","November","December"],Jb=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Qb(t,e){for(var n=t.length;n<e;n++)t="0".concat(t);return t}function tw(t){var e=t.toString().split(".");return e[1]?e=Number("0.".concat(e[1])):0}var ew=function(){function t(e,n,i){Ax(this,t);var r,o=e||{};o.qCalendarStrings||(o.qCalendarStrings={qLongDayNames:Kb,qDayNames:Gb,qLongMonthNames:Zb,qMonthNames:Jb}),this.localeInfo=o,this.locale_days=o.qCalendarStrings.qLongDayNames.slice(),this.locale_days_abbr=o.qCalendarStrings.qDayNames.slice(),this.locale_months=o.qCalendarStrings.qLongMonthNames.slice(),this.locale_months_abbr=o.qCalendarStrings.qMonthNames.slice(),n||(n=(Ox(r={},"T",o.qTimeFmt||"hh:mm:ss"),Ox(r,"D",o.qDateFmt||"YYYY-MM-DD"),Ox(r,"TS",o.qTimestampFmt||"YYYY-MM-DD hh:mm:ss"),r)[i]),this.pattern=n}return Ex(t,[{key:"clone",value:function(){var e=new t(this.localeInfo,this.pattern);return e.subtype=this.subtype,e}},{key:"format",value:function(t,e){e||(e=this.pattern?this.pattern:"YYYY-MM-DD hh:mm:ss"),e=e.replace(/\[.+]|\[|]/g,"");var n,i,r,o,a,s=/t+/gi.test(e);t instanceof Date?(r=s,o=(i=t).getUTCHours(),r&&((o%=12)||(o=12)),(a=i.getUTCDay()-1)<0&&(a=6),n={year:i.getUTCFullYear(),month:i.getUTCMonth(),day:a,date:i.getUTCDate(),h:o,m:i.getUTCMinutes(),s:i.getUTCSeconds(),f:i.getUTCMilliseconds(),t:i.getUTCHours()>=12?"pm":"am"}):(t<0&&(t=-t,e="-".concat(e)),n=function(t,e){var n,i=function(t){var e=t,n=24*tw(e),i=60*tw(n),r=60*tw(i),o=1e3*tw(r);return{d:Math.floor(e),h:Math.floor(n),m:Math.floor(i),s:Math.floor(r),f:Math.round(o)}}(t),r=i.d,o=i.h,a=i.m,s=i.s,l=i.f,c=0;/w+|t+/gi.test(e)&&(n=new Date(Date.UTC(1899,11,30+Math.floor(t),0,0,Math.round(86400*(t-Math.floor(t))))),isNaN(n.getTime())&&(n=null)),/D+/gi.test(e)||(o+=24*r),/h+/gi.test(e)||(a+=60*o),/m+/gi.test(e)||(s+=60*a),/w+/gi.test(e)&&(c=n?n.getDay()-1:0)<0&&(c=6);var u="";return n&&(u=n.getUTCHours()>=12?"pm":"am"),{year:0,month:0,day:c,date:r,h:o,m:a,s:s,f:l,t:u}}(t,e));var l=function(t,e){return{"Y+|y+":{Y:"".concat(Number("".concat(e.year).slice(-2))),YY:Qb("".concat(e.year).slice(-2),2),YYY:Qb("".concat(e.year).slice(-3),3),def:function(t){return Qb("".concat(e.year),t.length)}},"M+":{M:e.month+1,MM:Qb("".concat(e.month+1),2),MMM:t.locale_months_abbr[e.month],def:t.locale_months[e.month]},"W+|w+":{W:e.day,WW:Qb("".concat(e.day),2),WWW:t.locale_days_abbr[e.day],def:t.locale_days[e.day]},"D+|d+":{D:e.date,def:function(t){return Qb("".concat(e.date),t.length)}},"h+|H+":{h:e.h,def:function(t){return Qb("".concat(e.h),t.length)}},"m+":{m:e.m,def:function(t){return Qb("".concat(e.m),t.length)}},"s+|S+":{s:e.s,def:function(t){return Qb("".concat(e.s),t.length)}},"f+|F+":{def:function(t){var n="".concat(e.f),i=t.length-n.length;if(i>0)for(var r=0;r<i;r++)n+="0";else i<0&&(n=n.slice(0,t.length));return n}},"t{1,2}|T{1,2}":{def:function(t){var n=e.t;return t[0].toUpperCase()===t[0]&&(n=n.toUpperCase()),n.slice(0,t.length)}}}}(this,n),c=[];for(var u in l)Object.prototype.hasOwnProperty.call(l,u)&&c.push(u);var h=new RegExp(c.join("|"),"g");return e.replace(h,(function(t){var e,n,i;for(n in l)if(Object.prototype.hasOwnProperty.call(l,n)&&(e=new RegExp(n)).test(t))break;if(!e)return"";for(var r in l[n])if(r===t||r.toLowerCase()===t){void 0===(i=l[n][r])&&(i=l[n][r.toLowerCase()]);break}return void 0===i&&(i=l[n].def),"function"==typeof i&&(i=i(t)),i}))}}]),t}();function nw(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return zx(ew,e)}function iw(t){return new Date(Date.UTC(1899,11,30+Math.floor(t),0,0,0,Math.round(864e5*(t-Math.floor(t)))))}function rw(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TS",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=nw(n,t,e),r=Yb(i.format.bind(i),{toKey:function(t){return"object"===qx(t)&&"function"==typeof t.getTime?t.getTime():t}});function o(t){return"IV"!==e?iw(t):t}function a(t){return t=o(t),r(t)}return a.format=function(t,e){return r.clear(),e=o(e),i.format(e,t)},a.locale=function(n){return i=nw(n,t,e),r=Yb(i.format.bind(i),{toKey:function(t){return"object"===qx(t)?t.getTime():t}}),this},a.qtype=function(t){return void 0!==t&&(e=t,r.clear()),e},a}function ow(t,e){if(t&&t.qNumFormat&&-1!==["D","T","TS","IV"].indexOf(t.qNumFormat.qType))return rw(t.qNumFormat.qFmt,t.qNumFormat.qType,e);var n="#",i=e&&void 0!==e.qThousandSep?e.qThousandSep:",",r=e&&void 0!==e.qDecimalSep?e.qDecimalSep:".",o="U",a=t&&!!t.qIsAutoFormat;return t&&t.qNumFormat?(n=t.qNumFormat.qFmt||n,i=t.qNumFormat.qThou||i,r=t.qNumFormat.qDec||r,o=t.qNumFormat.qType||o,a=a&&-1===["M"].indexOf(t.qNumFormat.qType)):a=!0,(a||"U"===o)&&(n="#".concat(r,"##A"),o="U"),Xb(n,i,r,o,e)}function aw(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.meta,i=e.id,r=e.key,o=e.localeInfo,a=e.fieldExtractor,s=e.value,l=e.type,c=e.sourceField,u=s||("dimension"===l?function(t){return t.qElemNo}:function(t){return t.qValue}),h=function(t){return t.qText||""},d="dimension"===l?"first":"avg",f=ow(n,o),p="dimension"===l?"first":function(t,e){return f(e)},g={id:function(){return i},key:function(){return r},raw:function(){return n},title:function(){return n.qFallbackTitle||n.label},type:function(){return l},origin:function(){return c},items:function(){return t||(t=a(g)),t},min:function(){return n.qMin},max:function(){return n.qMax},value:u,label:h,reduce:d,reduceLabel:p,formatter:function(){return f},tags:function(){return n.qTags}};return g}function sw(t,e,n,i,r){return(e[t]||[]).map((function(e,o){var a="".concat(i?"".concat(i,"/"):"").concat(t,"/").concat(o),s={instance:aw(Gx({id:"".concat(n?"".concat(n,"/"):"").concat(a),key:a,meta:e},r))};return s.attrDims=sw("qAttrDimInfo",e,n,a,Gx({},r,{value:function(t){return t.qElemNo},type:"dimension"})),s.attrExps=sw("qAttrExprInfo",e,n,a,Gx({},r,{value:function(t){return t.qNum},type:"measure"})),s.measures=sw("qMeasureInfo",e,n,a,Gx({},r,{value:function(t){return t.qValue},type:"measure"})),s}))}function lw(){var t,e,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.key,o=i.data,a=i.config,s=void 0===a?{}:a,l={fields:[],wrappedFields:[],allFields:[],virtualFields:[]},c=o;if(!c)throw new Error('Missing "data" input');if(!c.qDimensionInfo)throw new Error('The "data" input is not recognized as a hypercube');var u=lw.util,h={cache:l,cube:c,localeInfo:s.localeInfo,fieldExtractor:null,pages:null,hierarchy:function(){return null},virtualFields:s.virtualFields},d={key:function(){return r},raw:function(){return c},field:function(t){return gb(t,h)},fields:function(){return l.fields.slice()},extract:function(t){return h.extractor(t,d,l,u)},hierarchy:function(t){return h.hierarchy(t,d,l,u)},_cache:function(){return l}};"K"===c.qMode||"T"===c.qMode||!c.qMode&&c.qNodesOnDim?(h.extractor=qb,h.hierarchy=Rb,h.pages="K"===c.qMode?c.qStackedDataPages:c.qTreeDataPages):"S"===c.qMode?(h.extractor=tb,h.pages=c.qDataPages,h.hierarchy=Rb):h.extractor=function(){return[]},h.fieldExtractor=function(t){return h.extractor({field:t},d,l,u)};var f="S"===c.qMode?function(t){return t.qElemNumber}:void 0,p="S"===c.qMode?function(t){return t.qNum}:void 0;(t=l.wrappedFields).push.apply(t,Fx(sw("qDimensionInfo",c,r,"",Gx({},h,{value:f,type:"dimension"})))),(e=l.wrappedFields).push.apply(e,Fx(sw("qMeasureInfo",c,r,"",Gx({},h,{value:p,type:"measure"})))),l.fields=l.wrappedFields.map((function(t){return t.instance}));var g=function t(e){e.forEach((function(e){l.allFields.push(e.instance),t(e.measures),t(e.attrDims),t(e.attrExps)}))};return g(l.wrappedFields),(s.virtualFields||[]).forEach((function(t){var e=d.field(t.from),n=aw(Tx({meta:e.raw(),id:"".concat(r,"/").concat(t.key),sourceField:e,fieldExtractor:function(t){return h.extractor({field:t},d,l,u)},key:t.key,type:e.type(),localeInfo:h.localeInfo,value:e.value},t.override||{}));l.virtualFields.push(n)})),(n=l.allFields).push.apply(n,Fx(l.virtualFields)),d}var cw=[["qHyperCube","qHyperCubeDef"],["qTreeData","qTreeDataDef"],["qDimensionInfo","qDimensions"],["qMeasureInfo","qMeasures"],["qAttrDimInfo","qAttributeDimensions"],["qAttrExprInfo","qAttributeExpressions"]],uw=/\/qDimensionInfo(?:\/(\d+))?/,hw=/\/qMeasureInfo\/(\d+)/,dw=/\/qAttrDimInfo\/(\d+)(?:\/(\d+))?/,fw=/\/qAttrExprInfo\/(\d+)/,pw=/\/?qHyperCube/,gw=/\/?qTreeData/,mw=function(t){return"".concat(t.substr(0,t.indexOf("/qHyperCubeDef")+14))},yw=function(t){return"".concat(t.substr(0,t.indexOf("/qTreeDataDef")+13))};function vw(t,e){var n=t,i=-1,r=-1,o="",a=function(t){return t};pw.test(t)?(o="".concat(n.substr(0,n.indexOf("qHyperCube")+10)),a=mw):gw.test(t)&&(o="".concat(n.substr(0,n.indexOf("qTreeData")+9)),a=yw);var s=!0;if(uw.test(t)&&(i=+uw.exec(t)[1]),hw.test(t)&&(r=+hw.exec(t)[1]),dw.test(t)){r=-1,i=0;var l=+dw.exec(n)[2];isNaN(l)||(i=l,n=n.replace(/\/\d+$/,"")),s=!1}if(fw.test(t)){var c=r;if(e){r=0;var u=db(o,e);r+=(u.qMeasureInfo||[]).length,i>-1?(r=u.qDimensionInfo.slice(0,i).reduce((function(t,e){return t+e.qAttrExprInfo.length}),r),i=-1):(r=u.qDimensionInfo.reduce((function(t,e){return t+e.qAttrExprInfo.length}),r),r=u.qMeasureInfo.slice(0,c).reduce((function(t,e){return t+e.qAttrExprInfo.length}),r)),r+=+fw.exec(n)[1]}else i>-1?(i=-1,r=+fw.exec(n)[1]):r+=+fw.exec(n)[1]+1}return cw.forEach((function(t){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){r=!0,o=t}finally{try{i||null==s.return||s.return()}finally{if(r)throw o}}return n}}(t,e)||Lx(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.")}()}(t,2),i=e[0],r=e[1];n=n.replace(i,r)})),s&&(n=a(n)),n&&"/"!==n[0]&&(n="/".concat(n)),{measureIdx:r,dimensionIdx:i,path:n}}function xw(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,r=n.byCells,o=n.primarySource,a=[],s={},l=t.isActive(),c=!1;return t.brushes().forEach((function(t){var e=vw(t.id,i);if("range"===t.type&&e.measureIdx>-1&&e.dimensionIdx>-1){var n=t.brush.ranges();n.length&&(c=!0,s.multiRangeSelectTreeDataValues||(s.multiRangeSelectTreeDataValues={path:e.path,ranges:[]}),n.forEach((function(t){return s.multiRangeSelectTreeDataValues.ranges.push({qMeasureIx:e.measureIdx,qDimensionIx:e.dimensionIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!0}})})))}else{if("range"===t.type&&e.measureIdx>-1){var l=t.brush.ranges();l.length&&(c=!0,s.rangeSelectHyperCubeValues||(s.rangeSelectHyperCubeValues={path:e.path,ranges:[]}),l.forEach((function(t){return s.rangeSelectHyperCubeValues.ranges.push({qMeasureIx:e.measureIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!0}})})))}if("range"===t.type&&e.dimensionIdx>-1){var u=t.brush.ranges();u.length&&(c=!0,s.selectHyperCubeContinuousRange||(s.selectHyperCubeContinuousRange={path:e.path,ranges:[]}),u.forEach((function(t){return s.selectHyperCubeContinuousRange.ranges.push({qDimIx:e.dimensionIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!1}})})))}if("value"===t.type&&e.dimensionIdx>-1)if(r)if(i&&i.qHyperCube&&("P"===i.qHyperCube.qMode||"T"===i.qHyperCube.qMode||"K"===i.qHyperCube.qMode)){var h=i.qHyperCube,d=h.qNoOfLeftDims,f=h.qEffectiveInterColumnSortOrder.indexOf(e.dimensionIdx);if(s.selectPivotCells||(s.selectPivotCells={path:e.path,cells:[]}),t.id===o||!o){var p=t.brush.values().map((function(t){return+t})).filter((function(t){return!isNaN(t)}));(0===d||f>=d)&&d>-1?p.forEach((function(t){s.selectPivotCells.cells.push({qType:"T",qCol:t,qRow:f-d})})):p.forEach((function(t){s.selectPivotCells.cells.push({qType:"L",qCol:e.dimensionIdx,qRow:t})})),c=!!s.selectPivotCells.cells.length}}else s.selectHyperCubeCells||(s.selectHyperCubeCells={path:e.path,cols:[]}),s.selectHyperCubeCells.cols.push(e.dimensionIdx),t.id!==o&&(o||s.selectHyperCubeCells.values)||(s.selectHyperCubeCells.values=t.brush.values().map((function(t){return+t})).filter((function(t){return!isNaN(t)})),c=!!s.selectHyperCubeCells.values.length);else{var g=t.brush.values().map((function(t){return+t})).filter((function(t){return!isNaN(t)}));c=!!g.length,a.push({params:[e.path,e.dimensionIdx,g,!1],method:"selectHyperCubeValues"})}}})),!c&&l?[{method:"resetMadeSelections",params:[]}]:(s.rangeSelectHyperCubeValues&&a.push({method:"rangeSelectHyperCubeValues",params:[s.rangeSelectHyperCubeValues.path,s.rangeSelectHyperCubeValues.ranges,[],null===(e=n.orMode)||void 0===e||e]}),s.selectHyperCubeContinuousRange&&a.push({method:"selectHyperCubeContinuousRange",params:[s.selectHyperCubeContinuousRange.path,s.selectHyperCubeContinuousRange.ranges]}),s.selectHyperCubeCells&&a.push({method:"selectHyperCubeCells",params:[s.selectHyperCubeCells.path,s.selectHyperCubeCells.values,s.selectHyperCubeCells.cols]}),s.selectPivotCells&&a.push({method:"selectPivotCells",params:[s.selectPivotCells.path,s.selectPivotCells.cells]}),s.multiRangeSelectTreeDataValues&&a.push({method:"multiRangeSelectTreeDataValues",params:[s.multiRangeSelectTreeDataValues.path,s.multiRangeSelectTreeDataValues.ranges]}),a)}function bw(t){lw.util=t.data("matrix").util,t.data("q",lw),t.formatter("q-number",Xb),t.formatter("q-time",rw)}function ww(t){var e=function(t,e,n){if(void 0===t||void 0===e)return n;for(var i=e.split("."),r=t,o=0;o<i.length;++o){var a=i[o];if(void 0===r[a])return n;r=r[a]}return r}(t.layout||{},t.path.split("/").join("."));if(!e)return!1;var n=e.qIsOneAndOnlyOne;return void 0!==n&&n}function kw(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==t||!t.length)return!1;var e=t.filter((function(t){return"object"===ey(t.data)&&Array.isArray(t.data.fields)})).every((function(t){return t.data.fields.every((function(t){var e=t.raw();return!(!e.qLocked&&e.qCardinal)}))}));return e}function _w(t){var e=t.brush,n=t.colorField,i=t.legendAlias,r=t.useLegendCube,o=void 0!==r&&r;!n||/qAttrDimInfo/.test(n)?(e.removeKeyAlias("attrDim/qDimensionInfo/0"),i&&e.removeKeyAlias(i),e.addKeyAlias("attrDim/qDimensionInfo/0","qHyperCube/".concat(n))):o&&e.addKeyAlias(i,"qHyperCube/".concat(n))}bw.qBrushHelper=xw,bw.selections=xw;var Mw="Shift";function Sw(t){var e=t.brush,n=t.getConfig;return{interceptor:function(t){var i=e.brushes(),r=n(),o=r.allowSimultaneous,a=r.layout,s=void 0===a?{}:a;i.forEach((function(n){var i,r,a;("range"===n.type||null!==(i=t[0])&&void 0!==i&&i.key&&(null===(r=t[0])||void 0===r?void 0:r.key)!==n.id&&0!==o.indexOf(null===(a=t[0])||void 0===a?void 0:a.key))&&e.clear([])}));var l=t.filter((function(t){return-2!==t.value}));return l.length>1?function(t){var e=t.layout,n=void 0===e?{}:e,i=t.values,r=void 0===i?[]:i;if(null==r||!r.length)return[];var o=Array.from(new Set(r.map((function(t){return t.key})))),a=[];return o.forEach((function(t){var e=ww({layout:n,path:t}),i=r.filter((function(e){return e.key===t})),o=e?[i.pop()]:i;a.push.apply(a,sy(o))})),a.filter(Boolean)}({layout:s,values:l}):l},rangeInterceptor:function(t){var i=e.brushes(),r=n().allowSimultaneous;return i.filter((function(t){return"value"===t.type})).length?(e.clear([]),t):(i.forEach((function(n){var i=n.id===t[0].key||r.includes(n.id)&&r.includes(t[0].key);"range"!==n.type||i||e.clear([])})),t)}}}var Cw=function t(e,n){return n[e]?t(e+1,n):e},Nw=function(t,e){var n=e.reduce((function(t,e){return t[e]=!0,t}),{});return t.reduce((function(t,e,i){var r=Cw(i,n);return n[r]=!0,t[i]=r,t}),{})};function Rw(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.layout,n=t.filtered,i=void 0===n?{}:n,r=(null==e?void 0:e.qHyperCube)||{},o=r.qDimensionInfo,a=void 0===o?[]:o,s=r.qMeasureInfo,l=void 0===s?[]:s;return{dimensions:Nw(a,i.dimensions||[]),measures:Nw(l,i.measures||[])}}function qw(t){var e=t.selection,n=t.fieldMap,i=e.method,r=e.params;if("selectHyperCubeValues"===i){var o=n.dimensions[r[1]];void 0!==o&&(r[1]=o)}return"selectHyperCubeContinuousRange"===i&&r[1].forEach((function(t){var e=n.dimensions[t.qDimIx];void 0!==e&&(t.qDimIx=e)})),e}var Aw=[],Dw=0,Ew=function(t){var e=Aw.filter((function(t){var e;return null===(e=t.selections)||void 0===e?void 0:e.isActive()}));e.length&&("Enter"===t.key?e.forEach((function(t){return t.selections.confirm()})):"Escape"!==t.key&&"Esc"!==t.key||e.forEach((function(t){return t.selections.cancel()})))},Ow=function(){document.addEventListener("keyup",Ew)},Iw=function(){document.removeEventListener("keyup",Ew)},Tw=function(t,e){Object.keys(e).forEach((function(n){t.on(n,e[n])}))},jw=function(t,e){Object.keys(e).forEach((function(n){t.removeListener(n,e[n])}))};function Pw(t,e,n){if(e&&void 0!==n&&"selectHyperCubeContinuousRange"===t.method){var i=t.params;if(i&&i[1]&&i[1][0]){var r=i[1][0],o=r.qDimIx,a=r.qRange;"undefined"!==o&&a&&!1===a.qMaxInclEq&&a.qMax>=n&&(a.qMaxInclEq=!0)}}}function zw(t){var e=t.chart,n=t.document,i=t.selectionInfo,r=t.eventName,o=t.componentName,a=t.brushName,s=void 0===a?"selection":a,l=t.emit,c=void 0===l?"rangeClear":l,u=i.event===r,h=n.querySelector("[data-key='".concat(o,"-edge-0']"));if(u||!h)return!1;var d=e.component(o);return!!d&&(d.emit(c),"string"==typeof s&&e.brush(s).clear(),d)}function Fw(t){var e=t.selectionInfo,n=t.chart,i=t.document,r=t.eventName,o=void 0===r?"discreteRange":r,a=t.componentName,s=void 0===a?"discrete-range-brush":a,l=t.cleared;return zw({selectionInfo:e,chart:n,document:i,eventName:void 0!==l&&l?void 0:o,componentName:s,emit:"areaClear",brushName:t.brushName})}function Lw(t){var e=t.selectionInfo,n=t.chart,i=t.document,r=t.eventName,o=void 0===r?"continuousRange":r,a=t.componentName,s=void 0===a?"continuous-range-brush":a,l=t.cleared;return zw({selectionInfo:e,chart:n,document:i,eventName:void 0!==l&&l?void 0:o,componentName:s,brushName:t.brushName})}function Bw(t){var e=t.selectionInfo,n=t.chart,i=t.document,r=t.componentName,o=void 0===r?"minor-range-brush":r,a=t.eventName,s=void 0===a?"minorRange":a,l=t.cleared,c=void 0!==l&&l,u=t.brushName,h=zw({selectionInfo:e,chart:n,document:i,eventName:c?void 0:s,componentName:o,brushName:void 0!==u&&u});if(h){var d=h.settings.settings,f=d.scale,p=d.brush,g=n.scale(f).data().fields.map((function(t){return t.id()})),m=n.brush(p),y=m.brushes().filter((function(t){return"range"===t.type&&g.some((function(e){return e===t.id}))}));m&&y.length&&y.forEach((function(t){m.removeRanges(t.brush.ranges().map((function(e){return{key:t.id,range:e}})))}))}}function Hw(t){var e=t.selectionInfo,n=t.chart,i=t.document,r=t.selections,o=t.eventName,a=void 0===o?"xAxis":o,s=t.cleared;zw({selectionInfo:e,chart:n,document:i,eventName:void 0!==s&&s?void 0:a,componentName:"".concat(a,"-range-brush"),emit:"areaClear",brushName:!1})&&r.clear()}function $w(t){var e=t.chart,n=t.selectionInfo,i=t.selections,r=t.events,o=void 0===r?["tap"]:r,a=t.brushNames,s=void 0===a?[]:a;if(n&&o.includes(n.event)){var l=n.currentComponent;n.previousComponent!==l&&(i.clear(),s.forEach((function(t){return e.brush(t).end()})))}}function Vw(t){var e=t.selectionInfo,n=t.chart,i=t.document,r=t.selections,o=t.eventName,a=void 0===o?"legendRange":o,s=t.componentName,l=void 0===s?"legend-range-brush":s,c=t.cleared,u=void 0!==c&&c,h=t.brushName;zw({selectionInfo:e,chart:n,document:i,eventName:u?void 0:a,componentName:l,brushName:void 0!==h&&h})&&r.clear()}var Ww=["chart","document","selections","selectionInfo"],Uw=function(t){t.chart,t.document,t.selections,t.selectionInfo;var e=oy(t,Ww);e.clearDiscrete(),e.clearContinuous(),e.clearMinor(),e.clearRange(),e.clearTap(),e.clearLegend()};function Yw(t){var e,n=t.lasso;null!=n&&null!==(e=n.active)&&void 0!==e&&e.call(n)&&(null==n||n.action(!1))}function Xw(t){var e,n=t.chart,i=t.selectionInfo,r=t.selectionActions,o=t.actions,a=void 0===o?{}:o,s=t.selections,l=t.selectionEvents;if(!1===r||!1===l)return function(){};var c=(a||{}).lasso,u=void 0!==c&&c,h=r.reset,d=void 0===h?Yw:h,f=r.clear,p=!1!==f&&function(t){var e=t.clear,n=void 0===e?Uw:e,i=t.selections,r=t.selectionInfo,o=t.chart;return function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).cleared,e={selections:i,selectionInfo:r,chart:o,document:document,cleared:t};return n(Qm({clearDiscrete:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Fw(Qm(Qm({},e),t))},clearContinuous:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Lw(Qm(Qm({},e),t))},clearMinor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Bw(Qm(Qm({},e),t))},clearRange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Hw(Qm(Qm({},e),t))},clearTap:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return $w(Qm(Qm({},e),t))},clearLegend:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Vw(Qm(Qm({},e),t))}},e))}}({clear:f,selections:s,selectionInfo:i,chart:n}),g=function(t){var e=t.chart,n=t.lasso,i=t.reset,r=t.clear,o=!1,a={deactivated:function(t){i({e:t,lasso:n})},canceled:function(t){i({e:t,lasso:n}),r({e:t,chart:e,document:document})},cleared:function(t){o||(o=!0,r({e:t,chart:e,document:document,cleared:!0}),o=!1)}};return!1===i&&delete a.deactivated,!1===r&&delete a.cleared,!1===i&&!1===r&&delete a.canceled,a}({chart:n,clear:p,reset:d,lasso:u}),m={};Object.entries(g).forEach((function(t){var e=ay(t,2),n=e[0],i=e[1];m[n]=function(t,e){return e?function(n){return e({event:n,defaultFunc:t})}:t}(i,l[n])}));var y=function(t){var e=t.selectionEvents,n=t.selections,i=t.selectionInfo,r=t.clear,o=t.chart,a=t.document,s=e.start,l={selections:n,selectionInfo:i,chart:o,document:a},c=function(t){return Object.assign(i,t||{})},u=function(t){var e=t.event,n=t.components;return function(){return function(t){var e=t.selectionInfo,n=t.clear,i=t.event,r=t.components,o=void 0===r?[]:r;(0,t.setSelectionInfo)(Qm(Qm({},void 0===e?{}:e),{},{event:i,components:o.map((function(t){return t.key})).filter(Boolean)})),n()}({event:e,components:n,clear:r,chart:o,selectionInfo:i,setSelectionInfo:c})}};return"function"==typeof s?function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];s(Qm(Qm({defaultFunc:u({event:t,components:e}),setSelectionInfo:c,clear:r},l),{},{event:t,components:e}))}:function(t){u({event:t,components:arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]})()}}({selectionEvents:l,selections:s,selectionInfo:i,clear:p,chart:n,document:document});return null==a||null===(e=a.select)||void 0===e||e.on("start",y),Object.entries(m).forEach((function(t){var e=ay(t,2),n=e[0],i=e[1];null==s||s.on(n,i)})),function(){var t;null==a||null===(t=a.select)||void 0===t||t.removeListener("start",y),Object.entries(m).forEach((function(t){var e=ay(t,2),n=e[0],i=e[1];null==s||s.removeListener(n,i)}))}}var Kw=[{key:"qHyperCube/qDimensionInfo/0:numeric",includeMax:!1}];function Gw(t){var e=t.chart,n=t.actions,i=t.selections,r=t.picassoQ,o=t.config,a=o.allowSimultaneous,s=void 0!==a&&a,l=o.majorScale,c=void 0===l?void 0:l,u=o.selectionActions,h=(u=void 0===u?{}:u).clear,d=u.reset,f=o.selectionEvents,p=void 0===f?{deactivated:void 0,canceled:void 0,cleared:void 0,start:void 0}:f,g=o.brushEvents,m=void 0===g?{}:g,y=o.brushName,v=void 0===y?"selection":y,x=o.brushMaxListeners,b=void 0===x?20:x,w=o.brushRanges,k=void 0!==w&&w,_=o.interceptors,M=void 0===_?{}:_,S=o.selectionsFn,C=void 0===S?r.selections:S,N=e.brush(v);if("number"==typeof b&&N.setMaxListeners(b),k){var R=!0===k?Kw:k;N.configure({ranges:R})}var q={canSelect:!0,getIsSelectionLocked:!1,isInnerDimensionLocked:!1,lockedDimensions:[],singleSelectIndex:0,selectionInfo:{colorField:void 0,components:[],event:void 0,currentComponent:void 0,previousComponent:void 0}},A=function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.selections,i=e.brush,r=e.majorScale,o=e.actions,a=e.selectionsFn,s=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).path,l=void 0===s?"/qHyperCubeDef":s;if(!n)return{layout:function(){},filteredFields:function(){},allowSimultaneous:function(){},release:function(){}};var c=++Dw,u=null,h={dimensions:[],measures:[]},d=[],f={};n.on=n.on.bind(n),n.isActive=n.isActive.bind(n),n.addListener=n.addListener.bind(n),n.removeListener=n.removeListener.bind(n);var p=Sw({brush:i,getConfig:function(){return{layout:u,allowSimultaneous:d}}}),g=p.rangeInterceptor,m=p.interceptor;i.intercept("set-ranges",g),i.intercept("toggle-ranges",g),i.intercept("toggle-values",m),i.intercept("set-values",m),i.intercept("add-values",m),i.on("start",(function(){return n.begin(l)}));var y={activate:function(){},deactivated:function(){return i.end()},cleared:function(){return i.clear()},canceled:function(){return i.end()}};Tw(n,y);var v=null==r||null===(t=r.max)||void 0===t?void 0:t.call(r);return null!=o&&o.select?(o.select.on("start",(function(){var t;i.start(),"function"==typeof o.select.getBrushOptions&&(f=(t=o.select).getBrushOptions.apply(t,arguments))})),o.select.on("end",(function(){var t=a(i,f,u),e=Rw({layout:u,filtered:h});t.forEach((function(t){var i=qw({selection:t,fieldMap:e});Pw(i,o.select.brushSelectionIncludeMax,v),n.select(i)}))}))):i.on("update",(function(){var t=a(i,f,u),e=Rw({layout:u,filtered:h});t.forEach((function(t){n.select(qw({selection:t,fieldMap:e}))}))})),0===Aw.length&&Ow(),Aw.push({key:c,selections:n}),{layout:function(t){u=t},filteredFields:function(t){h=t},allowSimultaneous:function(t){d=t},release:function(){u=null;var t=Aw.indexOf(Aw.filter((function(t){return t.key===c}))[0]);-1!==t&&Aw.splice(t,1),Aw.length||Iw(),jw(n,y)}}}({brush:N,majorScale:c,actions:n,selections:i,picassoQ:r,selectionsFn:C});!function(t){var e=t.brush,n=t.interceptors,i=void 0===n?{}:n;Object.entries(i).forEach((function(t){var n=ay(t,2),i=n[0],r=n[1];(Array.isArray(r)?r:[r]).forEach((function(t){e.intercept(i,t)}))}))}({brush:N,interceptors:M});var D=function(t){var e=t.chart,n=t.selectionActions,i=t.brush,r=t.actions,o=t.selectionInfo,a=t.selections,s=t.selectionEvents,l=function(t){var e=t.brush,n=t.chart,i=t.selectionInfo,r=t.brushEvents,o=void 0===r?{}:r,a=Object.entries(o).map((function(t){var r=ay(t,2),o=r[0],a=r[1],s=function(){return a({chart:n,selectionInfo:i})};return e.on(o,s),[o,s]}));return function(){a.forEach((function(t){var n=ay(t,2),i=n[0],r=n[1];e.removeListener(i,r)}))}}({brush:i,chart:e,selectionInfo:o,brushEvents:t.brushEvents}),c=Xw({chart:e,selectionInfo:o,selectionActions:n,actions:r,selections:a,selectionEvents:s}),u=function(t){var e=t.actions;if(null==e||!e.lasso)return function(){};var n=!1,i=function(t){n||t.key!==Mw||(e.lasso.action(!0),n=!0)},r=function(t){t.key===Mw&&(e.lasso.action(!1),n=!1)};return document.addEventListener("keydown",i),document.addEventListener("keyup",r),function(){document.removeEventListener("keydown",i),document.removeEventListener("keyup",r)}}({actions:r});return function(){l(),c(),u()}}({chart:e,brush:N,actions:n,selections:i,selectionInfo:q.selectionInfo,selectionActions:{clear:h,reset:d},selectionEvents:p,brushEvents:m});if(s){var E=!0===s?sy(Array(15)).map((function(t,e){return"qHyperCube/qMeasureInfo/".concat(e)})):s;A.allowSimultaneous(E)}return{unbindEvents:D,state:q,picassoSelections:A,brush:N}}var Zw=["colorField","useLegendCube"];function Jw(t){var e=t.chart,n=t.selections,i=t.actions,r=void 0!==i&&i,o=t.config,a=void 0===o?{}:o,s=Gw({chart:e,actions:r,selections:n,picassoQ:bw,config:a}),l=s.unbindEvents,c=s.state,u=s.picassoSelections,h=s.brush,d=a.custom,f=void 0===d?{}:d,p=a.legendAlias,g=void 0===p?void 0:p,m=a.setBrushAliases,y=void 0===m?_w:m;return{getIsDimensionLocked:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return c.lockedDimensions[t]},getIsSelectionLocked:function(){var t,e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return null!==(t=null==n||null===(e=n.isLocked)||void 0===e?void 0:e.call(n))&&void 0!==t?t:kw(i)},getIsSingleSelect:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.singleSelectIndex;return c.singleSelectDimensions[t]},getCanSelect:function(){return c.canSelect},getSelectionInfo:function(){return c.selectionInfo},setLayout:function(t){var e=function(t){var e,n,i,r=t.selections,o=t.picassoSelections,a=t.layout,s={lockedDimensions:[],singleSelectDimensions:[]};null!=r&&null!==(e=r.isModal)&&void 0!==e&&e.call(r)&&r.confirm(),o.layout(a);var l=(null!==(n=null==a?void 0:a.qHyperCube)&&void 0!==n?n:{}).qDimensionInfo,c=void 0===l?[]:l;return s.lockedDimensions=c.map((function(t){return!!t.qLocked})),s.singleSelectDimensions=c.map((function(t,e){return ww({layout:a,path:"qHyperCube/qDimensionInfo/".concat(e)})})),s.singleSelectIndex=function(t){var e,n=((null==t?void 0:t.qHyperCube)||{}).qDimensionInfo,i=void 0===n?[]:n;return null!==(e=i.map((function(t,e){var n;return!(t.qLocked||(null===(n=t.qCardinalities)||void 0===n?void 0:n.qHypercubeCardinal)<=1)&&e})).filter((function(t){return"number"==typeof t}))[0])&&void 0!==e?e:Math.max(i.length-1,0)}(a),s.canSelect=0===c.length||c.some((function(t){return!t.qLocked})),s.dimensionLocked=!(null===(i=c[0])||void 0===i||!i.qLocked),s}({selections:n,picassoSelections:u,layout:t});Object.assign(c,e)},setFilteredFields:function(t){u.filteredFields(t)},setBrushAliases:function(t){var e=t.colorField,n=t.useLegendCube,i=void 0!==n&&n,r=oy(t,Zw),o=Qm({useLegendCube:i,colorField:e,brush:h,legendAlias:g},r);y(Qm(Qm({},o),{},{defaultFunc:function(){return _w(o)}}))},destroy:function(){l(),u.release()},custom:Qm({},f)}}function Qw(t){const e=t.node.desc&&t.node.desc.share;return e?t.formatter("share")(e):""}function tk(t){return t.formatter("num")(t.node.data.num.value)}function ek({data:t}){return t?t.label:""}function nk(t){if(t.dataPoint.auto)return Qw;switch(t.dataPoint.labelMode){case"share":return Qw;case"value":return tk;case"none":return null;default:return Qw}}function ik(t,e,n){const i=(n,i=1)=>({component:"fun",selector:n,strategy:{type:"rows",settings:{align:i,fill:".labelCenter"===n?({node:t})=>e.getContrastingColorTo(t.desc.fill):e.getStyle("","","color"),labels:".labelCenter"===n?[{label:nk(t)}]:[{label:ek}],linkData:e=>".labelCenter"===n?"none"===t.dataPoint.labelMode?Math.random():`${e.data.value} ${nk(t)(e)}`:`${e.data.value} ${ek(e)}`}}});return{key:"funnel-labels",type:"labels",layout:{displayOrder:2},settings:{sources:[i(".labelLeft",0),i(".labelCenter",.5)]},animations:{enabled:n,trackBy:t=>t.data}}}function rk(t){if(!t.showDimensionTitle||!t.qHyperCube.qDimensionInfo[0].qFallbackTitle)return!1;return{key:"dimension-title",type:"text",text:t.qHyperCube.qDimensionInfo[0].qFallbackTitle,layout:{dock:"top"}}}function ok({picasso:e}){const n=t.useElement(),i=t.useSelections(),r=t.useModel(),o=t.useApp(),a=t.useTranslator(),s=t.useOptions(),[l,c]=t.useState(),[u,h]=t.useState(),[d,f]=t.useState(),[p,g]=t.useState();return t.useEffect((()=>{const t=function(t){var e,n,i,r,o=t.picasso,a=t.model,s=t.app,l=t.translator,c=t.layoutService,u=void 0===c?void 0:c,h=t.createConfig,d=void 0===h?Nx:h,f=t.config,p=void 0===f?{}:f,g=t.custom,m=void 0===g?{}:g,y=p.localeInfo,v=p.key,x=p.theme,b=void 0===x?void 0:x,w=p.auto,k=void 0===w?void 0:w,_=p.definitionPath,M=null==u||null===(e=u.getLayout)||void 0===e?void 0:e.call(u),S={theme:b,key:v,localeInfo:y,layout:M,hc:null==u||null===(n=u.getHyperCube)||void 0===n?void 0:n.call(u),legendProps:null==u||null===(i=u.getLayoutValue)||void 0===i?void 0:i.call(u,"legend"),colorProps:Qm(Qm({},null==u||null===(r=u.getLayoutValue)||void 0===r?void 0:r.call(u,"color")),{},{useBaseColors:M?_x(M):void 0})},C=wx({picasso:o,model:a,app:s,translator:l,auto:k});!1!==k&&C.auto((function(t){return k?k({layout:t,defaultAuto:Cx}):Cx(t)}));var N=!1;return{getColor:function(){return C.color()},getPaletteColor:function(t){var e=t.index,n=t.color;return C.resolveUIColor({index:e,color:n})},getData:function(){return C.data()},getDatumProps:function(t){return C.datumProps(t)},getSnapshotData:function(){return C.getSnapshotData(_)},getSettingsForMeasure:function(t){return C.settingsForMeasure(t)},getSettings:function(){return C.settings()},getLegend:function(t,e){return C.legend(t,e)},getScales:function(){return C.scales()},getPalettes:function(){return C.palettes()},isSelectionLocked:function(t){var e=t.isMeasureSelectionLocked;return C.isSelectionLocked({isMeasureSelectionLocked:e})},isInitialized:function(){return N},custom:Qm({},m),initialize:function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).createConfig,e=(void 0===t?d:t)({getUseBaseColors:_x}),n=Mx(S,e);return C.config(n),C.getAuxiliarySettings(_).then((function(){N=!0}))}}}({picasso:e,model:r,app:o,translator:a,config:{auto:!1,key:"fill"}});n.style.overflow="hidden";const l=e({renderer:{prio:[s.renderer||"svg"]}}).chart({element:n,data:[],settings:{}}),u=Jw({chart:l,selections:i,config:{selectionActions:!1}});return f(u),h(t),c(l),g(function(){var t={};return{get:function(e){return t[e]},set:function(e,n){return t[e]=n,n},has:function(e){return e in t},remove:function(e){delete t[e]},empty:function(){t={}}}}()),()=>{u.destroy(),l.destroy()}}),[]),[l,u,d,p]}function ak({picasso:e,flags:n}){const i=t.useStaleLayout(),r=t.useTheme(),o=t.useConstraints(),a=t.useRect(),s=t.usePlugins(),l=t.useAppLayout().qLocaleInfo,[c,u,h,d]=ok({picasso:e,layout:i}),f=t.useOptions(),p=()=>{const t=c.element.clientWidth!==d.get("width")||c.element.clientHeight!==d.get("height");return!1!==f.chartAnimations&&n.isEnabled("IM_1355_ANIMATIONS_FUNNEL")&&!o.active&&!t},[g]=t.usePromise((()=>{if(!u)return Promise.resolve();const t=function(t){return{layout:t,keys:{SCALE:{FILL:"fill"},COMPONENT:{FUNNEL:"fun",FUNNEL_LABELS:"funnel-labels",DIMENSION_TITLE:"dimension-title"}}}}(i),n=function(t){var e=t.picassoInstance,n=t.plugins,i=t.pluginArgs,r=void 0===i?{}:i,o={initialized:!1,definitions:[]};return{initialize:function(){return iy(ty().mark((function t(){var i,a,s,l;return ty().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!o.initialized){t.next=2;break}return t.abrupt("return");case 2:return a=Promise.all(n.filter((function(t){return"custom-component"===t.info.type})).map(function(){var t=iy(ty().mark((function t(n){var i;return ty().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n.info.componentName){t.next=2;break}throw new Error("plugin-service: Custom component is missing componentName");case 2:return t.next=4,n.fn(Qm({},r));case 4:if("object"===ey(i=t.sent)){t.next=7;break}throw new Error("plugin-service: Custom component needs to be an object");case 7:e.component(n.info.componentName,i);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())),s=Promise.all(n.filter((function(t){return"component-definition"===t.info.type})).map((function(t){return t.fn(Qm({},r))}))),t.next=6,Promise.all([a,s]);case 6:l=t.sent,o.initialized=!0,(i=o.definitions).push.apply(i,sy(l[1]));case 9:case"end":return t.stop()}}),t)})))()},extendComponents:function(t){return o.initialized?(o.definitions.filter(Boolean).forEach((function(e){var n=ay(t.filter((function(t){return t.key&&t.key===e.key})),1)[0];if(n){var i=vy(!0,{},n.brush);vy(!0,n,e),e.brush&&(n.brush=function(t,e){return"object"===ey(t)&&Object.keys(t).length?(Array.isArray(e.consume)&&(t.consume=Rx({originalArray:t.consume,newArray:e.consume,matchKey:"context"})),Array.isArray(e.trigger)&&(t.trigger=Rx({originalArray:t.trigger,newArray:e.trigger,matchKey:"on"})),t):e}(i,e.brush))}else t.push(e)})),t):t}}}({picassoInstance:e,plugins:s,pluginArgs:t});return Promise.all([u.initialize({createConfig:({getUseBaseColors:t})=>({theme:r,colorProps:{...i.color,useBaseColors:t(i)},layout:i,hc:i.qHyperCube})}),n.initialize()]).then((()=>n))}),[i,u]);t.useEffect((()=>{if(!c||!u||!g)return;const t=[{type:"q",key:"qHyperCube",data:i.qHyperCube,config:{localeInfo:l}},...u.getData()],e=function({layout:t,constraints:e,colorService:n,theme:i,pluginService:r,animationsEnabled:o}){const a=function(t){return{...t.getScales()}}(n),s=n.getPalettes(),l=[function({layout:t,constraints:e,colorService:n,animationsEnabled:i}){const r=n.getDatumProps(),o=n.getColor();return{type:"funnel",key:"fun",data:{extract:{field:"qDimensionInfo/0",props:{num:{field:"qMeasureInfo/0"},...r}}},brush:e.select||e.active?{}:{trigger:[{contexts:["selection"],data:[""]}],consume:[{context:"selection",filter:t=>"section"===t.tag,style:{inactive:{opacity:.3}}}]},settings:{num:{ref:"num"},fill:o,mode:t.funnel.mode},animations:{enabled:i,isMainComponent:!0,trackBy:t=>`${t.tag}: ${t.data.value}`}}}({layout:t,constraints:e,colorService:n,animationsEnabled:o}),ik(t,i,o),rk(t)];return{palettes:s,style:{"$font-family":i.getStyle("","","fontFamily"),"$font-color":i.getStyle("","","color"),"$font-size":i.getStyle("","","fontSize")},scales:a,components:r.extendComponents(l),formatters:{share:{type:"d3-number",format:".1%"},num:{data:{field:"qMeasureInfo/0"}}}}}({layout:i,constraints:o,colorService:u,theme:r,pluginService:g,animationsEnabled:p});c.update({data:t,settings:e}),d.set("width",c.element.clientWidth),d.set("height",c.element.clientHeight)}),[c,u,r.name(),g,o]),t.useEffect((()=>{c&&(c.update(),d.set("width",c.element.clientWidth),d.set("height",c.element.clientHeight))}),[a.width,a.height]),t.useEffect((()=>{h&&h.setLayout(i)}),[i]),t.onTakeSnapshot((t=>u.getSnapshotData().then((e=>(t.snapshotData=t.snapshotData||{},t.snapshotData.content=t.snapshotData.content||{},t.snapshotData.content.chartData=e,t))).catch((()=>t))))}return function(t){const e=Yp();e.use(Fm),e.component("funnel",Xm);const{flags:n}=t;return{ext:Gm,qae:{properties:{initial:Km},data:{targets:Zm}},component(){ak({picasso:e,flags:n})}}}}));
11
+ t.exports=function(t,e){if(!t||isNaN(+e))return e;var n,i,r,o,a,s,l,c,u,h,d=t.length,f=t.search(/[0-9\-\+#]/),p=f>0?t.substring(0,f):"",g=t.split("").reverse().join(""),m=g.search(/[0-9\-\+#]/),y=d-m,v=t.substring(y,y+1),x=y+("."===v||","===v?1:0),b=m>0?t.substring(x,d):"";if(n=(e="-"===(t=t.substring(f,x)).charAt(0)?-e:+e)<0?e=-e:0,r=(i=t.match(/[^\d\-\+#]/g))&&i[i.length-1]||".",o=i&&i[1]&&i[0]||",",t=t.split(r),e=+(e=e.toFixed(t[1]&&t[1].length))+"",s=t[1]&&t[1].lastIndexOf("0"),(!(c=e.split("."))[1]||c[1]&&c[1].length<=s)&&(e=(+e).toFixed(s+1)),u=t[0].split(o),t[0]=u.join(""),(a=t[0]&&t[0].indexOf("0"))>-1)for(;c[0].length<t[0].length-a;)c[0]="0"+c[0];else 0==+c[0]&&(c[0]="");if((e=e.split("."))[0]=c[0],l=u[1]&&u[u.length-1].length){for(g="",y=(h=e[0]).length%l,d=h.length,x=0;x<d;x++)g+=h.charAt(x),!((x-y+1)%l)&&x<d-l&&(g+=o);e[0]=g}return e[1]=t[1]&&e[1]?r+e[1]:"","0"!==(i=e.join(""))&&""!==i||(n=!1),p+(n?"-":"")+i+b}}(Vb={exports:{}}),Vb.exports);function Ub(t){return t.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}var Yb={3:"k",6:"M",9:"G",12:"T",15:"P",18:"E",21:"Z",24:"Y","-3":"m","-6":"μ","-9":"n","-12":"p","-15":"f","-18":"a","-21":"z","-24":"y"},Xb=/%$/,Kb=/^\(r(0[2-9]|[12]\d|3[0-6])\)/i,Gb=/^\(oct\)/i,Zb=/^\(dec\)/i,Jb=/^\(hex\)/i,Qb=/^\(bin\)/i,tw=/^\(rom\)/i,ew=/^(\(rom\)|\(bin\)|\(hex\)|\(dec\)|\(oct\)|\(r(0[2-9]|[12]\d|3[0-6])\))/i,nw=/#|0/g;function iw(t,e,n,i){return t=t.toString(e),n[1]===n[1].toUpperCase()&&(t=t.toUpperCase()),t.length-t.indexOf(".")>10&&(t=t.slice(0,t.indexOf(".")+11)),t.replace(".",i||".")}function rw(t,e,n){var i=Ub(t);return n?i:new RegExp(i||"",e)}function ow(t,e,n){var i,r,o,a,s,l,c,u,h,d,f,p=t.pattern;p.indexOf("A")>=0&&(p=p.replace("A",""),t.abbreviate=!0),d=e,(f=n)&&(f=Ub(f)),d&&(d=Ub(d)),h=new RegExp("(?:[#0]+".concat(d,")?[#0]+(?:").concat(f,"[#0]+)?")),a=(o=(o=p.match(h))?o[0]:"")?p.substr(0,p.indexOf(o)):p,s=o?p.substring(p.indexOf(o)+o.length):"",o||(o=p?"#":"##########"),e&&e===n&&(r=(i=o.split(n)).pop(),o=i.join("")+n+r,e=""),l=e,e=/,/.test(n)?"¤":",",l&&(o=o.replace(rw(l,"g"),e)),c=n,n=".",c&&(o=o.replace(rw(c,"g"),n)),u=(u=o.match(/#/g))?u.length:0;var g,m=p.split(c);m[1]&&(g=m[1].match(nw)),t.prefix=a||"",t.postfix=s||"",t.pattern=p,t.maxPrecision=g?g.length:2,t.percentage=Xb.test(p),t.numericPattern=o||"",t.numericRegex=new RegExp("".concat(rw(e,null,!0),"|").concat(rw(n,null,!0)),"g"),t.groupTemp=l,t.decTemp=c,t.t=e,t.d=n,t.temp=u}var aw=function(){function t(e,n,i,r,o){Vx(this,t),this.localeInfo=e,this.pattern=n,this.thousandDelimiter=i||",",this.decimalDelimiter=r||".",this.type=o||"numeric",this.patternSeparator=";",this.abbreviations=function(t,e){if(!t||!t.qNumericalAbbreviation)return Yb;var n={};return t.qNumericalAbbreviation.split(e).forEach((function(t){var e=t.split(":");2===e.length&&(n[e[0]]=e[1])})),n}(e,this.patternSeparator),this.prepare()}return Ux(t,[{key:"clone",value:function(){var e=new t(this.localeInfo,this.pattern,this.thousandDelimiter,this.decimalDelimiter,this.type);return e.subtype=this.subtype,e}},{key:"format",value:function(t,e,n,i){return this.prepare(e,n,i),this.formatValue(t)}},{key:"prepare",value:function(t,e,n){var i;void 0===t&&(t=this.pattern),void 0===e&&(e=this.thousandDelimiter),void 0===n&&(n=this.decimalDelimiter),t?(this._prepared={positive:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""},negative:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""},zero:{d:n,t:e,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""}},i=this._prepared,t=t.split(this.patternSeparator),i.positive.pattern=t[0],i.negative.pattern=t[1],i.zero.pattern=t[2],ew.test(t[0])&&(i.positive.isFunctional=!0),t[1]?ew.test(t[1])&&(i.negative.isFunctional=!0):i.negative=!1,t[2]?ew.test(t[2])&&(i.zero.isFunctional=!0):i.zero=!1,i.positive.isFunctional||ow(i.positive,e,n),i.negative&&!i.negative.isFunctional&&ow(i.negative,e,n),i.zero&&!i.zero.isFunctional&&ow(i.zero,e,n)):this._prepared={pattern:!1}}},{key:"formatValue",value:function(t){var e,n,i,r,o,a,s,l,c,u=this._prepared,h="",d="",f=t;if(isNaN(t))return"".concat(f);if(t=+t,!1===u.pattern)return t.toString();if(0===t&&u.zero)return(u=u.zero).pattern;if(t<0&&u.negative?(u=u.negative,t=-t):u=u.positive,o=u.d,a=u.t,u.isFunctional)t=function(t,e,n){var i;return Kb.test(e)?t=iw(t,Number(/\d{2}/.exec(e)[0]),e,n):Gb.test(e)?t=iw(t,8,e,n):Zb.test(e)?t=iw(t,10,e,n):Jb.test(e)?t=iw(t,16,e,n):Qb.test(e)?t=iw(t,2,e,n):tw.test(e)&&(i="",t<0&&(i="-",t=-t),0===(t=Math.floor(t))?t="0":t<=5e5?(t=function(t,e){for(var n,i="",r=Number(String(t).slice(-3)),o=(t-r)/1e3,a=[0,1,4,5,9,10,40,50,90,100,400,500,900].reverse(),s=["0","I","IV","V","IX","X","XL","L","XC","C","CD","D","CM"].reverse();r>0;)for(n=0;n<a.length;n++)if(a[n]<=r){i+=s[n],r-=a[n];break}for(n=0;n<o;n++)i="M".concat(i);return e[1]!==e[1].toUpperCase()&&(i=i.toLowerCase()),i}(t,e),t=i+t):t=e+i+t.toExponential(0)),t}(t,u.pattern,o);else{if(u.percentage&&(t*=100),u.abbreviate){var p,g,m=Object.keys(this.abbreviations).map((function(t){return parseInt(t,10)})).sort((function(t,e){return t-e})),y=m[0];for(s=0,n=Number(Number(t).toExponential().split("e")[1]);y<=n&&s<m.length;)y=m[++s];s>0&&(p=m[s-1]),p&&n>0&&p>0?g=p:(n<0&&p<0||!p)&&(y<0&&y-n<=u.maxPrecision?g=y:p<=n&&!(y>0&&-n<=u.maxPrecision)&&(g=p)),g&&(h=this.abbreviations[g],t/=Math.pow(10,g))}if(i=Math.abs(t),e=u.temp,c=(l=u.numericPattern).split(o)[1],"I"===this.type&&(t=Math.round(t)),r=t,c||"#"!==l.slice(-1)[0])if(i>=1e15||i>0&&i<=1e-14)t=i?i.toExponential(15).replace(/\.?0+(?=e)/,""):"0";else{var v=Number(t.toFixed(Math.min(20,c?c.length:0)).split(".")[0]),x=l.split(o)[0];if(t=Wb(x+=o,v)||"0",c){var b=Math.max(0,Math.min(14,c.length)),w=c.replace(/#+$/,"").length,k=("I"===this.type?0:i%1).toFixed(b).slice(2).replace(/0+$/,"");for(s=k.length;s<w;s++)k+="0";k&&(t+=o+k)}else 0===v&&(r=0)}else if(i>=Math.pow(10,e)||i<1||i<1e-4)0===t?t="0":i<1e-4||i>=1e20?(t=(t=r.toExponential(Math.max(1,Math.min(14,e))-1)).replace(/\.?0+(?=e)/,""),d=""):(t=t.toPrecision(Math.max(1,Math.min(14,e)))).indexOf(".")>=0&&(t=(t=t.replace(t.indexOf("e")<0?/0+$/:/\.?0+(?=e)/,"")).replace(".",o));else{for(l+=o,e=Math.max(0,Math.min(20,e-Math.ceil(Math.log(i)/Math.log(10)))),s=0;s<e;s++)l+="#";t=Wb(l,t)}t=t.replace(u.numericRegex,(function(t){return t===a?u.groupTemp:t===o?u.decTemp:""})),r<0&&!/^-/.test(t)&&(t="-".concat(t))}return u.prefix+t+d+h+u.postfix}}],[{key:"getStaticFormatter",value:function(){return{prepare:function(){},formatValue:function(t){return"".concat(t)}}}}]),t}();function sw(t){var e,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.size,o=void 0===r?5e3:r,a=i.multipleArguments,s=void 0!==a&&a,l=i.toKey,c=void 0===l?function(t){return t}:l,u=Object.create(null),h=Object.create(null),d=0,f=0;return(e=s?function(){return n=c.apply(void 0,arguments),e.has(n)?e.get(n):e.set(n,t.apply(void 0,arguments))}:function(i){return n=c(i),e.has(n)?e.get(n):e.set(n,t(i))}).set=function(t,e){return d>=o&&(delete u[h[f]],delete h[f],d--,f++),u[t]=e,h[d]=t,d++,e},e.get=function(t){return u[t]},e.has=function(t){return t in u},e.clear=function(){u=Object.create(null),h=Object.create(null),d=0,f=0},e.size=function(){return d},e}function lw(t,e,n,i,r){var o=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Jx(aw,e)}(r,t,e,n,i),a=sw(o.formatValue.bind(o),{toKey:function(t){return isNaN(t)?t:+t}});function s(t){return a(t)}return s.format=function(t,e,n,i){return a.clear(),o.format(e,t,n,i)},s.pattern=function(t){return t&&(a.clear(),o.pattern=t,o.prepare()),o.pattern},s}var cw=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],uw=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],hw=["January","February","March","April","May","June","July","August","September","October","November","December"],dw=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function fw(t,e){for(var n=t.length;n<e;n++)t="0".concat(t);return t}function pw(t){var e=t.toString().split(".");return e[1]?e=Number("0.".concat(e[1])):0}var gw=function(){function t(e,n,i){Vx(this,t);var r,o=e||{};o.qCalendarStrings||(o.qCalendarStrings={qLongDayNames:cw,qDayNames:uw,qLongMonthNames:hw,qMonthNames:dw}),this.localeInfo=o,this.locale_days=o.qCalendarStrings.qLongDayNames.slice(),this.locale_days_abbr=o.qCalendarStrings.qDayNames.slice(),this.locale_months=o.qCalendarStrings.qLongMonthNames.slice(),this.locale_months_abbr=o.qCalendarStrings.qMonthNames.slice(),n||(n=(Yx(r={},"T",o.qTimeFmt||"hh:mm:ss"),Yx(r,"D",o.qDateFmt||"YYYY-MM-DD"),Yx(r,"TS",o.qTimestampFmt||"YYYY-MM-DD hh:mm:ss"),r)[i]),this.pattern=n}return Ux(t,[{key:"clone",value:function(){var e=new t(this.localeInfo,this.pattern);return e.subtype=this.subtype,e}},{key:"format",value:function(t,e){e||(e=this.pattern?this.pattern:"YYYY-MM-DD hh:mm:ss"),e=e.replace(/\[.+]|\[|]/g,"");var n,i,r,o,a,s=/t+/gi.test(e);t instanceof Date?(r=s,o=(i=t).getUTCHours(),r&&((o%=12)||(o=12)),(a=i.getUTCDay()-1)<0&&(a=6),n={year:i.getUTCFullYear(),month:i.getUTCMonth(),day:a,date:i.getUTCDate(),h:o,m:i.getUTCMinutes(),s:i.getUTCSeconds(),f:i.getUTCMilliseconds(),t:i.getUTCHours()>=12?"pm":"am"}):(t<0&&(t=-t,e="-".concat(e)),n=function(t,e){var n,i=function(t){var e=t,n=24*pw(e),i=60*pw(n),r=60*pw(i),o=1e3*pw(r);return{d:Math.floor(e),h:Math.floor(n),m:Math.floor(i),s:Math.floor(r),f:Math.round(o)}}(t),r=i.d,o=i.h,a=i.m,s=i.s,l=i.f,c=0;/w+|t+/gi.test(e)&&(n=new Date(Date.UTC(1899,11,30+Math.floor(t),0,0,Math.round(86400*(t-Math.floor(t))))),isNaN(n.getTime())&&(n=null)),/D+/gi.test(e)||(o+=24*r),/h+/gi.test(e)||(a+=60*o),/m+/gi.test(e)||(s+=60*a),/w+/gi.test(e)&&(c=n?n.getDay()-1:0)<0&&(c=6);var u="";return n&&(u=n.getUTCHours()>=12?"pm":"am"),{year:0,month:0,day:c,date:r,h:o,m:a,s:s,f:l,t:u}}(t,e));var l=function(t,e){return{"Y+|y+":{Y:"".concat(Number("".concat(e.year).slice(-2))),YY:fw("".concat(e.year).slice(-2),2),YYY:fw("".concat(e.year).slice(-3),3),def:function(t){return fw("".concat(e.year),t.length)}},"M+":{M:e.month+1,MM:fw("".concat(e.month+1),2),MMM:t.locale_months_abbr[e.month],def:t.locale_months[e.month]},"W+|w+":{W:e.day,WW:fw("".concat(e.day),2),WWW:t.locale_days_abbr[e.day],def:t.locale_days[e.day]},"D+|d+":{D:e.date,def:function(t){return fw("".concat(e.date),t.length)}},"h+|H+":{h:e.h,def:function(t){return fw("".concat(e.h),t.length)}},"m+":{m:e.m,def:function(t){return fw("".concat(e.m),t.length)}},"s+|S+":{s:e.s,def:function(t){return fw("".concat(e.s),t.length)}},"f+|F+":{def:function(t){var n="".concat(e.f),i=t.length-n.length;if(i>0)for(var r=0;r<i;r++)n+="0";else i<0&&(n=n.slice(0,t.length));return n}},"t{1,2}|T{1,2}":{def:function(t){var n=e.t;return t[0].toUpperCase()===t[0]&&(n=n.toUpperCase()),n.slice(0,t.length)}}}}(this,n),c=[];for(var u in l)Object.prototype.hasOwnProperty.call(l,u)&&c.push(u);var h=new RegExp(c.join("|"),"g");return e.replace(h,(function(t){var e,n,i;for(n in l)if(Object.prototype.hasOwnProperty.call(l,n)&&(e=new RegExp(n)).test(t))break;if(!e)return"";for(var r in l[n])if(r===t||r.toLowerCase()===t){void 0===(i=l[n][r])&&(i=l[n][r.toLowerCase()]);break}return void 0===i&&(i=l[n].def),"function"==typeof i&&(i=i(t)),i}))}}]),t}();function mw(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Jx(gw,e)}function yw(t){return new Date(Date.UTC(1899,11,30+Math.floor(t),0,0,0,Math.round(864e5*(t-Math.floor(t)))))}function vw(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TS",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=mw(n,t,e),r=sw(i.format.bind(i),{toKey:function(t){return"object"===Hx(t)&&"function"==typeof t.getTime?t.getTime():t}});function o(t){return"IV"!==e?yw(t):t}function a(t){return t=o(t),r(t)}return a.format=function(t,e){return r.clear(),e=o(e),i.format(e,t)},a.locale=function(n){return i=mw(n,t,e),r=sw(i.format.bind(i),{toKey:function(t){return"object"===Hx(t)?t.getTime():t}}),this},a.qtype=function(t){return void 0!==t&&(e=t,r.clear()),e},a}function xw(t,e){if(t&&t.qNumFormat&&-1!==["D","T","TS","IV"].indexOf(t.qNumFormat.qType))return vw(t.qNumFormat.qFmt,t.qNumFormat.qType,e);var n="#",i=e&&void 0!==e.qThousandSep?e.qThousandSep:",",r=e&&void 0!==e.qDecimalSep?e.qDecimalSep:".",o="U",a=t&&!!t.qIsAutoFormat;return t&&t.qNumFormat?(n=t.qNumFormat.qFmt||n,i=t.qNumFormat.qThou||i,r=t.qNumFormat.qDec||r,o=t.qNumFormat.qType||o,a=a&&-1===["M"].indexOf(t.qNumFormat.qType)):a=!0,(a||"U"===o)&&(n="#".concat(r,"##A"),o="U"),lw(n,i,r,o,e)}function bw(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.meta,i=e.id,r=e.key,o=e.localeInfo,a=e.fieldExtractor,s=e.value,l=e.type,c=e.sourceField,u=s||("dimension"===l?function(t){return t.qElemNo}:function(t){return t.qValue}),h=function(t){return t.qText||""},d="dimension"===l?"first":"avg",f=xw(n,o),p="dimension"===l?"first":function(t,e){return f(e)},g={id:function(){return i},key:function(){return r},raw:function(){return n},title:function(){return n.qFallbackTitle||n.label},type:function(){return l},origin:function(){return c},items:function(){return t||(t=a(g)),t},min:function(){return n.qMin},max:function(){return n.qMax},value:u,label:h,reduce:d,reduceLabel:p,formatter:function(){return f},tags:function(){return n.qTags}};return g}function ww(t,e,n,i,r){return(e[t]||[]).map((function(e,o){var a="".concat(i?"".concat(i,"/"):"").concat(t,"/").concat(o),s={instance:bw(ub({id:"".concat(n?"".concat(n,"/"):"").concat(a),key:a,meta:e},r))};return s.attrDims=ww("qAttrDimInfo",e,n,a,ub({},r,{value:function(t){return t.qElemNo},type:"dimension"})),s.attrExps=ww("qAttrExprInfo",e,n,a,ub({},r,{value:function(t){return t.qNum},type:"measure"})),s.measures=ww("qMeasureInfo",e,n,a,ub({},r,{value:function(t){return t.qValue},type:"measure"})),s}))}function kw(){var t,e,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.key,o=i.data,a=i.config,s=void 0===a?{}:a,l={fields:[],wrappedFields:[],allFields:[],virtualFields:[]},c=o;if(!c)throw new Error('Missing "data" input');if(!c.qDimensionInfo)throw new Error('The "data" input is not recognized as a hypercube');var u=kw.util,h={cache:l,cube:c,localeInfo:s.localeInfo,fieldExtractor:null,pages:null,hierarchy:function(){return null},virtualFields:s.virtualFields},d={key:function(){return r},raw:function(){return c},field:function(t){return Rb(t,h)},fields:function(){return l.fields.slice()},extract:function(t){return h.extractor(t,d,l,u)},hierarchy:function(t){return h.hierarchy(t,d,l,u)},_cache:function(){return l}};"K"===c.qMode||"T"===c.qMode||!c.qMode&&c.qNodesOnDim?(h.extractor=Hb,h.hierarchy=Bb,h.pages="K"===c.qMode?c.qStackedDataPages:c.qTreeDataPages):"S"===c.qMode?(h.extractor=pb,h.pages=c.qDataPages,h.hierarchy=Bb):h.extractor=function(){return[]},h.fieldExtractor=function(t){return h.extractor({field:t},d,l,u)};var f="S"===c.qMode?function(t){return t.qElemNumber}:void 0,p="S"===c.qMode?function(t){return t.qNum}:void 0;(t=l.wrappedFields).push.apply(t,Qx(ww("qDimensionInfo",c,r,"",ub({},h,{value:f,type:"dimension"})))),(e=l.wrappedFields).push.apply(e,Qx(ww("qMeasureInfo",c,r,"",ub({},h,{value:p,type:"measure"})))),l.fields=l.wrappedFields.map((function(t){return t.instance}));var g=function t(e){e.forEach((function(e){l.allFields.push(e.instance),t(e.measures),t(e.attrDims),t(e.attrExps)}))};return g(l.wrappedFields),(s.virtualFields||[]).forEach((function(t){var e=d.field(t.from),n=bw(Kx({meta:e.raw(),id:"".concat(r,"/").concat(t.key),sourceField:e,fieldExtractor:function(t){return h.extractor({field:t},d,l,u)},key:t.key,type:e.type(),localeInfo:h.localeInfo,value:e.value},t.override||{}));l.virtualFields.push(n)})),(n=l.allFields).push.apply(n,Qx(l.virtualFields)),d}var _w=[["qHyperCube","qHyperCubeDef"],["qTreeData","qTreeDataDef"],["qDimensionInfo","qDimensions"],["qMeasureInfo","qMeasures"],["qAttrDimInfo","qAttributeDimensions"],["qAttrExprInfo","qAttributeExpressions"]],Mw=/\/qDimensionInfo(?:\/(\d+))?/,Sw=/\/qMeasureInfo\/(\d+)/,Cw=/\/qAttrDimInfo\/(\d+)(?:\/(\d+))?/,qw=/\/qAttrExprInfo\/(\d+)/,Nw=/\/?qHyperCube/,Rw=/\/?qTreeData/,Aw=function(t){return"".concat(t.substr(0,t.indexOf("/qHyperCubeDef")+14))},Ow=function(t){return"".concat(t.substr(0,t.indexOf("/qTreeDataDef")+13))};function Dw(t,e){var n=t,i=-1,r=-1,o="",a=function(t){return t};Nw.test(t)?(o="".concat(n.substr(0,n.indexOf("qHyperCube")+10)),a=Aw):Rw.test(t)&&(o="".concat(n.substr(0,n.indexOf("qTreeData")+9)),a=Ow);var s=!0;if(Mw.test(t)&&(i=+Mw.exec(t)[1]),Sw.test(t)&&(r=+Sw.exec(t)[1]),Cw.test(t)){r=-1,i=0;var l=+Cw.exec(n)[2];isNaN(l)||(i=l,n=n.replace(/\/\d+$/,"")),s=!1}if(qw.test(t)){var c=r;if(e){r=0;var u=Cb(o,e);r+=(u.qMeasureInfo||[]).length,i>-1?(r=u.qDimensionInfo.slice(0,i).reduce((function(t,e){return t+e.qAttrExprInfo.length}),r),i=-1):(r=u.qDimensionInfo.reduce((function(t,e){return t+e.qAttrExprInfo.length}),r),r=u.qMeasureInfo.slice(0,c).reduce((function(t,e){return t+e.qAttrExprInfo.length}),r)),r+=+qw.exec(n)[1]}else i>-1?(i=-1,r=+qw.exec(n)[1]):r+=+qw.exec(n)[1]+1}return _w.forEach((function(t){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){r=!0,o=t}finally{try{i||null==s.return||s.return()}finally{if(r)throw o}}return n}}(t,e)||tb(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.")}()}(t,2),i=e[0],r=e[1];n=n.replace(i,r)})),s&&(n=a(n)),n&&"/"!==n[0]&&(n="/".concat(n)),{measureIdx:r,dimensionIdx:i,path:n}}function Ew(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,r=n.byCells,o=n.primarySource,a=[],s={},l=t.isActive(),c=!1;return t.brushes().forEach((function(t){var e=Dw(t.id,i);if("range"===t.type&&e.measureIdx>-1&&e.dimensionIdx>-1){var n=t.brush.ranges();n.length&&(c=!0,s.multiRangeSelectTreeDataValues||(s.multiRangeSelectTreeDataValues={path:e.path,ranges:[]}),n.forEach((function(t){return s.multiRangeSelectTreeDataValues.ranges.push({qMeasureIx:e.measureIdx,qDimensionIx:e.dimensionIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!0}})})))}else{if("range"===t.type&&e.measureIdx>-1){var l=t.brush.ranges();l.length&&(c=!0,s.rangeSelectHyperCubeValues||(s.rangeSelectHyperCubeValues={path:e.path,ranges:[]}),l.forEach((function(t){return s.rangeSelectHyperCubeValues.ranges.push({qMeasureIx:e.measureIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!0}})})))}if("range"===t.type&&e.dimensionIdx>-1){var u=t.brush.ranges();u.length&&(c=!0,s.selectHyperCubeContinuousRange||(s.selectHyperCubeContinuousRange={path:e.path,ranges:[]}),u.forEach((function(t){return s.selectHyperCubeContinuousRange.ranges.push({qDimIx:e.dimensionIdx,qRange:{qMin:t.min,qMax:t.max,qMinInclEq:!0,qMaxInclEq:!1}})})))}if("value"===t.type&&e.dimensionIdx>-1)if(r)if(i&&i.qHyperCube&&("P"===i.qHyperCube.qMode||"T"===i.qHyperCube.qMode||"K"===i.qHyperCube.qMode)){var h=i.qHyperCube,d=h.qNoOfLeftDims,f=h.qEffectiveInterColumnSortOrder.indexOf(e.dimensionIdx);if(s.selectPivotCells||(s.selectPivotCells={path:e.path,cells:[]}),t.id===o||!o){var p=t.brush.values().map((function(t){return+t})).filter((function(t){return!isNaN(t)}));(0===d||f>=d)&&d>-1?p.forEach((function(t){s.selectPivotCells.cells.push({qType:"T",qCol:t,qRow:f-d})})):p.forEach((function(t){s.selectPivotCells.cells.push({qType:"L",qCol:e.dimensionIdx,qRow:t})})),c=!!s.selectPivotCells.cells.length}}else s.selectHyperCubeCells||(s.selectHyperCubeCells={path:e.path,cols:[]}),s.selectHyperCubeCells.cols.push(e.dimensionIdx),t.id!==o&&(o||s.selectHyperCubeCells.values)||(s.selectHyperCubeCells.values=t.brush.values().map((function(t){return+t})).filter((function(t){return!isNaN(t)})),c=!!s.selectHyperCubeCells.values.length);else{var g=t.brush.values().map((function(t){return+t})).filter((function(t){return!isNaN(t)}));c=!!g.length,a.push({params:[e.path,e.dimensionIdx,g,!1],method:"selectHyperCubeValues"})}}})),!c&&l?[{method:"resetMadeSelections",params:[]}]:(s.rangeSelectHyperCubeValues&&a.push({method:"rangeSelectHyperCubeValues",params:[s.rangeSelectHyperCubeValues.path,s.rangeSelectHyperCubeValues.ranges,[],null===(e=n.orMode)||void 0===e||e]}),s.selectHyperCubeContinuousRange&&a.push({method:"selectHyperCubeContinuousRange",params:[s.selectHyperCubeContinuousRange.path,s.selectHyperCubeContinuousRange.ranges]}),s.selectHyperCubeCells&&a.push({method:"selectHyperCubeCells",params:[s.selectHyperCubeCells.path,s.selectHyperCubeCells.values,s.selectHyperCubeCells.cols]}),s.selectPivotCells&&a.push({method:"selectPivotCells",params:[s.selectPivotCells.path,s.selectPivotCells.cells]}),s.multiRangeSelectTreeDataValues&&a.push({method:"multiRangeSelectTreeDataValues",params:[s.multiRangeSelectTreeDataValues.path,s.multiRangeSelectTreeDataValues.ranges]}),a)}function Iw(t){kw.util=t.data("matrix").util,t.data("q",kw),t.formatter("q-number",lw),t.formatter("q-time",vw)}function Tw(t){var e=Lx(t.layout||{},t.path.split("/").join("."));if(!e)return!1;var n=e.qIsOneAndOnlyOne;return void 0!==n&&n}function jw(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==t||!t.length)return!1;var e=t.filter((function(t){return"object"===uy(t.data)&&Array.isArray(t.data.fields)})).every((function(t){return t.data.fields.every((function(t){var e=t.raw();return!(!e.qLocked&&e.qCardinal)}))}));return e}function Pw(t){var e=t.brush,n=t.colorField,i=t.legendAlias,r=t.useLegendCube,o=void 0!==r&&r;!n||/qAttrDimInfo/.test(n)?(e.removeKeyAlias("attrDim/qDimensionInfo/0"),i&&e.removeKeyAlias(i),e.addKeyAlias("attrDim/qDimensionInfo/0","qHyperCube/".concat(n))):o&&e.addKeyAlias(i,"qHyperCube/".concat(n))}Iw.qBrushHelper=Ew,Iw.selections=Ew;var zw="Shift";function Fw(t){var e=t.brush,n=t.getConfig;return{interceptor:function(t){var i=e.brushes(),r=n(),o=r.allowSimultaneous,a=r.layout,s=void 0===a?{}:a;i.forEach((function(n){var i,r,a;("range"===n.type||null!==(i=t[0])&&void 0!==i&&i.key&&(null===(r=t[0])||void 0===r?void 0:r.key)!==n.id&&0!==o.indexOf(null===(a=t[0])||void 0===a?void 0:a.key))&&e.clear([])}));var l=t.filter((function(t){return-2!==t.value}));return l.length>1?function(t){var e=t.layout,n=void 0===e?{}:e,i=t.values,r=void 0===i?[]:i;if(null==r||!r.length)return[];var o=Array.from(new Set(r.map((function(t){return t.key})))),a=[];return o.forEach((function(t){var e=Tw({layout:n,path:t}),i=r.filter((function(e){return e.key===t})),o=e?[i.pop()]:i;a.push.apply(a,my(o))})),a.filter(Boolean)}({layout:s,values:l}):l},rangeInterceptor:function(t){var i=e.brushes(),r=n().allowSimultaneous;return i.filter((function(t){return"value"===t.type})).length?(e.clear([]),t):(i.forEach((function(n){var i=n.id===t[0].key||r.includes(n.id)&&r.includes(t[0].key);"range"!==n.type||i||e.clear([])})),t)}}}var Lw=function t(e,n){return n[e]?t(e+1,n):e},$w=function(t,e){var n=e.reduce((function(t,e){return t[e]=!0,t}),{});return t.reduce((function(t,e,i){var r=Lw(i,n);return n[r]=!0,t[i]=r,t}),{})};function Bw(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.layout,n=t.filtered,i=void 0===n?{}:n,r=(null==e?void 0:e.qHyperCube)||{},o=r.qDimensionInfo,a=void 0===o?[]:o,s=r.qMeasureInfo,l=void 0===s?[]:s;return{dimensions:$w(a,i.dimensions||[]),measures:$w(l,i.measures||[])}}function Hw(t){var e=t.selection,n=t.fieldMap,i=e.method,r=e.params;if("selectHyperCubeValues"===i){var o=n.dimensions[r[1]];void 0!==o&&(r[1]=o)}return"selectHyperCubeContinuousRange"===i&&r[1].forEach((function(t){var e=n.dimensions[t.qDimIx];void 0!==e&&(t.qDimIx=e)})),e}var Vw=[],Ww=0,Uw=function(t){var e=Vw.filter((function(t){var e;return null===(e=t.selections)||void 0===e?void 0:e.isActive()}));e.length&&("Enter"===t.key?e.forEach((function(t){return t.selections.confirm()})):"Escape"!==t.key&&"Esc"!==t.key||e.forEach((function(t){return t.selections.cancel()})))},Yw=function(){document.addEventListener("keyup",Uw)},Xw=function(){document.removeEventListener("keyup",Uw)},Kw=function(t,e){Object.keys(e).forEach((function(n){t.on(n,e[n])}))},Gw=function(t,e){Object.keys(e).forEach((function(n){t.removeListener(n,e[n])}))};function Zw(t,e,n){if(e&&void 0!==n&&"selectHyperCubeContinuousRange"===t.method){var i=t.params;if(i&&i[1]&&i[1][0]){var r=i[1][0],o=r.qDimIx,a=r.qRange;"undefined"!==o&&a&&!1===a.qMaxInclEq&&a.qMax>=n&&(a.qMaxInclEq=!0)}}}function Jw(t){var e=t.chart,n=t.document,i=t.selectionInfo,r=t.eventName,o=t.componentName,a=t.brushName,s=void 0===a?"selection":a,l=t.emit,c=void 0===l?"rangeClear":l,u=i.event===r,h=n.querySelector("[data-key='".concat(o,"-edge-0']"));if(u||!h)return!1;var d=e.component(o);return!!d&&(d.emit(c),"string"==typeof s&&e.brush(s).clear(),d)}function Qw(t){var e=t.selectionInfo,n=t.chart,i=t.document,r=t.eventName,o=void 0===r?"discreteRange":r,a=t.componentName,s=void 0===a?"discrete-range-brush":a,l=t.cleared;return Jw({selectionInfo:e,chart:n,document:i,eventName:void 0!==l&&l?void 0:o,componentName:s,emit:"areaClear",brushName:t.brushName})}function tk(t){var e=t.selectionInfo,n=t.chart,i=t.document,r=t.eventName,o=void 0===r?"continuousRange":r,a=t.componentName,s=void 0===a?"continuous-range-brush":a,l=t.cleared;return Jw({selectionInfo:e,chart:n,document:i,eventName:void 0!==l&&l?void 0:o,componentName:s,brushName:t.brushName})}function ek(t){var e=t.selectionInfo,n=t.chart,i=t.document,r=t.componentName,o=void 0===r?"minor-range-brush":r,a=t.eventName,s=void 0===a?"minorRange":a,l=t.cleared,c=void 0!==l&&l,u=t.brushName,h=Jw({selectionInfo:e,chart:n,document:i,eventName:c?void 0:s,componentName:o,brushName:void 0!==u&&u});if(h){var d=h.settings.settings,f=d.scale,p=d.brush,g=n.scale(f).data().fields.map((function(t){return t.id()})),m=n.brush(p),y=m.brushes().filter((function(t){return"range"===t.type&&g.some((function(e){return e===t.id}))}));m&&y.length&&y.forEach((function(t){m.removeRanges(t.brush.ranges().map((function(e){return{key:t.id,range:e}})))}))}}function nk(t){var e=t.selectionInfo,n=t.chart,i=t.document,r=t.selections,o=t.eventName,a=void 0===o?"xAxis":o,s=t.cleared;Jw({selectionInfo:e,chart:n,document:i,eventName:void 0!==s&&s?void 0:a,componentName:"".concat(a,"-range-brush"),emit:"areaClear",brushName:!1})&&r.clear()}function ik(t){var e=t.chart,n=t.selectionInfo,i=t.selections,r=t.events,o=void 0===r?["tap"]:r,a=t.brushNames,s=void 0===a?[]:a;if(n&&o.includes(n.event)){var l=n.currentComponent;n.previousComponent!==l&&(i.clear(),s.forEach((function(t){return e.brush(t).end()})))}}function rk(t){var e=t.selectionInfo,n=t.chart,i=t.document,r=t.selections,o=t.eventName,a=void 0===o?"legendRange":o,s=t.componentName,l=void 0===s?"legend-range-brush":s,c=t.cleared,u=void 0!==c&&c,h=t.brushName;Jw({selectionInfo:e,chart:n,document:i,eventName:u?void 0:a,componentName:l,brushName:void 0!==h&&h})&&r.clear()}var ok=["chart","document","selections","selectionInfo"],ak=function(t){t.chart,t.document,t.selections,t.selectionInfo;var e=py(t,ok);e.clearDiscrete(),e.clearContinuous(),e.clearMinor(),e.clearRange(),e.clearTap(),e.clearLegend()};function sk(t){var e,n=t.lasso;null!=n&&null!==(e=n.active)&&void 0!==e&&e.call(n)&&(null==n||n.action(!1))}function lk(t){var e,n=t.chart,i=t.selectionInfo,r=t.selectionActions,o=t.actions,a=void 0===o?{}:o,s=t.selections,l=t.selectionEvents;if(!1===r||!1===l)return function(){};var c=(a||{}).lasso,u=void 0!==c&&c,h=r.reset,d=void 0===h?sk:h,f=r.clear,p=!1!==f&&function(t){var e=t.clear,n=void 0===e?ak:e,i=t.selections,r=t.selectionInfo,o=t.chart;return function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).cleared,e={selections:i,selectionInfo:r,chart:o,document:document,cleared:t};return n(ly({clearDiscrete:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Qw(ly(ly({},e),t))},clearContinuous:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return tk(ly(ly({},e),t))},clearMinor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ek(ly(ly({},e),t))},clearRange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return nk(ly(ly({},e),t))},clearTap:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ik(ly(ly({},e),t))},clearLegend:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return rk(ly(ly({},e),t))}},e))}}({clear:f,selections:s,selectionInfo:i,chart:n}),g=function(t){var e=t.chart,n=t.lasso,i=t.reset,r=t.clear,o=!1,a={deactivated:function(t){i({e:t,lasso:n})},canceled:function(t){i({e:t,lasso:n}),r({e:t,chart:e,document:document})},cleared:function(t){o||(o=!0,r({e:t,chart:e,document:document,cleared:!0}),o=!1)}};return!1===i&&delete a.deactivated,!1===r&&delete a.cleared,!1===i&&!1===r&&delete a.canceled,a}({chart:n,clear:p,reset:d,lasso:u}),m={};Object.entries(g).forEach((function(t){var e=gy(t,2),n=e[0],i=e[1];m[n]=function(t,e){return e?function(n){return e({event:n,defaultFunc:t})}:t}(i,l[n])}));var y=function(t){var e=t.selectionEvents,n=t.selections,i=t.selectionInfo,r=t.clear,o=t.chart,a=t.document,s=e.start,l={selections:n,selectionInfo:i,chart:o,document:a},c=function(t){return Object.assign(i,t||{})},u=function(t){var e=t.event,n=t.components;return function(){return function(t){var e=t.selectionInfo,n=t.clear,i=t.event,r=t.components,o=void 0===r?[]:r;(0,t.setSelectionInfo)(ly(ly({},void 0===e?{}:e),{},{event:i,components:o.map((function(t){return t.key})).filter(Boolean)})),n()}({event:e,components:n,clear:r,chart:o,selectionInfo:i,setSelectionInfo:c})}};return"function"==typeof s?function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];s(ly(ly({defaultFunc:u({event:t,components:e}),setSelectionInfo:c,clear:r},l),{},{event:t,components:e}))}:function(t){u({event:t,components:arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]})()}}({selectionEvents:l,selections:s,selectionInfo:i,clear:p,chart:n,document:document});return null==a||null===(e=a.select)||void 0===e||e.on("start",y),Object.entries(m).forEach((function(t){var e=gy(t,2),n=e[0],i=e[1];null==s||s.on(n,i)})),function(){var t;null==a||null===(t=a.select)||void 0===t||t.removeListener("start",y),Object.entries(m).forEach((function(t){var e=gy(t,2),n=e[0],i=e[1];null==s||s.removeListener(n,i)}))}}var ck=[{key:"qHyperCube/qDimensionInfo/0:numeric",includeMax:!1}];function uk(t){var e=t.chart,n=t.actions,i=t.selections,r=t.picassoQ,o=t.config,a=o.allowSimultaneous,s=void 0!==a&&a,l=o.majorScale,c=void 0===l?void 0:l,u=o.selectionActions,h=(u=void 0===u?{}:u).clear,d=u.reset,f=o.selectionEvents,p=void 0===f?{deactivated:void 0,canceled:void 0,cleared:void 0,start:void 0}:f,g=o.brushEvents,m=void 0===g?{}:g,y=o.brushName,v=void 0===y?"selection":y,x=o.brushMaxListeners,b=void 0===x?20:x,w=o.brushRanges,k=void 0!==w&&w,_=o.interceptors,M=void 0===_?{}:_,S=o.selectionsFn,C=void 0===S?r.selections:S,q=e.brush(v);if("number"==typeof b&&q.setMaxListeners(b),k){var N=!0===k?ck:k;q.configure({ranges:N})}var R={canSelect:!0,getIsSelectionLocked:!1,isInnerDimensionLocked:!1,lockedDimensions:[],singleSelectIndex:0,selectionInfo:{colorField:void 0,components:[],event:void 0,currentComponent:void 0,previousComponent:void 0}},A=function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.selections,i=e.brush,r=e.majorScale,o=e.actions,a=e.selectionsFn,s=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).path,l=void 0===s?"/qHyperCubeDef":s;if(!n)return{layout:function(){},filteredFields:function(){},allowSimultaneous:function(){},release:function(){}};var c=++Ww,u=null,h={dimensions:[],measures:[]},d=[],f={};n.on=n.on.bind(n),n.isActive=n.isActive.bind(n),n.addListener=n.addListener.bind(n),n.removeListener=n.removeListener.bind(n);var p=Fw({brush:i,getConfig:function(){return{layout:u,allowSimultaneous:d}}}),g=p.rangeInterceptor,m=p.interceptor;i.intercept("set-ranges",g),i.intercept("toggle-ranges",g),i.intercept("toggle-values",m),i.intercept("set-values",m),i.intercept("add-values",m),i.on("start",(function(){return n.begin(l)}));var y={activate:function(){},deactivated:function(){return i.end()},cleared:function(){return i.clear()},canceled:function(){return i.end()}};Kw(n,y);var v=null==r||null===(t=r.max)||void 0===t?void 0:t.call(r);return null!=o&&o.select?(o.select.on("start",(function(){var t;i.start(),"function"==typeof o.select.getBrushOptions&&(f=(t=o.select).getBrushOptions.apply(t,arguments))})),o.select.on("end",(function(){var t=a(i,f,u),e=Bw({layout:u,filtered:h});t.forEach((function(t){var i=Hw({selection:t,fieldMap:e});Zw(i,o.select.brushSelectionIncludeMax,v),n.select(i)}))}))):i.on("update",(function(){var t=a(i,f,u),e=Bw({layout:u,filtered:h});t.forEach((function(t){n.select(Hw({selection:t,fieldMap:e}))}))})),0===Vw.length&&Yw(),Vw.push({key:c,selections:n}),{layout:function(t){u=t},filteredFields:function(t){h=t},allowSimultaneous:function(t){d=t},release:function(){u=null;var t=Vw.indexOf(Vw.filter((function(t){return t.key===c}))[0]);-1!==t&&Vw.splice(t,1),Vw.length||Xw(),Gw(n,y)}}}({brush:q,majorScale:c,actions:n,selections:i,picassoQ:r,selectionsFn:C});!function(t){var e=t.brush,n=t.interceptors,i=void 0===n?{}:n;Object.entries(i).forEach((function(t){var n=gy(t,2),i=n[0],r=n[1];(Array.isArray(r)?r:[r]).forEach((function(t){e.intercept(i,t)}))}))}({brush:q,interceptors:M});var O=function(t){var e=t.chart,n=t.selectionActions,i=t.brush,r=t.actions,o=t.selectionInfo,a=t.selections,s=t.selectionEvents,l=function(t){var e=t.brush,n=t.chart,i=t.selectionInfo,r=t.brushEvents,o=void 0===r?{}:r,a=Object.entries(o).map((function(t){var r=gy(t,2),o=r[0],a=r[1],s=function(){return a({chart:n,selectionInfo:i})};return e.on(o,s),[o,s]}));return function(){a.forEach((function(t){var n=gy(t,2),i=n[0],r=n[1];e.removeListener(i,r)}))}}({brush:i,chart:e,selectionInfo:o,brushEvents:t.brushEvents}),c=lk({chart:e,selectionInfo:o,selectionActions:n,actions:r,selections:a,selectionEvents:s}),u=function(t){var e=t.actions;if(null==e||!e.lasso)return function(){};var n=!1,i=function(t){n||t.key!==zw||(e.lasso.action(!0),n=!0)},r=function(t){t.key===zw&&(e.lasso.action(!1),n=!1)};return document.addEventListener("keydown",i),document.addEventListener("keyup",r),function(){document.removeEventListener("keydown",i),document.removeEventListener("keyup",r)}}({actions:r});return function(){l(),c(),u()}}({chart:e,brush:q,actions:n,selections:i,selectionInfo:R.selectionInfo,selectionActions:{clear:h,reset:d},selectionEvents:p,brushEvents:m});if(s){var D=!0===s?my(Array(15)).map((function(t,e){return"qHyperCube/qMeasureInfo/".concat(e)})):s;A.allowSimultaneous(D)}return{unbindEvents:O,state:R,picassoSelections:A,brush:q}}var hk=["colorField","useLegendCube"];function dk(t){var e=t.chart,n=t.selections,i=t.actions,r=void 0!==i&&i,o=t.config,a=void 0===o?{}:o,s=uk({chart:e,actions:r,selections:n,picassoQ:Iw,config:a}),l=s.unbindEvents,c=s.state,u=s.picassoSelections,h=s.brush,d=a.custom,f=void 0===d?{}:d,p=a.legendAlias,g=void 0===p?void 0:p,m=a.setBrushAliases,y=void 0===m?Pw:m;return{getIsDimensionLocked:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return c.lockedDimensions[t]},getIsSelectionLocked:function(){var t,e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return null!==(t=null==n||null===(e=n.isLocked)||void 0===e?void 0:e.call(n))&&void 0!==t?t:jw(i)},getIsSingleSelect:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.singleSelectIndex;return c.singleSelectDimensions[t]},getCanSelect:function(){return c.canSelect},getSelectionInfo:function(){return c.selectionInfo},setLayout:function(t){var e=function(t){var e,n,i,r=t.selections,o=t.picassoSelections,a=t.layout,s={lockedDimensions:[],singleSelectDimensions:[]};null!=r&&null!==(e=r.isModal)&&void 0!==e&&e.call(r)&&r.confirm(),o.layout(a);var l=(null!==(n=null==a?void 0:a.qHyperCube)&&void 0!==n?n:{}).qDimensionInfo,c=void 0===l?[]:l;return s.lockedDimensions=c.map((function(t){return!!t.qLocked})),s.singleSelectDimensions=c.map((function(t,e){return Tw({layout:a,path:"qHyperCube/qDimensionInfo/".concat(e)})})),s.singleSelectIndex=function(t){var e,n=((null==t?void 0:t.qHyperCube)||{}).qDimensionInfo,i=void 0===n?[]:n;return null!==(e=i.map((function(t,e){var n;return!(t.qLocked||(null===(n=t.qCardinalities)||void 0===n?void 0:n.qHypercubeCardinal)<=1)&&e})).filter((function(t){return"number"==typeof t}))[0])&&void 0!==e?e:Math.max(i.length-1,0)}(a),s.canSelect=0===c.length||c.some((function(t){return!t.qLocked})),s.dimensionLocked=!(null===(i=c[0])||void 0===i||!i.qLocked),s}({selections:n,picassoSelections:u,layout:t});Object.assign(c,e)},setFilteredFields:function(t){u.filteredFields(t)},setBrushAliases:function(t){var e=t.colorField,n=t.useLegendCube,i=void 0!==n&&n,r=py(t,hk),o=ly({useLegendCube:i,colorField:e,brush:h,legendAlias:g},r);y(ly(ly({},o),{},{defaultFunc:function(){return Pw(o)}}))},destroy:function(){l(),u.release()},custom:ly({},f)}}var fk={dataRelatedPropertiesPaths:["qHyperCube.qGrandTotalRow","qHyperCube.qHasOtherValues","qHyperCube.qSize","qHyperCube.qDimensionInfo[].qAttrDimInfo","qHyperCube.qDimensionInfo[].qCardinalities","qHyperCube.qDimensionInfo[].qMax","qHyperCube.qDimensionInfo[].qMin","qHyperCube.qDimensionInfo[].qStateCounts","qHyperCube.qMeasureInfo[].qApprMaxGlyphCount","qHyperCube.qMeasureInfo[].qMax","qHyperCube.qMeasureInfo[].qMin","qHyperCube.qMeasureInfo[].qTrendLines","qHyperCube.qTreeNodesOnDim","qSelectionInfo"]};function pk(t){const{qHyperCube:e,...n}=t,{qDataPages:i,qStackedDataPages:r,qTreeDataPages:o,...a}=e,s=ay(!0,{},{...n,qHyperCube:{...a,qDataPages:null,qStackedDataPages:null,qTreeDataPages:null}}),{dataRelatedPropertiesPaths:l}=fk;return l.forEach((t=>{const e=t.split("[");if(1===e.length)void 0!==Lx(s,t)&&$x(s,t,null);else{const t=e[0],n=e[1].split("].")[1];Lx(s,t,[]).forEach((t=>{void 0!==Lx(t,n)&&$x(t,n,null)}))}})),s}var gk={axes:{trackBy:function({isTime:t,isContinuous:e,isMeasure:n,isMajor:i}){return r=>{if(t||e||n){var o;if("line"===r.type)return null!==(o=r.tickValue)&&void 0!==o?o:"axis";if("text"===r.type)return`${r.tickValue} ${r.text}`;if("container"===r.type){const t=r.children.filter((t=>"text"===t.type)).map((t=>t.text));return`${r.data.value} ${t.join("")}`}return Math.random()}if(i){if("line"===r.type&&void 0===r.tickValue)return"axis";const t=r.transform&&r.transform.match(/rotate/gi)?"rotated":"horizontal";return`${r.data.group?r.data.group.value+" ":""}${r.data.value} ${r.text} ${t}`}return Math.random()}},compensateForLayoutChanges:function({isMeasure:t,isTime:e,isContinuous:n,isHorizontal:i,dock:r}){return({currentNodes:o,currentRect:a,previousRect:s})=>{const l=a.x-s.x,c=a.y-s.y,u=a.width-s.width,h=a.height-s.height;t?("left"===r&&o.forEach((t=>{"line"===t.type?(t.x1+=u,t.x2+=u):"text"===t.type&&(t.x+=u)})),"left"!==r&&"right"!==r||o.forEach((t=>{var e;("line"===t.type&&(t.x1===t.x2?(t.y1=a.y,t.y2=t.y1+a.height):(Math.round(t.y1)<a.y||t.y1>a.y+a.height)&&(t.strokeWidth=0)),"text"===t.type)&&((t.y<a.y||t.y>a.y+a.height)&&(t.fontSize="1px","#"===(null===(e=t.fill)||void 0===e?void 0:e[0])&&(t.fill=`${t.fill.slice(0,1)}00${t.fill.slice(1)}`)))})),"top"!==r&&"bottom"!==r||o.forEach((t=>{var e;("line"===t.type&&(t.y1===t.y2?(t.x1=a.x,t.x2=t.x1+a.width):(Math.round(t.x1)<a.x||t.x1>a.x+a.width)&&(t.strokeWidth=0)),"text"===t.type)&&((t.x<a.x||t.x>a.x+a.width)&&(t.fontSize="1px","#"===(null===(e=t.fill)||void 0===e?void 0:e[0])&&(t.fill=`${t.fill.slice(0,1)}00${t.fill.slice(1)}`)))}))):e?o.forEach((t=>{"line"===t.type?t.y1===t.y2?t.x2+=u:t.x1===t.x2&&(t.x1-=l,t.x2-=l):"text"===t.type&&(t.x-=l)})):n||i?o.forEach((t=>{"line"===t.type&&t.y1===t.y2&&(t.x1+=l,t.x2+=l+u)})):o.forEach((t=>{"line"===t.type&&t.x1===t.x2&&(t.y1+=c,t.y2+=c+h)}))}}},bars:{trackBy:function(t){return t.data.measureIndex?`${t.data.value} ${t.data.measureIndex.value}`:t.data.group?`${t.data.value} ${t.data.group.value}`:t.data.stack?`${t.data.value} ${t.data.stack.value}`:""+t.data.value},compensateForLayoutChanges:function({currentNodes:t,currentRect:e,previousRect:n}){const i=e.x-n.x,r=e.y-n.y;0===i&&0===r||t.forEach((t=>{t.children&&t.children.length>0&&t.children.forEach((t=>{void 0!==t.x&&void 0!==t.y?(t.x-=i,t.y-=r):t.transform=`translate(${-i}, ${-r})`}))}))}},barOobs:{compensateForLayoutChanges:function({currentNodes:t,currentRect:e,previousRect:n}){const i=e.x-n.x;0===e.y-n.y&&0===i||t.forEach((t=>{t.children&&t.children.length>0&&t.children.forEach((t=>{t.opacity=0}))}))}},labels:{trackBy:function(t){if("rect"===t.type)return"-3"===t.data?Math.random():`${t.type} ${t.data} ${t.rotation}`;const e=t.transform&&t.transform.match(/rotate/gi)?"rotated":"horizontal";return`${t.type} ${t.data} ${t.text} ${e}`},compensateForLayoutChanges:function({currentNodes:t,currentRect:e,previousRect:n}){const i=e.x-n.x,r=e.y-n.y;0===i&&0===r||t.forEach((t=>{t.transform&&t.transform.match(/rotate\(-90/gi)?(t.x+=r,t.y-=i):(t.x-=i,t.y-=r)}))},linkData:function(t){return t.data.measureIndex?`${t.data.value} ${t.data.measureIndex.value}`:t.data.group?`${t.data.value} ${t.data.group.value}`:t.data.stack?`${t.data.value} ${t.data.stack.value}`:""+t.data.value}},lines:{trackBy:function(t){var e;return"line"===t.type?null!==(e=t.value)&&void 0!==e?e:Math.random():"path"===t.type?`${t.generatorType} ${t.layerObj.id} ${t.data.source.key}`:Math.random()},compensateForLayoutChanges:function({currentNodes:t,currentRect:e,previousRect:n}){const i=e.x-n.x,r=e.y-n.y;t.forEach((t=>{if(void 0!==t.x1&&void 0!==t.y1)t.y1===t.y2?(t.x2=t.x1+e.width,t.y1-=r,t.y2-=r):t.x1===t.x2&&(t.y2=t.y1+e.height,t.x1-=i,t.x2-=i);else{const e="x"===t.major.p?i/t.major.size:r/t.major.size,n="y"===t.minor.p?r/t.minor.size:i/t.minor.size;t.points.forEach((t=>{t.modified||(t.major-=e,t.minor-=n,t.minor0-=n,t.modified=!0)}))}}))}},lineOobs:{compensateForLayoutChanges:function({currentNodes:t,currentRect:e,previousRect:n}){const i=e.x-n.x;0===e.y-n.y&&0===i||t.forEach((t=>{t.opacity=0}))}},points:{trackBy:function(t){return t.data.line?`${t.data.line.value} ${t.data.major.value}`:""+t.data.major.value},compensateForLayoutChanges:function({currentNodes:t,currentRect:e,previousRect:n}){const i=e.x-n.x,r=e.y-n.y;0===i&&0===r||t.forEach((t=>{t.cx-=i,t.cy-=r}))}},refLineLabels:{trackBy:function(t){if(void 0!==t.value){if("rect"===t.type)return""+t.value;if("text"===t.type)return`${t.value} ${t.text}`}return Math.random()},compensateForLayoutChanges:function({currentNodes:t,currentRect:e,previousRect:n}){const i=e.x-n.x,r=e.y-n.y,o=e.width-n.width,a=e.height-n.height;let s=-i,l=-r;t.forEach((t=>{switch(t.dock){case"right":i>0&&(s=e.width);break;case"left":o<0&&(s=-n.width);break;case"top":a<0&&(l=-n.height);break;case"bottom":r>0&&(l=e.height)}switch(t.type){case"text":case"rect":t.x+=s,t.y+=l;break;case"circle":t.cx+=s,t.cy+=l;break;case"path":t.transform=`translate(${s}, ${l})`}}))}},shadowBars:{trackBy:function(){return Math.random()}},cacheProperties:function({viewCache:t,layout:e}){const n=pk(e);t.set("dataIndependentProperties",JSON.stringify(n))},propertiesHaveChanged:function({viewCache:t,layout:e}){const n=pk(e);return t.get("dataIndependentProperties")!==JSON.stringify(n)},nonUpdatingNode:{trackBy:function(){return Math.random()}}};function mk(t){const e=t.node.desc&&t.node.desc.share;return e?t.formatter("share")(e):""}function yk(t){return t.formatter("num")(t.node.data.num.value)}function vk({data:t}){return t?t.label:""}function xk(t){if(t.dataPoint.auto)return mk;switch(t.dataPoint.labelMode){case"share":return mk;case"value":return yk;case"none":return null;default:return mk}}function bk(t,e,n){const i=(n,i=1)=>({component:"fun",selector:n,strategy:{type:"rows",settings:{align:i,fill:".labelCenter"===n?({node:t})=>e.getContrastingColorTo(t.desc.fill):e.getStyle("","","color"),labels:".labelCenter"===n?[{label:xk(t)}]:[{label:vk}],linkData:e=>".labelCenter"===n?"none"===t.dataPoint.labelMode?Math.random():`${e.data.value} ${xk(t)(e)}`:`${e.data.value} ${vk(e)}`}}});return{key:"funnel-labels",type:"labels",layout:{displayOrder:2},settings:{sources:[i(".labelLeft",0),i(".labelCenter",.5)]},animations:{enabled:n,trackBy:t=>t.data}}}function wk(t){if(!t.showDimensionTitle||!t.qHyperCube.qDimensionInfo[0].qFallbackTitle)return!1;return{key:"dimension-title",type:"text",text:t.qHyperCube.qDimensionInfo[0].qFallbackTitle,layout:{dock:"top"}}}function kk({picasso:e}){const n=t.useElement(),i=t.useSelections(),r=t.useModel(),o=t.useApp(),a=t.useTranslator(),s=t.useOptions(),[l,c]=t.useState(),[u,h]=t.useState(),[d,f]=t.useState(),[p,g]=t.useState();return t.useEffect((()=>{const t=function(t){var e,n,i,r,o=t.picasso,a=t.model,s=t.app,l=t.translator,c=t.layoutService,u=void 0===c?void 0:c,h=t.createConfig,d=void 0===h?Fx:h,f=t.config,p=void 0===f?{}:f,g=t.custom,m=void 0===g?{}:g,y=p.localeInfo,v=p.key,x=p.theme,b=void 0===x?void 0:x,w=p.auto,k=void 0===w?void 0:w,_=p.definitionPath,M=null==u||null===(e=u.getLayout)||void 0===e?void 0:e.call(u),S={theme:b,key:v,localeInfo:y,layout:M,hc:null==u||null===(n=u.getHyperCube)||void 0===n?void 0:n.call(u),legendProps:null==u||null===(i=u.getLayoutValue)||void 0===i?void 0:i.call(u,"legend"),colorProps:ly(ly({},null==u||null===(r=u.getLayoutValue)||void 0===r?void 0:r.call(u,"color")),{},{useBaseColors:M?Tx(M):void 0})},C=Ex({picasso:o,model:a,app:s,translator:l,auto:k});!1!==k&&C.auto((function(t){return k?k({layout:t,defaultAuto:zx}):zx(t)}));var q=!1;return{getColor:function(){return C.color()},getPaletteColor:function(t){var e=t.index,n=t.color;return C.resolveUIColor({index:e,color:n})},getData:function(){return C.data()},getDatumProps:function(t){return C.datumProps(t)},getSnapshotData:function(){return C.getSnapshotData(_)},getSettingsForMeasure:function(t){return C.settingsForMeasure(t)},getSettings:function(){return C.settings()},getLegend:function(t,e){return C.legend(t,e)},getScales:function(){return C.scales()},getPalettes:function(){return C.palettes()},isSelectionLocked:function(t){var e=t.isMeasureSelectionLocked;return C.isSelectionLocked({isMeasureSelectionLocked:e})},isInitialized:function(){return q},custom:ly({},m),initialize:function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).createConfig,e=(void 0===t?d:t)({getUseBaseColors:Tx}),n=jx(S,e);return C.config(n),C.getAuxiliarySettings(_).then((function(){q=!0}))}}}({picasso:e,model:r,app:o,translator:a,config:{auto:!1,key:"fill"}});n.style.overflow="hidden";const l=e({renderer:{prio:[s.renderer||"svg"]}}).chart({element:n,data:[],settings:{}}),u=dk({chart:l,selections:i,config:{selectionActions:!1}});return f(u),h(t),c(l),g(function(){var t={};return{get:function(e){return t[e]},set:function(e,n){return t[e]=n,n},has:function(e){return e in t},remove:function(e){delete t[e]},empty:function(){t={}}}}()),()=>{u.destroy(),l.destroy()}}),[]),[l,u,d,p]}function _k({picasso:e,flags:n}){const i=t.useStaleLayout(),r=t.useTheme(),o=t.useConstraints(),a=t.useRect(),s=t.usePlugins(),l=t.useAppLayout().qLocaleInfo,[c,u,h,d]=kk({picasso:e,layout:i}),f=t.useOptions(),p=()=>{const t=c.element.clientWidth!==d.get("width")||c.element.clientHeight!==d.get("height");return!1!==f.chartAnimations&&n.isEnabled("IM_1355_ANIMATIONS_FUNNEL")&&!t&&!gk.propertiesHaveChanged({viewCache:d,layout:i})},[g]=t.usePromise((()=>{if(!u)return Promise.resolve();const t=function(t){return{layout:t,keys:{SCALE:{FILL:"fill"},COMPONENT:{FUNNEL:"fun",FUNNEL_LABELS:"funnel-labels",DIMENSION_TITLE:"dimension-title"}}}}(i),n=function(t){var e=t.picassoInstance,n=t.plugins,i=t.pluginArgs,r=void 0===i?{}:i,o={initialized:!1,definitions:[]};return{initialize:function(){return dy(cy().mark((function t(){var i,a,s,l;return cy().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!o.initialized){t.next=2;break}return t.abrupt("return");case 2:return a=Promise.all(n.filter((function(t){return"custom-component"===t.info.type})).map(function(){var t=dy(cy().mark((function t(n){var i;return cy().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n.info.componentName){t.next=2;break}throw new Error("plugin-service: Custom component is missing componentName");case 2:return t.next=4,n.fn(ly({},r));case 4:if("object"===uy(i=t.sent)){t.next=7;break}throw new Error("plugin-service: Custom component needs to be an object");case 7:e.component(n.info.componentName,i);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())),s=Promise.all(n.filter((function(t){return"component-definition"===t.info.type})).map((function(t){return t.fn(ly({},r))}))),t.next=6,Promise.all([a,s]);case 6:l=t.sent,o.initialized=!0,(i=o.definitions).push.apply(i,my(l[1]));case 9:case"end":return t.stop()}}),t)})))()},extendComponents:function(t){return o.initialized?(o.definitions.filter(Boolean).forEach((function(e){var n=gy(t.filter((function(t){return t.key&&t.key===e.key})),1)[0];if(n){var i=qy(!0,{},n.brush);qy(!0,n,e),e.brush&&(n.brush=function(t,e){return"object"===uy(t)&&Object.keys(t).length?(Array.isArray(e.consume)&&(t.consume=Bx({originalArray:t.consume,newArray:e.consume,matchKey:"context"})),Array.isArray(e.trigger)&&(t.trigger=Bx({originalArray:t.trigger,newArray:e.trigger,matchKey:"on"})),t):e}(i,e.brush))}else t.push(e)})),t):t}}}({picassoInstance:e,plugins:s,pluginArgs:t});return Promise.all([u.initialize({createConfig:({getUseBaseColors:t})=>({theme:r,colorProps:{...i.color,useBaseColors:t(i)},layout:i,hc:i.qHyperCube})}),n.initialize()]).then((()=>n))}),[i,u]);t.useEffect((()=>{if(!c||!u||!g)return;const t=[{type:"q",key:"qHyperCube",data:i.qHyperCube,config:{localeInfo:l}},...u.getData()],e=function({layout:t,constraints:e,colorService:n,theme:i,pluginService:r,animationsEnabled:o}){const a=function(t){return{...t.getScales()}}(n),s=n.getPalettes(),l=[function({layout:t,constraints:e,colorService:n,animationsEnabled:i}){const r=n.getDatumProps(),o=n.getColor();return{type:"funnel",key:"fun",data:{extract:{field:"qDimensionInfo/0",props:{num:{field:"qMeasureInfo/0"},...r}}},brush:e.select||e.active?{}:{trigger:[{contexts:["selection"],data:[""]}],consume:[{context:"selection",filter:t=>"section"===t.tag,style:{inactive:{opacity:.3}}}]},settings:{num:{ref:"num"},fill:o,mode:t.funnel.mode},animations:{enabled:i,isMainComponent:!0,trackBy:t=>`${t.tag}: ${t.data.value}`}}}({layout:t,constraints:e,colorService:n,animationsEnabled:o}),bk(t,i,o),wk(t)];return{palettes:s,style:{"$font-family":i.getStyle("","","fontFamily"),"$font-color":i.getStyle("","","color"),"$font-size":i.getStyle("","","fontSize")},scales:a,components:r.extendComponents(l),formatters:{share:{type:"d3-number",format:".1%"},num:{data:{field:"qMeasureInfo/0"}}}}}({layout:i,constraints:o,colorService:u,theme:r,pluginService:g,animationsEnabled:p});c.update({data:t,settings:e}),d.set("width",c.element.clientWidth),d.set("height",c.element.clientHeight),gk.cacheProperties({viewCache:d,layout:i})}),[c,u,r.name(),g,o]),t.useEffect((()=>{c&&(c.update(),d.set("width",c.element.clientWidth),d.set("height",c.element.clientHeight))}),[a.width,a.height]),t.useEffect((()=>{h&&h.setLayout(i)}),[i]),t.onTakeSnapshot((t=>u.getSnapshotData().then((e=>(t.snapshotData=t.snapshotData||{},t.snapshotData.content=t.snapshotData.content||{},t.snapshotData.content.chartData=e,t))).catch((()=>t))))}return function(t){const e=Yp();e.use(Fm),e.component("funnel",Xm);const{flags:n}=t;return{ext:Gm,qae:{properties:{initial:Km},data:{targets:Zm}},component(){_k({picasso:e,flags:n})}}}}));