@hpcc-js/chart 3.3.7 → 3.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5253 -2145
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +2 -3
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +6 -6
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@hpcc-js/api"),require("@hpcc-js/common"),require("@hpcc-js/util")):typeof define=="function"&&define.amd?define(["exports","@hpcc-js/api","@hpcc-js/common","@hpcc-js/util"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global["@hpcc-js/chart"]={},global["@hpcc-js/api"],global["@hpcc-js/common"],global["@hpcc-js/util"]))})(this,function(exports2,api,common,util){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);const PKG_NAME="@hpcc-js/chart",PKG_VERSION="3.2.0",BUILD_VERSION="3.2.1";var pi$3=Math.PI,tau$3=2*pi$3,epsilon$3=1e-6,tauEpsilon=tau$3-epsilon$3;function Path(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function path(){return new Path}Path.prototype=path.prototype={constructor:Path,moveTo:function(x2,y2){this._+="M"+(this._x0=this._x1=+x2)+","+(this._y0=this._y1=+y2)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(x2,y2){this._+="L"+(this._x1=+x2)+","+(this._y1=+y2)},quadraticCurveTo:function(x12,y12,x2,y2){this._+="Q"+ +x12+","+ +y12+","+(this._x1=+x2)+","+(this._y1=+y2)},bezierCurveTo:function(x12,y12,x2,y2,x3,y3){this._+="C"+ +x12+","+ +y12+","+ +x2+","+ +y2+","+(this._x1=+x3)+","+(this._y1=+y3)},arcTo:function(x12,y12,x2,y2,r){x12=+x12,y12=+y12,x2=+x2,y2=+y2,r=+r;var x02=this._x1,y02=this._y1,x21=x2-x12,y21=y2-y12,x01=x02-x12,y01=y02-y12,l01_2=x01*x01+y01*y01;if(r<0)throw new Error("negative radius: "+r);if(this._x1===null)this._+="M"+(this._x1=x12)+","+(this._y1=y12);else if(l01_2>epsilon$3)if(!(Math.abs(y01*x21-y21*x01)>epsilon$3)||!r)this._+="L"+(this._x1=x12)+","+(this._y1=y12);else{var x20=x2-x02,y20=y2-y02,l21_2=x21*x21+y21*y21,l20_2=x20*x20+y20*y20,l21=Math.sqrt(l21_2),l01=Math.sqrt(l01_2),l=r*Math.tan((pi$3-Math.acos((l21_2+l01_2-l20_2)/(2*l21*l01)))/2),t01=l/l01,t21=l/l21;Math.abs(t01-1)>epsilon$3&&(this._+="L"+(x12+t01*x01)+","+(y12+t01*y01)),this._+="A"+r+","+r+",0,0,"+ +(y01*x20>x01*y20)+","+(this._x1=x12+t21*x21)+","+(this._y1=y12+t21*y21)}},arc:function(x2,y2,r,a0,a1,ccw){x2=+x2,y2=+y2,r=+r,ccw=!!ccw;var dx=r*Math.cos(a0),dy=r*Math.sin(a0),x02=x2+dx,y02=y2+dy,cw2=1^ccw,da=ccw?a0-a1:a1-a0;if(r<0)throw new Error("negative radius: "+r);this._x1===null?this._+="M"+x02+","+y02:(Math.abs(this._x1-x02)>epsilon$3||Math.abs(this._y1-y02)>epsilon$3)&&(this._+="L"+x02+","+y02),r&&(da<0&&(da=da%tau$3+tau$3),da>tauEpsilon?this._+="A"+r+","+r+",0,1,"+cw2+","+(x2-dx)+","+(y2-dy)+"A"+r+","+r+",0,1,"+cw2+","+(this._x1=x02)+","+(this._y1=y02):da>epsilon$3&&(this._+="A"+r+","+r+",0,"+ +(da>=pi$3)+","+cw2+","+(this._x1=x2+r*Math.cos(a1))+","+(this._y1=y2+r*Math.sin(a1))))},rect:function(x2,y2,w,h){this._+="M"+(this._x0=this._x1=+x2)+","+(this._y0=this._y1=+y2)+"h"+ +w+"v"+ +h+"h"+-w+"Z"},toString:function(){return this._}};function constant$3(x2){return function(){return x2}}var abs$1=Math.abs,atan2=Math.atan2,cos=Math.cos,max=Math.max,min=Math.min,sin=Math.sin,sqrt$1=Math.sqrt,epsilon$2=1e-12,pi$2=Math.PI,halfPi$1=pi$2/2,tau$2=2*pi$2;function acos(x2){return x2>1?0:x2<-1?pi$2:Math.acos(x2)}function asin$1(x2){return x2>=1?halfPi$1:x2<=-1?-halfPi$1:Math.asin(x2)}function arcInnerRadius$1(d){return d.innerRadius}function arcOuterRadius$1(d){return d.outerRadius}function arcStartAngle$1(d){return d.startAngle}function arcEndAngle$1(d){return d.endAngle}function arcPadAngle$1(d){return d&&d.padAngle}function intersect$1(x02,y02,x12,y12,x2,y2,x3,y3){var x10=x12-x02,y10=y12-y02,x32=x3-x2,y32=y3-y2,t=y32*x10-x32*y10;if(!(t*t<epsilon$2))return t=(x32*(y02-y2)-y32*(x02-x2))/t,[x02+t*x10,y02+t*y10]}function cornerTangents$1(x02,y02,x12,y12,r1,rc,cw2){var x01=x02-x12,y01=y02-y12,lo=(cw2?rc:-rc)/sqrt$1(x01*x01+y01*y01),ox=lo*y01,oy=-lo*x01,x11=x02+ox,y11=y02+oy,x10=x12+ox,y10=y12+oy,x002=(x11+x10)/2,y002=(y11+y10)/2,dx=x10-x11,dy=y10-y11,d2=dx*dx+dy*dy,r=r1-rc,D=x11*y10-x10*y11,d=(dy<0?-1:1)*sqrt$1(max(0,r*r*d2-D*D)),cx0=(D*dy-dx*d)/d2,cy0=(-D*dx-dy*d)/d2,cx1=(D*dy+dx*d)/d2,cy1=(-D*dx+dy*d)/d2,dx0=cx0-x002,dy0=cy0-y002,dx1=cx1-x002,dy1=cy1-y002;return dx0*dx0+dy0*dy0>dx1*dx1+dy1*dy1&&(cx0=cx1,cy0=cy1),{cx:cx0,cy:cy0,x01:-ox,y01:-oy,x11:cx0*(r1/r-1),y11:cy0*(r1/r-1)}}function d3Arc(){var innerRadius=arcInnerRadius$1,outerRadius=arcOuterRadius$1,cornerRadius=constant$3(0),padRadius=null,startAngle=arcStartAngle$1,endAngle=arcEndAngle$1,padAngle=arcPadAngle$1,context=null;function arc2(){var buffer,r,r0=+innerRadius.apply(this,arguments),r1=+outerRadius.apply(this,arguments),a0=startAngle.apply(this,arguments)-halfPi$1,a1=endAngle.apply(this,arguments)-halfPi$1,da=abs$1(a1-a0),cw2=a1>a0;if(context||(context=buffer=path()),r1<r0&&(r=r1,r1=r0,r0=r),!(r1>epsilon$2))context.moveTo(0,0);else if(da>tau$2-epsilon$2)context.moveTo(r1*cos(a0),r1*sin(a0)),context.arc(0,0,r1,a0,a1,!cw2),r0>epsilon$2&&(context.moveTo(r0*cos(a1),r0*sin(a1)),context.arc(0,0,r0,a1,a0,cw2));else{var a01=a0,a11=a1,a00=a0,a10=a1,da0=da,da1=da,ap=padAngle.apply(this,arguments)/2,rp=ap>epsilon$2&&(padRadius?+padRadius.apply(this,arguments):sqrt$1(r0*r0+r1*r1)),rc=min(abs$1(r1-r0)/2,+cornerRadius.apply(this,arguments)),rc0=rc,rc1=rc,t0,t1;if(rp>epsilon$2){var p0=asin$1(rp/r0*sin(ap)),p1=asin$1(rp/r1*sin(ap));(da0-=p0*2)>epsilon$2?(p0*=cw2?1:-1,a00+=p0,a10-=p0):(da0=0,a00=a10=(a0+a1)/2),(da1-=p1*2)>epsilon$2?(p1*=cw2?1:-1,a01+=p1,a11-=p1):(da1=0,a01=a11=(a0+a1)/2)}var x01=r1*cos(a01),y01=r1*sin(a01),x10=r0*cos(a10),y10=r0*sin(a10);if(rc>epsilon$2){var x11=r1*cos(a11),y11=r1*sin(a11),x002=r0*cos(a00),y002=r0*sin(a00),oc;if(da<pi$2&&(oc=intersect$1(x01,y01,x002,y002,x11,y11,x10,y10))){var ax=x01-oc[0],ay=y01-oc[1],bx=x11-oc[0],by=y11-oc[1],kc=1/sin(acos((ax*bx+ay*by)/(sqrt$1(ax*ax+ay*ay)*sqrt$1(bx*bx+by*by)))/2),lc=sqrt$1(oc[0]*oc[0]+oc[1]*oc[1]);rc0=min(rc,(r0-lc)/(kc-1)),rc1=min(rc,(r1-lc)/(kc+1))}}da1>epsilon$2?rc1>epsilon$2?(t0=cornerTangents$1(x002,y002,x01,y01,r1,rc1,cw2),t1=cornerTangents$1(x11,y11,x10,y10,r1,rc1,cw2),context.moveTo(t0.cx+t0.x01,t0.cy+t0.y01),rc1<rc?context.arc(t0.cx,t0.cy,rc1,atan2(t0.y01,t0.x01),atan2(t1.y01,t1.x01),!cw2):(context.arc(t0.cx,t0.cy,rc1,atan2(t0.y01,t0.x01),atan2(t0.y11,t0.x11),!cw2),context.arc(0,0,r1,atan2(t0.cy+t0.y11,t0.cx+t0.x11),atan2(t1.cy+t1.y11,t1.cx+t1.x11),!cw2),context.arc(t1.cx,t1.cy,rc1,atan2(t1.y11,t1.x11),atan2(t1.y01,t1.x01),!cw2))):(context.moveTo(x01,y01),context.arc(0,0,r1,a01,a11,!cw2)):context.moveTo(x01,y01),!(r0>epsilon$2)||!(da0>epsilon$2)?context.lineTo(x10,y10):rc0>epsilon$2?(t0=cornerTangents$1(x10,y10,x11,y11,r0,-rc0,cw2),t1=cornerTangents$1(x01,y01,x002,y002,r0,-rc0,cw2),context.lineTo(t0.cx+t0.x01,t0.cy+t0.y01),rc0<rc?context.arc(t0.cx,t0.cy,rc0,atan2(t0.y01,t0.x01),atan2(t1.y01,t1.x01),!cw2):(context.arc(t0.cx,t0.cy,rc0,atan2(t0.y01,t0.x01),atan2(t0.y11,t0.x11),!cw2),context.arc(0,0,r0,atan2(t0.cy+t0.y11,t0.cx+t0.x11),atan2(t1.cy+t1.y11,t1.cx+t1.x11),cw2),context.arc(t1.cx,t1.cy,rc0,atan2(t1.y11,t1.x11),atan2(t1.y01,t1.x01),!cw2))):context.arc(0,0,r0,a10,a00,cw2)}if(context.closePath(),buffer)return context=null,buffer+""||null}return arc2.centroid=function(){var r=(+innerRadius.apply(this,arguments)+ +outerRadius.apply(this,arguments))/2,a=(+startAngle.apply(this,arguments)+ +endAngle.apply(this,arguments))/2-pi$2/2;return[cos(a)*r,sin(a)*r]},arc2.innerRadius=function(_){return arguments.length?(innerRadius=typeof _=="function"?_:constant$3(+_),arc2):innerRadius},arc2.outerRadius=function(_){return arguments.length?(outerRadius=typeof _=="function"?_:constant$3(+_),arc2):outerRadius},arc2.cornerRadius=function(_){return arguments.length?(cornerRadius=typeof _=="function"?_:constant$3(+_),arc2):cornerRadius},arc2.padRadius=function(_){return arguments.length?(padRadius=_==null?null:typeof _=="function"?_:constant$3(+_),arc2):padRadius},arc2.startAngle=function(_){return arguments.length?(startAngle=typeof _=="function"?_:constant$3(+_),arc2):startAngle},arc2.endAngle=function(_){return arguments.length?(endAngle=typeof _=="function"?_:constant$3(+_),arc2):endAngle},arc2.padAngle=function(_){return arguments.length?(padAngle=typeof _=="function"?_:constant$3(+_),arc2):padAngle},arc2.context=function(_){return arguments.length?(context=_??null,arc2):context},arc2}function Linear$1(context){this._context=context}Linear$1.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(x2,y2){switch(x2=+x2,y2=+y2,this._point){case 0:this._point=1,this._line?this._context.lineTo(x2,y2):this._context.moveTo(x2,y2);break;case 1:this._point=2;default:this._context.lineTo(x2,y2);break}}};function d3CurveLinear(context){return new Linear$1(context)}function x$1(p){return p[0]}function y$1(p){return p[1]}function d3Line(){var x2=x$1,y2=y$1,defined=constant$3(!0),context=null,curve=d3CurveLinear,output=null;function line2(data){var i,n=data.length,d,defined0=!1,buffer;for(context==null&&(output=curve(buffer=path())),i=0;i<=n;++i)!(i<n&&defined(d=data[i],i,data))===defined0&&((defined0=!defined0)?output.lineStart():output.lineEnd()),defined0&&output.point(+x2(d,i,data),+y2(d,i,data));if(buffer)return output=null,buffer+""||null}return line2.x=function(_){return arguments.length?(x2=typeof _=="function"?_:constant$3(+_),line2):x2},line2.y=function(_){return arguments.length?(y2=typeof _=="function"?_:constant$3(+_),line2):y2},line2.defined=function(_){return arguments.length?(defined=typeof _=="function"?_:constant$3(!!_),line2):defined},line2.curve=function(_){return arguments.length?(curve=_,context!=null&&(output=curve(context)),line2):curve},line2.context=function(_){return arguments.length?(_==null?context=output=null:output=curve(context=_),line2):context},line2}function d3Area(){var x02=x$1,x12=null,y02=constant$3(0),y12=y$1,defined=constant$3(!0),context=null,curve=d3CurveLinear,output=null;function area2(data){var i,j,k,n=data.length,d,defined0=!1,buffer,x0z=new Array(n),y0z=new Array(n);for(context==null&&(output=curve(buffer=path())),i=0;i<=n;++i){if(!(i<n&&defined(d=data[i],i,data))===defined0)if(defined0=!defined0)j=i,output.areaStart(),output.lineStart();else{for(output.lineEnd(),output.lineStart(),k=i-1;k>=j;--k)output.point(x0z[k],y0z[k]);output.lineEnd(),output.areaEnd()}defined0&&(x0z[i]=+x02(d,i,data),y0z[i]=+y02(d,i,data),output.point(x12?+x12(d,i,data):x0z[i],y12?+y12(d,i,data):y0z[i]))}if(buffer)return output=null,buffer+""||null}function arealine(){return d3Line().defined(defined).curve(curve).context(context)}return area2.x=function(_){return arguments.length?(x02=typeof _=="function"?_:constant$3(+_),x12=null,area2):x02},area2.x0=function(_){return arguments.length?(x02=typeof _=="function"?_:constant$3(+_),area2):x02},area2.x1=function(_){return arguments.length?(x12=_==null?null:typeof _=="function"?_:constant$3(+_),area2):x12},area2.y=function(_){return arguments.length?(y02=typeof _=="function"?_:constant$3(+_),y12=null,area2):y02},area2.y0=function(_){return arguments.length?(y02=typeof _=="function"?_:constant$3(+_),area2):y02},area2.y1=function(_){return arguments.length?(y12=_==null?null:typeof _=="function"?_:constant$3(+_),area2):y12},area2.lineX0=area2.lineY0=function(){return arealine().x(x02).y(y02)},area2.lineY1=function(){return arealine().x(x02).y(y12)},area2.lineX1=function(){return arealine().x(x12).y(y02)},area2.defined=function(_){return arguments.length?(defined=typeof _=="function"?_:constant$3(!!_),area2):defined},area2.curve=function(_){return arguments.length?(curve=_,context!=null&&(output=curve(context)),area2):curve},area2.context=function(_){return arguments.length?(_==null?context=output=null:output=curve(context=_),area2):context},area2}function descending(a,b){return b<a?-1:b>a?1:b>=a?0:NaN}function identity$2(d){return d}function d3Pie(){var value=identity$2,sortValues=descending,sort=null,startAngle=constant$3(0),endAngle=constant$3(tau$2),padAngle=constant$3(0);function pie(data){var i,n=data.length,j,k,sum=0,index=new Array(n),arcs=new Array(n),a0=+startAngle.apply(this,arguments),da=Math.min(tau$2,Math.max(-tau$2,endAngle.apply(this,arguments)-a0)),a1,p=Math.min(Math.abs(da)/n,padAngle.apply(this,arguments)),pa=p*(da<0?-1:1),v;for(i=0;i<n;++i)(v=arcs[index[i]=i]=+value(data[i],i,data))>0&&(sum+=v);for(sortValues!=null?index.sort(function(i2,j2){return sortValues(arcs[i2],arcs[j2])}):sort!=null&&index.sort(function(i2,j2){return sort(data[i2],data[j2])}),i=0,k=sum?(da-n*pa)/sum:0;i<n;++i,a0=a1)j=index[i],v=arcs[j],a1=a0+(v>0?v*k:0)+pa,arcs[j]={data:data[j],index:i,value:v,startAngle:a0,endAngle:a1,padAngle:p};return arcs}return pie.value=function(_){return arguments.length?(value=typeof _=="function"?_:constant$3(+_),pie):value},pie.sortValues=function(_){return arguments.length?(sortValues=_,sort=null,pie):sortValues},pie.sort=function(_){return arguments.length?(sort=_,sortValues=null,pie):sort},pie.startAngle=function(_){return arguments.length?(startAngle=typeof _=="function"?_:constant$3(+_),pie):startAngle},pie.endAngle=function(_){return arguments.length?(endAngle=typeof _=="function"?_:constant$3(+_),pie):endAngle},pie.padAngle=function(_){return arguments.length?(padAngle=typeof _=="function"?_:constant$3(+_),pie):padAngle},pie}function point$7(that,x2,y2){that._context.bezierCurveTo((2*that._x0+that._x1)/3,(2*that._y0+that._y1)/3,(that._x0+2*that._x1)/3,(that._y0+2*that._y1)/3,(that._x0+4*that._x1+x2)/6,(that._y0+4*that._y1+y2)/6)}function Basis$1(context){this._context=context}Basis$1.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:point$7(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(x2,y2){switch(x2=+x2,y2=+y2,this._point){case 0:this._point=1,this._line?this._context.lineTo(x2,y2):this._context.moveTo(x2,y2);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:point$7(this,x2,y2);break}this._x0=this._x1,this._x1=x2,this._y0=this._y1,this._y1=y2}};function d3CurveBasis(context){return new Basis$1(context)}function Bundle$1(context,beta){this._basis=new Basis$1(context),this._beta=beta}Bundle$1.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var x2=this._x,y2=this._y,j=x2.length-1;if(j>0)for(var x02=x2[0],y02=y2[0],dx=x2[j]-x02,dy=y2[j]-y02,i=-1,t;++i<=j;)t=i/j,this._basis.point(this._beta*x2[i]+(1-this._beta)*(x02+t*dx),this._beta*y2[i]+(1-this._beta)*(y02+t*dy));this._x=this._y=null,this._basis.lineEnd()},point:function(x2,y2){this._x.push(+x2),this._y.push(+y2)}};const d3CurveBundle=function custom(beta){function bundle(context){return beta===1?new Basis$1(context):new Bundle$1(context,beta)}return bundle.beta=function(beta2){return custom(+beta2)},bundle}(.85);function point$6(that,x2,y2){that._context.bezierCurveTo(that._x1+that._k*(that._x2-that._x0),that._y1+that._k*(that._y2-that._y0),that._x2+that._k*(that._x1-x2),that._y2+that._k*(that._y1-y2),that._x2,that._y2)}function Cardinal$1(context,tension){this._context=context,this._k=(1-tension)/6}Cardinal$1.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:point$6(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(x2,y2){switch(x2=+x2,y2=+y2,this._point){case 0:this._point=1,this._line?this._context.lineTo(x2,y2):this._context.moveTo(x2,y2);break;case 1:this._point=2,this._x1=x2,this._y1=y2;break;case 2:this._point=3;default:point$6(this,x2,y2);break}this._x0=this._x1,this._x1=this._x2,this._x2=x2,this._y0=this._y1,this._y1=this._y2,this._y2=y2}};const d3CurveCardinal=function custom(tension){function cardinal(context){return new Cardinal$1(context,tension)}return cardinal.tension=function(tension2){return custom(+tension2)},cardinal}(0);function point$5(that,x2,y2){var x12=that._x1,y12=that._y1,x22=that._x2,y22=that._y2;if(that._l01_a>epsilon$2){var a=2*that._l01_2a+3*that._l01_a*that._l12_a+that._l12_2a,n=3*that._l01_a*(that._l01_a+that._l12_a);x12=(x12*a-that._x0*that._l12_2a+that._x2*that._l01_2a)/n,y12=(y12*a-that._y0*that._l12_2a+that._y2*that._l01_2a)/n}if(that._l23_a>epsilon$2){var b=2*that._l23_2a+3*that._l23_a*that._l12_a+that._l12_2a,m=3*that._l23_a*(that._l23_a+that._l12_a);x22=(x22*b+that._x1*that._l23_2a-x2*that._l12_2a)/m,y22=(y22*b+that._y1*that._l23_2a-y2*that._l12_2a)/m}that._context.bezierCurveTo(x12,y12,x22,y22,that._x2,that._y2)}function CatmullRom$1(context,alpha){this._context=context,this._alpha=alpha}CatmullRom$1.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);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(x2,y2){if(x2=+x2,y2=+y2,this._point){var x23=this._x2-x2,y23=this._y2-y2;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(x23*x23+y23*y23,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(x2,y2):this._context.moveTo(x2,y2);break;case 1:this._point=2;break;case 2:this._point=3;default:point$5(this,x2,y2);break}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=x2,this._y0=this._y1,this._y1=this._y2,this._y2=y2}};const d3curveCatmullRom=function custom(alpha){function catmullRom(context){return alpha?new CatmullRom$1(context,alpha):new Cardinal$1(context,0)}return catmullRom.alpha=function(alpha2){return custom(+alpha2)},catmullRom}(.5);function sign$1(x2){return x2<0?-1:1}function slope3$1(that,x2,y2){var h0=that._x1-that._x0,h1=x2-that._x1,s0=(that._y1-that._y0)/(h0||h1<0&&-0),s1=(y2-that._y1)/(h1||h0<0&&-0),p=(s0*h1+s1*h0)/(h0+h1);return(sign$1(s0)+sign$1(s1))*Math.min(Math.abs(s0),Math.abs(s1),.5*Math.abs(p))||0}function slope2$1(that,t){var h=that._x1-that._x0;return h?(3*(that._y1-that._y0)/h-t)/2:t}function point$4(that,t0,t1){var x02=that._x0,y02=that._y0,x12=that._x1,y12=that._y1,dx=(x12-x02)/3;that._context.bezierCurveTo(x02+dx,y02+dx*t0,x12-dx,y12-dx*t1,x12,y12)}function MonotoneX$1(context){this._context=context}MonotoneX$1.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:point$4(this,this._t0,slope2$1(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(x2,y2){var t1=NaN;if(x2=+x2,y2=+y2,!(x2===this._x1&&y2===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(x2,y2):this._context.moveTo(x2,y2);break;case 1:this._point=2;break;case 2:this._point=3,point$4(this,slope2$1(this,t1=slope3$1(this,x2,y2)),t1);break;default:point$4(this,this._t0,t1=slope3$1(this,x2,y2));break}this._x0=this._x1,this._x1=x2,this._y0=this._y1,this._y1=y2,this._t0=t1}}},Object.create(MonotoneX$1.prototype).point=function(x2,y2){MonotoneX$1.prototype.point.call(this,y2,x2)};function monotoneX(context){return new MonotoneX$1(context)}function Natural(context){this._context=context}Natural.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var x2=this._x,y2=this._y,n=x2.length;if(n)if(this._line?this._context.lineTo(x2[0],y2[0]):this._context.moveTo(x2[0],y2[0]),n===2)this._context.lineTo(x2[1],y2[1]);else for(var px=controlPoints(x2),py=controlPoints(y2),i0=0,i1=1;i1<n;++i0,++i1)this._context.bezierCurveTo(px[0][i0],py[0][i0],px[1][i0],py[1][i0],x2[i1],y2[i1]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(x2,y2){this._x.push(+x2),this._y.push(+y2)}};function controlPoints(x2){var i,n=x2.length-1,m,a=new Array(n),b=new Array(n),r=new Array(n);for(a[0]=0,b[0]=2,r[0]=x2[0]+2*x2[1],i=1;i<n-1;++i)a[i]=1,b[i]=4,r[i]=4*x2[i]+2*x2[i+1];for(a[n-1]=2,b[n-1]=7,r[n-1]=8*x2[n-1]+x2[n],i=1;i<n;++i)m=a[i]/b[i-1],b[i]-=m,r[i]-=m*r[i-1];for(a[n-1]=r[n-1]/b[n-1],i=n-2;i>=0;--i)a[i]=(r[i]-a[i+1])/b[i];for(b[n-1]=(x2[n]+a[n-1])/2,i=0;i<n-1;++i)b[i]=2*x2[i+1]-a[i+1];return[a,b]}function d3CurveNatural(context){return new Natural(context)}function Step$1(context,t){this._context=context,this._t=t}Step$1.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&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(x2,y2){switch(x2=+x2,y2=+y2,this._point){case 0:this._point=1,this._line?this._context.lineTo(x2,y2):this._context.moveTo(x2,y2);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,y2),this._context.lineTo(x2,y2);else{var x12=this._x*(1-this._t)+x2*this._t;this._context.lineTo(x12,this._y),this._context.lineTo(x12,y2)}break}}this._x=x2,this._y=y2}};function d3CurveStep(context){return new Step$1(context,.5)}function stepBefore(context){return new Step$1(context,0)}function stepAfter(context){return new Step$1(context,1)}var slice$2=Array.prototype.slice;function identity$1(x2){return x2}var top=1,right=2,bottom=3,left=4,epsilon$1=1e-6;function translateX(x2){return"translate("+(x2+.5)+",0)"}function translateY(y2){return"translate(0,"+(y2+.5)+")"}function number(scale){return function(d){return+scale(d)}}function center(scale){var offset=Math.max(0,scale.bandwidth()-1)/2;return scale.round()&&(offset=Math.round(offset)),function(d){return+scale(d)+offset}}function entering(){return!this.__axis}function axis(orient,scale){var tickArguments=[],tickValues=null,tickFormat=null,tickSizeInner=6,tickSizeOuter=6,tickPadding=3,k=orient===top||orient===left?-1:1,x2=orient===left||orient===right?"x":"y",transform=orient===top||orient===bottom?translateX:translateY;function axis2(context){var values=tickValues??(scale.ticks?scale.ticks.apply(scale,tickArguments):scale.domain()),format=tickFormat??(scale.tickFormat?scale.tickFormat.apply(scale,tickArguments):identity$1),spacing=Math.max(tickSizeInner,0)+tickPadding,range=scale.range(),range0=+range[0]+.5,range1=+range[range.length-1]+.5,position=(scale.bandwidth?center:number)(scale.copy()),selection=context.selection?context.selection():context,path2=selection.selectAll(".domain").data([null]),tick=selection.selectAll(".tick").data(values,scale).order(),tickExit=tick.exit(),tickEnter=tick.enter().append("g").attr("class","tick"),line2=tick.select("line"),text=tick.select("text");path2=path2.merge(path2.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),tick=tick.merge(tickEnter),line2=line2.merge(tickEnter.append("line").attr("stroke","currentColor").attr(x2+"2",k*tickSizeInner)),text=text.merge(tickEnter.append("text").attr("fill","currentColor").attr(x2,k*spacing).attr("dy",orient===top?"0em":orient===bottom?"0.71em":"0.32em")),context!==selection&&(path2=path2.transition(context),tick=tick.transition(context),line2=line2.transition(context),text=text.transition(context),tickExit=tickExit.transition(context).attr("opacity",epsilon$1).attr("transform",function(d){return isFinite(d=position(d))?transform(d):this.getAttribute("transform")}),tickEnter.attr("opacity",epsilon$1).attr("transform",function(d){var p=this.parentNode.__axis;return transform(p&&isFinite(p=p(d))?p:position(d))})),tickExit.remove(),path2.attr("d",orient===left||orient==right?tickSizeOuter?"M"+k*tickSizeOuter+","+range0+"H0.5V"+range1+"H"+k*tickSizeOuter:"M0.5,"+range0+"V"+range1:tickSizeOuter?"M"+range0+","+k*tickSizeOuter+"V0.5H"+range1+"V"+k*tickSizeOuter:"M"+range0+",0.5H"+range1),tick.attr("opacity",1).attr("transform",function(d){return transform(position(d))}),line2.attr(x2+"2",k*tickSizeInner),text.attr(x2,k*spacing).text(format),selection.filter(entering).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",orient===right?"start":orient===left?"end":"middle"),selection.each(function(){this.__axis=position})}return axis2.scale=function(_){return arguments.length?(scale=_,axis2):scale},axis2.ticks=function(){return tickArguments=slice$2.call(arguments),axis2},axis2.tickArguments=function(_){return arguments.length?(tickArguments=_==null?[]:slice$2.call(_),axis2):tickArguments.slice()},axis2.tickValues=function(_){return arguments.length?(tickValues=_==null?null:slice$2.call(_),axis2):tickValues&&tickValues.slice()},axis2.tickFormat=function(_){return arguments.length?(tickFormat=_,axis2):tickFormat},axis2.tickSize=function(_){return arguments.length?(tickSizeInner=tickSizeOuter=+_,axis2):tickSizeInner},axis2.tickSizeInner=function(_){return arguments.length?(tickSizeInner=+_,axis2):tickSizeInner},axis2.tickSizeOuter=function(_){return arguments.length?(tickSizeOuter=+_,axis2):tickSizeOuter},axis2.tickPadding=function(_){return arguments.length?(tickPadding=+_,axis2):tickPadding},axis2}function axisTop(scale){return axis(top,scale)}function axisRight(scale){return axis(right,scale)}function axisBottom(scale){return axis(bottom,scale)}function axisLeft(scale){return axis(left,scale)}class Axis extends common.SVGWidget{constructor(drawStartPosition="origin"){super();__publicField(this,"_origType");__publicField(this,"_origTimePattern");__publicField(this,"parser");__publicField(this,"parserInvert");__publicField(this,"formatter");__publicField(this,"d3Scale");__publicField(this,"d3Axis");__publicField(this,"d3Guides");__publicField(this,"_guideElement");__publicField(this,"svg");__publicField(this,"svgAxis");__publicField(this,"svgGuides");__publicField(this,"_prevOrientation");this._drawStartPos=drawStartPosition,this.updateScale()}lowValue(){return this.parse(this.low())}highValue(){return this.parse(this.high())}parse(d,forceNumeric){if(d instanceof Array)return d.map(function(d2){return this.parse(d2)},this);if(d!=null){if(this.parser)return this.parser(typeof d=="number"?d.toString():d);if(forceNumeric&&typeof d=="string")return+d}return d}parseInvert(d){return d instanceof Array?d.map(function(d2){return this.parseInvert(d2)},this):this.parserInvert&&d?this.parserInvert(d):d}format(d){return d instanceof Array?d.map(function(d2){return this.format(d2)},this):d!=null&&this.formatter?this.formatter(d):d}parseFormat(d){return this.format(this.parse(d))}scalePos(d){let retVal=this.d3Scale(this.parse(d));return this.type()==="ordinal"&&(retVal+=this.bandwidth()/2),retVal}bandwidth(){return this.d3Scale.bandwidth?this.d3Scale.bandwidth():0}isHorizontal(){switch(this.orientation()){case"left":case"right":return!1}return!0}domain(_){return arguments.length?(this.d3Scale.domain(_),this):this.d3Scale.domain()}range(_){if(!arguments.length){if(this.d3Scale.rangeRoundBands)return this.d3Scale.rangeExtent();if(this.d3Scale.rangeRound)return this.d3Scale.range()}return this.d3Scale.rangeRoundBands?this.d3Scale.rangeRoundBands(_,.1):this.d3Scale.rangeRound&&this.d3Scale.range(_),this}invert(pos){return this.d3Scale.invert(pos)}guideTarget(_){return this._guideElement=common.select(_).attr("class",this._class),this}enter(domNode,element){super.enter(domNode,element),this.svg=element.append("g"),this.svgAxis=this.svg.append("g").attr("class","axis"),this.svgGuides=(this._guideElement||element).append("g").attr("class","guide")}updateScale(){switch(this.type()){case"ordinal":if(this.d3Scale=common.scaleBand().paddingInner(this.ordinalPaddingInner()).paddingOuter(this.ordinalPaddingOuter()),this.ordinals_exists()&&this.d3Scale.domain(this.ordinals()),this.parser=null,this.ordinalMappings_exists()){const mappings=this.ordinalMappings();this.formatter=_=>mappings[_]||_}else this.formatter=null;break;case"linear":this.d3Scale=common.scaleLinear(),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=null,this.formatter=this.tickFormat_exists()?common.format(this.tickFormat()):null;break;case"pow":this.d3Scale=common.scalePow().exponent(this.powExponent()),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=null,this.formatter=this.tickFormat_exists()?common.format(this.tickFormat()):null;break;case"log":this.d3Scale=common.scaleLog().base(this.logBase()),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=null,this.formatter=this.tickFormat_exists()?common.format(this.tickFormat()):null;break;case"time":this.d3Scale=common.scaleTime(),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=this.timePattern_exists()?common.timeParse(this.timePattern()):null,this.parserInvert=this.timePattern_exists()?common.timeFormat(this.timePattern()):null,this.formatter=this.tickFormat_exists()?common.timeFormat(this.tickFormat()):null;break}if(this._prevOrientation!==this.orientation()){switch(this.orientation()){case"left":this.d3Axis=axisLeft(this.d3Scale),this.d3Guides=axisLeft(this.d3Scale);break;case"top":this.d3Axis=axisTop(this.d3Scale),this.d3Guides=axisTop(this.d3Scale);break;case"right":this.d3Axis=axisRight(this.d3Scale),this.d3Guides=axisRight(this.d3Scale);break;case"bottom":default:this.d3Axis=axisBottom(this.d3Scale),this.d3Guides=axisBottom(this.d3Scale);break}this._prevOrientation=this.orientation(),this.svgAxis&&this.svgAxis.html(""),this.svgGuides&&this.svgGuides.html("")}if(this.extend())switch(this.type()){case"ordinal":break;default:let length,delta,low,high,newLow,newHigh;this.isHorizontal()?(length=this.width(),this.d3Scale.range([0,length]),delta=length*this.extend()/100,low=this.d3Scale.invert(0),newLow=this.d3Scale.invert(-delta),high=this.d3Scale.invert(length),newHigh=this.d3Scale.invert(length+delta)):(length=this.height(),this.d3Scale.range([length,0]),delta=length*this.extend()/100,low=this.d3Scale.invert(length),newLow=this.d3Scale.invert(length+delta),high=this.d3Scale.invert(0),newHigh=this.d3Scale.invert(-delta)),newLow===low&&(newLow=low-low*this.extend()/100),newHigh===high&&(newHigh=high+high*this.extend()/100),Math.sign(low)!==Math.sign(newLow)&&(newLow=0),Math.sign(high)!==Math.sign(newHigh)&&(newHigh=0),this.d3Scale.domain([newLow,newHigh]);break}this.d3Axis.scale(this.d3Scale).tickFormat(this.formatter).ticks(this.tickCount()),this.d3Guides.scale(this.d3Scale).tickSize(this.tickLength_exists()?-this.tickLength():0).tickFormat("").ticks(this.tickCount());const customTicks=this.ticks();return customTicks.length&&(this.d3Axis.tickValues(customTicks.map(d=>this.parse(d.value))).tickFormat((_d,i)=>customTicks[i].label),this.d3Guides.tickValues(customTicks.map(d=>this.parse(d.value)))),this}adjustText(svg,tickOverlapModulus){const isHoriztontal=this.isHorizontal(),isLeft=this.orientation()==="left",isBottom=this.orientation()==="bottom",context=this,textSelection=svg.selectAll(".tick > text").style("font-family",this.fontFamily()).style("font-size",this.fontSize_exists()?this.fontSize()+"px":null);if(this.overlapMode()==="linebreak")this.type()==="ordinal"&&textSelection.call(function(){return context.linebreak.apply(context,arguments)},this.bandwidth());else if(this.overlapMode()==="wrap")this.type()==="ordinal"&&textSelection.call(function(){return context.wrap.apply(context,arguments)},this.bandwidth());else switch(isHoriztontal?this.overlapMode():"none"){case"stagger":textSelection.style("text-anchor","middle").attr("dy",function(_d,i){return(isBottom?1:-1)*((isBottom?.71:0)+i%tickOverlapModulus)+"em"}).attr("dx",0).attr("visibility",null).attr("transform","rotate(0)");break;case"hide":textSelection.style("text-anchor","middle").attr("dy",(isBottom?.71:0)+"em").attr("dx",0).attr("visibility",function(_d,i){return i%tickOverlapModulus?"hidden":null}).attr("transform","rotate(0)");break;case"rotate":const deg=-this.labelRotation()||0;if(deg!==0&&tickOverlapModulus>1){textSelection.each(function(){const elm=common.select(this),bbox=elm.node().getBBox(),dyOff=(isBottom?1:-1)*Math.sin(Math.PI*(-Math.abs(deg)/180));elm.style("text-anchor",deg>0?isBottom?"start":"end":isBottom?"end":"start").attr("dy",bbox.height/2*dyOff+"px").attr("dx",deg>0?isBottom?"0.71em":"-0.71em":isBottom?"-0.71em":"0.71em").attr("transform","rotate("+deg+")").attr("visibility",null)});break}default:textSelection.style("text-anchor",isHoriztontal?"middle":isLeft?"end":"start").attr("dy",isHoriztontal?(isBottom?.71:0)+"em":"0.32em").attr("dx",0).attr("visibility",null).attr("transform","rotate(0)")}}calcTickOverlapModulus(element){let retVal=1;switch(this.overlapMode()){case"rotate":case"stagger":case"hide":const bboxArr=[];element.selectAll(".tick > text").each(function(){const bbox=this.getBoundingClientRect();for(let i=bboxArr.length-1;i>=0&&!(bboxArr[i].right<bbox.left);--i)bboxArr.length+1-i>retVal&&(retVal=bboxArr.length+1-i);bboxArr.push(bbox)});break}return retVal}calcOverflow(element,ignoreText){if(this.updateScale(),this.hidden())return{left:0,top:0,right:0,bottom:0,depth:0,tickOverlapModulus:1};const isHorizontal=this.isHorizontal();this.range(isHorizontal?[0,this.width()]:[this.height(),0]);const tmpSvg=element.append("g").attr("class",this.classID()),tmpSvgG=tmpSvg.append("g");tmpSvgG.attr("class",isHorizontal?"x":"y").call(this.d3Axis),ignoreText&&element.selectAll(".tick > text").remove();const retVal={left:0,top:0,right:0,bottom:0,depth:0,tickOverlapModulus:this.calcTickOverlapModulus(tmpSvgG)};this.adjustText(tmpSvgG,retVal.tickOverlapModulus);const bbox=tmpSvgG.node().getBBox();switch(retVal.depth=isHorizontal?bbox.height:bbox.width,this.shrinkToFit()){case"low":case"both":retVal.left=isHorizontal?-bbox.x:0,retVal.bottom=isHorizontal?0:-(this.height()-(bbox.height+bbox.y));break}switch(this.shrinkToFit()){case"high":case"both":retVal.top=isHorizontal?0:-bbox.y,retVal.right=isHorizontal?-(this.width()-bbox.x-bbox.width):0;break}return tmpSvg.remove(),retVal}wrap(_text,bandSize,re){re=re||/\s+/;const context=this;_text.each(function(){const text=common.select(this),words=text.text().split(re).reverse();let line2=[],lineNumber=0;const lineHeight=1.1,x2=text.attr("x"),y2=text.attr("y"),fs=parseFloat(text.style("font-size"))||10,maxLinesPerBand=Math.floor(bandSize/(fs*lineHeight))-1,minWordsPerLine=context.isHorizontal()?1:Math.ceil(words.length/maxLinesPerBand),dy=parseFloat(text.attr("dy"));let tspan=text.text(null).append("tspan").attr("x",x2).attr("y",y2).attr("dy",dy+"em"),wordsOnLine=0,word=words.pop();for(;word;)line2.push(word),tspan.text(line2.join(" ")),wordsOnLine++,tspan.node().getComputedTextLength()>bandSize&&wordsOnLine>=minWordsPerLine&&(line2.pop(),tspan.text(line2.join(" ")),line2=[word],tspan=text.append("tspan").attr("x",x2).attr("y",y2).attr("dy",++lineNumber*lineHeight+dy+"em").text(word),wordsOnLine=0),word=words.pop();context.isHorizontal()||text.selectAll("tspan").attr("y",-lineNumber/2+"em")})}linebreak(text,bandSize){this.wrap(text,bandSize,`
|
|
2
|
-
`)}update(domNode,element){super.update(domNode,element),this.svg.style("display",this.hidden()?"none":null);const overlap=this.calcOverflow(element),lowerPos=this.isHorizontal()?overlap.left:this.height()-overlap.top-overlap.bottom,upperPos=this.isHorizontal()?this.width()-overlap.right-this.padding():0+this.padding();this.range(this.reverse()?[upperPos,lowerPos]:[lowerPos,upperPos]);const context=this;function doPosition(element2){element2.attr("transform",function(){switch(context.orientation()){case"left":return"translate("+overlap.depth+", "+overlap.top+")";case"top":return"translate(0,"+overlap.depth+")";case"right":return"translate("+(context.width()-overlap.depth)+", "+overlap.top+")";case"bottom":return"translate(0,"+(context.height()-overlap.depth)+")"}return"translate(0,0)"})}this.svg.style("visibility",this.type()==="none"?"hidden":null).transition().call(doPosition),this._guideElement&&this.svgGuides.transition().call(doPosition),this.svgAxis.call(this.d3Axis),this.adjustText(this.svgAxis,overlap.tickOverlapModulus);const svgLineBBox={x:this.pos().x,width:this.width()},svgText=this.svgAxis.selectAll(".axisTitle").data(this.title()?[this.title()]:[]),svgTitleTransition=svgText.enter().append("text").attr("class","axisTitle").merge(svgText).transition().attr("dx",null).style("text-anchor","end");switch(this.orientation()){case"left":svgTitleTransition.attr("transform","rotate(-90)").attr("x",-2).attr("y",2).attr("dy",".71em");break;case"right":svgTitleTransition.attr("transform","rotate(-90)").attr("x",-2).attr("y",4).attr("dx",null).attr("dy","-.71em");break;case"top":svgTitleTransition.attr("transform","rotate(0)").attr("x",svgLineBBox.width-2).attr("y",2).attr("dx",null).attr("dy",".71em");break;case"bottom":svgTitleTransition.attr("transform","rotate(0)").attr("x",svgLineBBox.width-2).attr("y",-2).attr("dy",null);break}svgTitleTransition.text(this.title_exists()?this.title():""),svgText.exit().remove(),this.svgGuides.call(this.d3Guides).selectAll(".tick").classed("guide-0",d=>d===0&&this.low()<0)}rerender(){this.svgAxis.call(this.d3Axis),this.svgGuides.call(this.d3Guides)}postUpdate(domNode,element){super.postUpdate(domNode,element),this._guideElement&&this._guideElement.attr("transform",this._element.attr("transform"))}}Axis.prototype._class+=" chart_Axis",Axis.prototype.publish("type","linear","set","Type",["none","ordinal","linear","pow","log","time"]),Axis.prototype.publish("timePattern","%Y-%m-%d","string","Time Series Pattern",null,{disable:w=>w.type()!=="time"}),Axis.prototype.publish("reverse",!1,"boolean","Reverse"),Axis.prototype.publish("title",null,"string","Title"),Axis.prototype.publish("orientation","bottom","set","Placement/orientation of the axis",["left","top","right","bottom"]),Axis.prototype.publish("powExponent",2,"number","Power exponent (disabled when type is not 'pow')",null,{disable:w=>w.type()!=="pow"}),Axis.prototype.publish("logBase",10,"number","Logarithmic base (disabled when type is not 'log')",null,{disable:w=>w.type()!=="log"}),Axis.prototype.publish("ordinals",[],"array","Array of ordinal values to display (disabled when type is not 'ordinal')",null,{disable:w=>w.type()!=="ordinal"}),Axis.prototype.publish("fontSize",null,"number","Size of tick label font (pixels)",null,{optional:!0}),Axis.prototype.publish("fontFamily",null,"string","Font family of tick labels",null,{optional:!0}),Axis.prototype.publish("tickCount",null,"number","Number of ticks to display (disabled when type is 'ordinal')",null,{optional:!0,disable:w=>w.type()==="ordinal"}),Axis.prototype.publish("tickFormat",null,"string","Format rules for tick text (disabled when type is 'ordinal')",null,{optional:!0,disable:w=>w.type()==="ordinal"}),Axis.prototype.publish("tickLength",null,"number","Height (or width for left/right orientations) of the axis ticks (in pixels)",null,{optional:!0}),Axis.prototype.publish("ticks",[],"array","Custom tick labels",null,{optional:!0}),Axis.prototype.publish("low",null,"any","Minimum tick value (disabled when type is ordinal)",null,{optional:!0,disable:w=>w.type()==="ordinal"}),Axis.prototype.publish("high",null,"any","Maximum tick value (disabled when type is ordinal)",null,{optional:!0,disable:w=>w.type()==="ordinal"}),Axis.prototype.publish("overlapMode","none","set","Specifies the behavior when tick labels overlap",["none","stagger","hide","rotate","linebreak","wrap"]),Axis.prototype.publish("labelRotation",33,"number","Angle of rotation for tick labels (disabled when overlapMode is not 'rotate')",null,{optional:!0,disable:w=>w.overlapMode()!=="rotate"}),Axis.prototype.publish("shrinkToFit","both","set","shrinkToFit",["none","low","high","both"]),Axis.prototype.publish("extend",5,"number","Extend the axis range by this % beyond what is needed to display the data (disabled when type is 'ordinal')",null,{optional:!0,disable:w=>w.type()==="ordinal"}),Axis.prototype.publish("hidden",!1,"boolean","Hides axis when 'true'"),Axis.prototype.publish("ordinalPaddingInner",.1,"number","Determines the ratio of the range that is reserved for blank space between band (0->1)",null,{disable:w=>w.type()!=="ordinal"}),Axis.prototype.publish("ordinalPaddingOuter",.1,"number","Determines the ratio of the range that is reserved for blank space before the first band and after the last band (0->1)",null,{disable:w=>w.type()!=="ordinal"}),Axis.prototype.publish("ordinalMappings",null,"object","Alternative label mappings (icons)",null,{optional:!0}),Axis.prototype.publish("padding",0,"number","Padding space at top of axis (pixels)",null,{optional:!0}),Axis.prototype._origType=Axis.prototype.type,Axis.prototype.type=function(_){const retVal=Axis.prototype._origType.apply(this,arguments);return _!==void 0&&(this._type=_,this.updateScale()),retVal},Axis.prototype._origTimePattern=Axis.prototype.timePattern,Axis.prototype.timePattern=function(_){const retVal=Axis.prototype._origTimePattern.apply(this,arguments);return _!==void 0&&(this._timePattern=_,this.updateScale()),retVal};class XYAxis extends common.SVGWidget{constructor(){super();__publicField(this,"domainAxis");__publicField(this,"valueAxis");__publicField(this,"xAxis");__publicField(this,"yAxis");__publicField(this,"xyBrush");__publicField(this,"xBrush");__publicField(this,"yBrush");__publicField(this,"margin");__publicField(this,"focusChart");__publicField(this,"_prevBrush");__publicField(this,"svg");__publicField(this,"svgRegions");__publicField(this,"svgDomainGuide");__publicField(this,"svgValueGuide");__publicField(this,"svgData");__publicField(this,"svgDataClipRect");__publicField(this,"svgFocus");__publicField(this,"svgBrush");__publicField(this,"_skipSelection",!1);__publicField(this,"_prevXAxisType");__publicField(this,"_selection");common.Utility.SimpleSelectionMixin.call(this),this._drawStartPos="origin",this.domainAxis=new Axis().classed({domain:!0}).orientation_default("bottom").type("ordinal").overlapMode_default("stagger").shrinkToFit_default("high").extend_default(0),this.valueAxis=new Axis().classed({value:!0}).orientation_default("left").type("linear").shrinkToFit_default("high"),this.xyBrush=common.brush().on("end",()=>this.brushMoved()).on("start.handle brush.handle end.handle",()=>this.brushMoved2()),this.xBrush=common.brushX().on("end",()=>this.brushMoved()).on("start.handle brush.handle end.handle",()=>this.brushMoved2()),this.yBrush=common.brushY().on("end",()=>this.brushMoved()).on("start.handle brush.handle end.handle",()=>this.brushMoved2())}resetSelection(){return this._prevBrush=null,this}parseData(d){return this.domainAxis.parse(d)}parseValue(d){return this.valueAxis.parse(d,!0)}formatData(d){return this.domainAxis.format(d)}formatValue(d){return this.valueAxis.format(d)}parsedData(){return this.data().map(function(row){let prevValue=0;return row.map(function(cell,idx){if(idx===0)return this.parseData(cell);if(idx>=this.columns().length)return cell;const _retVal=this.yAxisStacked()?[prevValue,prevValue+this.parseValue(cell)]:this.parseValue(cell);return prevValue+=this.parseValue(cell),_retVal},this)},this)}bandwidth(){return this.domainAxis.bandwidth()}enter(domNode,element){super.enter(domNode,element),this.svg=element.append("g"),this.svgRegions=element.append("g"),this.svgDomainGuide=this.svg.append("g"),this.svgValueGuide=this.svg.append("g"),this.svgData=this.svg.append("g"),this.svgDataClipRect=this.svg.append("clipPath").attr("id",this.id()+"_clippath").append("rect").attr("x",0).attr("y",0),this.svgData=this.svg.append("g").attr("clip-path","url(#"+this.id()+"_clippath)"),this._selection.widgetElement(this.svgData),this.svgFocus=element.append("g"),this.domainAxis.target(this.svg.node()).guideTarget(this.svgDomainGuide.node()),this.valueAxis.target(this.svg.node()).guideTarget(this.svgValueGuide.node()),this.svgBrush=element.append("g").attr("class","brush"),this.chartsEnter(this,this.svgData,250)}resizeBrushHandle(d,width,height){let e,x2,y2;return d.type==="e"||d.type==="w"?(e=+(d.type==="e"),x2=e?1:-1,y2=height/3,"M"+.5*x2+","+y2+"A6,6 0 0 "+e+" "+6.5*x2+","+(y2+6)+"V"+(2*y2-6)+"A6,6 0 0 "+e+" "+.5*x2+","+2*y2+"ZM"+2.5*x2+","+(y2+8)+"V"+(2*y2-8)+"M"+4.5*x2+","+(y2+8)+"V"+(2*y2-8)):(e=+(d.type==="s"),y2=e?1:-1,x2=width/3,"M"+x2+", "+.5*y2+"A6,6 0 0 "+(e+1)%2+" "+(x2+6)+","+6.5*y2+"H"+(2*x2-6)+"A6,6 0 0 "+(e+1)%2+" "+2*x2+","+.5*y2+"ZM"+(x2+8)+","+2.5*y2+"H"+(2*x2-8)+"M"+(x2+8)+","+4.5*y2+"H"+(2*x2-8))}skipSelection(_){return arguments.length?(this._skipSelection=_,this):this._skipSelection}brushMoved(){if(this._skipSelection)return;let selected=[];const context=this,currSel=common.brushSelection(this.svgBrush.node());currSel&&(selected=this.data().filter(function(d){const pos=context.dataPos(d[0]);if(context.use2dSelection()){const pos2=context.valuePos(d[1])+context.valueAxis.bandwidth()/2;return pos>=currSel[0][0]&&pos<=currSel[1][0]&&pos2>=currSel[0][1]&&pos2<=currSel[1][1]}else return pos>=currSel[0]&&pos<=currSel[1]})),this.selection(selected)}brushMoved2(){var _a;const isHorizontal=this.orientation()==="horizontal",handleTypes=this.use2dSelection()?[]:isHorizontal?[{type:"w"},{type:"e"}]:[{type:"n"},{type:"s"}],handlePath=this.svgBrush.selectAll(".handle--custom").data(handleTypes),s=(_a=common.d3Event())==null?void 0:_a.selection;s==null?handlePath.attr("display","none"):isHorizontal?handlePath.attr("display",null).attr("transform",(_d,i)=>"translate("+s[i]+",0)"):handlePath.attr("display",null).attr("transform",(_d,i)=>"translate(0, "+s[i]+")")}dataPos(d){return this.domainAxis.scalePos(d)}valuePos(d){return this.valueAxis.scalePos(d)}getAxisSize(host){return{width:this.xAxis?this.xAxis.width():host.xAxis.width(),height:this.yAxis?this.yAxis.height():host.yAxis.width()}}calcMargin(_domNode,element,isHorizontal){const margin={top:!isHorizontal&&this.selectionMode()?10:2,right:isHorizontal&&(this.selectionMode()||this.xAxisFocus())?10:2,bottom:(this.xAxisFocus()?this.xAxisFocusHeight():0)+2,left:2},width=this.width()-margin.left-margin.right,height=this.height()-margin.top-margin.bottom;let xRight=0,xHeight=30,yTop=0,yWidth=30;for(let i=0;i<10;++i){this.xAxis.width(width-yWidth).height(0);const xAxisOverlap=this.xAxis.calcOverflow(element),newXHeight=xAxisOverlap.depth;this.yAxis.width(0).height(height-xHeight);const yAxisOverlap=this.yAxis.calcOverflow(element),newYWidth=yAxisOverlap.depth;if(xRight=xAxisOverlap.right,yTop=yAxisOverlap.top,newXHeight===xHeight&&newYWidth===yWidth)break;xHeight=newXHeight,yWidth=newYWidth}return this.xAxis.x(width/2+yWidth/2+margin.left).y(height+margin.top).width(width-yWidth),this.yAxis.x(margin.left).y(height/2-xHeight/2+margin.top).height(height-xHeight),margin.left+=yWidth,margin.top+=yTop,margin.right+=xRight,margin.bottom+=xHeight,margin}updateRegions(_domNode,_element,isHorizontal){const context=this,regions=this.svgRegions.selectAll(".region").data(this.regions());regions.enter().append("rect").attr("class","region"),isHorizontal?regions.attr("x",function(d){return context.dataPos(d.x0)}).attr("y",0).attr("width",function(d){return context.dataPos(d.x1)-context.dataPos(d.x0)}).attr("height",this.height()).style("stroke",function(d){return context._palette(d.colorID)}).style("fill",function(d){return common.hsl(context._palette(d.colorID)).brighter()}):regions.attr("x",0).attr("y",function(d){return context.dataPos(d.x0)}).attr("width",this.width()).attr("height",function(d){return context.dataPos(d.x0)-context.dataPos(d.x1)}).style("stroke",function(d){return context._palette(d.colorID)}).style("fill",function(d){return common.hsl(context._palette(d.colorID)).brighter()}),regions.exit().remove()}update(domNode,element){super.update(domNode,element);const context=this,isHorizontal=this.orientation()==="horizontal";switch(this.updateRegions(domNode,element,isHorizontal),this.domainAxis.orientation(isHorizontal?"bottom":"left").title(this.xAxisTitle_exists()?this.xAxisTitle():this.columns()[0]),this.valueAxis.orientation(isHorizontal?"left":"bottom"),this.xAxis=isHorizontal?this.domainAxis:this.valueAxis,this.yAxis=isHorizontal?this.valueAxis:this.domainAxis,this.xAxisType()){case"ordinal":const colLen=this.columns().length,ordinalMappings={};this.domainAxis.ordinals(this.data().map(function(d){return ordinalMappings[d[0]]=context.xAxisOrdinalMapping(d,d[colLen]),d[0]})).ordinalMappings(ordinalMappings);break;default:const domainMin=this.xAxisDomainLow()?this.xAxisDomainLow():this.domainAxis.parseInvert(common.min(this.parsedData(),function(data){return data[0]})),domainMax=this.xAxisDomainHigh()?this.xAxisDomainHigh():this.domainAxis.parseInvert(common.max(this.parsedData(),function(data){return data[0]}));domainMin!==void 0&&domainMax!==void 0&&this.domainAxis.low(domainMin).high(domainMax);break}const min2=this.yAxisDomainLow()?this.yAxisDomainLow():this.valueAxis.parseInvert(common.min(this.parsedData(),function(data){return common.min(data.filter(function(cell,i){return i>0&&context.columns()[i]&&context.columns()[i].indexOf("__")!==0&&cell!==null}),function(d){return d instanceof Array?d[0]:d})})),max2=this.yAxisDomainHigh()?this.yAxisDomainHigh():this.valueAxis.parseInvert(common.max(this.parsedData(),function(data){return common.max(data.filter(function(cell,i){return i>0&&context.columns()[i]&&context.columns()[i].indexOf("__")!==0&&cell!==null}),function(d){return d instanceof Array?d[1]:d})}));this.valueAxis.low(min2).high(max2),this.margin=this.calcMargin(domNode,element,isHorizontal);let width=this.width()-this.margin.left-this.margin.right;width<0&&(width=0);let height=this.height()-this.margin.top-this.margin.bottom;height<0&&(height=0);const maxCurrExtent=isHorizontal?width:height,maxOtherExtent=isHorizontal?height:width;if(this.domainAxis.tickLength(this.xAxisGuideLines()?maxOtherExtent:0).render(),this.valueAxis.tickLength(this.yAxisGuideLines()?maxCurrExtent:0).render(),this.svgDataClipRect.attr("width",width).attr("height",height),this.svgData.transition().attr("transform","translate("+this.margin.left+","+this.margin.top+")"),this.updateBrush(width,height,maxCurrExtent,isHorizontal),this.updateFocusChart(domNode,element,this.margin,width,height,isHorizontal),this.chartsUpdate(width,height,250),this.selectionMode())return this.brushMoved()}updateBrush(width,height,maxCurrExtent,isHorizontal){const currBrush=this.use2dSelection()?this.xyBrush:isHorizontal?this.xBrush:this.yBrush,prevBrushSel=common.brushSelection(this.svgBrush.node());currBrush.extent([[0,0],[width,height]]),this.svgBrush.attr("transform","translate("+this.margin.left+", "+this.margin.top+")").style("display",this.selectionMode()?null:"none").call(currBrush);const handleTypes=this.use2dSelection()?[]:isHorizontal?[{type:"w"},{type:"e"}]:[{type:"n"},{type:"s"}],handlePath=this.svgBrush.selectAll(".handle--custom").data(handleTypes);if(handlePath.enter().append("path").attr("class","handle--custom").merge(handlePath).attr("cursor",isHorizontal?"ew-resize":"ns-resize").attr("d",d=>this.resizeBrushHandle(d,width,height)),this.selectionMode()){if(this._prevXAxisType!==this.xAxisType()&&(this._prevXAxisType=this.xAxisType(),this._prevBrush=null),this._prevBrush){if(prevBrushSel){if(this._prevBrush.orientation!==this.orientation()){const tmp=prevBrushSel[0];prevBrushSel[0]=this._prevBrush.maxCurrExtent-prevBrushSel[1],prevBrushSel[1]=this._prevBrush.maxCurrExtent-tmp}const ratio=maxCurrExtent/this._prevBrush.maxCurrExtent;ratio!==1&&this.svgBrush.transition().on("start",function(){currBrush.on("end",null)}).call(currBrush.move,[prevBrushSel[0]*ratio,prevBrushSel[1]*ratio]).on("end",()=>{currBrush.on("end",()=>this.brushMoved())})}}else this.svgBrush.call(currBrush.move,[0,maxCurrExtent]);this._prevBrush={orientation:this.orientation(),maxCurrExtent}}}updateFocusChart(domNode,element,margin,width,height,isHorizontal){const context=this,focusChart=this.svgFocus.selectAll("#"+this.id()+"_focusChart").data(this.xAxisFocus()?[!0]:[]);focusChart.enter().append("g").attr("id",this.id()+"_focusChart").attr("class","focus").each(function(){context.focusChart=new context.constructor().target(this),context.focusChart.xBrush.on("brush.focus",function(){context.syncAxis(width),context.chartsUpdate(width,height,0)}),context.focusChart.layers(context.layers().map(w=>new w.constructor))}).merge(focusChart).each(function(){context.copyPropsTo(context.focusChart,["layers"]);let layerIdx=0;for(const layer of context.layers())layer.copyPropsTo(context.focusChart.layers()[layerIdx]),layerIdx++;context.focusChart.xAxisFocus(!1).selectionMode(!0).skipSelection(!0).orientation("horizontal").xAxisGuideLines(!1).xAxisDomainLow(null).xAxisDomainHigh(null).yAxisGuideLines(!1).x(context.width()/2).y(context.height()-context.xAxisFocusHeight()/2).width(context.width()).height(context.xAxisFocusHeight()).columns(context.columns()).data(context.data()).render(),context.syncAxis(width)}),focusChart.exit().each(function(){context.focusChart&&(context.focusChart.target(null),delete context.focusChart)}).remove()}syncAxis(width){const currSel=common.brushSelection(this.focusChart.svgBrush.node());if(currSel){if(this.focusChart.xAxisType()!=="ordinal")this.xAxis.domain([this.focusChart.xAxis.invert(currSel[0]),this.focusChart.xAxis.invert(currSel[1])]);else{const scale=(currSel[1]-currSel[0])/width;this.xAxis.range([-currSel[0]/scale,(width-currSel[0])/scale])}this.xAxis.rerender()}}layerColumns(host){const masterColumns=host.columns(),retVal=super.columns().filter(col=>col!==masterColumns[0]);return retVal.length?[masterColumns[0],...retVal]:masterColumns}layerColumnIndices(host){const masterColumns=host.columns();return this.layerColumns(host).map(col=>masterColumns.indexOf(col))}layerColumnIndex(host,column){return host.columns().indexOf(column)}layerData(host){if(arguments.length===1){const indices=this.layerColumnIndices(host);return host.data().map(row=>{const retVal=indices.map(idx=>row[idx]);return retVal.__hpcc_origRow=row,retVal})}throw new Error("Setting data on XYAxisLayer is not supported.")}layerEnter(host,element,duration=250){}layerUpdate(host,element,duration=250){}layerExit(host,element,duration=250){}chartsEnter(host,element,duration=250){this.layerEnter(this,element,duration);for(const w of this.layers())w.__xyAxisElement=element.append("g").attr("class",w.class()),w.target(w.__xyAxisElement.node()).layerEnter(this,element,duration)}chartsUpdate(width,height,duration){this.layerUpdate(this,this.svgData,duration);for(const w of this.layers())w.resize({width,height}).layerUpdate(this,w.__xyAxisElement,duration)}exit(domNode,element){this.valueAxis.target(null),this.domainAxis.target(null),super.exit(domNode,element)}selection(_selected){const context=this;this._selection.widgetElement().selectAll(".selected,.deselected").each(function(d){const selected=_selected.indexOf(d.origRow)>=0;common.select(this).classed("selected",selected).classed("deselected",!selected).attr("filter",context._selection.svgGlowID()&&selected?`url(#${context._selection.svgGlowID()})`:null)});const selRows=_selected.map(d=>this.rowToObj(d));setTimeout(()=>{this.click(selRows,"",!0)},0)}xAxisOrdinalMapping(origRow,lparam){return origRow[0]}click(row,column,selected){}}XYAxis.prototype._class+=" chart_XYAxis",XYAxis.prototype.mixin(common.Utility.SimpleSelectionMixin),XYAxis.prototype.publish("orientation","horizontal","set","Selects orientation for the axis",["horizontal","vertical"]),XYAxis.prototype.publish("pointSizeColumn",null,"string","pointSizeColumn",null,{optional:!0}),XYAxis.prototype.publish("minPointSize",6,"number","minPointSize"),XYAxis.prototype.publish("maxPointSize",26,"number","maxPointSize"),XYAxis.prototype.publish("use2dSelection",!1,"boolean","2D Range Selector"),XYAxis.prototype.publish("selectionMode",!1,"boolean","Range Selector"),XYAxis.prototype.publishProxy("xAxisTitle","domainAxis","title"),XYAxis.prototype.publishProxy("xAxisTickCount","domainAxis","tickCount"),XYAxis.prototype.publishProxy("xAxisTickFormat","domainAxis","tickFormat"),XYAxis.prototype.publishProxy("xAxisTicks","domainAxis","ticks"),XYAxis.prototype.publishProxy("xAxisType","domainAxis","type"),XYAxis.prototype.publishProxy("xAxisTypeTimePattern","domainAxis","timePattern"),XYAxis.prototype.publish("xAxisDomainLow",null,"string","X-Axis Low",null,{optional:!0,disable:w=>w.xAxisType()==="ordinal"}),XYAxis.prototype.publish("xAxisDomainHigh",null,"string","X-Axis High",null,{optional:!0,disable:w=>w.xAxisType()==="ordinal"}),XYAxis.prototype.publishProxy("xAxisFontSize","domainAxis","fontSize"),XYAxis.prototype.publishProxy("xAxisFontFamily","domainAxis","fontFamily"),XYAxis.prototype.publishProxy("xAxisOrdinalPaddingInner","domainAxis","ordinalPaddingInner"),XYAxis.prototype.publishProxy("xAxisOrdinalPaddingOuter","domainAxis","ordinalPaddingOuter"),XYAxis.prototype.publishProxy("xAxisOverlapMode","domainAxis","overlapMode"),XYAxis.prototype.publishProxy("xAxisLabelRotation","domainAxis","labelRotation"),XYAxis.prototype.publishProxy("xAxisDomainPadding","domainAxis","extend"),XYAxis.prototype.publish("xAxisGuideLines",!1,"boolean","Y-Axis Guide Lines"),XYAxis.prototype.publish("xAxisFocus",!1,"boolean","X-Axis Focus",null,{disable:w=>w.orientation()!=="horizontal"}),XYAxis.prototype.publish("xAxisFocusHeight",80,"number","X-Axis Focus Height",null,{disable:w=>!w.xAxisFocus()}),XYAxis.prototype.publishProxy("xAxisHidden","domainAxis","hidden"),XYAxis.prototype.publishProxy("yAxisFontSize","valueAxis","fontSize"),XYAxis.prototype.publishProxy("yAxisFontFamily","valueAxis","fontFamily"),XYAxis.prototype.publishProxy("yAxisTitle","valueAxis","title"),XYAxis.prototype.publishProxy("yAxisTickCount","valueAxis","tickCount"),XYAxis.prototype.publishProxy("yAxisTickFormat","valueAxis","tickFormat"),XYAxis.prototype.publishProxy("yAxisTicks","valueAxis","ticks"),XYAxis.prototype.publishProxy("yAxisType","valueAxis","type"),XYAxis.prototype.publishProxy("yAxisTypeTimePattern","valueAxis","timePattern"),XYAxis.prototype.publishProxy("yAxisTypePowExponent","valueAxis","powExponent"),XYAxis.prototype.publishProxy("yAxisTypeLogBase","valueAxis","logBase"),XYAxis.prototype.publish("yAxisStacked",!1,"boolean","Stacked Chart",null,{tags:["Basic"],disable:w=>w.xAxisType()!=="ordinal"||w._class.indexOf("chart_Column")<0}),XYAxis.prototype.publish("yAxisDomainLow",null,"string","Y-Axis Low",null,{optional:!0,disable:w=>w.yAxisType()==="ordinal"}),XYAxis.prototype.publish("yAxisDomainHigh",null,"string","Y-Axis High",null,{optional:!0,disable:w=>w.yAxisType()==="ordinal"}),XYAxis.prototype.publishProxy("yAxisDomainPadding","valueAxis","extend"),XYAxis.prototype.publish("yAxisGuideLines",!0,"boolean","Y-Axis Guide Lines"),XYAxis.prototype.publishProxy("yAxisHidden","valueAxis","hidden"),XYAxis.prototype.publish("regions",[],"array","Regions"),XYAxis.prototype.publish("layers",[],"widgetArray","Layers",null,{render:!1}),XYAxis.prototype.publishProxy("xAxisPadding","domainAxis","padding"),XYAxis.prototype.publishProxy("yAxisPadding","valueAxis","padding");class Scatter extends XYAxis{constructor(){super();__publicField(this,"_prevPointShape");api.INDChart.call(this),api.ITooltip.call(this),this.xAxisGuideLines_default(!0).yAxisGuideLines_default(!0)}xPos(host,d){return host.orientation()==="horizontal"?host.dataPos(d.label):host.valuePos(d.value)}yPos(host,d){return host.orientation()==="horizontal"?host.valuePos(d.value):host.dataPos(d.label)}curve(){switch(this.interpolate()){case"linear":return d3CurveLinear;case"step":return d3CurveStep;case"step-before":return stepBefore;case"step-after":return stepAfter;case"basis":return d3CurveBasis;case"bundle":return d3CurveBundle;case"cardinal":return d3CurveCardinal;case"catmullRom":return d3curveCatmullRom;case"natural":return d3CurveNatural;case"monotone":default:return monotoneX}}getScale(){switch(this.pointSizeScale()){case"linear":return common.scaleLinear();case"pow":return common.scalePow().exponent(2);case"log":return common.scaleLog();case"sqrt":return common.scaleSqrt()}}pointColor(row,col,value,origRow){return this.interpolate()&&this.pointDarken()?this.strokeColor(row,col,value,origRow):this.fillColor(row,col,value,origRow)}lineColor(row,col,value,origRow){return this.interpolateFill()&&this.interpolateDarken()?this.strokeColor(row,col,value,origRow):this.fillColor(row,col,value,origRow)}areaColor(row,col,value,origRow){return this.fillColor(row,col,value,origRow)}layerEnter(host,element,duration=250){super.layerEnter(host,element,duration);const context=this;this.tooltipHTML(function(d){switch(context.tooltipStyle()){case"series-table":return context.tooltipFormat({label:d.label,arr:context.columns().slice(1).map(function(column,i){return{label:column,color:context._palette(column),value:context.data()[d.rowIdx][i+1]}})});default:return context.tooltipFormat({label:d.label,series:d.column,value:d.value})}})}layerUpdate(host,element,duration=250){super.layerUpdate(host,element);const isHorizontal=host.orientation()==="horizontal",height=isHorizontal?this.height():this.width(),context=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._prevPointShape!==this.pointShape()&&(element.selectAll(".data").remove(),this._prevPointShape=this.pointShape());function mapShape(shape){switch(shape){case"rectangle":return"rect";case"circle":return"circle";case"cross":return"path"}}const usePointSizeColumn=this.pointSizeColumn_exists();let pointSizeColumnIdx,extent,scale;usePointSizeColumn&&(pointSizeColumnIdx=this.columns().indexOf(this.pointSizeColumn()),extent=common.extent(this.data(),d=>d[pointSizeColumnIdx]),scale=this.getScale().domain(extent));const layerColumns=this.layerColumns(host),layerData=this.layerData(host),flatData=this.flattenData(layerColumns,layerData).map(function(d){return d.shape=mapShape(context.pointShape()),d.column=layerColumns[d.colIdx],d.row=layerData[d.rowIdx],d.origRow=layerData[d.rowIdx].__hpcc_origRow,extent?(d.size=scale(d.row[pointSizeColumnIdx])*(context.maxPointSize()-context.minPointSize())+context.minPointSize(),d.column===context.pointSizeColumn()?!1:d):(d.size=context.pointSize(),d)}).filter(d=>d),areas=element.selectAll(".area").data(layerColumns.filter(function(_d,idx){return context.interpolate()&&context.interpolateFill()&&idx>0})),areasEnter=areas.enter().append("path"),area2=d3Area().curve(this.curve());isHorizontal?area2.x(function(d){return context.xPos(host,d)}).y0(Math.min(height,this.yPos(host,{value:0}))).y1(function(d){return context.yPos(host,d)}):area2.y(function(d){return context.yPos(host,d)}).x0(Math.max(0,this.xPos(host,{value:0}))).x1(function(d){return context.xPos(host,d)}),areasEnter.merge(areas).attr("class",d=>"area series series-"+this.cssTag(d)).each(function(_d,idx){common.select(this).attr("d",area2(flatData.filter(function(d2){return d2.colIdx===idx+1}))).style("opacity",context.interpolateFillOpacity()).style("stroke","none").style("fill",context.areaColor([],_d,void 0,[]))}),areas.exit().remove();const lines=element.selectAll(".line").data(layerColumns.filter(function(_d,idx){return context.interpolate()&&idx>0})),linesEnter=lines.enter().append("path"),line2=d3Line().x(function(d){return context.xPos(host,d)}).y(function(d){return context.yPos(host,d)}).curve(this.curve());linesEnter.merge(lines).attr("class",d=>"line series series-"+this.cssTag(d)).each(function(_d,idx){const element2=common.select(this),data2=flatData.filter(function(d2){return d2.colIdx===idx+1});element2.attr("d",line2(data2)).style("stroke",context.lineColor([],_d,void 0,[])).style("fill","none")}),lines.exit().remove();const points=element.selectAll(".point").data(flatData,function(d,idx){return d.shape+"_"+idx});points.enter().append("g").each(function(d2){const element2=common.select(this);element2.append(d2.shape).attr("class","pointShape"),element2.append("text").attr("class","pointValue").style("display","none").attr("text-anchor",context.valueAnchor()).attr("alignment-baseline",context.valueBaseline()).attr("fill",function(d,_idx){return context.valueBaseline()==="middle"||context.valueBaseline()==="central"?context.textColor(d.row,d.column,d.value,d.origRow):null}),element2.append("circle").attr("class","pointSelection").on("mouseout.tooltip",context.tooltip.hide).on("mousemove.tooltip",context.tooltip.show).call(host._selection.enter.bind(host._selection)).on("click",function(d,_idx){context.click(host.rowToObj(host.data()[d.rowIdx]),d.column,host._selection.selected(this))}).on("dblclick",function(d,_idx){context.dblclick(host.rowToObj(host.data()[d.rowIdx]),d.column,host._selection.selected(this))})}).merge(points).attr("class",d=>"point series series-"+this.cssTag(d.column)).each(function(d2){common.select(this).select(".pointValue").attr("x",function(d){return context.xPos(host,d)}).attr("y",function(d){return context.yPos(host,d)}).style("display",context.showValue()?"block":"none").attr("text-anchor",context.valueAnchor()).attr("alignment-baseline",context.valueBaseline()).text(function(d){return d.value}),common.select(this).select(".pointSelection").attr("cx",function(d){return context.xPos(host,d)}).attr("cy",function(d){return context.yPos(host,d)}).attr("r",d2.size);const element2=common.select(this).select(".pointShape");switch(d2.shape){case"rect":element2.attr("x",function(d){return context.xPos(host,d)-d2.size/2}).attr("y",function(d){return context.yPos(host,d)-d2.size/2}).attr("width",d2.size).attr("height",d2.size).style("fill",context.pointColor(d2.row,d2.column,d2.value,d2.origRow));break;case"circle":element2.attr("cx",function(d){return context.xPos(host,d)}).attr("cy",function(d){return context.yPos(host,d)}).attr("r",d2.size*.9).style("fill",context.pointColor(d2.row,d2.column,d2.value,d2.origRow));break;case"path":element2.attr("d",function(d){return"M"+(context.xPos(host,d)-d2.size/2)+" "+(context.yPos(host,d)-d2.size/2)+" L"+(context.xPos(host,d)+d2.size/2)+" "+(context.yPos(host,d)+d2.size/2)+" M"+(context.xPos(host,d)-d2.size/2)+" "+(context.yPos(host,d)+d2.size/2)+" L"+(context.xPos(host,d)+d2.size/2)+" "+(context.yPos(host,d)-d2.size/2)}).style("stroke",context.pointColor(d2.row,d2.column,d2.value,d2.origRow));break}}),points.exit().remove()}exit(domNode,element){super.exit(domNode,element)}}__publicField(Scatter,"__inputs",[{id:"label",type:"any"},{id:"values",type:"number",multi:!0}]),Scatter.prototype._class+=" chart_Scatter",Scatter.prototype.implements(api.INDChart.prototype),Scatter.prototype.implements(api.ITooltip.prototype),Scatter.prototype.publish("paletteID","default","set","Color palette for this widget",Scatter.prototype._palette.switch(),{tags:["Basic","Shared"]}),Scatter.prototype.publish("pointSizeScale","linear","set","pointSizeScale",["linear","pow","log","sqrt"]),Scatter.prototype.publish("pointShape","cross","set","Shape of the data points",["circle","rectangle","cross"]),Scatter.prototype.publish("pointSize",6,"number","Point Size",null,{range:{min:1,step:1,max:200}}),Scatter.prototype.publish("interpolate","","set","Interpolate Data",["","linear","step","step-before","step-after","basis","bundle","cardinal","catmullRom","natural","monotone"]),Scatter.prototype.publish("pointDarken",!0,"boolean","If true, and interpolate is set, then points will have a slightly darker color than their assigned palette color",null,{disable:w=>!w.interpolate()}),Scatter.prototype.publish("interpolateDarken",!0,"boolean","If true, and interpolateFill is true, then lines will have a slightly darker color than their assigned palette color",null,{disable:w=>!w.interpolateFill()}),Scatter.prototype.publish("interpolateFill",!1,"boolean","If true, the area between the line and zero will be filled"),Scatter.prototype.publish("interpolateFillOpacity",.66,"number","Fill interpolation Opacity",null,{range:{min:0,step:.01,max:1}}),Scatter.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Scatter.prototype.publish("showValue",!1,"boolean"),Scatter.prototype.publish("valueAnchor","middle","set","text-anchor for shown value text",["start","middle","end"]),Scatter.prototype.publish("valueBaseline","ideographic","set","alignment-baseline for shown value text",["auto","baseline","before-edge","text-before-edge","middle","central","after-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical","inherit"]);class Area extends Scatter{constructor(){super(),this.interpolate_default("linear").interpolateFill_default(!0)}}Area.prototype._class+=" chart_Area";class Column extends XYAxis{constructor(){super();__publicField(this,"_linearGap");__publicField(this,"textLocal",common.local());__publicField(this,"stackedTextLocal",common.local());__publicField(this,"isHorizontal");api.INDChart.call(this),api.ITooltip.call(this),this._selection.skipBringToTop(!0),this._linearGap=25}layerEnter(host,element,duration=250){super.layerEnter(host,element,duration);const context=this;this.tooltipHTML(function(d){switch(context.tooltipStyle()){case"series-table":return context.tooltipFormat({label:d.row[0],arr:context.columns().slice(1).map(function(column,i){return{label:column,color:context._palette(column),value:d.row[i+1]}})});default:let value=d.row[d.idx];return value instanceof Array&&(value=value[1]-value[0]),context.tooltipFormat({label:d.row[0],series:context.layerColumns(host)[d.idx],value})}})}adjustedData(host){return this.layerData(host).map(row=>{let prevValue=0;return row.map((cell,idx)=>{if(idx===0||idx>=this.layerColumns(host).length)return cell;const retVal2=host.yAxisStacked()?[prevValue,prevValue+cell]:cell;return prevValue+=cell,retVal2},this)},this)}layerUpdate(host,element,duration=250){super.layerUpdate(host,element,duration);const isHorizontal=host.orientation()==="horizontal";this.isHorizontal=isHorizontal;const context=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));const formatPct=common.format(context.showValueAsPercentFormat());let dataLen=10,offset=0;switch(host.xAxisType()){case"ordinal":dataLen=host.bandwidth(),offset=-dataLen/2;break;case"linear":case"time":dataLen=Math.max(Math.abs(host.dataPos(2)-host.dataPos(1))*(100-this._linearGap)/100,dataLen),offset=-dataLen/2;break}this.tooltip.direction(isHorizontal?"n":"e");const columnScale=common.scaleBand().domain(context.layerColumns(host).filter(function(_d,idx){return idx>0})).rangeRound(isHorizontal?[0,dataLen]:[dataLen,0]).paddingInner(this.xAxisSeriesPaddingInner()).paddingOuter(0);let domainSums=[];const seriesSums=[],columnLength=this.columns().length,rowData=this.data();this.showValue()&&this.showValueAsPercent()==="series"&&rowData.forEach(row=>{row.filter((_,idx)=>idx>0&&idx<columnLength).forEach((col,idx)=>{seriesSums[idx+1]===void 0&&(seriesSums[idx+1]=0),seriesSums[idx+1]+=col})}),(this.showDomainTotal()||this.showValue()&&this.showValueAsPercent()==="domain")&&(domainSums=rowData.map(row=>row.filter((cell,idx)=>idx>0&&idx<columnLength).reduce((sum,cell)=>sum+cell,0)));const column=element.selectAll(".dataRow").data(this.adjustedData(host)),hostData=host.data(),axisSize=this.getAxisSize(host);column.enter().append("g").attr("class","dataRow").merge(column).each(function(dataRow,dataRowIdx){const element2=common.select(this),columnGRect=element2.selectAll(".dataCell").data(dataRow.filter(function(_d,i){return i<context.layerColumns(host).length}).map(function(d,i){return{column:context.layerColumns(host)[i],row:dataRow,origRow:hostData[dataRowIdx],value:d,idx:i}}).filter(function(d){return d.value!==null&&d.idx>0}),d=>d.column),columnGEnter=columnGRect.enter().append("g").attr("class","dataCell").on("mouseout.tooltip",function(d){(!context.tooltipInnerTextEllipsedOnly()||d.innerTextObj&&d.innerTextObj.isTruncated)&&context.tooltip.hide.apply(context,arguments)}).on("mousemove.tooltip",function(d){(!context.tooltipInnerTextEllipsedOnly()||d.innerTextObj&&d.innerTextObj.isTruncated)&&context.tooltip.show.apply(context,arguments)}).call(host._selection.enter.bind(host._selection)).on("click",function(d){context.click(host.rowToObj(d.origRow),d.column,host._selection.selected(this))}).on("dblclick",function(d){context.dblclick(host.rowToObj(d.origRow),d.column,host._selection.selected(this))}).style("opacity",0).each(function(d){const element3=common.select(this);element3.append("rect").attr("class","columnRect series series-"+context.cssTag(d.column)),element3.append("text").attr("class","columnRectText").style("stroke","transparent")});columnGEnter.transition().duration(duration).style("opacity",1);const domainLength=host.yAxisStacked()?dataLen:columnScale.bandwidth();columnGEnter.merge(columnGRect).each(function(d){const element3=common.select(this),domainPos=host.dataPos(dataRow[0])+(host.yAxisStacked()?0:columnScale(d.column))+offset,upperValue=d.value instanceof Array?d.value[1]:d.value;let valueText=d.origRow[d.idx];if(context.showValue()){const dm=context.dataMeta();switch(context.showValueAsPercent()){case"series":const seriesSum=typeof dm.sum<"u"?dm.sum:seriesSums[d.idx];valueText=formatPct(valueText/seriesSum);break;case"domain":const domainSum=typeof dm.sum<"u"?dm.sum:domainSums[dataRowIdx];valueText=formatPct(valueText/domainSum);break;case null:default:valueText=common.format(context.showValueFormat())(valueText);break}}const upperValuePos=host.valuePos(upperValue),lowerValuePos=host.valuePos(d.value instanceof Array?d.value[0]:0),valuePos=Math.min(lowerValuePos,upperValuePos),valueLength=Math.abs(upperValuePos-lowerValuePos),innerTextHeight=context.innerTextFontSize(),innerTextPadding=context.innerTextPadding_exists()?context.innerTextPadding():innerTextHeight/2.5,dataRect=context.intersectRectRect({x:isHorizontal?domainPos:valuePos,y:isHorizontal?valuePos:domainPos,width:isHorizontal?domainLength:valueLength,height:isHorizontal?valueLength:domainLength},{x:0,y:0,width:axisSize.width,height:axisSize.height}),_rects=element3.select("rect").transition().duration(duration).style("fill",d2=>context.fillColor(d2.row,d2.column,d2.value,d2.origRow));isHorizontal?_rects.attr("x",domainPos).attr("y",valuePos).attr("width",domainLength).attr("height",valueLength):_rects.attr("y",domainPos).attr("x",valuePos).attr("height",domainLength).attr("width",valueLength);const _texts=element3.select("text").transition().duration(duration).style("font-size",innerTextHeight+"px").style("fill",d2=>context.textColor(d2.row,d2.column,d2.value,d2.origRow));_texts.style("font-family",context.innerTextFontFamily_exists()?context.innerTextFontFamily():null);const padding=context.innerTextPadding_exists()?context.innerTextPadding():8,textHeightOffset=innerTextHeight/2.7;if(isHorizontal){const y2=dataRect.y+dataRect.height-innerTextPadding;_texts.attr("x",domainPos+domainLength/2).attr("y",y2+textHeightOffset).attr("transform",`rotate(-90, ${domainPos+domainLength/2}, ${y2})`)}else _texts.attr("x",dataRect.x+padding).attr("y",domainPos+domainLength/2+textHeightOffset);_texts.attr("height",domainLength).attr("width",valueLength),context.showInnerText()&&_texts.text(d2=>{const innerText=context.innerText(d2.origRow,d2.origRow[columnLength],d2.idx);if(innerText){const clippedValueLength=isHorizontal?dataRect.height:dataRect.width,innerTextObj=context.calcInnerText(clippedValueLength,innerText,valueText);return d2.innerTextObj=innerTextObj,innerTextObj.text}return""});const dataText=element3.selectAll(".dataText").data(context.showValue()?[`${upperValue}`]:[]);dataText.enter().append("g").attr("class","dataText").each(function(d2){context.textLocal.set(this,new common.Text().target(this).colorStroke_default("transparent"))}).merge(dataText).each(function(){const pos={x:0,y:0},valueFontFamily=context.valueFontFamily(),valueFontSize=context.valueFontSize(),textSize=context.textSize(valueText,valueFontFamily,valueFontSize),isPositive=parseFloat(valueText)>=0;let valueAnchor=context.valueAnchor()?context.valueAnchor():isHorizontal?"middle":"start";const leftSpace=dataRect.x,rightSpace=axisSize.width-(dataRect.x+dataRect.width),topSpace=dataRect.y,bottomSpace=axisSize.height-(dataRect.y+dataRect.height);let noRoomInside,isOutside,noRoomOnExpectedSide;if(d.innerTextObj){const{padding:padding2,valueTextWidth}=d.innerTextObj;isOutside=!1,isHorizontal?(valueAnchor="middle",pos.x=domainPos+domainLength/2,d.innerTextObj.category===4?(isOutside=!0,pos.y=valuePos-padding2-valueFontSize/2):pos.y=valuePos+padding2+valueFontSize/2):(valueAnchor="start",d.innerTextObj.category===4?(isOutside=!0,pos.x=valueLength+valuePos+padding2):pos.x=valueLength+valuePos-valueTextWidth-padding2,pos.y=domainPos+domainLength/2)}else isHorizontal?(noRoomInside=dataRect.height<textSize.height,isOutside=!context.valueCentered()||noRoomInside,pos.x=dataRect.x+dataRect.width/2,isOutside?isPositive?(noRoomOnExpectedSide=topSpace<textSize.height+padding,noRoomOnExpectedSide?noRoomInside?pos.y=dataRect.y+dataRect.height+textSize.height:(isOutside=!1,pos.y=dataRect.y+dataRect.height/2):pos.y=dataRect.y-textSize.height/2-padding):(noRoomOnExpectedSide=bottomSpace<textSize.height,noRoomOnExpectedSide?noRoomInside?pos.y=dataRect.y-textSize.height/2-padding:(isOutside=!1,pos.y=dataRect.y+dataRect.height/2):pos.y=dataRect.y+textSize.height+padding):pos.y=dataRect.y+dataRect.height/2):(noRoomInside=dataRect.width<textSize.width,isOutside=!context.valueCentered()||noRoomInside,pos.y=dataRect.y+dataRect.height/2,isOutside?isPositive?(noRoomOnExpectedSide=rightSpace<textSize.width+padding,noRoomOnExpectedSide?context.showInnerText()||!noRoomInside?(isOutside=!1,pos.x=dataRect.x+dataRect.width/2):pos.x=dataRect.x-(textSize.width-padding):pos.x=dataRect.x+dataRect.width+textSize.width/2+padding):(noRoomOnExpectedSide=leftSpace<textSize.width,noRoomOnExpectedSide?context.showInnerText()||!noRoomInside?(isOutside=!1,pos.x=dataRect.x+dataRect.width/2):pos.x=dataRect.x+dataRect.width+(textSize.width-padding):pos.x=dataRect.x-(textSize.width-padding)):pos.x=dataRect.x+dataRect.width/2);const textColor=isOutside?null:context.textColor(d.row,d.column,d.value,d.origRow),columns=context.columns(),hideValue=context.yAxisStacked()&&noRoomInside||isOutside&&context.yAxisStacked()&&columns.indexOf(d.column)!==columns.length-1;context.textLocal.get(this).pos(pos).anchor(valueAnchor).fontFamily(valueFontFamily).fontSize(valueFontSize).text(`${valueText}`).colorFill(textColor).visible(context.showValue()&&!hideValue).render()}),dataText.exit().each(function(d2){context.textLocal.get(this).target(null)}).remove()}),columnGRect.exit().transition().duration(duration).style("opacity",0).remove();const value4pos=host.yAxisStacked()?domainSums[dataRowIdx]:Math.max(...dataRow.filter((_,idx)=>idx>0&&idx<columnLength)),stackedTotalText=element2.selectAll(".stackedTotalText").data(context.showDomainTotal()?[domainSums[dataRowIdx]]:[]);stackedTotalText.enter().append("g").attr("class","stackedTotalText").each(function(d){context.stackedTextLocal.set(this,new common.Text().target(this).colorStroke_default("transparent"))}).merge(stackedTotalText).each(function(d){const pos={x:0,y:0},domainPos=host.dataPos(dataRow[0]),valuePos=host.valuePos(value4pos),valueFontFamily=context.valueFontFamily(),valueFontSize=context.valueFontSize(),textSize=context.textSize(d,valueFontFamily,valueFontSize),isPositive=parseFloat(d)>=0;let valueAnchor="middle";isHorizontal?(pos.x=domainPos,isPositive?pos.y=valuePos-textSize.height/2:pos.y=valuePos+textSize.height/2):(valueAnchor="start",pos.y=domainPos,isPositive?pos.x=valuePos+textSize.width/2:pos.x=valuePos-textSize.width/2),context.stackedTextLocal.get(this).pos(pos).anchor(valueAnchor).fontFamily(valueFontFamily).fontSize(valueFontSize).text(d).render()}),stackedTotalText.exit().each(function(d){context.textLocal.get(this).target(null)}).remove()}),column.exit().transition().duration(duration).remove()}calcInnerText(offset,innerText,valueText){const fontFamily=this.innerTextFontFamily_exists()?this.innerTextFontFamily():"Verdana",fontSize=this.innerTextFontSize(),valueFontFamily=this.valueFontFamily_exists()?this.valueFontFamily():"Verdana",valueFontSize=this.valueFontSize(),padding=this.innerTextPadding_exists()?this.innerTextPadding():fontSize/2.5,valueTextWidth=this.isHorizontal?valueFontSize:this.textSize(valueText,valueFontFamily,valueFontSize).width,ellipsisWidth=this.textSize("...",fontFamily,fontSize).width,innerTextWidth=this.textSize(innerText,fontFamily,fontSize).width,origInnerText=innerText,fullWidth=padding*3+innerTextWidth+valueTextWidth,fullWidth2=padding*3+ellipsisWidth+valueTextWidth,fullWidth3=padding*1+valueTextWidth;let category=4;if(fullWidth<offset)category=1;else if(fullWidth2<offset){const excessWidth=offset-fullWidth2;let _text="";for(const letter of innerText)if(this.textSize(_text+letter,fontFamily,fontSize).width>excessWidth){innerText=_text+"...";break}else _text+=letter;category=2}else fullWidth3<offset?(innerText="",category=3):innerText="";return{text:innerText,isTruncated:origInnerText!==innerText,padding,category,valueTextWidth}}innerText(origRow,lparam,idx){return origRow[0]}}__publicField(Column,"__inputs",[{id:"label",type:"string"},{id:"values",type:"number",multi:!0}]),Column.prototype._class+=" chart_Column",Column.prototype.implements(api.INDChart.prototype),Column.prototype.implements(api.ITooltip.prototype),Column.prototype.publish("valueFontFamily",null,"string","Font family of value text",null,{optional:!0}),Column.prototype.publish("valueFontSize",12,"number","Height of value text (pixels)"),Column.prototype.publish("innerTextFontFamily",null,"string","Font family of inner text",null,{optional:!0}),Column.prototype.publish("innerTextPadding",8,"number","Offset of inner text (pixels)",null,{optional:!0}),Column.prototype.publish("innerTextFontSize",12,"number","Height of inner text (pixels)"),Column.prototype.publish("paletteID","default","set","Color palette for this widget",()=>Column.prototype._palette.switch(),{tags:["Basic","Shared"]}),Column.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Column.prototype.publish("showValue",!1,"boolean","Show Value in column"),Column.prototype.publish("showInnerText",!1,"boolean","Show Label in column"),Column.prototype.publish("showValueFormat",",","string","D3 Format for Value",null,{disable:w=>!w.showValue()||!!w.showValueAsPercent()}),Column.prototype.publish("showValueAsPercent",null,"set","If showValue is true, optionally show value as a percentage by Series or Domain",[null,"series","domain"],{disable:w=>!w.showValue(),optional:!0}),Column.prototype.publish("showValueAsPercentFormat",".0%","string","D3 Format for %",null,{disable:w=>!w.showValue()||!w.showValueAsPercent()}),Column.prototype.publish("showDomainTotal",!1,"boolean","Show Total Value for Stacked Columns",null),Column.prototype.publish("valueCentered",!1,"boolean","Show Value in center of column"),Column.prototype.publish("valueAnchor","middle","set","text-anchor for shown value text",["start","middle","end"]),Column.prototype.publish("xAxisSeriesPaddingInner",0,"number","Determines the ratio of the range that is reserved for blank space between band (0->1)"),Column.prototype.publish("tooltipInnerTextEllipsedOnly",!1,"boolean","Show tooltip only when inner text is truncated with an ellipsis");class Bar extends Column{constructor(){super(),this.orientation_default("vertical")}}Bar.prototype._class+=" chart_Bar";function count(node){var sum=0,children=node.children,i=children&&children.length;if(!i)sum=1;else for(;--i>=0;)sum+=children[i].value;node.value=sum}function node_count(){return this.eachAfter(count)}function node_each(callback){var node=this,current,next=[node],children,i,n;do for(current=next.reverse(),next=[];node=current.pop();)if(callback(node),children=node.children,children)for(i=0,n=children.length;i<n;++i)next.push(children[i]);while(next.length);return this}function node_eachBefore(callback){for(var node=this,nodes=[node],children,i;node=nodes.pop();)if(callback(node),children=node.children,children)for(i=children.length-1;i>=0;--i)nodes.push(children[i]);return this}function node_eachAfter(callback){for(var node=this,nodes=[node],next=[],children,i,n;node=nodes.pop();)if(next.push(node),children=node.children,children)for(i=0,n=children.length;i<n;++i)nodes.push(children[i]);for(;node=next.pop();)callback(node);return this}function node_sum(value){return this.eachAfter(function(node){for(var sum=+value(node.data)||0,children=node.children,i=children&&children.length;--i>=0;)sum+=children[i].value;node.value=sum})}function node_sort(compare){return this.eachBefore(function(node){node.children&&node.children.sort(compare)})}function node_path(end){for(var start=this,ancestor=leastCommonAncestor(start,end),nodes=[start];start!==ancestor;)start=start.parent,nodes.push(start);for(var k=nodes.length;end!==ancestor;)nodes.splice(k,0,end),end=end.parent;return nodes}function leastCommonAncestor(a,b){if(a===b)return a;var aNodes=a.ancestors(),bNodes=b.ancestors(),c=null;for(a=aNodes.pop(),b=bNodes.pop();a===b;)c=a,a=aNodes.pop(),b=bNodes.pop();return c}function node_ancestors(){for(var node=this,nodes=[node];node=node.parent;)nodes.push(node);return nodes}function node_descendants(){var nodes=[];return this.each(function(node){nodes.push(node)}),nodes}function node_leaves(){var leaves=[];return this.eachBefore(function(node){node.children||leaves.push(node)}),leaves}function node_links(){var root=this,links=[];return root.each(function(node){node!==root&&links.push({source:node.parent,target:node})}),links}function hierarchy(data,children){var root=new Node$1(data),valued=+data.value&&(root.value=data.value),node,nodes=[root],child,childs,i,n;for(children==null&&(children=defaultChildren);node=nodes.pop();)if(valued&&(node.value=+node.data.value),(childs=children(node.data))&&(n=childs.length))for(node.children=new Array(n),i=n-1;i>=0;--i)nodes.push(child=node.children[i]=new Node$1(childs[i])),child.parent=node,child.depth=node.depth+1;return root.eachBefore(computeHeight)}function node_copy(){return hierarchy(this).eachBefore(copyData)}function defaultChildren(d){return d.children}function copyData(node){node.data=node.data.data}function computeHeight(node){var height=0;do node.height=height;while((node=node.parent)&&node.height<++height)}function Node$1(data){this.data=data,this.depth=this.height=0,this.parent=null}Node$1.prototype=hierarchy.prototype={constructor:Node$1,count:node_count,each:node_each,eachAfter:node_eachAfter,eachBefore:node_eachBefore,sum:node_sum,sort:node_sort,path:node_path,ancestors:node_ancestors,descendants:node_descendants,leaves:node_leaves,links:node_links,copy:node_copy};var slice$1=Array.prototype.slice;function shuffle(array2){for(var m=array2.length,t,i;m;)i=Math.random()*m--|0,t=array2[m],array2[m]=array2[i],array2[i]=t;return array2}function enclose(circles){for(var i=0,n=(circles=shuffle(slice$1.call(circles))).length,B=[],p,e;i<n;)p=circles[i],e&&enclosesWeak(e,p)?++i:(e=encloseBasis(B=extendBasis(B,p)),i=0);return e}function extendBasis(B,p){var i,j;if(enclosesWeakAll(p,B))return[p];for(i=0;i<B.length;++i)if(enclosesNot(p,B[i])&&enclosesWeakAll(encloseBasis2(B[i],p),B))return[B[i],p];for(i=0;i<B.length-1;++i)for(j=i+1;j<B.length;++j)if(enclosesNot(encloseBasis2(B[i],B[j]),p)&&enclosesNot(encloseBasis2(B[i],p),B[j])&&enclosesNot(encloseBasis2(B[j],p),B[i])&&enclosesWeakAll(encloseBasis3(B[i],B[j],p),B))return[B[i],B[j],p];throw new Error}function enclosesNot(a,b){var dr=a.r-b.r,dx=b.x-a.x,dy=b.y-a.y;return dr<0||dr*dr<dx*dx+dy*dy}function enclosesWeak(a,b){var dr=a.r-b.r+1e-6,dx=b.x-a.x,dy=b.y-a.y;return dr>0&&dr*dr>dx*dx+dy*dy}function enclosesWeakAll(a,B){for(var i=0;i<B.length;++i)if(!enclosesWeak(a,B[i]))return!1;return!0}function encloseBasis(B){switch(B.length){case 1:return encloseBasis1(B[0]);case 2:return encloseBasis2(B[0],B[1]);case 3:return encloseBasis3(B[0],B[1],B[2])}}function encloseBasis1(a){return{x:a.x,y:a.y,r:a.r}}function encloseBasis2(a,b){var x12=a.x,y12=a.y,r1=a.r,x2=b.x,y2=b.y,r2=b.r,x21=x2-x12,y21=y2-y12,r21=r2-r1,l=Math.sqrt(x21*x21+y21*y21);return{x:(x12+x2+x21/l*r21)/2,y:(y12+y2+y21/l*r21)/2,r:(l+r1+r2)/2}}function encloseBasis3(a,b,c){var x12=a.x,y12=a.y,r1=a.r,x2=b.x,y2=b.y,r2=b.r,x3=c.x,y3=c.y,r3=c.r,a2=x12-x2,a3=x12-x3,b2=y12-y2,b3=y12-y3,c2=r2-r1,c3=r3-r1,d1=x12*x12+y12*y12-r1*r1,d2=d1-x2*x2-y2*y2+r2*r2,d3=d1-x3*x3-y3*y3+r3*r3,ab=a3*b2-a2*b3,xa=(b2*d3-b3*d2)/(ab*2)-x12,xb=(b3*c2-b2*c3)/ab,ya=(a3*d2-a2*d3)/(ab*2)-y12,yb=(a2*c3-a3*c2)/ab,A=xb*xb+yb*yb-1,B=2*(r1+xa*xb+ya*yb),C=xa*xa+ya*ya-r1*r1,r=-(A?(B+Math.sqrt(B*B-4*A*C))/(2*A):C/B);return{x:x12+xa+xb*r,y:y12+ya+yb*r,r}}function place(b,a,c){var dx=b.x-a.x,x2,a2,dy=b.y-a.y,y2,b2,d2=dx*dx+dy*dy;d2?(a2=a.r+c.r,a2*=a2,b2=b.r+c.r,b2*=b2,a2>b2?(x2=(d2+b2-a2)/(2*d2),y2=Math.sqrt(Math.max(0,b2/d2-x2*x2)),c.x=b.x-x2*dx-y2*dy,c.y=b.y-x2*dy+y2*dx):(x2=(d2+a2-b2)/(2*d2),y2=Math.sqrt(Math.max(0,a2/d2-x2*x2)),c.x=a.x+x2*dx-y2*dy,c.y=a.y+x2*dy+y2*dx)):(c.x=a.x+c.r,c.y=a.y)}function intersects(a,b){var dr=a.r+b.r-1e-6,dx=b.x-a.x,dy=b.y-a.y;return dr>0&&dr*dr>dx*dx+dy*dy}function score(node){var a=node._,b=node.next._,ab=a.r+b.r,dx=(a.x*b.r+b.x*a.r)/ab,dy=(a.y*b.r+b.y*a.r)/ab;return dx*dx+dy*dy}function Node(circle2){this._=circle2,this.next=null,this.previous=null}function packEnclose(circles){if(!(n=circles.length))return 0;var a,b,c,n,aa,ca,i,j,k,sj,sk;if(a=circles[0],a.x=0,a.y=0,!(n>1))return a.r;if(b=circles[1],a.x=-b.r,b.x=a.r,b.y=0,!(n>2))return a.r+b.r;place(b,a,c=circles[2]),a=new Node(a),b=new Node(b),c=new Node(c),a.next=c.previous=b,b.next=a.previous=c,c.next=b.previous=a;pack:for(i=3;i<n;++i){place(a._,b._,c=circles[i]),c=new Node(c),j=b.next,k=a.previous,sj=b._.r,sk=a._.r;do if(sj<=sk){if(intersects(j._,c._)){b=j,a.next=b,b.previous=a,--i;continue pack}sj+=j._.r,j=j.next}else{if(intersects(k._,c._)){a=k,a.next=b,b.previous=a,--i;continue pack}sk+=k._.r,k=k.previous}while(j!==k.next);for(c.previous=a,c.next=b,a.next=b.previous=b=c,aa=score(a);(c=c.next)!==b;)(ca=score(c))<aa&&(a=c,aa=ca);b=a.next}for(a=[b._],c=b;(c=c.next)!==b;)a.push(c._);for(c=enclose(a),i=0;i<n;++i)a=circles[i],a.x-=c.x,a.y-=c.y;return c.r}function optional(f){return f==null?null:required(f)}function required(f){if(typeof f!="function")throw new Error;return f}function constantZero(){return 0}function constant$2(x2){return function(){return x2}}function defaultRadius(d){return Math.sqrt(d.value)}function d3Pack(){var radius=null,dx=1,dy=1,padding=constantZero;function pack(root){return root.x=dx/2,root.y=dy/2,radius?root.eachBefore(radiusLeaf(radius)).eachAfter(packChildren(padding,.5)).eachBefore(translateChild(1)):root.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildren(constantZero,1)).eachAfter(packChildren(padding,root.r/Math.min(dx,dy))).eachBefore(translateChild(Math.min(dx,dy)/(2*root.r))),root}return pack.radius=function(x2){return arguments.length?(radius=optional(x2),pack):radius},pack.size=function(x2){return arguments.length?(dx=+x2[0],dy=+x2[1],pack):[dx,dy]},pack.padding=function(x2){return arguments.length?(padding=typeof x2=="function"?x2:constant$2(+x2),pack):padding},pack}function radiusLeaf(radius){return function(node){node.children||(node.r=Math.max(0,+radius(node)||0))}}function packChildren(padding,k){return function(node){if(children=node.children){var children,i,n=children.length,r=padding(node)*k||0,e;if(r)for(i=0;i<n;++i)children[i].r+=r;if(e=packEnclose(children),r)for(i=0;i<n;++i)children[i].r-=r;node.r=e+r}}}function translateChild(k){return function(node){var parent=node.parent;node.r*=k,parent&&(node.x=parent.x+k*node.x,node.y=parent.y+k*node.y)}}class Bubble extends common.SVGWidget{constructor(){super();__publicField(this,"labelWidgets");__publicField(this,"d3Pack");api.I2DChart.call(this),api.ITooltip.call(this),common.Utility.SimpleSelectionMixin.call(this),this._drawStartPos="origin",this.labelWidgets={},this.d3Pack=d3Pack().size([this.width(),this.height()]).padding(1.5)}size(_){const retVal=super.size.apply(this,arguments);return arguments.length&&this.d3Pack.size([this.width(),this.height()]),retVal}enter(domNode,element){super.enter(domNode,element),this._selection.widgetElement(element);const context=this;this.tooltipHTML(function(d){switch(context.tooltipStyle()){case"series-table":return context.tooltipFormat({label:d[0],arr:context.columns().slice(1).map(function(column,i){return{label:column,color:context._palette(d[0]),value:d[1]}})});default:return context.tooltipFormat({label:d.data[0],value:d.data[1]})}})}update(domNode,element){super.update(domNode,element);const context=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));const root=hierarchy({children:this.cloneData()}).sum(function(d){return d[1]}).sort(function(b,a){return a[1]<b[1]?-1:a[1]>b[1]?1:0});this.d3Pack(root);const node=element.selectAll(".node").data(root.children||[],d=>d.data[0]);node.enter().append("g").attr("class",(d,i)=>"node series series-"+this.cssTag(d.data[0])).attr("opacity",0).call(this._selection.enter.bind(this._selection)).on("click",function(d){context.click(context.rowToObj(d.data),context.columns()[1],context._selection.selected(this))}).on("dblclick",function(d){context.dblclick(context.rowToObj(d.data),context.columns()[1],context._selection.selected(this))}).each(function(d){const element2=common.select(this),pos={x:d.x,y:d.y};element2.append("circle").attr("transform","translate("+pos.x+","+pos.y+")").attr("r",0).on("mouseout.tooltip",context.tooltip.hide).on("mousemove.tooltip",context.tooltip.show),d.__viz_faChar?context.labelWidgets[d.data[0]]=new common.FAChar().char(d.__viz_faChar).target(this).render():context.labelWidgets[d.data[0]]=new common.Text().text(d.data[0]).target(this).render()}).merge(node).transition().attr("opacity",1).each(function(d){const element2=common.select(this),pos={x:d.x,y:d.y};element2.select("circle").transition().attr("transform","translate("+pos.x+","+pos.y+")").style("fill",context.fillColor(d.data,context.columns()[1],d.data[1])).attr("r",d.r).select("title").text(d.data[0]+" ("+d.data[1]+")"),d.__viz_faChar?context.labelWidgets[d.data[0]].pos(pos).render():context.labelWidgets[d.data[0]].pos(pos).colorFill_default(context.textColor(d.data,context.columns()[1],d.data[1])).width(d.r*2).text(d.data[0]).render()}),node.exit().transition().style("opacity",0).remove()}exit(domNode,element){super.exit(domNode,element)}}__publicField(Bubble,"__inputs",[{id:"label",type:"string"},{id:"value",type:"number"}]),Bubble.prototype._class+=" chart_Bubble",Bubble.prototype.implements(api.I2DChart.prototype),Bubble.prototype.implements(api.ITooltip.prototype),Bubble.prototype.mixin(common.Utility.SimpleSelectionMixin),Bubble.prototype.publish("paletteID","default","set","Color palette for this widget",Bubble.prototype._palette.switch(),{tags:["Basic","Shared"]}),Bubble.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]});class BubbleXY extends Scatter{constructor(){super()}enter(domNode,element){this.pointSizeColumn_exists()||this.pointSizeColumn(this.columns()[this.columns().length-1]),super.enter(domNode,element)}}BubbleXY.prototype._class+=" chart_BubbleXY";var frame=0,timeout=0,interval=0,pokeDelay=1e3,taskHead,taskTail,clockLast=0,clockNow=0,clockSkew=0,clock=typeof performance=="object"&&performance.now?performance:Date,setFrame=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(f){setTimeout(f,17)};function now(){return clockNow||(setFrame(clearNow),clockNow=clock.now()+clockSkew)}function clearNow(){clockNow=0}function Timer(){this._call=this._time=this._next=null}Timer.prototype={constructor:Timer,restart:function(callback,delay,time){if(typeof callback!="function")throw new TypeError("callback is not a function");time=(time==null?now():+time)+(delay==null?0:+delay),!this._next&&taskTail!==this&&(taskTail?taskTail._next=this:taskHead=this,taskTail=this),this._call=callback,this._time=time,sleep()},stop:function(){this._call&&(this._call=null,this._time=1/0,sleep())}};function timerFlush(){now(),++frame;for(var t=taskHead,e;t;)(e=clockNow-t._time)>=0&&t._call.call(null,e),t=t._next;--frame}function wake(){clockNow=(clockLast=clock.now())+clockSkew,frame=timeout=0;try{timerFlush()}finally{frame=0,nap(),clockNow=0}}function poke(){var now2=clock.now(),delay=now2-clockLast;delay>pokeDelay&&(clockSkew-=delay,clockLast=now2)}function nap(){for(var t0,t1=taskHead,t2,time=1/0;t1;)t1._call?(time>t1._time&&(time=t1._time),t0=t1,t1=t1._next):(t2=t1._next,t1._next=null,t1=t0?t0._next=t2:taskHead=t2);taskTail=t0,sleep(time)}function sleep(time){if(!frame){timeout&&(timeout=clearTimeout(timeout));var delay=time-clockNow;delay>24?(time<1/0&&(timeout=setTimeout(wake,time-clock.now()-clockSkew)),interval&&(interval=clearInterval(interval))):(interval||(clockLast=clock.now(),interval=setInterval(poke,pokeDelay)),frame=1,setFrame(wake))}}function d3Bullet(){var orient="left",reverse=!1,vertical=!1,ranges=bulvarRanges,markers=bulvarMarkers,measures=bulvarMeasures,width=380,height=30,xAxis=axisLeft();function bulvar(g){g.each(function(d,i){var rangez=ranges.call(this,d,i).slice().sort(common.descending),markerz=markers.call(this,d,i).slice().sort(common.descending),measurez=measures.call(this,d,i).slice().sort(common.descending),g2=common.select(this),extentX,extentY,wrap2=g2.select("g.wrap");wrap2.empty()&&(wrap2=g2.append("g").attr("class","wrap")),vertical?(extentX=height,extentY=width,wrap2.attr("transform","rotate(90)translate(0,"+-width+")")):(extentX=width,extentY=height,wrap2.attr("transform",null));var x12=common.scaleLinear().domain([0,Math.max(rangez[0],markerz[0],measurez[0])]).range(reverse?[extentX,0]:[0,extentX]),x02=this.__chart__||common.scaleLinear().domain([0,1/0]).range(x12.range());this.__chart__=x12;var w0=bulvarWidth(x02),w1=bulvarWidth(x12),range=wrap2.selectAll("rect.range").data(rangez);range.enter().append("rect").attr("class",function(_d,i2){return"range s"+i2}).attr("width",w0).attr("height",extentY).attr("x",reverse?x02:0).merge(range).transition(range).attr("x",reverse?x12:0).attr("width",w1).attr("height",extentY);var measure=wrap2.selectAll("rect.measure").data(measurez);measure.enter().append("rect").attr("class",function(_d,i2){return"measure s"+i2}).attr("width",w0).attr("height",extentY/3).attr("x",reverse?x02:0).attr("y",extentY/3).merge(measure).transition(measure).attr("width",w1).attr("height",extentY/3).attr("x",reverse?x12:0).attr("y",extentY/3);var marker=wrap2.selectAll("line.marker").data(markerz);marker.enter().append("line").attr("class","marker").attr("x1",x02).attr("x2",x02).attr("y1",extentY/6).attr("y2",extentY*5/6).merge(marker).transition(marker).attr("x1",x12).attr("x2",x12).attr("y1",extentY/6).attr("y2",extentY*5/6);var axis2=g2.selectAll("g.axis").data([0]);axis2.enter().append("g").attr("class","axis"),axis2.attr("transform",vertical?null:"translate(0,"+extentY+")").call(xAxis.scale(x12))}),timerFlush()}return bulvar.orient=function(_){return arguments.length?(orient=_+"",reverse=orient==="right"||orient==="bottom",xAxis.orient((vertical=orient==="top"||orient==="bottom")?"left":"bottom"),bulvar):orient},bulvar.ranges=function(_){return arguments.length?(ranges=_,bulvar):ranges},bulvar.markers=function(_){return arguments.length?(markers=_,bulvar):markers},bulvar.measures=function(_){return arguments.length?(measures=_,bulvar):measures},bulvar.width=function(_){return arguments.length?(width=+_,bulvar):width},bulvar.height=function(_){return arguments.length?(height=+_,bulvar):height},bulvar.tickFormat=function(_){return arguments.length?(xAxis.tickFormat(_),bulvar):xAxis.tickFormat()},bulvar}function bulvarRanges(d){return d.ranges}function bulvarMarkers(d){return d.markers}function bulvarMeasures(d){return d.measures}function bulvarWidth(x2){var x02=x2(0);return function(d){return Math.abs(x2(d)-x02)}}class Bullet extends common.HTMLWidget{constructor(){super();__publicField(this,"_hiddenColumns",{});__publicField(this,"_selection");common.Utility.SimpleSelectionMixin.call(this,!0)}bulletData(){const context=this;this._hiddenColumns={};const columns=this.columns();return this.data().map(function(row){return{title:valueOf(row,this.titleColumn()),subtitle:valueOf(row,this.subtitleColumn()),ranges:valueOf(row,this.rangesColumn(),"range"),measures:valueOf(row,this.measuresColumn(),"measure"),markers:valueOf(row,this.markersColumn(),"marker"),origRow:row}},this);function valueOf(row,column,columnType){const colIdx=columns.indexOf(column);return colIdx>=0?row[colIdx]instanceof Array?row[colIdx]:[row[colIdx]]:(columnType&&(context._hiddenColumns[columnType]=!0),[0])}}enter(domNode,element){super.enter(domNode,element),common.select(domNode.parentNode).style("overflow","auto"),this._selection.widgetElement(element)}update(_domNode,element){super.update(_domNode,element);const context=this;element.selectAll(".axis").style("display","none"),element.selectAll(".range,.measure,.marker").style("display",null);const margin={left:2,top:8,right:2,bottom:8},width=this.width()-margin.left-margin.right,height=40-margin.top-margin.bottom,svg=element.selectAll("svg").data(this.bulletData()),svgUpdate=svg.enter().append("svg").attr("class","bullet").call(this._selection.enter.bind(this._selection)).on("click",function(d){context.click(context.rowToObj(d.origRow),context.titleColumn(),context._selection.selected(this))}).on("dblclick",function(d){context.dblclick(context.rowToObj(d.origRow),context.titleColumn(),context._selection.selected(this))}).each(function(){const bulletTitle=common.select(this).append("g").attr("class",(d,i)=>"bulletBar series series-"+context.cssTag(context.titleColumn())).append("g").attr("class","bulletTitle");bulletTitle.append("text").attr("class","title"),bulletTitle.append("text").attr("class","subtitle").attr("dy","1em")}).merge(svg),title=svgUpdate.select(".bulletTitle").style("text-anchor","end").attr("transform","translate(-6,"+height/2+")");title.select(".title").text(function(d){return d.title}),title.select(".subtitle").text(function(d){return d.subtitle});let titleWidth=0;title.each(function(){const bbox=this.getBBox();bbox.width>titleWidth&&(titleWidth=bbox.width)});const chart=d3Bullet().width(width-titleWidth-6).height(height);svgUpdate.attr("width",width).attr("height",height+margin.top+margin.bottom).style("margin-left",`${margin.left}px`),svgUpdate.select(".bulletBar").attr("transform","translate("+(titleWidth+6)+","+margin.top+")").call(chart),svg.exit().remove(),Object.keys(this._hiddenColumns).length>0&&element.selectAll(`.${Object.keys(this._hiddenColumns).join(",.")}`).style("display","none")}exit(domNode,element){super.exit(domNode,element)}click(row,column,selected){}dblclick(row,column,selected){}}Bullet.prototype._class+=" chart_Bullet",Bullet.prototype.publish("titleColumn",null,"set","Title Column",function(){return this.columns()},{optional:!0}),Bullet.prototype.publish("subtitleColumn",null,"set","Subtitle Column",function(){return this.columns()},{optional:!0}),Bullet.prototype.publish("rangesColumn",null,"set","Ranges Column",function(){return this.columns()},{optional:!0}),Bullet.prototype.publish("measuresColumn",null,"set","Measures Column",function(){return this.columns()},{optional:!0}),Bullet.prototype.publish("markersColumn",null,"set","Markers Column",function(){return this.columns()},{optional:!0});var array=Array.prototype,slice=array.slice;function ascending(a,b){return a-b}function area(ring){for(var i=0,n=ring.length,area2=ring[n-1][1]*ring[0][0]-ring[n-1][0]*ring[0][1];++i<n;)area2+=ring[i-1][1]*ring[i][0]-ring[i-1][0]*ring[i][1];return area2}function constant$1(x2){return function(){return x2}}function contains(ring,hole){for(var i=-1,n=hole.length,c;++i<n;)if(c=ringContains(ring,hole[i]))return c;return 0}function ringContains(ring,point2){for(var x2=point2[0],y2=point2[1],contains2=-1,i=0,n=ring.length,j=n-1;i<n;j=i++){var pi2=ring[i],xi=pi2[0],yi=pi2[1],pj=ring[j],xj=pj[0],yj=pj[1];if(segmentContains(pi2,pj,point2))return 0;yi>y2!=yj>y2&&x2<(xj-xi)*(y2-yi)/(yj-yi)+xi&&(contains2=-contains2)}return contains2}function segmentContains(a,b,c){var i;return collinear(a,b,c)&&within(a[i=+(a[0]===b[0])],c[i],b[i])}function collinear(a,b,c){return(b[0]-a[0])*(c[1]-a[1])===(c[0]-a[0])*(b[1]-a[1])}function within(p,q,r){return p<=q&&q<=r||r<=q&&q<=p}function noop$2(){}var cases=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function contours(){var dx=1,dy=1,threshold=common.thresholdSturges,smooth=smoothLinear;function contours2(values){var tz=threshold(values);if(Array.isArray(tz))tz=tz.slice().sort(ascending);else{var domain=common.extent(values),start=domain[0],stop=domain[1];tz=common.tickStep(start,stop,tz),tz=common.range(Math.floor(start/tz)*tz,Math.floor(stop/tz)*tz,tz)}return tz.map(function(value){return contour(values,value)})}function contour(values,value){var polygons=[],holes=[];return isorings(values,value,function(ring){smooth(ring,values,value),area(ring)>0?polygons.push([ring]):holes.push(ring)}),holes.forEach(function(hole){for(var i=0,n=polygons.length,polygon;i<n;++i)if(contains((polygon=polygons[i])[0],hole)!==-1){polygon.push(hole);return}}),{type:"MultiPolygon",value,coordinates:polygons}}function isorings(values,value,callback){var fragmentByStart=new Array,fragmentByEnd=new Array,x2,y2,t0,t1,t2,t3;for(x2=y2=-1,t1=values[0]>=value,cases[t1<<1].forEach(stitch);++x2<dx-1;)t0=t1,t1=values[x2+1]>=value,cases[t0|t1<<1].forEach(stitch);for(cases[t1<<0].forEach(stitch);++y2<dy-1;){for(x2=-1,t1=values[y2*dx+dx]>=value,t2=values[y2*dx]>=value,cases[t1<<1|t2<<2].forEach(stitch);++x2<dx-1;)t0=t1,t1=values[y2*dx+dx+x2+1]>=value,t3=t2,t2=values[y2*dx+x2+1]>=value,cases[t0|t1<<1|t2<<2|t3<<3].forEach(stitch);cases[t1|t2<<3].forEach(stitch)}for(x2=-1,t2=values[y2*dx]>=value,cases[t2<<2].forEach(stitch);++x2<dx-1;)t3=t2,t2=values[y2*dx+x2+1]>=value,cases[t2<<2|t3<<3].forEach(stitch);cases[t2<<3].forEach(stitch);function stitch(line2){var start=[line2[0][0]+x2,line2[0][1]+y2],end=[line2[1][0]+x2,line2[1][1]+y2],startIndex=index(start),endIndex=index(end),f,g;(f=fragmentByEnd[startIndex])?(g=fragmentByStart[endIndex])?(delete fragmentByEnd[f.end],delete fragmentByStart[g.start],f===g?(f.ring.push(end),callback(f.ring)):fragmentByStart[f.start]=fragmentByEnd[g.end]={start:f.start,end:g.end,ring:f.ring.concat(g.ring)}):(delete fragmentByEnd[f.end],f.ring.push(end),fragmentByEnd[f.end=endIndex]=f):(f=fragmentByStart[endIndex])?(g=fragmentByEnd[startIndex])?(delete fragmentByStart[f.start],delete fragmentByEnd[g.end],f===g?(f.ring.push(end),callback(f.ring)):fragmentByStart[g.start]=fragmentByEnd[f.end]={start:g.start,end:f.end,ring:g.ring.concat(f.ring)}):(delete fragmentByStart[f.start],f.ring.unshift(start),fragmentByStart[f.start=startIndex]=f):fragmentByStart[startIndex]=fragmentByEnd[endIndex]={start:startIndex,end:endIndex,ring:[start,end]}}}function index(point2){return point2[0]*2+point2[1]*(dx+1)*4}function smoothLinear(ring,values,value){ring.forEach(function(point2){var x2=point2[0],y2=point2[1],xt=x2|0,yt=y2|0,v0,v1=values[yt*dx+xt];x2>0&&x2<dx&&xt===x2&&(v0=values[yt*dx+xt-1],point2[0]=x2+(value-v0)/(v1-v0)-.5),y2>0&&y2<dy&&yt===y2&&(v0=values[(yt-1)*dx+xt],point2[1]=y2+(value-v0)/(v1-v0)-.5)})}return contours2.contour=contour,contours2.size=function(_){if(!arguments.length)return[dx,dy];var _0=Math.ceil(_[0]),_1=Math.ceil(_[1]);if(!(_0>0)||!(_1>0))throw new Error("invalid size");return dx=_0,dy=_1,contours2},contours2.thresholds=function(_){return arguments.length?(threshold=typeof _=="function"?_:Array.isArray(_)?constant$1(slice.call(_)):constant$1(_),contours2):threshold},contours2.smooth=function(_){return arguments.length?(smooth=_?smoothLinear:noop$2,contours2):smooth===smoothLinear},contours2}function blurX(source,target,r){for(var n=source.width,m=source.height,w=(r<<1)+1,j=0;j<m;++j)for(var i=0,sr=0;i<n+r;++i)i<n&&(sr+=source.data[i+j*n]),i>=r&&(i>=w&&(sr-=source.data[i-w+j*n]),target.data[i-r+j*n]=sr/Math.min(i+1,n-1+w-i,w))}function blurY(source,target,r){for(var n=source.width,m=source.height,w=(r<<1)+1,i=0;i<n;++i)for(var j=0,sr=0;j<m+r;++j)j<m&&(sr+=source.data[i+j*n]),j>=r&&(j>=w&&(sr-=source.data[i+(j-w)*n]),target.data[i+(j-r)*n]=sr/Math.min(j+1,m-1+w-j,w))}function defaultX(d){return d[0]}function defaultY(d){return d[1]}function defaultWeight(){return 1}function d3ContourDensity(){var x2=defaultX,y2=defaultY,weight=defaultWeight,dx=960,dy=500,r=20,k=2,o=r*3,n=dx+o*2>>k,m=dy+o*2>>k,threshold=constant$1(20);function density(data){var values0=new Float32Array(n*m),values1=new Float32Array(n*m);data.forEach(function(d,i,data2){var xi=+x2(d,i,data2)+o>>k,yi=+y2(d,i,data2)+o>>k,wi=+weight(d,i,data2);xi>=0&&xi<n&&yi>=0&&yi<m&&(values0[xi+yi*n]+=wi)}),blurX({width:n,height:m,data:values0},{data:values1},r>>k),blurY({width:n,height:m,data:values1},{data:values0},r>>k),blurX({width:n,height:m,data:values0},{data:values1},r>>k),blurY({width:n,height:m,data:values1},{data:values0},r>>k),blurX({width:n,height:m,data:values0},{data:values1},r>>k),blurY({width:n,height:m,data:values1},{data:values0},r>>k);var tz=threshold(values0);if(!Array.isArray(tz)){var stop=common.max(values0);tz=common.tickStep(0,stop,tz),tz=common.range(0,Math.floor(stop/tz)*tz,tz),tz.shift()}return contours().thresholds(tz).size([n,m])(values0).map(transform)}function transform(geometry){return geometry.value*=Math.pow(2,-2*k),geometry.coordinates.forEach(transformPolygon),geometry}function transformPolygon(coordinates){coordinates.forEach(transformRing)}function transformRing(coordinates){coordinates.forEach(transformPoint)}function transformPoint(coordinates){coordinates[0]=coordinates[0]*Math.pow(2,k)-o,coordinates[1]=coordinates[1]*Math.pow(2,k)-o}function resize(){return o=r*3,n=dx+o*2>>k,m=dy+o*2>>k,density}return density.x=function(_){return arguments.length?(x2=typeof _=="function"?_:constant$1(+_),density):x2},density.y=function(_){return arguments.length?(y2=typeof _=="function"?_:constant$1(+_),density):y2},density.weight=function(_){return arguments.length?(weight=typeof _=="function"?_:constant$1(+_),density):weight},density.size=function(_){if(!arguments.length)return[dx,dy];var _0=Math.ceil(_[0]),_1=Math.ceil(_[1]);if(!(_0>=0)&&!(_0>=0))throw new Error("invalid size");return dx=_0,dy=_1,resize()},density.cellSize=function(_){if(!arguments.length)return 1<<k;if(!((_=+_)>=1))throw new Error("invalid cell size");return k=Math.floor(Math.log(_)/Math.LN2),resize()},density.thresholds=function(_){return arguments.length?(threshold=typeof _=="function"?_:Array.isArray(_)?constant$1(slice.call(_)):constant$1(_),density):threshold},density.bandwidth=function(_){if(!arguments.length)return Math.sqrt(r*(r+1));if(!((_=+_)>=0))throw new Error("invalid bandwidth");return r=Math.round((Math.sqrt(4*_*_+1)-1)/2),resize()},density}function adder(){return new Adder}function Adder(){this.reset()}Adder.prototype={constructor:Adder,reset:function(){this.s=this.t=0},add:function(y2){add(temp,y2,this.t),add(this,temp.s,this.s),this.s?this.t+=temp.t:this.s=temp.t},valueOf:function(){return this.s}};var temp=new Adder;function add(adder2,a,b){var x2=adder2.s=a+b,bv=x2-a,av=x2-bv;adder2.t=a-av+(b-bv)}var pi$1=Math.PI,tau$1=pi$1*2,abs=Math.abs,sqrt=Math.sqrt;function noop$1(){}function streamGeometry(geometry,stream){geometry&&streamGeometryType.hasOwnProperty(geometry.type)&&streamGeometryType[geometry.type](geometry,stream)}var streamObjectType={Feature:function(object,stream){streamGeometry(object.geometry,stream)},FeatureCollection:function(object,stream){for(var features=object.features,i=-1,n=features.length;++i<n;)streamGeometry(features[i].geometry,stream)}},streamGeometryType={Sphere:function(object,stream){stream.sphere()},Point:function(object,stream){object=object.coordinates,stream.point(object[0],object[1],object[2])},MultiPoint:function(object,stream){for(var coordinates=object.coordinates,i=-1,n=coordinates.length;++i<n;)object=coordinates[i],stream.point(object[0],object[1],object[2])},LineString:function(object,stream){streamLine(object.coordinates,stream,0)},MultiLineString:function(object,stream){for(var coordinates=object.coordinates,i=-1,n=coordinates.length;++i<n;)streamLine(coordinates[i],stream,0)},Polygon:function(object,stream){streamPolygon(object.coordinates,stream)},MultiPolygon:function(object,stream){for(var coordinates=object.coordinates,i=-1,n=coordinates.length;++i<n;)streamPolygon(coordinates[i],stream)},GeometryCollection:function(object,stream){for(var geometries=object.geometries,i=-1,n=geometries.length;++i<n;)streamGeometry(geometries[i],stream)}};function streamLine(coordinates,stream,closed){var i=-1,n=coordinates.length-closed,coordinate;for(stream.lineStart();++i<n;)coordinate=coordinates[i],stream.point(coordinate[0],coordinate[1],coordinate[2]);stream.lineEnd()}function streamPolygon(coordinates,stream){var i=-1,n=coordinates.length;for(stream.polygonStart();++i<n;)streamLine(coordinates[i],stream,1);stream.polygonEnd()}function geoStream(object,stream){object&&streamObjectType.hasOwnProperty(object.type)?streamObjectType[object.type](object,stream):streamGeometry(object,stream)}function identity(x2){return x2}var areaSum=adder(),areaRingSum=adder(),x00$2,y00$2,x0$3,y0$3,areaStream={point:noop$1,lineStart:noop$1,lineEnd:noop$1,polygonStart:function(){areaStream.lineStart=areaRingStart,areaStream.lineEnd=areaRingEnd},polygonEnd:function(){areaStream.lineStart=areaStream.lineEnd=areaStream.point=noop$1,areaSum.add(abs(areaRingSum)),areaRingSum.reset()},result:function(){var area2=areaSum/2;return areaSum.reset(),area2}};function areaRingStart(){areaStream.point=areaPointFirst}function areaPointFirst(x2,y2){areaStream.point=areaPoint,x00$2=x0$3=x2,y00$2=y0$3=y2}function areaPoint(x2,y2){areaRingSum.add(y0$3*x2-x0$3*y2),x0$3=x2,y0$3=y2}function areaRingEnd(){areaPoint(x00$2,y00$2)}var x0$2=1/0,y0$2=x0$2,x1=-x0$2,y1=x1,boundsStream={point:boundsPoint,lineStart:noop$1,lineEnd:noop$1,polygonStart:noop$1,polygonEnd:noop$1,result:function(){var bounds=[[x0$2,y0$2],[x1,y1]];return x1=y1=-(y0$2=x0$2=1/0),bounds}};function boundsPoint(x2,y2){x2<x0$2&&(x0$2=x2),x2>x1&&(x1=x2),y2<y0$2&&(y0$2=y2),y2>y1&&(y1=y2)}var X0=0,Y0=0,Z0=0,X1=0,Y1=0,Z1=0,X2=0,Y2=0,Z2=0,x00$1,y00$1,x0$1,y0$1,centroidStream={point:centroidPoint,lineStart:centroidLineStart,lineEnd:centroidLineEnd,polygonStart:function(){centroidStream.lineStart=centroidRingStart,centroidStream.lineEnd=centroidRingEnd},polygonEnd:function(){centroidStream.point=centroidPoint,centroidStream.lineStart=centroidLineStart,centroidStream.lineEnd=centroidLineEnd},result:function(){var centroid=Z2?[X2/Z2,Y2/Z2]:Z1?[X1/Z1,Y1/Z1]:Z0?[X0/Z0,Y0/Z0]:[NaN,NaN];return X0=Y0=Z0=X1=Y1=Z1=X2=Y2=Z2=0,centroid}};function centroidPoint(x2,y2){X0+=x2,Y0+=y2,++Z0}function centroidLineStart(){centroidStream.point=centroidPointFirstLine}function centroidPointFirstLine(x2,y2){centroidStream.point=centroidPointLine,centroidPoint(x0$1=x2,y0$1=y2)}function centroidPointLine(x2,y2){var dx=x2-x0$1,dy=y2-y0$1,z=sqrt(dx*dx+dy*dy);X1+=z*(x0$1+x2)/2,Y1+=z*(y0$1+y2)/2,Z1+=z,centroidPoint(x0$1=x2,y0$1=y2)}function centroidLineEnd(){centroidStream.point=centroidPoint}function centroidRingStart(){centroidStream.point=centroidPointFirstRing}function centroidRingEnd(){centroidPointRing(x00$1,y00$1)}function centroidPointFirstRing(x2,y2){centroidStream.point=centroidPointRing,centroidPoint(x00$1=x0$1=x2,y00$1=y0$1=y2)}function centroidPointRing(x2,y2){var dx=x2-x0$1,dy=y2-y0$1,z=sqrt(dx*dx+dy*dy);X1+=z*(x0$1+x2)/2,Y1+=z*(y0$1+y2)/2,Z1+=z,z=y0$1*x2-x0$1*y2,X2+=z*(x0$1+x2),Y2+=z*(y0$1+y2),Z2+=z*3,centroidPoint(x0$1=x2,y0$1=y2)}function PathContext(context){this._context=context}PathContext.prototype={_radius:4.5,pointRadius:function(_){return this._radius=_,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(x2,y2){switch(this._point){case 0:{this._context.moveTo(x2,y2),this._point=1;break}case 1:{this._context.lineTo(x2,y2);break}default:{this._context.moveTo(x2+this._radius,y2),this._context.arc(x2,y2,this._radius,0,tau$1);break}}},result:noop$1};var lengthSum=adder(),lengthRing,x00,y00,x0,y0,lengthStream={point:noop$1,lineStart:function(){lengthStream.point=lengthPointFirst},lineEnd:function(){lengthRing&&lengthPoint(x00,y00),lengthStream.point=noop$1},polygonStart:function(){lengthRing=!0},polygonEnd:function(){lengthRing=null},result:function(){var length=+lengthSum;return lengthSum.reset(),length}};function lengthPointFirst(x2,y2){lengthStream.point=lengthPoint,x00=x0=x2,y00=y0=y2}function lengthPoint(x2,y2){x0-=x2,y0-=y2,lengthSum.add(sqrt(x0*x0+y0*y0)),x0=x2,y0=y2}function PathString(){this._string=[]}PathString.prototype={_radius:4.5,_circle:circle(4.5),pointRadius:function(_){return(_=+_)!==this._radius&&(this._radius=_,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(x2,y2){switch(this._point){case 0:{this._string.push("M",x2,",",y2),this._point=1;break}case 1:{this._string.push("L",x2,",",y2);break}default:{this._circle==null&&(this._circle=circle(this._radius)),this._string.push("M",x2,",",y2,this._circle);break}}},result:function(){if(this._string.length){var result=this._string.join("");return this._string=[],result}else return null}};function circle(radius){return"m0,"+radius+"a"+radius+","+radius+" 0 1,1 0,"+-2*radius+"a"+radius+","+radius+" 0 1,1 0,"+2*radius+"z"}function geoPath(projection,context){var pointRadius=4.5,projectionStream,contextStream;function path2(object){return object&&(typeof pointRadius=="function"&&contextStream.pointRadius(+pointRadius.apply(this,arguments)),geoStream(object,projectionStream(contextStream))),contextStream.result()}return path2.area=function(object){return geoStream(object,projectionStream(areaStream)),areaStream.result()},path2.measure=function(object){return geoStream(object,projectionStream(lengthStream)),lengthStream.result()},path2.bounds=function(object){return geoStream(object,projectionStream(boundsStream)),boundsStream.result()},path2.centroid=function(object){return geoStream(object,projectionStream(centroidStream)),centroidStream.result()},path2.projection=function(_){return arguments.length?(projectionStream=_==null?(projection=null,identity):(projection=_).stream,path2):projection},path2.context=function(_){return arguments.length?(contextStream=_==null?(context=null,new PathString):new PathContext(context=_),typeof pointRadius!="function"&&contextStream.pointRadius(pointRadius),path2):context},path2.pointRadius=function(_){return arguments.length?(pointRadius=typeof _=="function"?_:(contextStream.pointRadius(+_),+_),path2):pointRadius},path2.projection(projection).context(context)}class Contour extends XYAxis{constructor(){super();__publicField(this,"_dataMinWeight");__publicField(this,"_dataMaxWeight");this.xAxisGuideLines_default(!1).yAxisGuideLines_default(!1).xAxisType_default("linear")}xPos(host,d){return host.orientation()==="horizontal"?host.dataPos(d.label):host.valuePos(d.value)}yPos(host,d){return host.orientation()==="horizontal"?host.valuePos(d.value):host.dataPos(d.label)}layerEnter(host,element,duration=250){super.layerEnter(host,element,duration)}layerUpdate(host,element,duration=250){super.layerUpdate(host,element,duration),this._palette=this._palette.switch(this.paletteID());const data=this.flattenData(this.layerColumns(host),this.layerData(host)),contourData=d3ContourDensity().x(d=>this.xPos(host,d)).y(d=>this.yPos(host,d)).size([this.width(),this.height()]).bandwidth(this.contourBandwidth())(data),_vals=contourData.map(d=>d.value),minValue=Math.min.apply(this,_vals),maxValue=Math.max.apply(this,_vals);this._dataMinWeight=minValue,this._dataMaxWeight=maxValue;const lines=element.selectAll("path").data(contourData);lines.enter().append("path").merge(lines).attr("d",geoPath()).attr("fill",d=>this.showContourFill()?this._palette(d.value,minValue,maxValue):"none").attr("stroke",this.contourStrokeColor()).attr("stroke-linejoin","round").attr("stroke-width",this.contourStrokeWidth()),lines.exit().remove()}exit(_domNode,_element){super.exit(_domNode,_element)}}__publicField(Contour,"__inputs",[{id:"x",type:"any"},{id:"y",type:"number"}]),Contour.prototype._class+=" chart_Contour",Contour.prototype.implements(api.I1DChart.prototype),Contour.prototype.publish("paletteID","YlGnBu","string","Color palette for this widget"),Contour.prototype.publish("useClonedPalette",!0,"boolean","Enable or disable using a cloned palette"),Contour.prototype.publish("showContourFill",!0,"boolean","Show/hide the contour background colors"),Contour.prototype.publish("showContour",!0,"boolean","Show/hide the contour border lines"),Contour.prototype.publish("contourBandwidth",40,"number","Controls the sensitivity of the contour grouping algorithm"),Contour.prototype.publish("contourStrokeColor","#2C3A47","html-color","Color of the contour border lines"),Contour.prototype.publish("contourStrokeWidth",1,"number","Width of the contour border lines");class Gantt extends Bar{constructor(){super(),this.orientation_default("vertical").xAxisType_default("ordinal").yAxisType_default("time")}}Gantt.prototype._class+=" chart_Gantt";function constant(x2){return function(){return x2}}var epsilon=1e-12,pi=Math.PI,halfPi=pi/2,tau=2*pi;function arcInnerRadius(d){return d.innerRadius}function arcOuterRadius(d){return d.outerRadius}function arcStartAngle(d){return d.startAngle}function arcEndAngle(d){return d.endAngle}function arcPadAngle(d){return d&&d.padAngle}function asin(x2){return x2>=1?halfPi:x2<=-1?-halfPi:Math.asin(x2)}function intersect(x02,y02,x12,y12,x2,y2,x3,y3){var x10=x12-x02,y10=y12-y02,x32=x3-x2,y32=y3-y2,t=(x32*(y02-y2)-y32*(x02-x2))/(y32*x10-x32*y10);return[x02+t*x10,y02+t*y10]}function cornerTangents(x02,y02,x12,y12,r1,rc,cw2){var x01=x02-x12,y01=y02-y12,lo=(cw2?rc:-rc)/Math.sqrt(x01*x01+y01*y01),ox=lo*y01,oy=-lo*x01,x11=x02+ox,y11=y02+oy,x10=x12+ox,y10=y12+oy,x002=(x11+x10)/2,y002=(y11+y10)/2,dx=x10-x11,dy=y10-y11,d2=dx*dx+dy*dy,r=r1-rc,D=x11*y10-x10*y11,d=(dy<0?-1:1)*Math.sqrt(Math.max(0,r*r*d2-D*D)),cx0=(D*dy-dx*d)/d2,cy0=(-D*dx-dy*d)/d2,cx1=(D*dy+dx*d)/d2,cy1=(-D*dx+dy*d)/d2,dx0=cx0-x002,dy0=cy0-y002,dx1=cx1-x002,dy1=cy1-y002;return dx0*dx0+dy0*dy0>dx1*dx1+dy1*dy1&&(cx0=cx1,cy0=cy1),{cx:cx0,cy:cy0,x01:-ox,y01:-oy,x11:cx0*(r1/r-1),y11:cy0*(r1/r-1)}}function arc(){var innerRadius=arcInnerRadius,outerRadius=arcOuterRadius,cornerRadius=constant(0),padRadius=null,startAngle=arcStartAngle,endAngle=arcEndAngle,padAngle=arcPadAngle,context=null;function arc2(){var buffer,r,r0=+innerRadius.apply(this,arguments),r1=+outerRadius.apply(this,arguments),a0=startAngle.apply(this,arguments)-halfPi,a1=endAngle.apply(this,arguments)-halfPi,da=Math.abs(a1-a0),cw2=a1>a0;if(context||(context=buffer=path()),r1<r0&&(r=r1,r1=r0,r0=r),!(r1>epsilon))context.moveTo(0,0);else if(da>tau-epsilon)context.moveTo(r1*Math.cos(a0),r1*Math.sin(a0)),context.arc(0,0,r1,a0,a1,!cw2),r0>epsilon&&(context.moveTo(r0*Math.cos(a1),r0*Math.sin(a1)),context.arc(0,0,r0,a1,a0,cw2));else{var a01=a0,a11=a1,a00=a0,a10=a1,da0=da,da1=da,ap=padAngle.apply(this,arguments)/2,rp=ap>epsilon&&(padRadius?+padRadius.apply(this,arguments):Math.sqrt(r0*r0+r1*r1)),rc=Math.min(Math.abs(r1-r0)/2,+cornerRadius.apply(this,arguments)),rc0=rc,rc1=rc,t0,t1;if(rp>epsilon){var p0=asin(rp/r0*Math.sin(ap)),p1=asin(rp/r1*Math.sin(ap));(da0-=p0*2)>epsilon?(p0*=cw2?1:-1,a00+=p0,a10-=p0):(da0=0,a00=a10=(a0+a1)/2),(da1-=p1*2)>epsilon?(p1*=cw2?1:-1,a01+=p1,a11-=p1):(da1=0,a01=a11=(a0+a1)/2)}var x01=r1*Math.cos(a01),y01=r1*Math.sin(a01),x10=r0*Math.cos(a10),y10=r0*Math.sin(a10);if(rc>epsilon){var x11=r1*Math.cos(a11),y11=r1*Math.sin(a11),x002=r0*Math.cos(a00),y002=r0*Math.sin(a00);if(da<pi){var oc=da0>epsilon?intersect(x01,y01,x002,y002,x11,y11,x10,y10):[x10,y10],ax=x01-oc[0],ay=y01-oc[1],bx=x11-oc[0],by=y11-oc[1],kc=1/Math.sin(Math.acos((ax*bx+ay*by)/(Math.sqrt(ax*ax+ay*ay)*Math.sqrt(bx*bx+by*by)))/2),lc=Math.sqrt(oc[0]*oc[0]+oc[1]*oc[1]);rc0=Math.min(rc,(r0-lc)/(kc-1)),rc1=Math.min(rc,(r1-lc)/(kc+1))}}da1>epsilon?rc1>epsilon?(t0=cornerTangents(x002,y002,x01,y01,r1,rc1,cw2),t1=cornerTangents(x11,y11,x10,y10,r1,rc1,cw2),context.moveTo(t0.cx+t0.x01,t0.cy+t0.y01),rc1<rc?context.arc(t0.cx,t0.cy,rc1,Math.atan2(t0.y01,t0.x01),Math.atan2(t1.y01,t1.x01),!cw2):(context.arc(t0.cx,t0.cy,rc1,Math.atan2(t0.y01,t0.x01),Math.atan2(t0.y11,t0.x11),!cw2),context.arc(0,0,r1,Math.atan2(t0.cy+t0.y11,t0.cx+t0.x11),Math.atan2(t1.cy+t1.y11,t1.cx+t1.x11),!cw2),context.arc(t1.cx,t1.cy,rc1,Math.atan2(t1.y11,t1.x11),Math.atan2(t1.y01,t1.x01),!cw2))):(context.moveTo(x01,y01),context.arc(0,0,r1,a01,a11,!cw2)):context.moveTo(x01,y01),!(r0>epsilon)||!(da0>epsilon)?context.lineTo(x10,y10):rc0>epsilon?(t0=cornerTangents(x10,y10,x11,y11,r0,-rc0,cw2),t1=cornerTangents(x01,y01,x002,y002,r0,-rc0,cw2),context.lineTo(t0.cx+t0.x01,t0.cy+t0.y01),rc0<rc?context.arc(t0.cx,t0.cy,rc0,Math.atan2(t0.y01,t0.x01),Math.atan2(t1.y01,t1.x01),!cw2):(context.arc(t0.cx,t0.cy,rc0,Math.atan2(t0.y01,t0.x01),Math.atan2(t0.y11,t0.x11),!cw2),context.arc(0,0,r0,Math.atan2(t0.cy+t0.y11,t0.cx+t0.x11),Math.atan2(t1.cy+t1.y11,t1.cx+t1.x11),cw2),context.arc(t1.cx,t1.cy,rc0,Math.atan2(t1.y11,t1.x11),Math.atan2(t1.y01,t1.x01),!cw2))):context.arc(0,0,r0,a10,a00,cw2)}if(context.closePath(),buffer)return context=null,buffer+""||null}return arc2.centroid=function(){var r=(+innerRadius.apply(this,arguments)+ +outerRadius.apply(this,arguments))/2,a=(+startAngle.apply(this,arguments)+ +endAngle.apply(this,arguments))/2-pi/2;return[Math.cos(a)*r,Math.sin(a)*r]},arc2.innerRadius=function(_){return arguments.length?(innerRadius=typeof _=="function"?_:constant(+_),arc2):innerRadius},arc2.outerRadius=function(_){return arguments.length?(outerRadius=typeof _=="function"?_:constant(+_),arc2):outerRadius},arc2.cornerRadius=function(_){return arguments.length?(cornerRadius=typeof _=="function"?_:constant(+_),arc2):cornerRadius},arc2.padRadius=function(_){return arguments.length?(padRadius=_==null?null:typeof _=="function"?_:constant(+_),arc2):padRadius},arc2.startAngle=function(_){return arguments.length?(startAngle=typeof _=="function"?_:constant(+_),arc2):startAngle},arc2.endAngle=function(_){return arguments.length?(endAngle=typeof _=="function"?_:constant(+_),arc2):endAngle},arc2.padAngle=function(_){return arguments.length?(padAngle=typeof _=="function"?_:constant(+_),arc2):padAngle},arc2.context=function(_){return arguments.length?(context=_??null,arc2):context},arc2}function Linear(context){this._context=context}Linear.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(x2,y2){switch(x2=+x2,y2=+y2,this._point){case 0:this._point=1,this._line?this._context.lineTo(x2,y2):this._context.moveTo(x2,y2);break;case 1:this._point=2;default:this._context.lineTo(x2,y2);break}}};function curveLinear(context){return new Linear(context)}function x(p){return p[0]}function y(p){return p[1]}function line(){var x$12=x,y$12=y,defined=constant(!0),context=null,curve=curveLinear,output=null;function line2(data){var i,n=data.length,d,defined0=!1,buffer;for(context==null&&(output=curve(buffer=path())),i=0;i<=n;++i)!(i<n&&defined(d=data[i],i,data))===defined0&&((defined0=!defined0)?output.lineStart():output.lineEnd()),defined0&&output.point(+x$12(d,i,data),+y$12(d,i,data));if(buffer)return output=null,buffer+""||null}return line2.x=function(_){return arguments.length?(x$12=typeof _=="function"?_:constant(+_),line2):x$12},line2.y=function(_){return arguments.length?(y$12=typeof _=="function"?_:constant(+_),line2):y$12},line2.defined=function(_){return arguments.length?(defined=typeof _=="function"?_:constant(!!_),line2):defined},line2.curve=function(_){return arguments.length?(curve=_,context!=null&&(output=curve(context)),line2):curve},line2.context=function(_){return arguments.length?(_==null?context=output=null:output=curve(context=_),line2):context},line2}function noop(){}function point$3(that,x2,y2){that._context.bezierCurveTo((2*that._x0+that._x1)/3,(2*that._y0+that._y1)/3,(that._x0+2*that._x1)/3,(that._y0+2*that._y1)/3,(that._x0+4*that._x1+x2)/6,(that._y0+4*that._y1+y2)/6)}function Basis(context){this._context=context}Basis.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:point$3(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(x2,y2){switch(x2=+x2,y2=+y2,this._point){case 0:this._point=1,this._line?this._context.lineTo(x2,y2):this._context.moveTo(x2,y2);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:point$3(this,x2,y2);break}this._x0=this._x1,this._x1=x2,this._y0=this._y1,this._y1=y2}};function Bundle(context,beta){this._basis=new Basis(context),this._beta=beta}Bundle.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var x2=this._x,y2=this._y,j=x2.length-1;if(j>0)for(var x02=x2[0],y02=y2[0],dx=x2[j]-x02,dy=y2[j]-y02,i=-1,t;++i<=j;)t=i/j,this._basis.point(this._beta*x2[i]+(1-this._beta)*(x02+t*dx),this._beta*y2[i]+(1-this._beta)*(y02+t*dy));this._x=this._y=null,this._basis.lineEnd()},point:function(x2,y2){this._x.push(+x2),this._y.push(+y2)}},function custom(beta){function bundle(context){return beta===1?new Basis(context):new Bundle(context,beta)}return bundle.beta=function(beta2){return custom(+beta2)},bundle}(.85);function point$2(that,x2,y2){that._context.bezierCurveTo(that._x1+that._k*(that._x2-that._x0),that._y1+that._k*(that._y2-that._y0),that._x2+that._k*(that._x1-x2),that._y2+that._k*(that._y1-y2),that._x2,that._y2)}function Cardinal(context,tension){this._context=context,this._k=(1-tension)/6}Cardinal.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:point$2(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(x2,y2){switch(x2=+x2,y2=+y2,this._point){case 0:this._point=1,this._line?this._context.lineTo(x2,y2):this._context.moveTo(x2,y2);break;case 1:this._point=2,this._x1=x2,this._y1=y2;break;case 2:this._point=3;default:point$2(this,x2,y2);break}this._x0=this._x1,this._x1=this._x2,this._x2=x2,this._y0=this._y1,this._y1=this._y2,this._y2=y2}},function custom(tension){function cardinal(context){return new Cardinal(context,tension)}return cardinal.tension=function(tension2){return custom(+tension2)},cardinal}(0);function CardinalClosed(context,tension){this._context=context,this._k=(1-tension)/6}CardinalClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(x2,y2){switch(x2=+x2,y2=+y2,this._point){case 0:this._point=1,this._x3=x2,this._y3=y2;break;case 1:this._point=2,this._context.moveTo(this._x4=x2,this._y4=y2);break;case 2:this._point=3,this._x5=x2,this._y5=y2;break;default:point$2(this,x2,y2);break}this._x0=this._x1,this._x1=this._x2,this._x2=x2,this._y0=this._y1,this._y1=this._y2,this._y2=y2}},function custom(tension){function cardinal(context){return new CardinalClosed(context,tension)}return cardinal.tension=function(tension2){return custom(+tension2)},cardinal}(0);function CardinalOpen(context,tension){this._context=context,this._k=(1-tension)/6}CardinalOpen.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(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(x2,y2){switch(x2=+x2,y2=+y2,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:point$2(this,x2,y2);break}this._x0=this._x1,this._x1=this._x2,this._x2=x2,this._y0=this._y1,this._y1=this._y2,this._y2=y2}},function custom(tension){function cardinal(context){return new CardinalOpen(context,tension)}return cardinal.tension=function(tension2){return custom(+tension2)},cardinal}(0);function point$1(that,x2,y2){var x12=that._x1,y12=that._y1,x22=that._x2,y22=that._y2;if(that._l01_a>epsilon){var a=2*that._l01_2a+3*that._l01_a*that._l12_a+that._l12_2a,n=3*that._l01_a*(that._l01_a+that._l12_a);x12=(x12*a-that._x0*that._l12_2a+that._x2*that._l01_2a)/n,y12=(y12*a-that._y0*that._l12_2a+that._y2*that._l01_2a)/n}if(that._l23_a>epsilon){var b=2*that._l23_2a+3*that._l23_a*that._l12_a+that._l12_2a,m=3*that._l23_a*(that._l23_a+that._l12_a);x22=(x22*b+that._x1*that._l23_2a-x2*that._l12_2a)/m,y22=(y22*b+that._y1*that._l23_2a-y2*that._l12_2a)/m}that._context.bezierCurveTo(x12,y12,x22,y22,that._x2,that._y2)}function CatmullRom(context,alpha){this._context=context,this._alpha=alpha}CatmullRom.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);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(x2,y2){if(x2=+x2,y2=+y2,this._point){var x23=this._x2-x2,y23=this._y2-y2;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(x23*x23+y23*y23,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(x2,y2):this._context.moveTo(x2,y2);break;case 1:this._point=2;break;case 2:this._point=3;default:point$1(this,x2,y2);break}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=x2,this._y0=this._y1,this._y1=this._y2,this._y2=y2}};const curveCatmullRom=function custom(alpha){function catmullRom(context){return alpha?new CatmullRom(context,alpha):new Cardinal(context,0)}return catmullRom.alpha=function(alpha2){return custom(+alpha2)},catmullRom}(.5);function CatmullRomClosed(context,alpha){this._context=context,this._alpha=alpha}CatmullRomClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=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 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(x2,y2){if(x2=+x2,y2=+y2,this._point){var x23=this._x2-x2,y23=this._y2-y2;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(x23*x23+y23*y23,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=x2,this._y3=y2;break;case 1:this._point=2,this._context.moveTo(this._x4=x2,this._y4=y2);break;case 2:this._point=3,this._x5=x2,this._y5=y2;break;default:point$1(this,x2,y2);break}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=x2,this._y0=this._y1,this._y1=this._y2,this._y2=y2}},function custom(alpha){function catmullRom(context){return alpha?new CatmullRomClosed(context,alpha):new CardinalClosed(context,0)}return catmullRom.alpha=function(alpha2){return custom(+alpha2)},catmullRom}(.5);function CatmullRomOpen(context,alpha){this._context=context,this._alpha=alpha}CatmullRomOpen.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(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(x2,y2){if(x2=+x2,y2=+y2,this._point){var x23=this._x2-x2,y23=this._y2-y2;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(x23*x23+y23*y23,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:point$1(this,x2,y2);break}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=x2,this._y0=this._y1,this._y1=this._y2,this._y2=y2}},function custom(alpha){function catmullRom(context){return alpha?new CatmullRomOpen(context,alpha):new CardinalOpen(context,0)}return catmullRom.alpha=function(alpha2){return custom(+alpha2)},catmullRom}(.5);function sign(x2){return x2<0?-1:1}function slope3(that,x2,y2){var h0=that._x1-that._x0,h1=x2-that._x1,s0=(that._y1-that._y0)/(h0||h1<0&&-0),s1=(y2-that._y1)/(h1||h0<0&&-0),p=(s0*h1+s1*h0)/(h0+h1);return(sign(s0)+sign(s1))*Math.min(Math.abs(s0),Math.abs(s1),.5*Math.abs(p))||0}function slope2(that,t){var h=that._x1-that._x0;return h?(3*(that._y1-that._y0)/h-t)/2:t}function point(that,t0,t1){var x02=that._x0,y02=that._y0,x12=that._x1,y12=that._y1,dx=(x12-x02)/3;that._context.bezierCurveTo(x02+dx,y02+dx*t0,x12-dx,y12-dx*t1,x12,y12)}function MonotoneX(context){this._context=context}MonotoneX.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:point(this,this._t0,slope2(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(x2,y2){var t1=NaN;if(x2=+x2,y2=+y2,!(x2===this._x1&&y2===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(x2,y2):this._context.moveTo(x2,y2);break;case 1:this._point=2;break;case 2:this._point=3,point(this,slope2(this,t1=slope3(this,x2,y2)),t1);break;default:point(this,this._t0,t1=slope3(this,x2,y2));break}this._x0=this._x1,this._x1=x2,this._y0=this._y1,this._y1=y2,this._t0=t1}}},Object.create(MonotoneX.prototype).point=function(x2,y2){MonotoneX.prototype.point.call(this,y2,x2)};var _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol=="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},classCallCheck=function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")},createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},get=function get2(object,property,receiver){object===null&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===void 0){var parent=Object.getPrototypeOf(object);return parent===null?void 0:get2(parent,property,receiver)}else{if("value"in desc)return desc.value;var getter=desc.get;return getter===void 0?void 0:getter.call(receiver)}},inherits=function(subClass,superClass){if(typeof superClass!="function"&&superClass!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)},possibleConstructorReturn=function(self2,call){if(!self2)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return call&&(typeof call=="object"||typeof call=="function")?call:self2},toConsumableArray=function(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}else return Array.from(arr)},Annotation=function(){function Annotation2(_ref){var _ref$x=_ref.x,x2=_ref$x===void 0?0:_ref$x,_ref$y=_ref.y,y2=_ref$y===void 0?0:_ref$y,nx=_ref.nx,ny=_ref.ny,_ref$dy=_ref.dy,dy=_ref$dy===void 0?0:_ref$dy,_ref$dx=_ref.dx,dx=_ref$dx===void 0?0:_ref$dx,_ref$color=_ref.color,color=_ref$color===void 0?"grey":_ref$color,data=_ref.data,type=_ref.type,subject=_ref.subject,connector=_ref.connector,note=_ref.note,disable=_ref.disable,id=_ref.id,className=_ref.className;classCallCheck(this,Annotation2),this._dx=nx!==void 0?nx-x2:dx,this._dy=ny!==void 0?ny-y2:dy,this._x=x2,this._y=y2,this._color=color,this.id=id,this._className=className||"",this._type=type||"",this.data=data,this.note=note||{},this.connector=connector||{},this.subject=subject||{},this.disable=disable||[]}return createClass(Annotation2,[{key:"updatePosition",value:function(){this.type.setPosition&&(this.type.setPosition(),this.type.subject&&this.type.subject.selectAll(":not(.handle)").nodes().length!==0&&this.type.redrawSubject())}},{key:"clearComponents",value:function(){this.type.clearComponents&&this.type.clearComponents()}},{key:"updateOffset",value:function(){this.type.setOffset&&(this.type.setOffset(),this.type.connector.selectAll(":not(.handle)").nodes().length!==0&&this.type.redrawConnector(),this.type.redrawNote())}},{key:"className",get:function(){return this._className},set:function(className){this._className=className,this.type.setClassName&&this.type.setClassName()}},{key:"type",get:function(){return this._type},set:function(type){this._type=type,this.clearComponents()}},{key:"x",get:function(){return this._x},set:function(x2){this._x=x2,this.updatePosition()}},{key:"y",get:function(){return this._y},set:function(y2){this._y=y2,this.updatePosition()}},{key:"color",get:function(){return this._color},set:function(color){this._color=color,this.updatePosition()}},{key:"dx",get:function(){return this._dx},set:function(dx){this._dx=dx,this.updateOffset()}},{key:"dy",get:function(){return this._dy},set:function(dy){this._dy=dy,this.updateOffset()}},{key:"nx",set:function(nx){this._dx=nx-this._x,this.updateOffset()}},{key:"ny",set:function(ny){this._dy=ny-this._y,this.updateOffset()}},{key:"offset",get:function(){return{x:this._dx,y:this._dy}},set:function(_ref2){var x2=_ref2.x,y2=_ref2.y;this._dx=x2,this._dy=y2,this.updateOffset()}},{key:"position",get:function(){return{x:this._x,y:this._y}},set:function(_ref3){var x2=_ref3.x,y2=_ref3.y;this._x=x2,this._y=y2,this.updatePosition()}},{key:"translation",get:function(){return{x:this._x+this._dx,y:this._y+this._dy}}},{key:"json",get:function(){var json={x:this._x,y:this._y,dx:this._dx,dy:this._dy};return this.data&&Object.keys(this.data).length>0&&(json.data=this.data),this.type&&(json.type=this.type),this._className&&(json.className=this._className),Object.keys(this.connector).length>0&&(json.connector=this.connector),Object.keys(this.subject).length>0&&(json.subject=this.subject),Object.keys(this.note).length>0&&(json.note=this.note),json}}]),Annotation2}(),AnnotationCollection=function(){function AnnotationCollection2(_ref){var annotations=_ref.annotations,accessors=_ref.accessors,accessorsInverse=_ref.accessorsInverse;classCallCheck(this,AnnotationCollection2),this.accessors=accessors,this.accessorsInverse=accessorsInverse,this.annotations=annotations}return createClass(AnnotationCollection2,[{key:"clearTypes",value:function(newSettings){this.annotations.forEach(function(d){d.type=void 0,d.subject=newSettings&&newSettings.subject||d.subject,d.connector=newSettings&&newSettings.connector||d.connector,d.note=newSettings&&newSettings.note||d.note})}},{key:"setPositionWithAccessors",value:function(){var _this=this;this.annotations.forEach(function(d){d.type.setPositionWithAccessors(_this.accessors)})}},{key:"editMode",value:function(_editMode){this.annotations.forEach(function(a){a.type&&(a.type.editMode=_editMode,a.type.updateEditMode())})}},{key:"updateDisable",value:function(disable){this.annotations.forEach(function(a){a.disable=disable,a.type&&disable.forEach(function(d){a.type[d]&&(a.type[d].remove&&a.type[d].remove(),a.type[d]=void 0)})})}},{key:"updateTextWrap",value:function(textWrap){this.annotations.forEach(function(a){a.type&&a.type.updateTextWrap&&a.type.updateTextWrap(textWrap)})}},{key:"updateText",value:function(){this.annotations.forEach(function(a){a.type&&a.type.drawText&&a.type.drawText()})}},{key:"updateNotePadding",value:function(notePadding){this.annotations.forEach(function(a){a.type&&(a.type.notePadding=notePadding)})}},{key:"json",get:function(){var _this2=this;return this.annotations.map(function(a){var json=a.json;return _this2.accessorsInverse&&a.data&&(json.data={},Object.keys(_this2.accessorsInverse).forEach(function(k){json.data[k]=_this2.accessorsInverse[k]({x:a.x,y:a.y})})),json})}},{key:"noteNodes",get:function(){return this.annotations.map(function(a){return _extends({},a.type.getNoteBBoxOffset(),{positionX:a.x,positionY:a.y})})}}]),AnnotationCollection2}(),pointHandle=function(_ref){var _ref$cx=_ref.cx,cx=_ref$cx===void 0?0:_ref$cx,_ref$cy=_ref.cy,cy=_ref$cy===void 0?0:_ref$cy;return{move:{x:cx,y:cy}}},circleHandles=function(_ref2){var _ref2$cx=_ref2.cx,cx=_ref2$cx===void 0?0:_ref2$cx,_ref2$cy=_ref2.cy,cy=_ref2$cy===void 0?0:_ref2$cy,r1=_ref2.r1,r2=_ref2.r2,padding=_ref2.padding,h={move:{x:cx,y:cy}};return r1!==void 0&&(h.r1={x:cx+r1/Math.sqrt(2),y:cy+r1/Math.sqrt(2)}),r2!==void 0&&(h.r2={x:cx+r2/Math.sqrt(2),y:cy+r2/Math.sqrt(2)}),padding!==void 0&&(h.padding={x:cx+r1+padding,y:cy}),h},addHandles=function(_ref5){var group=_ref5.group,handles=_ref5.handles,_ref5$r=_ref5.r,r=_ref5$r===void 0?10:_ref5$r,h=group.selectAll("circle.handle").data(handles);h.enter().append("circle").attr("class","handle").attr("fill","grey").attr("fill-opacity",.1).attr("cursor","move").attr("stroke-dasharray",5).attr("stroke","grey").call(common.drag().container(common.select("g.annotations").node()).on("start",function(d){return d.start&&d.start(d)}).on("drag",function(d){return d.drag&&d.drag(d)}).on("end",function(d){return d.end&&d.end(d)})),group.selectAll("circle.handle").attr("cx",function(d){return d.x}).attr("cy",function(d){return d.y}).attr("r",function(d){return d.r||r}).attr("class",function(d){return"handle "+(d.className||"")}),h.exit().remove()},leftRightDynamic=function(align,y2){return(align==="dynamic"||align==="left"||align==="right")&&(y2<0?align="top":align="bottom"),align},topBottomDynamic=function(align,x2){return(align==="dynamic"||align==="top"||align==="bottom")&&(x2<0?align="right":align="left"),align},orientationTopBottom=["topBottom","top","bottom"],orientationLeftRight=["leftRight","left","right"],noteAlignment=function(_ref){var _ref$padding=_ref.padding,padding=_ref$padding===void 0?0:_ref$padding,_ref$bbox=_ref.bbox,bbox=_ref$bbox===void 0?{x:0,width:0,height:0}:_ref$bbox,align=_ref.align,orientation=_ref.orientation,_ref$offset=_ref.offset,offset=_ref$offset===void 0?{x:0,y:0}:_ref$offset,x2=-bbox.x,y2=0;return orientationTopBottom.indexOf(orientation)!==-1?(align=topBottomDynamic(align,offset.x),offset.y<0&&orientation==="topBottom"||orientation==="top"?y2-=bbox.height+padding:y2+=padding,align==="middle"?x2-=bbox.width/2:align==="right"&&(x2-=bbox.width)):orientationLeftRight.indexOf(orientation)!==-1&&(align=leftRightDynamic(align,offset.y),offset.x<0&&orientation==="leftRight"||orientation==="left"?x2-=bbox.width+padding:x2+=padding,align==="middle"?y2-=bbox.height/2:align==="top"&&(y2-=bbox.height)),{x:x2,y:y2}},lineBuilder=function(_ref){var data=_ref.data,_ref$curve=_ref.curve,curve=_ref$curve===void 0?curveLinear:_ref$curve,canvasContext=_ref.canvasContext,className=_ref.className,classID=_ref.classID,lineGen2=line().curve(curve),builder={type:"path",className,classID,data};return canvasContext?(lineGen2.context(canvasContext),builder.pathMethods=lineGen2):builder.attrs={d:lineGen2(data)},builder},arcBuilder=function(_ref2){var data=_ref2.data,canvasContext=_ref2.canvasContext,className=_ref2.className,classID=_ref2.classID,builder={type:"path",className,classID,data},arcShape=arc().innerRadius(data.innerRadius||0).outerRadius(data.outerRadius||data.radius||2).startAngle(data.startAngle||0).endAngle(data.endAngle||2*Math.PI);return canvasContext?(arcShape.context(canvasContext),builder.pathMethods=lineGen):builder.attrs={d:arcShape()},builder},noteVertical=function(_ref){var align=_ref.align,_ref$x=_ref.x,x2=_ref$x===void 0?0:_ref$x,_ref$y=_ref.y,y2=_ref$y===void 0?0:_ref$y,bbox=_ref.bbox,offset=_ref.offset;align=leftRightDynamic(align,offset.y),align==="top"?y2-=bbox.height:align==="middle"&&(y2-=bbox.height/2);var data=[[x2,y2],[x2,y2+bbox.height]];return{components:[lineBuilder({data,className:"note-line"})]}},noteHorizontal=function(_ref){var align=_ref.align,_ref$x=_ref.x,x2=_ref$x===void 0?0:_ref$x,_ref$y=_ref.y,y2=_ref$y===void 0?0:_ref$y,offset=_ref.offset,bbox=_ref.bbox;align=topBottomDynamic(align,offset.x),align==="right"?x2-=bbox.width:align==="middle"&&(x2-=bbox.width/2);var data=[[x2,y2],[x2+bbox.width,y2]];return{components:[lineBuilder({data,className:"note-line"})]}},lineSetup=function(_ref){var type=_ref.type,subjectType=_ref.subjectType,annotation2=type.annotation,offset=annotation2.position,x12=annotation2.x-offset.x,x2=x12+annotation2.dx,y12=annotation2.y-offset.y,y2=y12+annotation2.dy,subjectData=annotation2.subject;if(subjectType==="circle"&&(subjectData.outerRadius||subjectData.radius)){var h=Math.sqrt((x12-x2)*(x12-x2)+(y12-y2)*(y12-y2)),angle=Math.asin(-y2/h),r=subjectData.outerRadius||subjectData.radius+(subjectData.radiusPadding||0);x12=Math.abs(Math.cos(angle)*r)*(x2<0?-1:1),y12=Math.abs(Math.sin(angle)*r)*(y2<0?-1:1)}if(subjectType==="rect"){var width=subjectData.width,height=subjectData.height;(width>0&&annotation2.dx>0||width<0&&annotation2.dx<0)&&(Math.abs(width)>Math.abs(annotation2.dx)?x12=width/2:x12=width),(height>0&&annotation2.dy>0||height<0&&annotation2.dy<0)&&(Math.abs(height)>Math.abs(annotation2.dy)?y12=height/2:y12=height),x12===width/2&&y12===height/2&&(x12=x2,y12=y2)}return[[x12,y12],[x2,y2]]},connectorLine=function(connectorData){var data=lineSetup(connectorData);return{components:[lineBuilder({data,className:"connector"})]}},connectorElbow=function(_ref){var type=_ref.type,subjectType=_ref.subjectType,annotation2=type.annotation,offset=annotation2.position,x12=annotation2.x-offset.x,x2=x12+annotation2.dx,y12=annotation2.y-offset.y,y2=y12+annotation2.dy,subjectData=annotation2.subject;if(subjectType==="rect"){var width=subjectData.width,height=subjectData.height;(width>0&&annotation2.dx>0||width<0&&annotation2.dx<0)&&(Math.abs(width)>Math.abs(annotation2.dx)?x12=width/2:x12=width),(height>0&&annotation2.dy>0||height<0&&annotation2.dy<0)&&(Math.abs(height)>Math.abs(annotation2.dy)?y12=height/2:y12=height),x12===width/2&&y12===height/2&&(x12=x2,y12=y2)}var data=[[x12,y12],[x2,y2]],diffY=y2-y12,diffX=x2-x12,xe=x2,ye=y2,opposite=y2<y12&&x2>x12||x2<x12&&y2>y12?-1:1;if(Math.abs(diffX)<Math.abs(diffY)?(xe=x2,ye=y12+diffX*opposite):(ye=y2,xe=x12+diffY*opposite),subjectType==="circle"&&(subjectData.outerRadius||subjectData.radius)){var r=(subjectData.outerRadius||subjectData.radius)+(subjectData.radiusPadding||0),length=r/Math.sqrt(2);if(Math.abs(diffX)>length&&Math.abs(diffY)>length)x12=length*(x2<0?-1:1),y12=length*(y2<0?-1:1),data=[[x12,y12],[xe,ye],[x2,y2]];else if(Math.abs(diffX)>Math.abs(diffY)){var angle=Math.asin(-y2/r);x12=Math.abs(Math.cos(angle)*r)*(x2<0?-1:1),data=[[x12,y2],[x2,y2]]}else{var _angle=Math.acos(x2/r);y12=Math.abs(Math.sin(_angle)*r)*(y2<0?-1:1),data=[[x2,y12],[x2,y2]]}}else data=[[x12,y12],[xe,ye],[x2,y2]];return{components:[lineBuilder({data,className:"connector"})]}},connectorCurve=function(_ref){var type=_ref.type,connectorData=_ref.connectorData,subjectType=_ref.subjectType;connectorData||(connectorData={}),(!connectorData.points||typeof connectorData.points=="number")&&(connectorData.points=createPoints(type.annotation.offset,connectorData.points)),connectorData.curve||(connectorData.curve=curveCatmullRom);var handles=[];if(type.editMode){var cHandles=connectorData.points.map(function(c,i){return _extends({},pointHandle({cx:c[0],cy:c[1]}),{index:i})}),updatePoint=function(index){connectorData.points[index][0]+=common.event.dx,connectorData.points[index][1]+=common.event.dy,type.redrawConnector()};handles=type.mapHandles(cHandles.map(function(h){return _extends({},h.move,{drag:updatePoint.bind(type,h.index)})}))}var data=lineSetup({type,subjectType});data=[data[0]].concat(toConsumableArray(connectorData.points),[data[1]]);var components=[lineBuilder({data,curve:connectorData.curve,className:"connector"})];return{components,handles}},createPoints=function(offset){for(var anchors=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,diff={x:offset.x/(anchors+1),y:offset.y/(anchors+1)},p=[],i=1;i<=anchors;i++)p.push([diff.x*i+i%2*20,diff.y*i-i%2*20]);return p},connectorArrow=function(_ref){var annotation2=_ref.annotation,start=_ref.start,end=_ref.end,_ref$scale=_ref.scale,scale=_ref$scale===void 0?1:_ref$scale,offset=annotation2.position;start?start=[-end[0]+start[0],-end[1]+start[1]]:start=[annotation2.dx,annotation2.dy],end||(end=[annotation2.x-offset.x,annotation2.y-offset.y]);var x12=end[0],y12=end[1],dx=start[0],dy=start[1],size=10*scale,angleOffset=16/180*Math.PI,angle=Math.atan(dy/dx);dx<0&&(angle+=Math.PI);var data=[[x12,y12],[Math.cos(angle+angleOffset)*size+x12,Math.sin(angle+angleOffset)*size+y12],[Math.cos(angle-angleOffset)*size+x12,Math.sin(angle-angleOffset)*size+y12],[x12,y12]];return{components:[lineBuilder({data,className:"connector-end connector-arrow",classID:"connector-end"})]}},connectorDot=function(_ref){var line$$1=_ref.line,_ref$scale=_ref.scale,scale=_ref$scale===void 0?1:_ref$scale,dot=arcBuilder({className:"connector-end connector-dot",classID:"connector-end",data:{radius:3*Math.sqrt(scale)}});return dot.attrs.transform="translate("+line$$1.data[0][0]+", "+line$$1.data[0][1]+")",{components:[dot]}},subjectCircle=function(_ref){var subjectData=_ref.subjectData,type=_ref.type;!subjectData.radius&&!subjectData.outerRadius&&(subjectData.radius=20);var handles=[],c=arcBuilder({data:subjectData,className:"subject"});if(type.editMode){var h=circleHandles({r1:c.data.outerRadius||c.data.radius,r2:c.data.innerRadius,padding:subjectData.radiusPadding}),updateRadius=function(attr){var r=subjectData[attr]+common.event.dx*Math.sqrt(2);subjectData[attr]=r,type.redrawSubject(),type.redrawConnector()},cHandles=[_extends({},h.r1,{drag:updateRadius.bind(type,subjectData.outerRadius!==void 0?"outerRadius":"radius")})];subjectData.innerRadius&&cHandles.push(_extends({},h.r2,{drag:updateRadius.bind(type,"innerRadius")})),handles=type.mapHandles(cHandles)}return c.attrs["fill-opacity"]=0,{components:[c],handles}},subjectRect=function(_ref){var subjectData=_ref.subjectData,type=_ref.type;subjectData.width||(subjectData.width=100),subjectData.height||(subjectData.height=100);var handles=[],width=subjectData.width,height=subjectData.height,data=[[0,0],[width,0],[width,height],[0,height],[0,0]],rect=lineBuilder({data,className:"subject"});if(type.editMode){var updateWidth=function(){subjectData.width=common.event.x,type.redrawSubject(),type.redrawConnector()},updateHeight=function(){subjectData.height=common.event.y,type.redrawSubject(),type.redrawConnector()},rHandles=[{x:width,y:height/2,drag:updateWidth.bind(type)},{x:width/2,y:height,drag:updateHeight.bind(type)}];handles=type.mapHandles(rHandles)}return rect.attrs["fill-opacity"]=.1,{components:[rect],handles}},subjectThreshold=function(_ref){var subjectData=_ref.subjectData,type=_ref.type,offset=type.annotation.position,x12=(subjectData.x1!==void 0?subjectData.x1:offset.x)-offset.x,x2=(subjectData.x2!==void 0?subjectData.x2:offset.x)-offset.x,y12=(subjectData.y1!==void 0?subjectData.y1:offset.y)-offset.y,y2=(subjectData.y2!==void 0?subjectData.y2:offset.y)-offset.y,data=[[x12,y12],[x2,y2]];return{components:[lineBuilder({data,className:"subject"})]}},subjectBadge=function(_ref){var _ref$subjectData=_ref.subjectData,subjectData=_ref$subjectData===void 0?{}:_ref$subjectData,_ref$type=_ref.type,type=_ref$type===void 0?{}:_ref$type,annotation2=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},typeSettings=type.typeSettings&&type.typeSettings.subject;subjectData.radius||(typeSettings&&typeSettings.radius?subjectData.radius=typeSettings.radius:subjectData.radius=14),subjectData.x||typeSettings&&typeSettings.x&&(subjectData.x=typeSettings.x),subjectData.y||typeSettings&&typeSettings.y&&(subjectData.y=typeSettings.y);var handles=[],components=[],radius=subjectData.radius,innerRadius=radius*.7,x2=0,y2=0,notCornerOffset=Math.sqrt(2)*radius,placement={xleftcorner:-radius,xrightcorner:radius,ytopcorner:-radius,ybottomcorner:radius,xleft:-notCornerOffset,xright:notCornerOffset,ytop:-notCornerOffset,ybottom:notCornerOffset};subjectData.x&&!subjectData.y?x2=placement["x"+subjectData.x]:subjectData.y&&!subjectData.x?y2=placement["y"+subjectData.y]:subjectData.x&&subjectData.y&&(x2=placement["x"+subjectData.x+"corner"],y2=placement["y"+subjectData.y+"corner"]);var transform="translate("+x2+", "+y2+")",circlebg=arcBuilder({className:"subject",data:{radius}});circlebg.attrs.transform=transform,circlebg.attrs.fill=annotation2.color,circlebg.attrs["stroke-linecap"]="round",circlebg.attrs["stroke-width"]="3px";var circle2=arcBuilder({className:"subject-ring",data:{outerRadius:radius,innerRadius}});circle2.attrs.transform=transform,circle2.attrs["stroke-width"]="3px",circle2.attrs.fill="white";var pointer=void 0;if(x2&&y2||!x2&&!y2)pointer=lineBuilder({className:"subject-pointer",data:[[0,0],[x2||0,0],[0,y2||0],[0,0]]});else if(x2||y2){var notCornerPointerXY=function(v){var sign2=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return v&&v/Math.sqrt(2)/Math.sqrt(2)||sign2*radius/Math.sqrt(2)};pointer=lineBuilder({className:"subject-pointer",data:[[0,0],[notCornerPointerXY(x2),notCornerPointerXY(y2)],[notCornerPointerXY(x2,-1),notCornerPointerXY(y2,-1)],[0,0]]})}if(pointer&&(pointer.attrs.fill=annotation2.color,pointer.attrs["stroke-linecap"]="round",pointer.attrs["stroke-width"]="3px",components.push(pointer)),type.editMode){var dragBadge=function(){subjectData.x=common.event.x<-radius*2?"left":common.event.x>radius*2?"right":void 0,subjectData.y=common.event.y<-radius*2?"top":common.event.y>radius*2?"bottom":void 0,type.redrawSubject()},bHandles={x:x2*2,y:y2*2,drag:dragBadge.bind(type)};!bHandles.x&&!bHandles.y&&(bHandles.y=-radius),handles=type.mapHandles([bHandles])}var text=void 0;return subjectData.text&&(text={type:"text",className:"badge-text",attrs:{fill:"white",stroke:"none","font-size":".7em",text:subjectData.text,"text-anchor":"middle",dy:".25em",x:x2,y:y2}}),components.push(circlebg),components.push(circle2),components.push(text),{components,handles}},Type=function(){function Type2(_ref){var a=_ref.a,annotation2=_ref.annotation,editMode=_ref.editMode,dispatcher=_ref.dispatcher,notePadding=_ref.notePadding,accessors=_ref.accessors;if(classCallCheck(this,Type2),this.a=a,this.note=annotation2.disable.indexOf("note")===-1&&a.select("g.annotation-note"),this.noteContent=this.note&&a.select("g.annotation-note-content"),this.connector=annotation2.disable.indexOf("connector")===-1&&a.select("g.annotation-connector"),this.subject=annotation2.disable.indexOf("subject")===-1&&a.select("g.annotation-subject"),this.dispatcher=dispatcher,dispatcher){var handler=addHandlers.bind(null,dispatcher,annotation2);handler({component:this.note,name:"note"}),handler({component:this.connector,name:"connector"}),handler({component:this.subject,name:"subject"})}this.annotation=annotation2,this.editMode=annotation2.editMode||editMode,this.notePadding=notePadding!==void 0?notePadding:3,this.offsetCornerX=0,this.offsetCornerY=0,accessors&&annotation2.data&&this.init(accessors)}return createClass(Type2,[{key:"init",value:function(accessors){this.annotation.x||this.mapX(accessors),this.annotation.y||this.mapY(accessors)}},{key:"mapY",value:function(accessors){accessors.y&&(this.annotation.y=accessors.y(this.annotation.data))}},{key:"mapX",value:function(accessors){accessors.x&&(this.annotation.x=accessors.x(this.annotation.data))}},{key:"updateEditMode",value:function(){this.a.selectAll("circle.handle").remove()}},{key:"drawOnSVG",value:function(component,builders){var _this=this;Array.isArray(builders)||(builders=[builders]),builders.filter(function(b){return b}).forEach(function(_ref2){var type=_ref2.type,className=_ref2.className,attrs=_ref2.attrs,handles=_ref2.handles,classID=_ref2.classID;if(type==="handle")addHandles({group:component,r:attrs&&attrs.r,handles});else{newWithClass(component,[_this.annotation],type,className,classID);for(var el=component.select(type+"."+(classID||className)),addAttrs=Object.keys(attrs),removeAttrs=[],currentAttrs=el.node().attributes,i=currentAttrs.length-1;i>=0;i--){var name=currentAttrs[i].name;addAttrs.indexOf(name)===-1&&name!=="class"&&removeAttrs.push(name)}addAttrs.forEach(function(attr){attr==="text"?el.text(attrs[attr]):el.attr(attr,attrs[attr])}),removeAttrs.forEach(function(attr){return el.attr(attr,null)})}})}},{key:"getNoteBBox",value:function(){return bboxWithoutHandles(this.note,".annotation-note-content text")}},{key:"getNoteBBoxOffset",value:function(){var bbox=bboxWithoutHandles(this.note,".annotation-note-content"),transform=this.noteContent.attr("transform").split(/\(|\,|\)/g);return bbox.offsetCornerX=parseFloat(transform[1])+this.annotation.dx,bbox.offsetCornerY=parseFloat(transform[2])+this.annotation.dy,bbox.offsetX=this.annotation.dx,bbox.offsetY=this.annotation.dy,bbox}},{key:"drawSubject",value:function(){var _this2=this,context=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},subjectData=this.annotation.subject,type=context.type,subjectParams={type:this,subjectData},subject={};type==="circle"?subject=subjectCircle(subjectParams):type==="rect"?subject=subjectRect(subjectParams):type==="threshold"?subject=subjectThreshold(subjectParams):type==="badge"&&(subject=subjectBadge(subjectParams,this.annotation));var _subject=subject,_subject$components=_subject.components,components=_subject$components===void 0?[]:_subject$components,_subject$handles=_subject.handles,handles=_subject$handles===void 0?[]:_subject$handles;return components.forEach(function(c){c&&c.attrs&&!c.attrs.stroke&&(c.attrs.stroke=_this2.annotation.color)}),this.editMode&&(handles=handles.concat(this.mapHandles([{drag:this.dragSubject.bind(this)}])),components.push({type:"handle",handles})),components}},{key:"drawConnector",value:function(){var _this3=this,context=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},connectorData=this.annotation.connector,type=connectorData.type||context.type,connectorParams={type:this,connectorData};connectorParams.subjectType=this.typeSettings&&this.typeSettings.subject&&this.typeSettings.subject.type;var connector={};type==="curve"?connector=connectorCurve(connectorParams):type==="elbow"?connector=connectorElbow(connectorParams):connector=connectorLine(connectorParams);var _connector=connector,_connector$components=_connector.components,components=_connector$components===void 0?[]:_connector$components,_connector$handles=_connector.handles,handles=_connector$handles===void 0?[]:_connector$handles,line$$1=components[0];line$$1&&(line$$1.attrs.stroke=this.annotation.color,line$$1.attrs.fill="none");var endType=connectorData.end||context.end,end={};if(endType==="arrow"){var s=line$$1.data[1],e=line$$1.data[0],distance=Math.sqrt(Math.pow(s[0]-e[0],2)+Math.pow(s[1]-e[1],2));distance<5&&line$$1.data[2]&&(s=line$$1.data[2]),end=connectorArrow({annotation:this.annotation,start:s,end:e,scale:connectorData.endScale})}else endType==="dot"?end=connectorDot({line:line$$1,scale:connectorData.endScale}):(!endType||endType==="none")&&this.connector&&this.connector.select(".connector-end").remove();return end.components&&(end.components.forEach(function(c){c.attrs.fill=_this3.annotation.color,c.attrs.stroke=_this3.annotation.color}),components=components.concat(end.components)),this.editMode&&handles.length!==0&&components.push({type:"handle",handles}),components}},{key:"drawNote",value:function(){var _this4=this,context=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},noteData=this.annotation.note,align=noteData.align||context.align||"dynamic",noteParams={bbox:context.bbox,align,offset:this.annotation.offset},lineType=noteData.lineType||context.lineType,note={};lineType==="vertical"?note=noteVertical(noteParams):lineType==="horizontal"&&(note=noteHorizontal(noteParams));var _note=note,_note$components=_note.components,components=_note$components===void 0?[]:_note$components,_note$handles=_note.handles,handles=_note$handles===void 0?[]:_note$handles;if(components.forEach(function(c){c.attrs.stroke=_this4.annotation.color}),this.editMode){handles=this.mapHandles([{x:0,y:0,drag:this.dragNote.bind(this)}]),components.push({type:"handle",handles});var dragging=this.dragNote.bind(this),start=this.dragstarted.bind(this),end=this.dragended.bind(this);this.note.call(common.drag().container(common.select("g.annotations").node()).on("start",function(d){return start(d)}).on("drag",function(d){return dragging(d)}).on("end",function(d){return end(d)}))}else this.note.on("mousedown.drag",null);return components}},{key:"drawNoteContent",value:function(context){var noteData=this.annotation.note,padding=noteData.padding!==void 0?noteData.padding:this.notePadding,orientation=noteData.orientation||context.orientation||"topBottom",lineType=noteData.lineType||context.lineType,align=noteData.align||context.align||"dynamic";lineType==="vertical"?orientation="leftRight":lineType==="horizontal"&&(orientation="topBottom");var noteParams={padding,bbox:context.bbox,offset:this.annotation.offset,orientation,align},_noteAlignment=noteAlignment(noteParams),x2=_noteAlignment.x,y2=_noteAlignment.y;return this.offsetCornerX=x2+this.annotation.dx,this.offsetCornerY=y2+this.annotation.dy,this.note&&this.noteContent.attr("transform","translate("+x2+", "+y2+")"),[]}},{key:"drawOnScreen",value:function(component,drawFunction){return this.drawOnSVG(component,drawFunction)}},{key:"redrawSubject",value:function(){this.subject&&this.drawOnScreen(this.subject,this.drawSubject())}},{key:"redrawConnector",value:function(){this.connector&&this.drawOnScreen(this.connector,this.drawConnector())}},{key:"redrawNote",value:function(){var bbox=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.getNoteBBox();this.noteContent&&this.drawOnScreen(this.noteContent,this.drawNoteContent({bbox})),this.note&&this.drawOnScreen(this.note,this.drawNote({bbox}))}},{key:"setPosition",value:function(){var position=this.annotation.position;this.a.attr("transform","translate("+position.x+", "+position.y+")")}},{key:"clearComponents",value:function(){this.subject&&this.subject.select("*").remove(),this.connector&&this.connector.select("*").remove()}},{key:"setOffset",value:function(){if(this.note){var offset=this.annotation.offset;this.note.attr("transform","translate("+offset.x+", "+offset.y+")")}}},{key:"setPositionWithAccessors",value:function(accessors){accessors&&this.annotation.data&&(this.mapX(accessors),this.mapY(accessors)),this.setPosition()}},{key:"setClassName",value:function(){this.a.attr("class","annotation "+(this.className&&this.className())+" "+(this.editMode?"editable":"")+" "+(this.annotation.className||""))}},{key:"draw",value:function(){this.setClassName(),this.setPosition(),this.setOffset(),this.redrawSubject(),this.redrawConnector(),this.redrawNote()}},{key:"dragstarted",value:function(){common.event.sourceEvent.stopPropagation(),this.dispatcher&&this.dispatcher.call("dragstart",this.a,this.annotation),this.a.classed("dragging",!0),this.a.selectAll("circle.handle").style("pointer-events","none")}},{key:"dragended",value:function(){this.dispatcher&&this.dispatcher.call("dragend",this.a,this.annotation),this.a.classed("dragging",!1),this.a.selectAll("circle.handle").style("pointer-events","all")}},{key:"dragSubject",value:function(){var position=this.annotation.position;position.x+=common.event.dx,position.y+=common.event.dy,this.annotation.position=position}},{key:"dragNote",value:function(){var offset=this.annotation.offset;offset.x+=common.event.dx,offset.y+=common.event.dy,this.annotation.offset=offset}},{key:"mapHandles",value:function(handles){var _this5=this;return handles.map(function(h){return _extends({},h,{start:_this5.dragstarted.bind(_this5),end:_this5.dragended.bind(_this5)})})}}]),Type2}(),customType=function(initialType,typeSettings,_init){return function(_initialType){inherits(customType3,_initialType);function customType3(settings){classCallCheck(this,customType3);var _this6=possibleConstructorReturn(this,(customType3.__proto__||Object.getPrototypeOf(customType3)).call(this,settings));return _this6.typeSettings=typeSettings,typeSettings.disable&&typeSettings.disable.forEach(function(d){_this6[d]&&_this6[d].remove(),_this6[d]=void 0,d==="note"&&(_this6.noteContent=void 0)}),_this6}return createClass(customType3,[{key:"className",value:function(){return""+(typeSettings.className||get(customType3.prototype.__proto__||Object.getPrototypeOf(customType3.prototype),"className",this)&&get(customType3.prototype.__proto__||Object.getPrototypeOf(customType3.prototype),"className",this).call(this)||"")}},{key:"drawSubject",value:function(context){return this.typeSettings.subject=_extends({},typeSettings.subject,this.typeSettings.subject),get(customType3.prototype.__proto__||Object.getPrototypeOf(customType3.prototype),"drawSubject",this).call(this,_extends({},context,this.typeSettings.subject))}},{key:"drawConnector",value:function(context){return this.typeSettings.connector=_extends({},typeSettings.connector,this.typeSettings.connector),get(customType3.prototype.__proto__||Object.getPrototypeOf(customType3.prototype),"drawConnector",this).call(this,_extends({},context,typeSettings.connector,this.typeSettings.connector))}},{key:"drawNote",value:function(context){return this.typeSettings.note=_extends({},typeSettings.note,this.typeSettings.note),get(customType3.prototype.__proto__||Object.getPrototypeOf(customType3.prototype),"drawNote",this).call(this,_extends({},context,typeSettings.note,this.typeSettings.note))}},{key:"drawNoteContent",value:function(context){return get(customType3.prototype.__proto__||Object.getPrototypeOf(customType3.prototype),"drawNoteContent",this).call(this,_extends({},context,typeSettings.note,this.typeSettings.note))}}],[{key:"init",value:function(annotation2,accessors){return get(customType3.__proto__||Object.getPrototypeOf(customType3),"init",this).call(this,annotation2,accessors),_init&&(annotation2=_init(annotation2,accessors)),annotation2}}]),customType3}(initialType)},d3NoteText=function(_Type){inherits(d3NoteText2,_Type);function d3NoteText2(params){classCallCheck(this,d3NoteText2);var _this7=possibleConstructorReturn(this,(d3NoteText2.__proto__||Object.getPrototypeOf(d3NoteText2)).call(this,params));return _this7.textWrap=params.textWrap||120,_this7.drawText(),_this7}return createClass(d3NoteText2,[{key:"updateTextWrap",value:function(textWrap){this.textWrap=textWrap,this.drawText()}},{key:"drawText",value:function(){if(this.note){newWithClass(this.note,[this.annotation],"g","annotation-note-content");var noteContent=this.note.select("g.annotation-note-content");newWithClass(noteContent,[this.annotation],"rect","annotation-note-bg"),newWithClass(noteContent,[this.annotation],"text","annotation-note-label"),newWithClass(noteContent,[this.annotation],"text","annotation-note-title");var titleBBox={height:0},label=this.a.select("text.annotation-note-label"),wrapLength=this.annotation.note&&this.annotation.note.wrap||this.typeSettings&&this.typeSettings.note&&this.typeSettings.note.wrap||this.textWrap,wrapSplitter=this.annotation.note&&this.annotation.note.wrapSplitter||this.typeSettings&&this.typeSettings.note&&this.typeSettings.note.wrapSplitter,bgPadding=this.annotation.note&&this.annotation.note.bgPadding||this.typeSettings&&this.typeSettings.note&&this.typeSettings.note.bgPadding,bgPaddingFinal={top:0,bottom:0,left:0,right:0};if(typeof bgPadding=="number"?bgPaddingFinal={top:bgPadding,bottom:bgPadding,left:bgPadding,right:bgPadding}:bgPadding&&(typeof bgPadding>"u"?"undefined":_typeof(bgPadding))==="object"&&(bgPaddingFinal=_extends(bgPaddingFinal,bgPadding)),this.annotation.note.title){var title=this.a.select("text.annotation-note-title");title.text(this.annotation.note.title),title.attr("fill",this.annotation.color),title.attr("font-weight","bold"),title.call(wrap,wrapLength,wrapSplitter),titleBBox=title.node().getBBox()}label.text(this.annotation.note.label).attr("dx","0"),label.call(wrap,wrapLength,wrapSplitter),label.attr("y",titleBBox.height*1.1||0),label.attr("fill",this.annotation.color);var bbox=this.getNoteBBox();this.a.select("rect.annotation-note-bg").attr("width",bbox.width+bgPaddingFinal.left+bgPaddingFinal.right).attr("height",bbox.height+bgPaddingFinal.top+bgPaddingFinal.bottom).attr("x",bbox.x-bgPaddingFinal.left).attr("y",-bgPaddingFinal.top).attr("fill","white").attr("fill-opacity",0)}}}]),d3NoteText2}(Type);customType(d3NoteText,{className:"label",note:{align:"middle"}});var d3Callout=customType(d3NoteText,{className:"callout",note:{lineType:"horizontal"}}),d3CalloutElbow=customType(d3Callout,{className:"callout elbow",connector:{type:"elbow"}});customType(d3Callout,{className:"callout curve",connector:{type:"curve"}}),customType(Type,{className:"badge",subject:{type:"badge"},disable:["connector","note"]}),customType(d3NoteText,{className:"callout circle",subject:{type:"circle"},note:{lineType:"horizontal"},connector:{type:"elbow"}}),customType(d3NoteText,{className:"callout rect",subject:{type:"rect"},note:{lineType:"horizontal"},connector:{type:"elbow"}});var ThresholdMap=function(_d3Callout){inherits(ThresholdMap2,_d3Callout);function ThresholdMap2(){return classCallCheck(this,ThresholdMap2),possibleConstructorReturn(this,(ThresholdMap2.__proto__||Object.getPrototypeOf(ThresholdMap2)).apply(this,arguments))}return createClass(ThresholdMap2,[{key:"mapY",value:function(accessors){get(ThresholdMap2.prototype.__proto__||Object.getPrototypeOf(ThresholdMap2.prototype),"mapY",this).call(this,accessors);var a=this.annotation;(a.subject.x1||a.subject.x2)&&a.data&&accessors.y&&(a.y=accessors.y(a.data)),(a.subject.x1||a.subject.x2)&&!a.x&&(a.x=a.subject.x1||a.subject.x2)}},{key:"mapX",value:function(accessors){get(ThresholdMap2.prototype.__proto__||Object.getPrototypeOf(ThresholdMap2.prototype),"mapX",this).call(this,accessors);var a=this.annotation;(a.subject.y1||a.subject.y2)&&a.data&&accessors.x&&(a.x=accessors.x(a.data)),(a.subject.y1||a.subject.y2)&&!a.y&&(a.y=a.subject.y1||a.subject.y2)}}]),ThresholdMap2}(d3Callout);customType(ThresholdMap,{className:"callout xythreshold",subject:{type:"threshold"}});var newWithClass=function(a,d,type,className,classID){var group=a.selectAll(type+"."+(classID||className)).data(d);return group.enter().append(type).merge(group).attr("class",className),group.exit().remove(),a},addHandlers=function(dispatcher,annotation2,_ref3){var component=_ref3.component,name=_ref3.name;component&&component.on("mouseover.annotations",function(){dispatcher.call(name+"over",component,annotation2)}).on("mouseout.annotations",function(){return dispatcher.call(name+"out",component,annotation2)}).on("click.annotations",function(){return dispatcher.call(name+"click",component,annotation2)})},wrap=function(text,width,wrapSplitter){var lineHeight=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1.2;text.each(function(){for(var text2=common.select(this),words=text2.text().split(wrapSplitter||/[ \t\r\n]+/).reverse().filter(function(w){return w!==""}),word=void 0,line$$1=[],tspan=text2.text(null).append("tspan").attr("x",0).attr("dy",.8+"em");word=words.pop();)line$$1.push(word),tspan.text(line$$1.join(" ")),tspan.node().getComputedTextLength()>width&&line$$1.length>1&&(line$$1.pop(),tspan.text(line$$1.join(" ")),line$$1=[word],tspan=text2.append("tspan").attr("x",0).attr("dy",lineHeight+"em").text(word))})},bboxWithoutHandles=function(selection){var selector=arguments.length>1&&arguments[1]!==void 0?arguments[1]:":not(.handle)";return selection?selection.selectAll(selector).nodes().reduce(function(p,c){var bbox=c.getBBox();p.x=Math.min(p.x,bbox.x),p.y=Math.min(p.y,bbox.y),p.width=Math.max(p.width,bbox.width);var yOffset=c&&c.attributes&&c.attributes.y;return p.height=Math.max(p.height,(yOffset&&parseFloat(yOffset.value)||0)+bbox.height),p},{x:0,y:0,width:0,height:0}):{x:0,y:0,width:0,height:0}};function annotation(){var annotations=[],collection=void 0,context=void 0,disable=[],accessors={},accessorsInverse={},editMode=!1,ids=void 0,type=d3Callout,textWrap=void 0,notePadding=void 0,annotationDispatcher=common.dispatch("subjectover","subjectout","subjectclick","connectorover","connectorout","connectorclick","noteover","noteout","noteclick","dragend","dragstart"),sel=void 0,annotation2=function(selection){sel=selection,editMode||selection.selectAll("circle.handle").remove();var translatedAnnotations=annotations.map(function(a){return a.type||(a.type=type),a.disable||(a.disable=disable),new Annotation(a)});collection=collection||new AnnotationCollection({annotations:translatedAnnotations,accessors,accessorsInverse,ids});var annotationG=selection.selectAll("g").data([collection]);annotationG.enter().append("g").attr("class","annotations");var group=selection.select("g.annotations");newWithClass(group,collection.annotations,"g","annotation");var annotation4=group.selectAll("g.annotation");annotation4.each(function(d){var a=common.select(this);a.attr("class","annotation"),newWithClass(a,[d],"g","annotation-connector"),newWithClass(a,[d],"g","annotation-subject"),newWithClass(a,[d],"g","annotation-note"),newWithClass(a.select("g.annotation-note"),[d],"g","annotation-note-content"),d.type=d.type.toString()==="[object Object]"?d.type:new d.type({a,annotation:d,textWrap,notePadding,editMode,dispatcher:annotationDispatcher,accessors}),d.type.draw(),d.type.drawText&&d.type.drawText()})};return annotation2.json=function(){return console.log("Annotations JSON was copied to your clipboard. Please note the annotation type is not JSON compatible. It appears in the objects array in the console, but not in the copied JSON.",collection.json),window.copy(JSON.stringify(collection.json.map(function(a){return delete a.type,a}))),annotation2},annotation2.update=function(){return annotations&&collection&&(annotations=collection.annotations.map(function(a){return a.type.draw(),a})),annotation2},annotation2.updateText=function(){return collection&&(collection.updateText(textWrap),annotations=collection.annotations),annotation2},annotation2.updatedAccessors=function(){return collection.setPositionWithAccessors(),annotations=collection.annotations,annotation2},annotation2.disable=function(_){return arguments.length?(disable=_,collection&&(collection.updateDisable(disable),annotations=collection.annotations),annotation2):disable},annotation2.textWrap=function(_){return arguments.length?(textWrap=_,collection&&(collection.updateTextWrap(textWrap),annotations=collection.annotations),annotation2):textWrap},annotation2.notePadding=function(_){return arguments.length?(notePadding=_,collection&&(collection.updateNotePadding(notePadding),annotations=collection.annotations),annotation2):notePadding},annotation2.type=function(_,settings){return arguments.length?(type=_,collection&&(collection.annotations.map(function(a){a.type.note&&a.type.note.selectAll("*:not(.annotation-note-content)").remove(),a.type.noteContent&&a.type.noteContent.selectAll("*").remove(),a.type.subject&&a.type.subject.selectAll("*").remove(),a.type.connector&&a.type.connector.selectAll("*").remove(),a.type.typeSettings={},a.type=type,a.subject=settings&&settings.subject||a.subject,a.connector=settings&&settings.connector||a.connector,a.note=settings&&settings.note||a.note}),annotations=collection.annotations),annotation2):type},annotation2.annotations=function(_){if(!arguments.length)return collection&&collection.annotations||annotations;if(annotations=_,collection&&collection.annotations){var rerun=annotations.some(function(d){return!d.type||d.type.toString()!=="[object Object]"});rerun?(collection=null,annotation2(sel)):collection.annotations=annotations}return annotation2},annotation2.context=function(_){return arguments.length?(context=_,annotation2):context},annotation2.accessors=function(_){return arguments.length?(accessors=_,annotation2):accessors},annotation2.accessorsInverse=function(_){return arguments.length?(accessorsInverse=_,annotation2):accessorsInverse},annotation2.ids=function(_){return arguments.length?(ids=_,annotation2):ids},annotation2.editMode=function(_){return arguments.length?(editMode=_,sel&&sel.selectAll("g.annotation").classed("editable",editMode),collection&&(collection.editMode(editMode),annotations=collection.annotations),annotation2):editMode},annotation2.collection=function(_){return arguments.length?(collection=_,annotation2):collection},annotation2.on=function(){var value=annotationDispatcher.on.apply(annotationDispatcher,arguments);return value===annotationDispatcher?annotation2:value},annotation2}function value2Angle(value){return(value-.5)*.65*2*Math.PI}function pointOnArc(angle,radius){return{x:Math.cos(angle-Math.PI/2)*radius,y:Math.sin(angle-Math.PI/2)*radius}}function indicatorTranslate(angle,radius,inner=!1){const point2=pointOnArc(angle,radius),rotation=angle*180/Math.PI+(inner===!0?180:0);return`translate(${point2.x}, ${point2.y}) rotate(${rotation})`}function indicatorTween(newAngle,radius,inner=!1){return function(d){const interpolate=common.interpolate(d.angle,newAngle);return d.angle=newAngle,function(t){return indicatorTranslate(interpolate(t),radius,inner)}}}function arcTween(startAngle,endAngle,arc2){return function(d){const startInterpolate=common.interpolate(d.startAngle,startAngle),endInterpolate=common.interpolate(d.endAngle,endAngle);return function(t){return d.startAngle=startInterpolate(t),d.endAngle=endInterpolate(t),arc2(d)}}}class Gauge extends common.SVGWidget{constructor(){super();__publicField(this,"_d3Arc",d3Arc().innerRadius(85).outerRadius(100));__publicField(this,"_colorScale",common.scaleLinear().interpolate(common.interpolateHcl));__publicField(this,"_usageArc");__publicField(this,"_meanArc");__publicField(this,"_freeArc");__publicField(this,"_indInner");__publicField(this,"_indOuter");__publicField(this,"_centerTextG");__publicField(this,"_centerText");__publicField(this,"_bottomText");__publicField(this,"_tooltipG");__publicField(this,"_mainTooltip")}tip(d){if(d===null||d.label==="")this._tooltipG.transition().style("opacity",0).on("interrupt end",()=>{this._tooltipG.selectAll("g").remove()});else{this._tooltipG.interrupt().style("opacity",1),d.w=this._centerText.datum().w+10;let lineType="horizontal",xOffset=0,yOffset=5,padding=5;d.y>=5&&d.y<=25?(xOffset=d.x<0?-d.w/2:d.w/2,yOffset=12.5,padding=void 0,lineType="vertical"):d.y>25&&(yOffset=25,padding=0);const annotationtip=annotation().type(d3CalloutElbow).annotations([{data:d,dx:-d.x+xOffset,dy:-d.y+yOffset,color:"black",note:{label:d.label,lineType,padding,align:"middle"}}]).accessors({x:d2=>d2.x,y:d2=>d2.y});this._tooltipG.call(annotationtip)}}calcSize(textElement,width,height){const bb=textElement.node().getBBox(),widthTransform=width/bb.width,heightTransform=height/bb.height,scale=widthTransform<heightTransform?widthTransform:heightTransform;return{width:bb.width,height:bb.height,scale}}updateText(textElement,x2,y2,w,h){textElement.datum({x:x2,y:y2,w,h}).attr("transform",null);const size=this.calcSize(textElement,w,h),x22=x2+w/2-size.width/2*size.scale,y22=y2+h/2-size.height/2*size.scale;textElement.attr("transform",`translate(${x22}, ${y22}) scale(${size.scale})`)}calcWidth(){return Math.min(this.width(),this.height(),this.maxDiameter())}enter(domNode,element){super.enter(domNode,element),element.on("click",d=>{this.click(d)}),this._usageArc=element.append("path").datum({startAngle:value2Angle(0),endAngle:value2Angle(0)}).style("fill","green").on("mousemove",d=>{const[x2,y2]=this._d3Arc.centroid(d);this.tip({x:x2,y:y2,label:this.valueDescription()})}).on("mouseout",d=>{this.tip(null)}),this._freeArc=element.append("path").datum({startAngle:value2Angle(0),endAngle:value2Angle(1)}).style("fill","lightGrey"),this._meanArc=element.append("path").datum({startAngle:value2Angle(0),endAngle:value2Angle(0)}).style("fill","black").on("mousemove",d=>{const[x2,y2]=this._d3Arc.centroid(d);this.tip({x:x2,y:y2,label:this.tickValueDescription()})}).on("mouseout",d=>{this.tip(null)}),this._mainTooltip=element.append("title");const context=this;function appendIndicator(){return element.append("path").datum({angle:value2Angle(0)}).style("fill","black").style("stroke","black").attr("d","M 0 0 l -3 -3 l 6 0 z").on("mousemove",d=>{const[x2,y2]=context._d3Arc.centroid(context._meanArc.datum());context.tip({x:x2,y:y2,label:context.tickValueDescription()})}).on("mouseout",d=>{context.tip(null)})}this._indInner=appendIndicator(),this._indOuter=appendIndicator(),this._centerText=element.append("text").attr("dy",".66em").style("fill","green").on("mousemove",d=>{this.tip({x:0,y:0,label:this.valueDescription()})}).on("mouseout",d=>{this.tip(null)}),this._bottomText=element.append("text").attr("dy",".66em").on("mousemove",d=>{this.tip({x:0,y:d.y,label:this.titleDescription()})}).on("mouseout",d=>{this.tip(null)}),this._tooltipG=element.append("g").attr("class","annotation-tip")}update(domNode,element){super.update(domNode,element),this._colorScale.domain(this.colorDomain()).range(this.colorRange()),element.attr("title",this.tooltip()).style("cursor",this.click!==Gauge.prototype.click?"pointer":null);const innerRadius=this.calcWidth()/3,outerRadius=this.calcWidth()/2-5;this._d3Arc.innerRadius(innerRadius).outerRadius(outerRadius);const val=this.value(),tickVal=this.tickValue();this._usageArc.style("fill",this._colorScale(val)).transition().duration(750).attrTween("d",arcTween(value2Angle(0),value2Angle(val),this._d3Arc)),this._freeArc.style("fill",this.emptyColor()).transition().duration(750).attrTween("d",arcTween(value2Angle(val),value2Angle(1),this._d3Arc)),this._meanArc.style("fill",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("d",arcTween(value2Angle(tickVal-.001),value2Angle(tickVal+.001),this._d3Arc)),this._indInner.style("fill",this.tickColor()).style("stroke",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("transform",indicatorTween(value2Angle(tickVal),innerRadius,!0)),this._indOuter.style("fill",this.tickColor()).style("stroke",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("transform",indicatorTween(value2Angle(tickVal),outerRadius)),this._centerText.style("fill",this._colorScale(val)).text(common.format(".0%")(val)),this._bottomText.style("fill",this.click!==Gauge.prototype.click?"blue":"black").style("text-decoration",this.click!==Gauge.prototype.click?"underline":null).text(this.title());const point2=pointOnArc(value2Angle(1),innerRadius-8);this.updateText(this._centerText,-point2.x,-point2.y,2*point2.x,2*point2.y);const point22=pointOnArc(value2Angle(1),outerRadius);point22.y+=5;const width=this.calcWidth()-20,height=this.calcWidth()/2-point22.y-5;this.updateText(this._bottomText,-width/2,point22.y,width,height),this._mainTooltip.text(this.tooltip())}click(w){}}Gauge.prototype._class+=" chart_Gauge",Gauge.prototype.publish("title","","string","Title"),Gauge.prototype.publish("titleDescription","","string","Title Description"),Gauge.prototype.publish("maxDiameter",128,"number","Max Diameter"),Gauge.prototype.publish("value",0,"number","Value"),Gauge.prototype.publish("valueDescription","","string","Value Description"),Gauge.prototype.publish("showTick",!1,"boolean","Show Tick"),Gauge.prototype.publish("tickValue",0,"number","Tick Value"),Gauge.prototype.publish("tickValueDescription","","string","Tick Value Description"),Gauge.prototype.publish("tooltip","","string","Tooltip"),Gauge.prototype.publish("colorRange",["green","green","green","green","green","green","green","green","orange","red","red"],"array","Array of colors for the filled gauge portion. The fill color will be relative to the gauge value."),Gauge.prototype.publish("colorDomain",[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1],"array","This array augments the mapping of the value to the fill colorRange."),Gauge.prototype.publish("emptyColor","lightgrey","html-color","Color of the empty portion of the gauge"),Gauge.prototype.publish("tickColor","black","html-color","Color of the tick");const sortAscending=(a,b)=>a[1]-b[1]>0?1:-1,sortDescending=(a,b)=>a[1]-b[1]>0?-1:1;class Pie extends common.SVGWidget{constructor(){super();__publicField(this,"_totalValue");__publicField(this,"d3Pie");__publicField(this,"d3Arc");__publicField(this,"d3LabelArc");__publicField(this,"_labelPositions");__publicField(this,"_smallValueLabelHeight");__publicField(this,"_labelWidthLimit");__publicField(this,"_quadIdxArr");__publicField(this,"_minLabelTop",0);__publicField(this,"_maxLabelBottom",0);__publicField(this,"_seriesValueFormatter");__publicField(this,"_seriesPercentageFormatter");__publicField(this,"_slices");__publicField(this,"_labels");api.I2DChart.call(this),api.ITooltip.call(this),common.Utility.SimpleSelectionMixin.call(this),this.d3Pie=d3Pie(),this.d3Arc=d3Arc(),this.d3LabelArc=d3Arc(),this.tooltipTick_default(!1).tooltipOffset_default(0)}intersection(pointA,pointB){return this.intersectCircle(this.calcOuterRadius(),pointA,pointB)}calcInnerRadius(){return this.innerRadius_exists()?this.calcOuterRadius()*this.innerRadius()/100:0}calcOuterRadius(){const maxTextWidth=this.textSize(this.data().map(d=>this.getLabelText({data:d},!1)),"Verdana",12).width,horizontalLimit=this._size.width-(this.showLabels()?maxTextWidth*2:0)-20,verticalLimit=this._size.height-12*3-(this.showLabels()?this._smallValueLabelHeight:0),outerRadius=Math.min(horizontalLimit,verticalLimit)/2-2;return horizontalLimit/2-2<this.minOuterRadius()?this._labelWidthLimit=maxTextWidth-(this.minOuterRadius()-(horizontalLimit/2-2)):this._labelWidthLimit=maxTextWidth,outerRadius<this.minOuterRadius()?this.minOuterRadius():outerRadius}calcSmallValueLabelHeight(){const totalVal=this.data().reduce((acc,n)=>acc+n[1],0);let smallCount=0;return this.data().forEach(row=>{row[1]/totalVal<.1&&smallCount++}),this.labelHeight()*smallCount}calcTotalValue(){return this.data().reduce((acc,d)=>acc+d[1],0)}getLabelText(d,truncate){let len,label=d.data[0];if(typeof this._labelWidthLimit<"u"&&truncate){const labelWidth=this.textSize(label,"Verdana",this.labelHeight()).width;this._labelWidthLimit<labelWidth&&(len=label.length*(this._labelWidthLimit/labelWidth)-3,label=len<label.length?label.slice(0,len)+"...":label)}if(this.showSeriesValue()&&(label+=` : ${this._seriesValueFormatter(d.data[1])}`),this.showSeriesPercentage()){let sum=this._totalValue;const dm=this.dataMeta();typeof dm.sum<"u"&&(sum=dm.sum);const perc=d.data[1]/sum*100;label+=` : ${this._seriesPercentageFormatter(perc)}%`}return label}selection(_){var _a;if(!arguments.length)try{return(_a=this._selection.selection2()[0])==null?void 0:_a.data}catch{return}const strRow=JSON.stringify(_);this._selection.selection2(d=>strRow===JSON.stringify(d.data))}selectByLabel(_){const row=this.data().filter(row2=>row2[0]===_)[0];row&&this.selection(row)}enter(_domNode,element){super.enter(_domNode,element),this._selection.widgetElement(element),this._slices=element.append("g"),this._labels=element.append("g");const context=this;this.tooltipHTML(function(d){switch(context.tooltipStyle()){case"series-table":return context.tooltipFormat({label:d.data[0],arr:context.columns().slice(1).map(function(column,i){return{label:column,color:context._palette(d.data[0]),value:d.data[i+1]}})});default:return context.tooltipFormat({label:d.data[0],value:d.data[1]})}})}update(_domNode,element){super.update(_domNode,element);const context=this;this.updateD3Pie(),this._palette=this._palette.switch(this.paletteID()),this._seriesValueFormatter=common.format(this.seriesValueFormat()),this._seriesPercentageFormatter=common.format(this.seriesPercentageFormat()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._smallValueLabelHeight=this.calcSmallValueLabelHeight(),this._totalValue=this.calcTotalValue();const innerRadius=this.calcInnerRadius(),outerRadius=this.calcOuterRadius(),labelRadius=outerRadius+12;this.d3Arc.innerRadius(innerRadius).padRadius(outerRadius).outerRadius(outerRadius),this._quadIdxArr=[[],[],[],[]];const data=[...this.data()];switch(this.sortDataByValue()){case"ascending":data.sort(sortAscending);break;case"descending":data.sort(sortDescending);break}const arc2=this._slices.selectAll(".arc").data(this.d3Pie(data),d=>d.data[0]);this._labelPositions=[],arc2.enter().append("g").attr("class",(d,i)=>"arc series series-"+this.cssTag(d.data[0])).attr("opacity",0).call(this._selection.enter.bind(this._selection)).on("click",function(d){context.click(context.rowToObj(d.data),context.columns()[1],context._selection.selected(this))}).on("dblclick",function(d){context.dblclick(context.rowToObj(d.data),context.columns()[1],context._selection.selected(this))}).each(function(d,i){common.select(this).append("path").on("mouseout.tooltip",context.tooltip.hide).on("mousemove.tooltip",context.tooltip.show).on("mouseover",arcTween2(0,0)).on("mouseout",arcTween2(-5,150))}).merge(arc2).transition().attr("opacity",1).each(function(d,i){const quad=context.getQuadrant(midAngle(d));context._quadIdxArr[quad].push(i),d.outerRadius=outerRadius-5,common.select(this).select("path").transition().attr("d",context.d3Arc).style("fill",context.fillColor(d.data,context.columns()[1],d.data[1]))}),arc2.exit().transition().style("opacity",0).remove(),this.d3LabelArc.innerRadius(labelRadius).outerRadius(labelRadius);const text=this._labels.selectAll("text").data(this.showLabels()?this.d3Pie(data):[],d=>d.data[0]),mergedText=text.enter().append("text").on("mouseout.tooltip",context.tooltip.hide).on("mousemove.tooltip",context.tooltip.show).attr("dy",".5em").on("click",function(d){context._slices.selectAll("g").filter(function(d2){d.data===d2.data&&(context._selection.click(this),context.click(context.rowToObj(d.data),context.columns()[1],context._selection.selected(this)))})}).on("dblclick",function(d){context._slices.selectAll("g").filter(function(d2){d.data===d2.data&&context.dblclick(context.rowToObj(d.data),context.columns()[1],context._selection.selected(this))})}).merge(text).text(d=>this.getLabelText(d,!0)).each(function(d,i){const pos=context.d3LabelArc.centroid(d),mid_angle=midAngle(d);pos[0]=labelRadius*(context.isLeftSide(mid_angle)?1:-1),context._labelPositions.push({top:pos[1],bottom:pos[1]+context.labelHeight()})});this.showLabels()&&(this.adjustForOverlap(),mergedText.transition().style("font-size",this.labelHeight()+"px").attr("transform",(d,i)=>{const pos=context.d3LabelArc.centroid(d);return pos[0]=labelRadius*(context.isLeftSide(midAngle(d))?1:-1),pos[1]=context._labelPositions[i].top,"translate("+pos+")"}).style("text-anchor",d=>this.isLeftSide(midAngle(d))?"start":"end")),text.exit().remove();const polyline=this._labels.selectAll("polyline").data(this.showLabels()?this.d3Pie(data):[],d=>this.getLabelText(d,!0));polyline.enter().append("polyline").merge(polyline).transition().attr("points",function(d,i){const pos=context.d3LabelArc.centroid(d),pos1=context.d3Arc.centroid(d),pos2=[...pos];return pos[0]=labelRadius*(context.isLeftSide(midAngle(d))?1:-1),pos[1]=context._labelPositions[i].top,[pos1,pos2,pos]}),polyline.exit().remove(),this.showLabels()&&this.centerOnLabels();function midAngle(d){return d.startAngle+(d.endAngle-d.startAngle)/2}function arcTween2(outerRadiusDelta,delay){return function(){common.select(this).transition().delay(delay).attrTween("d",function(d){const i=common.interpolate(d.outerRadius,outerRadius+outerRadiusDelta);return function(t){return d.outerRadius=i(t),context.d3Arc(d)}})}}}isLeftSide(midAngle){return midAngle=util.normalizeRadians(midAngle),midAngle>Math.PI*2?midAngle:midAngle<Math.PI&&midAngle>0}getQuadrant(radians){let quad=0;const rad=util.normalizeRadians(radians);return quad=rad<=Math.PI*1&&rad>=Math.PI*.5?3:quad,quad=rad<=Math.PI*.5&&rad>=Math.PI*0?2:quad,quad=rad<=Math.PI*0&&rad>=Math.PI*-.5?1:quad,quad}centerOnLabels(){const gY=this.pos().y,gY2=gY*2,radius=this.calcOuterRadius(),top2=Math.min(this._minLabelTop,-radius),bottom2=Math.max(this._maxLabelBottom,radius),h=bottom2-top2,heightDiff=gY2-h,absTop=Math.abs(this._minLabelTop);let yShift=0;bottom2>gY?(yShift=gY-bottom2+this.labelHeight()/2,yShift-=heightDiff/2):top2<0&&absTop>gY&&(yShift=absTop-gY+this.labelHeight()/2,yShift+=heightDiff/2);const pos=this.pos();this.pos({y:pos.y+yShift,x:pos.x})}adjustForOverlap(){const labelHeight=this.labelHeight();this._quadIdxArr.forEach((arr,quad)=>{this._quadIdxArr[quad].sort((a,b)=>{if(quad===1||quad===2)return this._labelPositions[a].top>this._labelPositions[b].top?-1:1;if(quad===0||quad===3)return this._labelPositions[a].top>this._labelPositions[b].top?1:-1});let prevTop;this._quadIdxArr[quad].forEach((n,i)=>{if(i>0){if(quad===1||quad===2){if(prevTop<this._labelPositions[n].bottom){const overlap=this._labelPositions[n].bottom-prevTop;this._labelPositions[n].top-=overlap,this._labelPositions[n].bottom-=overlap}}else if((quad===0||quad===3)&&prevTop+labelHeight>this._labelPositions[n].top){const overlap=Math.abs(this._labelPositions[n].top)-Math.abs(prevTop+labelHeight);this._labelPositions[n].top-=overlap,this._labelPositions[n].bottom-=overlap}}prevTop=this._labelPositions[n].top})}),this._minLabelTop=0,this._maxLabelBottom=0,this._quadIdxArr.forEach((arr,quad)=>{this._quadIdxArr[quad].forEach((n,i)=>{this._minLabelTop>this._labelPositions[n].top&&(this._minLabelTop=this._labelPositions[n].top),this._maxLabelBottom<this._labelPositions[n].bottom&&(this._maxLabelBottom=this._labelPositions[n].bottom)})})}exit(domNode,element){super.exit(domNode,element)}updateD3Pie(){const startAngle=util.normalizeRadians(util.degreesToRadians(this.startAngle()));switch(this.sortDataByValue()){case"ascending":this.d3Pie.sort(sortAscending);break;case"descending":this.d3Pie.sort(sortDescending);break;default:this.d3Pie.sort(null)}this.d3Pie.padAngle(.0025).startAngle(startAngle).endAngle(2*Math.PI+startAngle).value(function(d){return d[1]})}}__publicField(Pie,"__inputs",[{id:"label",type:"string"},{id:"value",type:"number"}]),Pie.prototype._class+=" chart_Pie",Pie.prototype.implements(api.I2DChart.prototype),Pie.prototype.implements(api.ITooltip.prototype),Pie.prototype.mixin(common.Utility.SimpleSelectionMixin),Pie.prototype.publish("showLabels",!0,"boolean","If true, wedge labels will display"),Pie.prototype.publish("showSeriesValue",!1,"boolean","Append data series value next to label",null,{disable:w=>!w.showLabels()}),Pie.prototype.publish("seriesValueFormat",",.0f","string","Number format used for formatting series values",null,{disable:w=>!w.showSeriesValue()}),Pie.prototype.publish("showSeriesPercentage",!1,"boolean","Append data series percentage next to label",null,{disable:w=>!w.showLabels()}),Pie.prototype.publish("seriesPercentageFormat",",.0f","string","Number format used for formatting series percentages",null,{disable:w=>!w.showSeriesPercentage()}),Pie.prototype.publish("paletteID","default","set","Color palette for this widget",Pie.prototype._palette.switch(),{tags:["Basic","Shared"]}),Pie.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Pie.prototype.publish("innerRadius",0,"number","Sets inner pie hole radius as a percentage of the radius of the pie chart",null,{tags:["Basic"],range:{min:0,step:1,max:100}}),Pie.prototype.publish("minOuterRadius",20,"number","Minimum outer radius (pixels)"),Pie.prototype.publish("startAngle",0,"number","Starting angle of the first (and largest) wedge (degrees)"),Pie.prototype.publish("labelHeight",12,"number","Font size of labels (pixels)",null,{disable:w=>!w.showLabels()}),Pie.prototype.publish("sortDataByValue","descending","set","Sort data by value",["none","ascending","descending"]);class HalfPie extends Pie{constructor(){super()}postUpdate(domNode,element){super.postUpdate(domNode,element);let x2=this._pos.x,y2=this._pos.y;this._drawStartPos==="origin"&&this._target instanceof SVGElement&&(x2-=this._size.width/2,y2-=this._size.height/2),y2+=this._size.height/4,this._element.attr("transform","translate("+x2+","+y2+")scale("+this._widgetScale+")")}updateD3Pie(){super.updateD3Pie(),this.d3Pie.startAngle(-Math.PI/2).endAngle(Math.PI/2)}}HalfPie.prototype._class+=" chart_HalfPie";class Heat extends XYAxis{constructor(){super();__publicField(this,"_domForeignObject");__publicField(this,"_domCanvas");__publicField(this,"_heat");this.xAxisGuideLines_default(!0).yAxisGuideLines_default(!0)}radius(r){return this.radiusX(r),this.radiusY(r),this}layerEnter(host,element,duration=250){super.layerEnter(host,element,duration),this._domForeignObject=this.svg.insert("foreignObject",`#${this.id()+"_clippath"}`),this._domCanvas=this._domForeignObject.append("xhtml:body").style("margin","0px").style("padding","0px").style("background-color","transparent").append("canvas"),this._heat=simpleheat(this._domCanvas.node())}layerUpdate(host,element,duration=250){super.layerUpdate(host,element),this._palette=this._palette.switch(this.paletteID());let width=this.width()-this.margin.left-this.margin.right;width<0&&(width=0);let height=this.height()-this.margin.top-this.margin.bottom;height<0&&(height=0),this._domForeignObject.attr("x",this.margin.left).attr("y",this.margin.top).attr("width",width).attr("height",height),this._domCanvas.attr("width",width).attr("height",height);const data=host.orientation()==="horizontal"?this.data().map(r=>[host.dataPos(r[0]),host.valuePos(r[1]),r[2]]):this.data().map(r=>[host.valuePos(r[1]),host.dataPos(r[0]),r[2]]),maxWeight=this.maxWeight_exists()?this.maxWeight():common.max(data,r=>r[2]);if(this.paletteID()!=="default"){const gradient={},reverse=this.reversePalette();for(let i=0;i<8;++i)gradient[i/8]=this._palette((reverse?8-i:i)/8,0,1);this._heat.gradient(gradient)}else this._heat.gradient(this._heat.defaultGradient);this._heat.resize();const radiusX=this.radiusAsPercent()?this.radiusX()*width/100:this.radiusX(),radiusY=this.radiusAsPercent()?this.radiusY()*height/100:this.radiusY();this._heat.clear().radius(radiusX,radiusY,this.blur()).max(maxWeight).data(data).draw(this.minOpacity())}}Heat.prototype._class+=" chart_Heat",Heat.prototype._palette=common.Palette.rainbow("default"),Heat.prototype.publish("paletteID","default","set","Color palette for this widget",Heat.prototype._palette.switch(),{tags:["Basic"]}),Heat.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Heat.prototype.publish("reversePalette",!1,"boolean","Reverse Palette Colors",null,{disable:w=>w.paletteID()==="default"}),Heat.prototype.publish("radiusX",25,"number","Point X radius (25 by default)"),Heat.prototype.publish("radiusY",25,"number","Point Y radius (25 by default)"),Heat.prototype.publish("radiusAsPercent",!1,"boolean","Calculate RadiusX + RadiusY as % of size"),Heat.prototype.publish("blur",15,"number","Point blur radius (15 by default)"),Heat.prototype.publish("maxWeight",void 0,"number","Clamp max weight to value (optional), omitting uses max data point",void 0,{optional:!0}),Heat.prototype.publish("minOpacity",.05,"number","Minimum point opacity (0.05 by default)");function simpleheat(canvas){if(!(this instanceof simpleheat))return new simpleheat(canvas);this._canvas=canvas=typeof canvas=="string"?document.getElementById(canvas):canvas,this._ctx=canvas.getContext("2d"),this._width=canvas.width,this._height=canvas.height,this._max=1,this._data=[]}simpleheat.prototype={defaultRadius:25,defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"},data:function(data){return this._data=data,this},max:function(max2){return this._max=max2,this},add:function(point2){return this._data.push(point2),this},clear:function(){return this._data=[],this},radius:function(rX,rY,blur){blur=blur===void 0?15:blur;const ellipse=this._ellipse=this._createCanvas(),ctx=ellipse.getContext("2d"),rX2=this._r=rX+blur,rY2=this._r=rY+blur;return ellipse.width=rX2*2,ellipse.height=rY2*2,ctx.shadowOffsetX=ctx.shadowOffsetY=rX2*2,ctx.shadowOffsetY=ctx.shadowOffsetY=rY2*2,ctx.shadowBlur=blur,ctx.shadowColor="black",ctx.beginPath(),ctx.ellipse(-rX2,-rY2,rX,rY,0,0,Math.PI*2,!0),ctx.closePath(),ctx.fill(),this},resize:function(){this._width=this._canvas.width,this._height=this._canvas.height},gradient:function(grad){const canvas=this._createCanvas(),ctx=canvas.getContext("2d"),gradient=ctx.createLinearGradient(0,0,0,256);canvas.width=1,canvas.height=256;for(const i in grad)gradient.addColorStop(+i,grad[i]);return ctx.fillStyle=gradient,ctx.fillRect(0,0,1,256),this._grad=ctx.getImageData(0,0,1,256).data,this},draw:function(minOpacity){this._ellipse||this.radius(this.defaultRadius,this.defaultRadius),this._grad||this.gradient(this.defaultGradient);const ctx=this._ctx;ctx.clearRect(0,0,this._width,this._height);for(let i=0,len=this._data.length,p;i<len;i++)p=this._data[i],p[2]<0?p[2]=0:p[2]>this._max&&(p[2]=this._max),ctx.globalAlpha=Math.max(p[2]/this._max,minOpacity===void 0?.05:minOpacity),ctx.drawImage(this._ellipse,p[0]-this._r,p[1]-this._r);const colored=ctx.getImageData(0,0,this._width,this._height);return this._colorize(colored.data,this._grad),ctx.putImageData(colored,0,0),this},_colorize:function(pixels,gradient){for(let i=0,len=pixels.length,j;i<len;i+=4)j=pixels[i+3]*4,j&&(pixels[i]=gradient[j],pixels[i+1]=gradient[j+1],pixels[i+2]=gradient[j+2])},_createCanvas:function(){return typeof document<"u"?document.createElement("canvas"):new this._canvas.constructor}};var thirdPi=Math.PI/3,angles=[0,thirdPi,2*thirdPi,3*thirdPi,4*thirdPi,5*thirdPi];function pointX(d){return d[0]}function pointY(d){return d[1]}function d3HexBin(){var x02=0,y02=0,x12=1,y12=1,x2=pointX,y2=pointY,r,dx,dy;function hexbin(points){var binsById={},bins=[],i,n=points.length;for(i=0;i<n;++i)if(!(isNaN(px=+x2.call(null,point2=points[i],i,points))||isNaN(py=+y2.call(null,point2,i,points)))){var point2,px,py,pj=Math.round(py=py/dy),pi2=Math.round(px=px/dx-(pj&1)/2),py1=py-pj;if(Math.abs(py1)*3>1){var px1=px-pi2,pi22=pi2+(px<pi2?-1:1)/2,pj2=pj+(py<pj?-1:1),px2=px-pi22,py2=py-pj2;px1*px1+py1*py1>px2*px2+py2*py2&&(pi2=pi22+(pj&1?1:-1)/2,pj=pj2)}var id=pi2+"-"+pj,bin=binsById[id];bin?bin.push(point2):(bins.push(bin=binsById[id]=[point2]),bin.x=(pi2+(pj&1)/2)*dx,bin.y=pj*dy)}return bins}function hexagon(radius){var x03=0,y03=0;return angles.map(function(angle){var x13=Math.sin(angle)*radius,y13=-Math.cos(angle)*radius,dx2=x13-x03,dy2=y13-y03;return x03=x13,y03=y13,[dx2,dy2]})}return hexbin.hexagon=function(radius){return"m"+hexagon(radius==null?r:+radius).join("l")+"z"},hexbin.centers=function(){for(var centers=[],j=Math.round(y02/dy),i=Math.round(x02/dx),y3=j*dy;y3<y12+r;y3+=dy,++j)for(var x3=i*dx+(j&1)*dx/2;x3<x12+dx/2;x3+=dx)centers.push([x3,y3]);return centers},hexbin.mesh=function(){var fragment=hexagon(r).slice(0,4).join("l");return hexbin.centers().map(function(p){return"M"+p+"m"+fragment}).join("")},hexbin.x=function(_){return arguments.length?(x2=_,hexbin):x2},hexbin.y=function(_){return arguments.length?(y2=_,hexbin):y2},hexbin.radius=function(_){return arguments.length?(r=+_,dx=r*2*Math.sin(thirdPi),dy=r*1.5,hexbin):r},hexbin.size=function(_){return arguments.length?(x02=y02=0,x12=+_[0],y12=+_[1],hexbin):[x12-x02,y12-y02]},hexbin.extent=function(_){return arguments.length?(x02=+_[0][0],y02=+_[0][1],x12=+_[1][0],y12=+_[1][1],hexbin):[[x02,y02],[x12,y12]]},hexbin.radius(1)}class HexBin extends XYAxis{constructor(){super();__publicField(this,"_hexbin");__publicField(this,"_dataMinWeight");__publicField(this,"_dataMaxWeight");api.I2DAggrChart.call(this),this.tooltipValueFormat_default(",.0f"),api.ITooltip.call(this),this.tooltipHTML(d=>{const seriesExtent=common.extent(d,d2=>d2.label),labelExtent=common.extent(d,d2=>d2.value);return this.tooltipFormat({series:seriesExtent[0]===seriesExtent[1]?seriesExtent[0]:`${seriesExtent[0]} -> ${seriesExtent[1]}`,label:labelExtent[0]===labelExtent[1]?labelExtent[0]:`${labelExtent[0]} -> ${labelExtent[1]}`,value:d.length})}),this._hexbin=d3HexBin().x(d=>d.x).y(d=>d.y),this.xAxisGuideLines_default(!1).yAxisGuideLines_default(!1).xAxisType_default("linear")}xPos(host,d){return host.orientation()==="horizontal"?host.dataPos(d.label):host.valuePos(d.value)}yPos(host,d){return host.orientation()==="horizontal"?host.valuePos(d.value):host.dataPos(d.label)}layerUpdate(host,element,duration=250){super.layerUpdate(host,element,duration);const context=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._hexbin.extent([0,0],[this.width(),this.height()]).radius(this.binSize());const dataPoints=this.flattenData().map(d=>({x:context.xPos(host,d),y:context.yPos(host,d),label:host.parseData(d.label),value:host.parseValue(d.value),origRow:d})),hexBinPoints=this._hexbin(dataPoints),minBinPoints=common.min(hexBinPoints,function(d){return d.length}),maxBinPoints=common.max(hexBinPoints,function(d){return d.length});this._dataMinWeight=minBinPoints,this._dataMaxWeight=maxBinPoints;const points=element.selectAll(".hexagon").data(hexBinPoints,function(d){return d.i+"_"+d.j});points.enter().append("path").attr("class","hexagon").call(host._selection.enter.bind(host._selection)).on("click",function(d){const data=context.data();context.click(d.map(row=>host.rowToObj(data[row.origRow.rowIdx])),context.columns()[1],host._selection.selected(this))}).on("dblclick",function(d){const data=context.data();context.dblclick(d.map(row=>host.rowToObj(data[row.origRow.rowIdx])),context.columns()[1],host._selection.selected(this))}).on("mouseout.tooltip",context.tooltip.hide).on("mousemove.tooltip",context.tooltip.show).attr("transform",function(d){return"translate("+d.x+","+d.y+")scale(0)"}).merge(points).transition().duration(duration).attr("d",this._hexbin.hexagon()).attr("transform",function(d){return"translate("+d.x+","+d.y+")scale(1)"}).style("fill",function(d){return context._palette(d.length,minBinPoints,maxBinPoints)}),points.exit().transition().duration(duration).attr("transform",function(d){return"translate("+d.x+","+d.y+")scale(0)"}).remove()}exit(domNode,element){super.exit(domNode,element)}click(row,column,selected){}dblclick(row,column,selected){}}__publicField(HexBin,"__inputs",[{id:"x",type:"any"},{id:"y",type:"number"}]),HexBin.prototype._class+=" chart_HexBin",HexBin.prototype.implements(api.I2DAggrChart.prototype),HexBin.prototype.implements(api.ITooltip.prototype),HexBin.prototype.publish("paletteID","Blues","set","Color palette for this widget",HexBin.prototype._palette.switch(),{tags:["Basic","Shared"]}),HexBin.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),HexBin.prototype.publish("binSize",20,"number","Bin radius",null,{range:{min:1,max:300,step:1}});class Line extends Scatter{constructor(){super(),this.interpolate_default("linear")}}Line.prototype._class+=" chart_Line";class QuarterPie extends Pie{constructor(){super()}postUpdate(domNode,element){super.postUpdate(domNode,element);let x2=this.orientation()==="left"?0:this._size.width,y2=this._size.height;this._drawStartPos==="origin"&&this._target instanceof SVGElement&&(x2-=this._size.width/2,y2-=this._size.height/2),this._element.attr("transform","translate("+x2+","+y2+")scale("+this._widgetScale+")")}updateD3Pie(){super.updateD3Pie(),this.d3Pie.startAngle(this.orientation()==="left"?0:-Math.PI/2).endAngle(this.orientation()==="left"?Math.PI/2:0)}calcOuterRadius(){const maxTextWidth=this.textSize(this.data().map(d=>this.getLabelText({data:d})),"Verdana",12).width;return Math.min(this._size.width-maxTextWidth-10,this._size.height-12*3)-2}}QuarterPie.prototype._class+=" chart_QuarterPie",QuarterPie.prototype.publish("orientation","left","set","Determines the placement and start/end angle.",["left","right"]);class QuartileCandlestick extends common.SVGWidget{constructor(){super();__publicField(this,"_g");__publicField(this,"_leftLine");__publicField(this,"_rightLine");__publicField(this,"_midLine");__publicField(this,"_midOuterRect");__publicField(this,"_midInnerRect1");__publicField(this,"_midInnerRect2");__publicField(this,"_q0text");__publicField(this,"_q1text");__publicField(this,"_q2text");__publicField(this,"_q3text");__publicField(this,"_q4text");__publicField(this,"_q0val");__publicField(this,"_q1val");__publicField(this,"_q2val");__publicField(this,"_q3val");__publicField(this,"_q4val")}enter(domNode,element){super.enter(domNode,element),this._g=element.append("g"),this._leftLine=this._g.append("rect"),this._rightLine=this._g.append("rect"),this._midLine=this._g.append("rect"),this._midOuterRect=this._g.append("rect"),this._midInnerRect1=this._g.append("rect"),this._midInnerRect2=this._g.append("rect"),this._q0text=this._g.append("text"),this._q1text=this._g.append("text"),this._q2text=this._g.append("text"),this._q3text=this._g.append("text"),this._q4text=this._g.append("text"),this._q0val=this._g.append("text"),this._q1val=this._g.append("text"),this._q2val=this._g.append("text"),this._q3val=this._g.append("text"),this._q4val=this._g.append("text")}update(domNode,element){super.update(domNode,element);const valueSize=(this.orientation()==="horizontal"?this.width():this.height())-this.lineWidth(),domainSize=this.orientation()==="horizontal"?this.height():this.width(),scale=common.scaleLinear().domain([this.data()[0],this.data()[4]]).range([this.edgePadding(),valueSize-this.edgePadding()]),candleWidth=this.candleWidth_exists()?this.candleWidth():domainSize,lineWidth=this.lineWidth(),lineColor=this.lineColor(),roundedCorners=this.roundedCorners(),q0x=this.edgePadding();let q1x=scale(this.data()[1]),q2x=scale(this.data()[2]),q3x=scale(this.data()[3]);const dataTop=-candleWidth/2,dataBottom=candleWidth/2,upperTextRotation=this.upperTextRotation(),lowerTextRotation=this.lowerTextRotation(),padding=this.textPadding(),labelFontSize=this.labelFontSize(),valueFontSize=this.valueFontSize(),sz=Math.max(labelFontSize,valueFontSize),q4x=valueSize-q0x;if(sz>0){for(;q1x-q0x<sz;)q1x+=sz;for(;q2x-q1x<sz;)q2x+=sz;for(;q3x-q2x<sz;)q3x+=sz;for(;q4x-q3x<sz;)q3x-=sz;for(;q3x-q2x<sz;)q2x-=sz;for(;q2x-q1x<sz;)q1x-=sz}let transX=-valueSize/2-this.lineWidth()/2,transY=0,rotate=0;const s=1;let textScale=1,labelAnchor="start",valueAnchor="end";this.orientation()==="vertical"&&(transX=0,transY=valueSize/2+this.lineWidth()/2,rotate=-90,labelAnchor="end",valueAnchor="start",textScale=-1),this._g.style("shape-rendering","crispEdges").attr("transform",`translate(${transX},${transY})rotate(${rotate})scale(${s})`),this._leftLine.attr("fill",lineColor).attr("height",candleWidth).attr("width",lineWidth).attr("x",q0x).attr("y",dataTop).attr("rx",roundedCorners).attr("ry",roundedCorners),this._rightLine.attr("class","right-line").attr("fill",lineColor).attr("height",candleWidth).attr("width",lineWidth).attr("x",q4x).attr("y",dataTop).attr("rx",roundedCorners).attr("ry",roundedCorners),this._midLine.attr("fill",lineColor).attr("height",lineWidth).attr("width",q4x-q0x).attr("x",q0x).attr("y",-lineWidth/2),this._midOuterRect.attr("fill",lineColor).attr("height",candleWidth).attr("width",q3x-q1x).attr("x",q1x).attr("y",dataTop).attr("rx",roundedCorners).attr("ry",roundedCorners),this._midInnerRect1.attr("fill",this.innerRectColor()).attr("height",candleWidth-lineWidth*2).attr("width",q2x-(q1x+lineWidth*2)).attr("x",q1x+lineWidth).attr("y",lineWidth-candleWidth/2).attr("rx",roundedCorners*.618).attr("ry",roundedCorners*.618),this._midInnerRect2.attr("fill",this.innerRectColor()).attr("height",candleWidth-lineWidth*2).attr("width",q3x-q2x-lineWidth).attr("x",q2x).attr("y",lineWidth-candleWidth/2).attr("rx",roundedCorners*.618).attr("ry",roundedCorners*.618),this._q0text.attr("height",candleWidth).attr("width",q3x-q1x).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${q0x}, ${dataTop-padding})rotate(${upperTextRotation})scale(${textScale})`).attr("font-size",labelFontSize).attr("text-anchor",labelAnchor).attr("alignment-baseline","hanging").text(this.columns()[0]),this._q1text.attr("height",candleWidth).attr("width",q3x-q1x).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${q1x}, ${dataTop-padding})rotate(${upperTextRotation})scale(${textScale})`).attr("font-size",labelFontSize).attr("text-anchor",labelAnchor).attr("alignment-baseline","middle").text(this.columns()[1]),this._q2text.attr("height",candleWidth).attr("width",q3x-q1x).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${q2x}, ${dataTop-padding})rotate(${upperTextRotation})scale(${textScale})`).attr("font-size",labelFontSize).attr("text-anchor",labelAnchor).attr("alignment-baseline","middle").text(this.columns()[2]),this._q3text.attr("height",candleWidth).attr("width",q3x-q1x).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${q3x}, ${dataTop-padding})rotate(${upperTextRotation})scale(${textScale})`).attr("font-size",labelFontSize).attr("text-anchor",labelAnchor).attr("alignment-baseline","middle").text(this.columns()[3]),this._q4text.attr("height",candleWidth).attr("width",q3x-q1x).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${q4x+lineWidth}, ${dataTop-padding})rotate(${upperTextRotation})scale(${textScale})`).attr("font-size",labelFontSize).attr("text-anchor",labelAnchor).attr("alignment-baseline","baseline").text(this.columns()[4]),this._q0val.attr("height",candleWidth).attr("width",q3x-q1x).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${q0x}, ${dataBottom+padding})rotate(${lowerTextRotation})scale(${textScale})`).attr("font-size",valueFontSize).attr("text-anchor",valueAnchor).attr("alignment-baseline","hanging").text(this.data()[0]),this._q1val.attr("height",candleWidth).attr("width",q3x-q1x).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${q1x}, ${dataBottom+padding})rotate(${lowerTextRotation})scale(${textScale})`).attr("font-size",valueFontSize).attr("text-anchor",valueAnchor).attr("alignment-baseline","middle").text(this.data()[1]),this._q2val.attr("height",candleWidth).attr("width",q3x-q1x).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${q2x}, ${dataBottom+padding})rotate(${lowerTextRotation})scale(${textScale})`).attr("font-size",valueFontSize).attr("text-anchor",valueAnchor).attr("alignment-baseline","middle").text(this.data()[2]),this._q3val.attr("height",candleWidth).attr("width",q3x-q1x).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${q3x}, ${dataBottom+padding})rotate(${lowerTextRotation})scale(${textScale})`).attr("font-size",valueFontSize).attr("text-anchor",valueAnchor).attr("alignment-baseline","middle").text(this.data()[3]),this._q4val.attr("height",candleWidth).attr("width",q3x-q1x).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${q4x+lineWidth}, ${dataBottom+padding})rotate(${lowerTextRotation})scale(${textScale})`).attr("font-size",valueFontSize).attr("text-anchor",valueAnchor).attr("alignment-baseline","baseline").text(this.data()[4])}}QuartileCandlestick.prototype._class+=" chart_QuartileCandlestick",QuartileCandlestick.prototype.publish("textColor","black","html-color","Color of label and value text"),QuartileCandlestick.prototype.publish("showLabels",!0,"boolean","If true, labels will be shown"),QuartileCandlestick.prototype.publish("showValues",!0,"boolean","If true, values will be shown"),QuartileCandlestick.prototype.publish("orientation","horizontal","set","Determines layout",["horizontal","vertical"]),QuartileCandlestick.prototype.publish("valueFontSize",12,"number","Font size of value text (pixels)"),QuartileCandlestick.prototype.publish("labelFontSize",12,"number","Font size of label text (pixels)"),QuartileCandlestick.prototype.publish("roundedCorners",8,"number","Radius of rounded rect corners (pixels)"),QuartileCandlestick.prototype.publish("lineWidth",4,"number","Width of lines (pixels)"),QuartileCandlestick.prototype.publish("candleWidth",null,"number","Height of outer rect (pixels)",null,{optional:!0}),QuartileCandlestick.prototype.publish("textPadding",8,"number","Padding between outer rect and text (pixels)"),QuartileCandlestick.prototype.publish("edgePadding",30,"number","Padding between outer rect and left/right sides (pixels)"),QuartileCandlestick.prototype.publish("lineColor","#333","html-color","Color of outer rect and lines"),QuartileCandlestick.prototype.publish("innerRectColor","white","html-color","Color of the inner rects"),QuartileCandlestick.prototype.publish("upperTextRotation",-60,"number","Rotation of label text (degrees)"),QuartileCandlestick.prototype.publish("lowerTextRotation",-60,"number","Rotation of value text (degrees)");class Radar extends common.SVGWidget{constructor(){super(),api.INDChart.call(this),api.ITooltip.call(this),common.Utility.SimpleSelectionMixin.call(this)}mapShape(shape){switch(shape){case"rectangle":return"rect";case"circle":return"circle";case"cross":return"path"}}setPointAttributes(element,x2,y2){const shape=this.mapShape(this.pointShape()),context=this;switch(shape){case"rect":element.attr("width",context.pointSize()).attr("height",context.pointSize()).style("fill",d=>this.strokeColor(d.data,d.column,d.value));break;case"circle":element.attr("r",context.pointSize()/2).attr("cx",x2).attr("cy",y2).style("fill",d=>this.strokeColor(d.data,d.column,d.value));break;case"path":const half_size=context.pointSize()/2;element.attr("d",function(d){return"M"+(x2-half_size)+" "+(y2-half_size)+" L"+(x2+half_size)+" "+(y2+half_size)+" M"+(x2-half_size)+" "+(y2+half_size)+" L"+(x2+half_size)+" "+(y2-half_size)}).style("stroke",d=>this.strokeColor(d.data,d.column,d.value));break}}enter(domNode,element){super.enter(domNode,element),this._selection.widgetElement(element),this.tooltipHTML(d=>this.tooltipFormat({label:d.label,series:d.column,value:d.value}))}update(domNode,element){super.update(domNode,element),this._palette=this._palette.switch(this.paletteID());const context=this,h=this.height(),w=this.width(),half_h=h/2,half_w=w/2,columns=this.columns(),data=this.data(),flatData=this.flattenData(columns,data).map((d,idx)=>(d.shape=this.mapShape(this.pointShape()),d.column=columns[d.colIdx],d.row=data[idx],d)),domain_points=[],arc2=this.degrees2radians(360/this.data().length),max_label_h=this.fontSize();let max_label_w=0;flatData.filter(n=>n.colIdx===1).forEach(n=>{const isize=super.textSize(n.label,`${this.fontFamily()}`,this.fontSize());max_label_w<isize.width&&(max_label_w=isize.width)});const radius=Math.min(half_h-max_label_h,half_w-max_label_w),labels=element.selectAll(".label").data(flatData.filter(n=>n.colIdx===1)),max_val=Math.max.apply(context,flatData.map(n=>n.value));labels.enter().append("text").attr("class","label").attr("text-anchor","middle").merge(labels).attr("font-size",this.fontSize()).attr("font-family",this.fontFamily()).each(function(n,i){const xy=context.polar2cartesian(radius,i*arc2-Math.PI/2);domain_points.push(xy.map(n2=>n2*context.labelPaddingRatio()));let text_anchor="middle";const _x=Math.round(xy[0]);text_anchor=_x>0?"start":text_anchor,text_anchor=_x<0?"end":text_anchor,common.select(this).attr("text-anchor",text_anchor).attr("x",xy[0]).attr("y",xy[1])}).text(n=>n.label),labels.exit().remove();const domains=element.selectAll(".domain").data(flatData.filter(n=>n.colIdx===1));domains.enter().append("line").classed("domain",!0).style("stroke","#000").style("stroke-opacity","0.75").style("stroke-width","1px").merge(domains).attr("x1",0).attr("y1",0).attr("x2",(n,i)=>domain_points[i][0]).attr("y2",(n,i)=>domain_points[i][1]),domains.exit().remove();const value_guides=element.selectAll(".value_guide").data(this.valueGuideRatios());value_guides.enter().append("polygon").classed("value_guide",!0).style("stroke","grey").style("stroke-opacity","0.75").style("stroke-width","0.3px").merge(value_guides).each(function(mult,i){const poly_points=[];domain_points.forEach((domain_point,row_idx)=>{poly_points.push([domain_point[0]*mult,domain_point[1]*mult])}),common.select(this).attr("points",poly_points.join(" ")).attr("stroke","rgb(0, 0, 0)").attr("stroke-opacity",.75).attr("stroke-width",.3).attr("fill-opacity",0)}),value_guides.exit().remove();const value_guide_text=element.selectAll(".value_guide_text").data(this.valueGuideRatios());value_guide_text.enter().append("text").attr("class","value_guide_text").attr("text-anchor","start").attr("font-size",this.fontSize()).attr("font-family",this.fontFamily()).merge(value_guide_text).attr("x",2).attr("y",mult=>domain_points[0][1]*mult).text((mult,i)=>Math.round(mult*max_val)),value_guides.exit().remove();const series_polygons=element.selectAll(".area").data(columns.filter((n,i)=>i>0));series_polygons.enter().append("polygon").attr("class","area").style("stroke-opacity","0.75").style("stroke-width","0.3px").merge(series_polygons).style("stroke",d=>this.strokeColor([],d,0)).style("fill",d=>this.fillColor([],d,0)).style("fill-opacity",this.fillOpacity()).attr("points",(d,col_idx)=>domain_points.map((domain_point,row_idx)=>{const val=data[row_idx][col_idx+1],val_mult=val===0?0:val/max_val;return domain_point[0]*val_mult+","+domain_point[1]*val_mult}).join(" ")),series_polygons.exit().remove();const point_elm=element.selectAll(".point").data(flatData);point_elm.enter().append("g").attr("class","point").on("mouseout.tooltip",context.tooltip.hide).on("mousemove.tooltip",context.tooltip.show).on("click",function(d,_idx){const data_row=context.data()[d.rowIdx],row_obj=context.rowToObj(data_row),selected=context._selection.selected(this);context.click(row_obj,context.columns()[d.colIdx],selected)}).on("dblclick",function(d,_idx){context.dblclick(context.rowToObj(context.data()[d.rowIdx]),d.column,context._selection.selected(this))}).each(function(d){const element2=common.select(this);element2.append("circle").attr("class","pointSelection").attr("r",context.pointSize()).call(context._selection.enter.bind(context._selection)),element2.append(context.mapShape(context.pointShape())).attr("class","pointShape")}).merge(point_elm).each(function(d){const element2=common.select(this),val_mult=d.value===0?0:d.value/max_val,x2=domain_points[d.rowIdx][0]*val_mult,y2=domain_points[d.rowIdx][1]*val_mult;element2.select(".pointSelection").attr("cx",x2).attr("cy",y2);const pointElement=element2.select(".pointShape").style("stroke",context.strokeColor(d.row,d.column,d.value)).style("fill",context.fillColor(d.row,d.column,d.value));context.setPointAttributes(pointElement,x2,y2)}),point_elm.exit().remove()}polar2cartesian(r,theta){return[r*Math.cos(theta),r*Math.sin(theta)]}cartesian2polar(x2,y2){return[Math.atan2(y2,x2),Math.sqrt(x2*x2+y2*y2)]}degrees2radians(d){return d/57.295779513}radians2degrees(r){return r*57.295779513}point_in_polygon(point2,vs){const x2=point2[0],y2=point2[1];let inside=!1;for(let i=0,j=vs.length-1;i<vs.length;j=i++){const xi=vs[i][0],yi=vs[i][1],xj=vs[j][0],yj=vs[j][1];yi>y2!=yj>y2&&x2<(xj-xi)*(y2-yi)/(yj-yi)+xi&&(inside=!inside)}return inside}}Radar.prototype._class+=" chart_Radar",Radar.prototype.implements(api.INDChart.prototype),Radar.prototype.implements(api.ITooltip.prototype),Radar.prototype.mixin(common.Utility.SimpleSelectionMixin),Radar.prototype.publish("paletteID","default","set","Color palette for this widget",Radar.prototype._palette.switch()),Radar.prototype.publish("pointShape","cross","set","pointShape",["circle","rectangle","cross"]),Radar.prototype.publish("pointSize",6,"number","Point Size",null,{range:{min:1,step:1,max:200}}),Radar.prototype.publish("valueGuideRatios",[.2,.4,.6,.8,1],"array","Array of values between 0 and 1 that are multiplied by the widget radius to produce guide lines"),Radar.prototype.publish("fillOpacity",.66,"number","Opacity of the data polygon(s)"),Radar.prototype.publish("fontFamily","","string","fontFamily"),Radar.prototype.publish("fontSize",16,"number","fontSize"),Radar.prototype.publish("labelPaddingRatio",.9,"number","labelPaddingRatio");class RadialBar extends common.SVGWidget{constructor(){super();__publicField(this,"_domainScale",common.scaleBand());__publicField(this,"_valueScale",common.scaleLinear());__publicField(this,"_d3Arc",d3Arc().startAngle(0).endAngle(d=>this._valueScale(d[1])));__publicField(this,"_arcs");__publicField(this,"_axialAxis");__publicField(this,"_radialAxis");api.INDChart.call(this),api.ITooltip.call(this),common.Utility.SimpleSelectionMixin.call(this)}enter(domNode,element){super.enter(domNode,element),this._selection.widgetElement(element),this.tooltipHTML(d=>this.tooltipFormat({label:d[0],value:d[1]})),this._radialAxis=element.append("g").attr("class","r axis"),this._axialAxis=element.append("g").attr("class","a axis"),this._arcs=element.append("g").attr("class","data")}update(domNode,element){super.update(domNode,element);const context=this,maxValue=Math.max(this.valueDomainHigh_exists()?this.valueDomainHigh():0,...this.data().map(d=>d[1]));this._valueScale.domain([0,maxValue]).range([0,this.radians(this.valueMaxAngle())]);const ticks=this._valueScale.ticks(this.tickCount()),maxTextWidth=this.textSize(ticks.map(d=>""+d),"Verdana",12).width,chartRadius=Math.min(this.width()-(10+maxTextWidth)*2,this.height()-22*2)/2,domainData=this.data().map(d=>d[0]);this._domainScale.domain(domainData).range([0,chartRadius]).padding(this.domainPadding());const domainPadding=this._domainScale.step()*this._domainScale.padding(),domainCircles=this._radialAxis.selectAll("circle").data(domainData);domainCircles.enter().append("circle").attr("fill","transparent").merge(domainCircles).attr("r",d=>this._domainScale(d)+this._domainScale.step()-domainPadding/2),domainCircles.exit().remove();const domainText=this._radialAxis.selectAll(".arc-text").data(domainData);domainText.enter().append("text").attr("class","arc-text").attr("x",-4).attr("alignment-baseline","middle").attr("text-anchor","end").merge(domainText).attr("y",d=>-this._domainScale(d)-this._domainScale.bandwidth()/2).text(d=>d),domainText.exit().remove();const valueLines=this._axialAxis.selectAll("line").data(ticks);valueLines.enter().append("line").merge(valueLines).attr("x2",d=>chartRadius*Math.cos(this._valueScale(d)-this.radians(90))).attr("y2",d=>chartRadius*Math.sin(this._valueScale(d)-this.radians(90))),valueLines.exit().remove();const valueText=this._axialAxis.selectAll("text").data(ticks);valueText.enter().append("text").style("dominant-baseline","central").merge(valueText).attr("x",d=>(chartRadius+10)*Math.cos(this._valueScale(d)-this.radians(90))).attr("y",d=>(chartRadius+10)*Math.sin(this._valueScale(d)-this.radians(90))).style("text-anchor",d=>{const angle=this.degrees(this._valueScale(d));return angle>=0&&angle<=20||angle>=160&&angle<=200||angle>=340&&angle<=360?"middle":angle>=180&&angle<=360?"end":null}).text(d=>d),valueText.exit().remove();const valueColumn=this.columns().length>1?this.columns()[1]:"";this._d3Arc.innerRadius(d=>this._domainScale(d[0])).outerRadius(d=>this._domainScale(d[0])+this._domainScale.bandwidth());const arcs=this._arcs.selectAll("path").data(this.data(),d=>d[0]);arcs.enter().append("path").attr("class","arc").call(this._selection.enter.bind(this._selection)).on("mouseout.tooltip",this.tooltip.hide).on("mousemove.tooltip",this.tooltip.show).on("click",function(d,_idx){context.click(context.rowToObj(d),valueColumn,context._selection.selected(this))}).on("dblclick",function(d,_idx){context.dblclick(context.rowToObj(d),valueColumn,context._selection.selected(this))}).merge(arcs).style("fill",(d,i)=>this.fillColor(d,d[0],d[1])).transition().delay((d,i)=>i*this.transitionDelay()).duration(this.transitionDuration()).attrTween("d",(d,indx)=>{const interpolate=common.interpolate(d._current||0,d[1]);return d._current=d[1],t=>this._d3Arc([d[0],interpolate(t)],indx)}),arcs.exit().remove()}degrees(radians){return radians*180/Math.PI}radians(degrees){return degrees*Math.PI/180}}__publicField(RadialBar,"__inputs",[{id:"label",type:"any"},{id:"values",type:"number"}]),RadialBar.prototype._class+=" chart_RadialBar",RadialBar.prototype.implements(api.INDChart.prototype),RadialBar.prototype.implements(api.ITooltip.prototype),RadialBar.prototype.mixin(common.Utility.SimpleSelectionMixin),RadialBar.prototype.publish("paletteID","default","set","Color palette for this widget",RadialBar.prototype._palette.switch()),RadialBar.prototype.publish("tickCount",10,"number","Number of ticks to display"),RadialBar.prototype.publish("domainPadding",.25,"number","Padding between chart edge and container edge (0..1)"),RadialBar.prototype.publish("valueMaxAngle",270,"number","Maximum angular length of a bar (degrees)"),RadialBar.prototype.publish("valueDomainHigh",null,"number","Value domain high",void 0,{optional:!0}),RadialBar.prototype.publish("transitionDelay",100,"number","Delay between the start of each row animation (ms)"),RadialBar.prototype.publish("transitionDuration",750,"number","Duration of a row's animation (ms)");const rainbow=common.Palette.rainbow("Blues"),palette=common.Palette.ordinal("Quartile",[rainbow(100,0,100),rainbow(50,0,100),rainbow(50,0,100),rainbow(75,0,100)]);palette("Std. Dev."),palette("MinMax"),palette("25%"),palette("50%");function myFormatter(format){const formatter=common.format(format);return function(num){const strVal=(Math.round(num*100)/100).toString();return strVal.length<=4?strVal:formatter(num)}}class StatChart extends common.HTMLWidget{constructor(){super();__publicField(this,"_selectElement");__publicField(this,"_tickFormatter");__publicField(this,"_bellCurve",new Scatter().columns(["","Std. Dev."]).paletteID("Quartile").interpolate_default("basis").pointSize(0).xAxisType("linear").xAxisOverlapMode("none").xAxisTickFormat(",").yAxisHidden(!0).yAxisDomainLow(0).yAxisDomainHigh(110).yAxisGuideLines(!1));__publicField(this,"_candle",new QuartileCandlestick().columns(["Min","25%","50%","75%","Max"]).edgePadding(0).roundedCorners(1).lineWidth(1).upperTextRotation(-90).lowerTextRotation(-90).labelFontSize(0).valueFontSize(0).lineColor(rainbow(90,0,100)).innerRectColor(rainbow(10,0,100)));this.columns(["Min","25%","50%","75%","Max","Mean","Std. Dev."])}stdDev(degrees){return this.mean()+degrees*this.standardDeviation()}formatStdDev(degrees){return this._tickFormatter(this.stdDev(degrees))}quartile(q){return this.quartiles()[q]}formatQ(q){return this._tickFormatter(this.quartile(q))}domain(mode){switch(mode){case"25_75":return[this.quartile(1),this.quartile(3)];case"normal":return[this.stdDev(-4),this.stdDev(4)];case"min_max":default:return[this.quartile(0),this.quartile(4)]}}min(){return this.quartile(0)}max(){return this.quartile(4)}data(_){if(!arguments.length)return[[...this.quartiles(),this.mean(),this.standardDeviation()]];const row=_[0];return this.quartiles([row[0],row[1],row[2],row[3],row[4]]),this.mean(row[5]),this.standardDeviation(row[6]),this}enter(domNode,element){super.enter(domNode,element),this._bellCurve.target(element.append("div").node()),this._candle.target(element.append("div").node()),this._selectElement=element.append("div").style("position","absolute").style("top","0px").style("right","0px").append("select").on("change",()=>{this.view(this._selectElement.node().value),this.lazyRender()}),this._selectElement.append("option").attr("value","min_max").text("Min / Max"),this._selectElement.append("option").attr("value","25_75").text("25% / 75%"),this._selectElement.append("option").attr("value","normal").text("Normal")}bellTicks(mode){let ticks;switch(mode){case"25_75":ticks=[{label:this.formatQ(1),value:this.quartile(1)},{label:this.formatQ(2),value:this.quartile(2)},{label:this.formatQ(3),value:this.quartile(3)}];break;case"normal":ticks=[{label:this.formatStdDev(-4),value:this.stdDev(-4)},{label:"-3σ",value:this.stdDev(-3)},{label:"-2σ",value:this.stdDev(-2)},{label:"-1σ",value:this.stdDev(-1)},{label:this.formatStdDev(0),value:this.stdDev(0)},{label:"+1σ",value:this.stdDev(1)},{label:"+2σ",value:this.stdDev(2)},{label:"+3σ",value:this.stdDev(3)},{label:this.formatStdDev(4),value:this.stdDev(4)}];break;case"min_max":default:ticks=[{label:this.formatQ(0),value:this.quartile(0)},{label:this.formatQ(1),value:this.quartile(1)},{label:this.formatQ(2),value:this.quartile(2)},{label:this.formatQ(3),value:this.quartile(3)},{label:this.formatQ(4),value:this.quartile(4)}]}const[domainLow,domainHigh]=this.domain(this._selectElement.node().value);return ticks.filter(sd=>sd.value>=domainLow&&sd.value<=domainHigh).map(sd=>({label:sd.label,value:sd.value.toString()}))}updateScatter(){const mode=this._selectElement.node().value,[domainLow,domainHigh]=this.domain(mode),padding=(domainHigh-domainLow)*(this.domainPadding()/100);this._bellCurve.xAxisDomainLow(domainLow-padding).xAxisDomainHigh(domainHigh+padding).xAxisTicks(this.bellTicks(mode)).data([[this.stdDev(-4),0],[this.stdDev(-3),.3],[this.stdDev(-2),5],[this.stdDev(-1),68],[this.stdDev(0),100],[this.stdDev(1),68],[this.stdDev(2),5],[this.stdDev(3),.3],[this.stdDev(4),0]]).resize({width:this.width(),height:this.height()-this.candleHeight()}).render()}updateCandle(){const candleX=this._bellCurve.dataPos(this.quartile(0)),candleW=this._bellCurve.dataPos(this.quartile(4))-candleX;this._candle.resize({width:this.width(),height:this.candleHeight()}).pos({x:candleX+candleW/2+2,y:this.candleHeight()/2}).width(candleW).candleWidth(this.candleHeight()).data(this.quartiles()).render()}update(domNode,element){super.update(domNode,element),this._tickFormatter=myFormatter(this.tickFormat()),this._selectElement.node().value=this.view(),this.updateScatter(),this.updateCandle()}exit(domNode,element){this._bellCurve.target(null),this._candle.target(null),this._selectElement.remove(),super.exit(domNode,element)}}StatChart.prototype._class+=" chart_StatChart",StatChart.prototype.publish("view","min_max","set","View",["min_max","25_75","normal"]),StatChart.prototype.publish("tickFormat",".2e","string","X-Axis Tick Format"),StatChart.prototype.publish("candleHeight",20,"number","Height of candle widget (pixels)"),StatChart.prototype.publish("domainPadding",10,"number","Domain value padding"),StatChart.prototype.publish("mean",.5,"number","Mean"),StatChart.prototype.publish("standardDeviation",.125,"number","Standard Deviation (σ)"),StatChart.prototype.publish("quartiles",[0,.25,.5,.75,1],"object","Quartiles (Min, 25%, 50%, 75%, Max)");class Step extends Scatter{constructor(){super(),this.interpolate_default("step")}}Step.prototype._class+=" chart_Step";const TEXT="text",HTML="html";class Summary extends common.HTMLWidget{constructor(){super();__publicField(this,"_playIntervalIdx",0);__publicField(this,"_mainDiv");__publicField(this,"_headerDiv");__publicField(this,"_textDiv");this._tag="div",this._drawStartPos="center",this.playInterval(this.playInterval())}lookupFieldIdx(propID,defaultIdx){let retVal=defaultIdx;if(!(this[propID+"_exists"]()&&(retVal=this.columns().indexOf(this[propID]()),retVal<0)))return retVal}lookupFieldText(propID,defaultIdx){return this[propID+"_exists"]()?this[propID]():defaultIdx!==void 0&&this.columns()[defaultIdx]||""}currentRow(){return this.data()[this._playIntervalIdx]}summaryData(){let labelFieldIdx;this.hideLabel()||(labelFieldIdx=this.lookupFieldIdx("labelColumn",0));const iconFieldIdx=this.lookupFieldIdx("iconColumn"),valueFieldIdx=this.lookupFieldIdx("valueColumn",1);let moreIconIdx,moreTextIdx;this.hideMore()||(moreIconIdx=this.lookupFieldIdx("moreIconColumn"),moreTextIdx=this.lookupFieldIdx("moreTextColumn"));const colorFillIdx=this.lookupFieldIdx("colorFillColumn"),colorStrokeIdx=this.lookupFieldIdx("colorStrokeColumn");return this.formattedData().map(function(row){return{icon:iconFieldIdx===void 0?this.icon():row[iconFieldIdx],label:labelFieldIdx===void 0?"":row[labelFieldIdx],value:row[valueFieldIdx],moreIcon:moreIconIdx===void 0?this.hideMore()?"":this.moreIcon():row[moreIconIdx],moreText:moreTextIdx===void 0?this.hideMore()?"":this.moreText():row[moreTextIdx],fill:colorFillIdx===void 0?this.colorFill():row[colorFillIdx],stroke:colorStrokeIdx===void 0?this.colorStroke():row[colorStrokeIdx]}},this)}enter(domNode,element){super.enter(domNode,element),this._mainDiv=element.append("div");const context=this;this._headerDiv=this._mainDiv.append("h2").on("click",function(){context.click(context.rowToObj(context.currentRow()),context.lookupFieldText("valueColumn",1),!0)}).on("dblclick",function(){context.dblclick(context.rowToObj(context.currentRow()),context.lookupFieldText("valueColumn",1),!0)}),this._textDiv=this._mainDiv.append("div").attr("class","text").on("click",function(){context.click(context.rowToObj(context.currentRow()),context.lookupFieldText("labelColumn",0),!0)}).on("dblclick",function(){context.dblclick(context.rowToObj(context.currentRow()),context.lookupFieldText("labelColumn",0),!0)})}update(domNode,element){super.update(domNode,element),this.data().length;const data=this.summaryData();this._playIntervalIdx>=data.length&&(this._playIntervalIdx=0);const row=this._playIntervalIdx<data.length?data[this._playIntervalIdx]:["",""];element.style("width",this.fixedSize()?this.minWidth_exists()?this.minWidth()+"px":null:"100%").style("height",this.fixedSize()?this.minHeight_exists()?this.minHeight()+"px":null:"100%"),this._mainDiv.attr("class","content bgIcon "+row.icon).transition().style("background-color",row.fill).style("color",row.stroke).style("min-width",this.minWidth_exists()?this.minWidth()+"px":null).style("min-height",this.minHeight_exists()?this.minHeight()+"px":null).style("font-size",this.iconFontSize()+"px"),this._headerDiv.transition().style("color",row.stroke).style("font-size",this.headerFontSize()+"px")[this.valueHTML()?HTML:TEXT](row.value),this._textDiv.style("font-size",this.textFontSize()+"px")[this.labelHTML()?HTML:TEXT](row.label);const context=this,moreDivs=this._mainDiv.selectAll(".more").data([row]),moreDivsUpdate=moreDivs.enter().append("div").attr("class","more").on("click",function(d){context.click(context.rowToObj(context.currentRow()),context.lookupFieldText("moreTextColumn")||"more",!0)}).each(function(){const element2=common.select(this);element2.append("i"),element2.append("span")}).merge(moreDivs).style("display",this.hideMoreWrapper()?"none":null).style("font-size",this.moreFontSize()+"px").style("height",this.moreWrapperHeight_exists()?this.moreWrapperHeight()+"px":null).transition().style("background-color",common.rgb(row.fill).darker(.75).toString());moreDivsUpdate.select("i").attr("class",function(d){return"fa "+d.moreIcon}),this.moreTextHTML()?moreDivsUpdate.select("span").each(function(d){this.innerHTML=d.moreText}):moreDivsUpdate.select("span").text(d=>d.moreText),moreDivs.exit().remove()}exit(domNode,element){super.exit(domNode,element)}}Summary.prototype._class+=" chart_Summary",Summary.prototype.implements(api.I2DChart.prototype),Summary.prototype.publish("iconColumn",null,"set","Select Icon Column",function(){return this.columns()},{optional:!0}),Summary.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:w=>w.iconColumn()}),Summary.prototype.publish("headerFontSize",null,"number","headerFontSize"),Summary.prototype.publish("textFontSize",null,"number","textFontSize"),Summary.prototype.publish("moreFontSize",null,"number","moreFontSize"),Summary.prototype.publish("iconFontSize",null,"number","iconFontSize"),Summary.prototype.publish("hideLabel",!1,"boolean","Hide label column"),Summary.prototype.publish("labelColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0,disable:w=>w.hideLabel()}),Summary.prototype.publish("labelHTML",!1,"boolean","Allow HTML",null,{disable:w=>w.hideLabel()}),Summary.prototype.publish("valueColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),Summary.prototype.publish("valueHTML",!1,"boolean","Allow HTML"),Summary.prototype.publish("hideMore",!1,"boolean","Hide More Information"),Summary.prototype.publish("hideMoreWrapper",!1,"boolean","Hide More Information Wrapper"),Summary.prototype.publish("moreWrapperHeight",null,"number","Height of the 'more' text wrapper (pixels)"),Summary.prototype.publish("moreIconColumn",null,"set","Select More Icon Column",function(){return this.columns()},{optional:!0,disable:w=>w.hideMore()}),Summary.prototype.publish("moreIcon","fa-info-circle","string","FA Char icon class",null,{disable:w=>w.hideMore()||w.moreIconColumn()}),Summary.prototype.publish("moreTextColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0,disable:w=>w.hideMore()}),Summary.prototype.publish("moreText","More Info","string","More text",null,{disable:w=>w.hideMore()||w.moreTextColumn()}),Summary.prototype.publish("moreTextHTML",!1,"boolean","Allow HTML",null,{disable:w=>w.hideMore()}),Summary.prototype.publish("colorFillColumn",null,"set","Column for color",function(){return this.columns()},{optional:!0}),Summary.prototype.publish("colorFill","#3498db","html-color","Fill Color",null,{disable:w=>w.colorFillColumn()}),Summary.prototype.publish("colorStrokeColumn",null,"set","Column for color",function(){return this.columns()},{optional:!0}),Summary.prototype.publish("colorStroke","#ffffff","html-color","Fill Color",null,{disable:w=>w.colorStrokeColumn()}),Summary.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),Summary.prototype.publish("minWidth",225,"number","Minimum Width"),Summary.prototype.publish("minHeight",150,"number","Minimum Height"),Summary.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0});const playInterval$1=Summary.prototype.playInterval;Summary.prototype.playInterval=function(_){const retVal=playInterval$1.apply(this,arguments);if(arguments.length){this._playIntervalHandle&&clearInterval(this._playIntervalHandle);const context=this;_&&(this._playIntervalHandle=setInterval(function(){context._playIntervalIdx++,context._renderCount&&context.data().length&&context.render()},_))}return retVal};class SummaryC extends common.CanvasWidget{constructor(){super();__publicField(this,"_playIntervalIdx",0);api.I2DChart.call(this),this.playInterval(this.playInterval())}currentRow(){return this.data()[this._playIntervalIdx]}enter(domNode,element){super.enter.apply(this,arguments);const{width,height}=this.size();domNode.height=height,domNode.width=width}update(domNode,element){super.update.apply(this,arguments);const context=this;this._playIntervalIdx>=this.data().length&&(this._playIntervalIdx=0);const size=this.size(),minDimension=Math.min(size.width,size.height),sizeRatio=this.fontSizeRatio(),labelIdx=this.columns().indexOf(this.labelColumn()),valueIdx=this.columns().indexOf(this.valueColumn()),bgColorIdx=this.columns().indexOf(this.colorFillColumn()),fontColorIdx=this.columns().indexOf(this.colorStrokeColumn()),iconIdx=this.columns().indexOf(this.iconColumn()),icon=iconIdx!==-1?this.currentRow()[iconIdx]:this.icon(),label=labelIdx!==-1?this.currentRow()[labelIdx]:"",value=valueIdx!==-1?this.currentRow()[valueIdx]:"",bgColor=bgColorIdx!==-1?this.currentRow()[bgColorIdx]:this.colorFill(),fontColor=fontColorIdx!==-1?this.currentRow()[fontColorIdx]:this.colorStroke();let mainFontSize=size.height*(sizeRatio-this.paddingSizeRatio());const subFontSize=size.height*(1-sizeRatio-this.paddingSizeRatio()),iconSize=size.height*(this.iconSizeRatio()-this.paddingSizeRatio()),p=minDimension*this.paddingSizeRatio(),ctx=domNode.getContext("2d");ctx.clearRect(0,0,size.width,size.height);const fontFamily=context.fontFamily();ctx.fillStyle=bgColor,ctx.fillRect(0,0,size.width,size.height),ctx.globalAlpha=this.iconOpacity(),drawIcon(common.Utility.faChar(icon),iconSize,context.iconAnchor()),ctx.globalAlpha=this.valueOpacity(),mainFontSize=drawText(value,p,mainFontSize,context.valueAnchor()),ctx.globalAlpha=this.labelOpacity(),drawText(label,mainFontSize+p,subFontSize,context.labelAnchor());function drawText(text,y2,fontSize,anchorMode){ctx.textBaseline="top",ctx.font=`${fontSize}px ${fontFamily}`,ctx.fillStyle=fontColor;let measurement=ctx.measureText(text);if(measurement.width>size.width-p*2){const fontSizeMult=(size.width-p*2)/measurement.width;fontSize=fontSize*fontSizeMult,ctx.font=`${fontSize}px ${fontFamily}`,measurement=ctx.measureText(text)}const x2=getTextOffsetX(measurement.width,anchorMode);return ctx.fillText(text,x2,y2),fontSize}function drawIcon(text,fontSize,anchorMode){if(typeof text>"u")return;ctx.textBaseline=context.iconBaseline(),ctx.font=`${fontSize}px FontAwesome`,ctx.fillStyle=fontColor;let measurement=ctx.measureText(text);if(measurement.width>size.width-p*2){const fontSizeMult=(size.width-p*2)/measurement.width;ctx.font=`${fontSize*fontSizeMult}px FontAwesome`,measurement=ctx.measureText(text)}const x2=getTextOffsetX(measurement.width,anchorMode),y2=getTextOffsetY(context.iconBaseline());ctx.fillText(text,x2,y2)}function getTextOffsetX(width,anchorMode){switch(anchorMode){case"start":return p;case"middle":return size.width/2-width/2;case"end":return size.width-width-p}}function getTextOffsetY(anchorMode){switch(anchorMode){case"top":return p;case"middle":return size.height/2;case"bottom":return size.height-p}}}}SummaryC.prototype._class+=" chart_SummaryC",SummaryC.prototype.implements(api.I2DChart.prototype),SummaryC.prototype.publish("iconBaseline","bottom","string","Text baseline for the icon",["top","middle","bottom"]),SummaryC.prototype.publish("iconAnchor","end","set","Anchors the icon either at the start, middle, or end of the summary",["start","middle","end"]),SummaryC.prototype.publish("valueAnchor","start","set","Anchors the value either at the start, middle, or end of the summary",["start","middle","end"]),SummaryC.prototype.publish("labelAnchor","start","set","Anchors the label either at the start, middle, or end of the summary",["start","middle","end"]),SummaryC.prototype.publish("iconColumn",null,"set","Select Icon Column",function(){return this.columns()},{optional:!0}),SummaryC.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:w=>w.iconColumn()}),SummaryC.prototype.publish("fontFamily","Arial","string","Font Family"),SummaryC.prototype.publish("labelColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),SummaryC.prototype.publish("valueColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),SummaryC.prototype.publish("colorFillColumn",null,"set","Column for background color",function(){return this.columns()},{optional:!0}),SummaryC.prototype.publish("colorFill","#0097e6","html-color","Background Color",null,{disable:w=>w.colorFillColumn()}),SummaryC.prototype.publish("colorStrokeColumn",null,"set","Column for font color",function(){return this.columns()},{optional:!0}),SummaryC.prototype.publish("colorStroke","#2f3640","html-color","Font Color",null,{disable:w=>w.colorStrokeColumn()}),SummaryC.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),SummaryC.prototype.publish("minWidth",225,"number","Minimum Width"),SummaryC.prototype.publish("minHeight",150,"number","Minimum Height"),SummaryC.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0}),SummaryC.prototype.publish("fontSizeRatio",.618,"number","Ratio between widget height and value font size"),SummaryC.prototype.publish("valueOpacity",1,"number","Opacity of value text (0..1)"),SummaryC.prototype.publish("labelOpacity",.9,"number","Opacity of label text (0..1)"),SummaryC.prototype.publish("iconOpacity",.3,"number","Opacity of icon text (0..1)"),SummaryC.prototype.publish("paddingSizeRatio",.1,"number","Ratio of the smallest dimension for edge padding (0..1)"),SummaryC.prototype.publish("iconSizeRatio",.9,"number","Ratio of the height for icon size (0..1)");const playInterval=SummaryC.prototype.playInterval;SummaryC.prototype.playInterval=function(_){const retVal=playInterval.apply(this,arguments);if(arguments.length){this._playIntervalHandle&&clearInterval(this._playIntervalHandle);const context=this;_&&(this._playIntervalHandle=setInterval(function(){context._playIntervalIdx++,context._renderCount&&context.data().length&&context.render()},_))}return retVal};const cloudRadians=Math.PI/180,cw=64,ch=2048;function d3Cloud(){const event=common.dispatch("word","end"),cloud={};let size=[256,256],text=cloudText,font=cloudFont,fontSize=cloudFontSize,fontStyle=cloudFontNormal,fontWeight=cloudFontNormal,rotate=cloudRotate,padding=cloudPadding,words=[],spiral=archimedeanSpiral,timeInterval=1/0,timer=null,random=Math.random,canvas=cloudCanvas;cloud.canvas=function(_){return arguments.length?(canvas=functor(_),cloud):canvas},cloud.start=function(){const contextAndRatio=getContext(canvas()),board=zeroArray((size[0]>>5)*size[1]);let bounds=null;const n=words.length;let i=-1;const tags=[],data=words.map(function(d,i2){return d.text=text.call(this,d,i2),d.font=font.call(this,d,i2),d.style=fontStyle.call(this,d,i2),d.weight=fontWeight.call(this,d,i2),d.rotate=rotate.call(this,d,i2),d.size=~~fontSize.call(this,d,i2),d.padding=padding.call(this,d,i2),d}).sort(function(a,b){return b.size-a.size});return timer&&clearInterval(timer),timer=setInterval(step,0),step(),cloud;function step(){const start=Date.now();for(;Date.now()-start<timeInterval&&++i<n&&timer;){const d=data[i];d.x=size[0]*(random()+.5)>>1,d.y=size[1]*(random()+.5)>>1,cloudSprite(contextAndRatio,d,data,i),d.hasText&&place2(board,d,bounds)&&(tags.push(d),event.call("word",cloud,d),bounds?cloudBounds(bounds,d):bounds=[{x:d.x+d.x0,y:d.y+d.y0},{x:d.x+d.x1,y:d.y+d.y1}],d.x-=size[0]>>1,d.y-=size[1]>>1)}i>=n&&(cloud.stop(),event.call("end",cloud,tags,bounds))}},cloud.stop=function(){return timer&&(clearInterval(timer),timer=null),cloud};function getContext(canvas2){canvas2.width=canvas2.height=1;const ratio=Math.sqrt(canvas2.getContext("2d").getImageData(0,0,1,1).data.length>>2);canvas2.width=(cw<<5)/ratio,canvas2.height=ch/ratio;const context=canvas2.getContext("2d");return context.fillStyle=context.strokeStyle="red",context.textAlign="center",{context,ratio}}function place2(board,tag,bounds){const startX=tag.x,startY=tag.y,maxDelta=Math.sqrt(size[0]*size[0]+size[1]*size[1]),s=spiral(size),dt=random()<.5?1:-1;let t=-dt,dxdy,dx,dy;for(;(dxdy=s(t+=dt))&&(dx=~~dxdy[0],dy=~~dxdy[1],!(Math.min(Math.abs(dx),Math.abs(dy))>=maxDelta));)if(tag.x=startX+dx,tag.y=startY+dy,!(tag.x+tag.x0<0||tag.y+tag.y0<0||tag.x+tag.x1>size[0]||tag.y+tag.y1>size[1])&&(!bounds||!cloudCollide(tag,board,size[0]))&&(!bounds||collideRects(tag,bounds))){const sprite=tag.sprite,w=tag.width>>5,sw=size[0]>>5,lx=tag.x-(w<<4),sx=lx&127,msx=32-sx,h=tag.y1-tag.y0;let x2=(tag.y+tag.y0)*sw+(lx>>5),last;for(let j=0;j<h;j++){last=0;for(let i=0;i<=w;i++)board[x2+i]|=last<<msx|(i<w?(last=sprite[j*w+i])>>>sx:0);x2+=sw}return delete tag.sprite,!0}return!1}return cloud.timeInterval=function(_){return arguments.length?(timeInterval=_??1/0,cloud):timeInterval},cloud.words=function(_){return arguments.length?(words=_,cloud):words},cloud.size=function(_){return arguments.length?(size=[+_[0],+_[1]],cloud):size},cloud.font=function(_){return arguments.length?(font=functor(_),cloud):font},cloud.fontStyle=function(_){return arguments.length?(fontStyle=functor(_),cloud):fontStyle},cloud.fontWeight=function(_){return arguments.length?(fontWeight=functor(_),cloud):fontWeight},cloud.rotate=function(_){return arguments.length?(rotate=functor(_),cloud):rotate},cloud.text=function(_){return arguments.length?(text=functor(_),cloud):text},cloud.spiral=function(_){return arguments.length?(spiral=spirals[_]||_,cloud):spiral},cloud.fontSize=function(_){return arguments.length?(fontSize=functor(_),cloud):fontSize},cloud.padding=function(_){return arguments.length?(padding=functor(_),cloud):padding},cloud.random=function(_){return arguments.length?(random=_,cloud):random},cloud.on=function(){const value=event.on.apply(event,arguments);return value===event?cloud:value},cloud}function cloudText(d){return d.text}function cloudFont(){return"serif"}function cloudFontNormal(){return"normal"}function cloudFontSize(d){return Math.sqrt(d.value)}function cloudRotate(){return(~~(Math.random()*6)-3)*30}function cloudPadding(){return 1}function cloudSprite(contextAndRatio,d,data,di){if(d.sprite)return;const c=contextAndRatio.context,ratio=contextAndRatio.ratio;c.clearRect(0,0,(cw<<5)/ratio,ch/ratio);let x2=0,y2=0,maxh=0;const n=data.length;for(--di;++di<n;){d=data[di],c.save(),c.font=d.style+" "+d.weight+" "+~~((d.size+1)/ratio)+"px "+d.font;let w=c.measureText(d.text+"m").width*ratio,h=d.size<<1;if(d.rotate){const sr=Math.sin(d.rotate*cloudRadians),cr=Math.cos(d.rotate*cloudRadians),wcr=w*cr,wsr=w*sr,hcr=h*cr,hsr=h*sr;w=Math.max(Math.abs(wcr+hsr),Math.abs(wcr-hsr))+31>>5<<5,h=~~Math.max(Math.abs(wsr+hcr),Math.abs(wsr-hcr))}else w=w+31>>5<<5;if(h>maxh&&(maxh=h),x2+w>=cw<<5&&(x2=0,y2+=maxh,maxh=0),y2+h>=ch)break;c.translate((x2+(w>>1))/ratio,(y2+(h>>1))/ratio),d.rotate&&c.rotate(d.rotate*cloudRadians),c.fillText(d.text,0,0),d.padding&&(c.lineWidth=2*d.padding,c.strokeText(d.text,0,0)),c.restore(),d.width=w,d.height=h,d.xoff=x2,d.yoff=y2,d.x1=w>>1,d.y1=h>>1,d.x0=-d.x1,d.y0=-d.y1,d.hasText=!0,x2+=w}const pixels=c.getImageData(0,0,(cw<<5)/ratio,ch/ratio).data,sprite=[];for(;--di>=0;){if(d=data[di],!d.hasText)continue;const w=d.width,w32=w>>5;let h=d.y1-d.y0;for(let i=0;i<h*w32;i++)sprite[i]=0;if(x2=d.xoff,x2==null)return;y2=d.yoff;let seen=0,seenRow=-1;for(let j=0;j<h;j++){for(let i=0;i<w;i++){const k=w32*j+(i>>5),m=pixels[(y2+j)*(cw<<5)+(x2+i)<<2]?1<<31-i%32:0;sprite[k]|=m,seen|=m}seen?seenRow=j:(d.y0++,h--,j--,y2++)}d.y1=d.y0+seenRow,d.sprite=sprite.slice(0,(d.y1-d.y0)*w32)}}function cloudCollide(tag,board,sw){sw>>=5;const sprite=tag.sprite,w=tag.width>>5,lx=tag.x-(w<<4),sx=lx&127,msx=32-sx,h=tag.y1-tag.y0;let x2=(tag.y+tag.y0)*sw+(lx>>5),last;for(let j=0;j<h;j++){last=0;for(let i=0;i<=w;i++)if((last<<msx|(i<w?(last=sprite[j*w+i])>>>sx:0))&board[x2+i])return!0;x2+=sw}return!1}function cloudBounds(bounds,d){const b0=bounds[0],b1=bounds[1];d.x+d.x0<b0.x&&(b0.x=d.x+d.x0),d.y+d.y0<b0.y&&(b0.y=d.y+d.y0),d.x+d.x1>b1.x&&(b1.x=d.x+d.x1),d.y+d.y1>b1.y&&(b1.y=d.y+d.y1)}function collideRects(a,b){return a.x+a.x1>b[0].x&&a.x+a.x0<b[1].x&&a.y+a.y1>b[0].y&&a.y+a.y0<b[1].y}function archimedeanSpiral(size){const e=size[0]/size[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function rectangularSpiral(size){const dx=4*size[0]/size[1];let x2=0,y2=0;return function(t){const sign2=t<0?-1:1;switch(Math.sqrt(1+4*sign2*t)-sign2&3){case 0:x2+=dx;break;case 1:y2+=4;break;case 2:x2-=dx;break;default:y2-=4;break}return[x2,y2]}}function zeroArray(n){const a=[];let i=-1;for(;++i<n;)a[i]=0;return a}function cloudCanvas(){return document.createElement("canvas")}function functor(d){return typeof d=="function"?d:function(){return d}}const spirals={archimedean:archimedeanSpiral,rectangular:rectangularSpiral};class WordCloud extends common.SVGWidget{constructor(){super();__publicField(this,"_prevOffsetX");__publicField(this,"_prevOffsetY");__publicField(this,"_prevZoom");__publicField(this,"_root");__publicField(this,"_canvas");__publicField(this,"_d3Cloud");__publicField(this,"_d3Zoom");api.I2DChart.call(this),api.ITooltip.call(this),common.Utility.SimpleSelectionMixin.call(this),this._prevOffsetX=this.offsetX(),this._prevOffsetY=this.offsetY(),this._prevZoom=this.zoom()}calcData(){return this.data().map(row=>({__viz_label:row[0],__viz_weight:row[1],__viz_row:row}))}enter(domNode,element){super.enter(domNode,element),this._selection.widgetElement(element),this._root=element.append("g"),this._canvas=document.createElement("canvas");const context=this;this._d3Zoom=common.zoom().scaleExtent([.1,10]),this._d3Zoom.on("zoom",function(evt){const event=common.d3Event();event&&event.transform&&context.zoomed(context._d3Zoom,[event.transform.x,event.transform.y],event.transform.k)}),element.call(this._d3Zoom),this.tooltipHTML(function(d){const columns=context.columns(),series=columns&&columns.length?columns[0]:"Word";return context.tooltipFormat({label:d.__viz_label,series,value:d.__viz_weight})})}update(domNode,element){super.update(domNode,element),this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._d3Cloud=d3Cloud().canvas(()=>this._canvas),this.zoomed(this,[this.offsetX(),this.offsetY()],this.zoom());const data=this.calcData(),context=this,extent=common.extent(data,function(d){return d.__viz_weight});let scaler;switch(this.scaleMode()){case"log":scaler=common.scaleLog;break;case"sqrt":scaler=common.scaleSqrt;break;case"pow":scaler=common.scalePow;break;case"linear":default:scaler=common.scaleLinear;break}const scale=scaler().domain(extent).range([this.fontSizeFrom(),this.fontSizeTo()]),angleDomain=common.scaleLinear().domain([0,context.angleCount()-1]).range([context.angleFrom(),context.angleTo()]);this._d3Cloud.stop().size([this.width(),this.height()]).words(data).font(this.fontFamily()).padding(this.padding()).spiral(this.spiral()).text(function(d){return d.__viz_label.trim()}).fontSize(function(d){return scale(d.__viz_weight)}).rotate((d,i)=>angleDomain(i%context.angleCount())).on("word",w=>{}).on("end",draw).start();function draw(data2,bounds){const text=context._root.selectAll("text").data(data2,function(d){return d.__viz_label?d.__viz_label.toLowerCase():""});text.enter().append("text").attr("text-anchor","middle").call(context._selection.enter.bind(context._selection)).text(function(d){return d.__viz_label}).on("click",function(d){context.click(context.rowToObj(d.__viz_row),context.columns()[1],context._selection.selected(this))}).on("dblclick",function(d){context.dblclick(context.rowToObj(d.__viz_row),context.columns()[1],context._selection.selected(this))}).on("mouseout.tooltip",context.tooltip.hide).on("mousemove.tooltip",context.tooltip.show).style("opacity",1e-6).merge(text).style("font-size",function(d){return scale(d.__viz_weight)+"px"}).style("font-family",context.fontFamily()).transition().duration(1e3).attr("transform",function(d){return"translate("+[d.x,d.y]+")rotate("+d.rotate+")"}).style("fill",function(d){return context._palette(d.__viz_label?d.__viz_label.toLowerCase():"")}).style("opacity",1),text.exit().transition().duration(1e3).style("opacity",1e-4).remove()}}zoomed(source,translate,scale){if(translate[0]!==this._prevOffsetX||translate[1]!==this._prevOffsetY||scale!==this._prevZoom){switch(this._root.attr("transform",translate),source){case this:break;case this._d3Zoom:this.offsetX(translate[0]),this.offsetY(translate[1]),this.zoom(scale);break}this._prevOffsetX=translate[0],this._prevOffsetY=translate[1],this._prevZoom=scale}}}__publicField(WordCloud,"__inputs",[{id:"label",type:"string"},{id:"value",type:"number"}]),WordCloud.prototype._class+=" chart_WordCloud",WordCloud.prototype.implements(api.I2DChart.prototype),WordCloud.prototype.implements(api.ITooltip.prototype),WordCloud.prototype.mixin(common.Utility.SimpleSelectionMixin),WordCloud.prototype.publish("paletteID","default","set","Color palette for this widget",WordCloud.prototype._palette.switch(),{tags:["Basic","Shared"]}),WordCloud.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),WordCloud.prototype.publish("fontFamily","Impact","string","Font Name",null,{tags:["Basic"]}),WordCloud.prototype.publish("fontSizeFrom",6,"number","Minimum font size (pixels)",null,{tags:["Basic"]}),WordCloud.prototype.publish("fontSizeTo",48,"number","Maximum font size (pixels)",null,{tags:["Basic"]}),WordCloud.prototype.publish("angleFrom",-60,"number","Minimum angle (degrees)",null,{tags:["Basic"]}),WordCloud.prototype.publish("angleTo",60,"number","Maximum angle (degrees)",null,{tags:["Basic"]}),WordCloud.prototype.publish("angleCount",5,"number","Number of different angles",null,{tags:["Basic"]}),WordCloud.prototype.publish("padding",0,"number","Padding between words (pixels)",null,{tags:["Intermediate"]}),WordCloud.prototype.publish("scaleMode","linear","set","Text scaling mode",["linear","log","sqrt","pow"],{tags:["Intermediate"]}),WordCloud.prototype.publish("spiral","archimedean","set","Text scaling mode",["archimedean","rectangular"],{tags:["Intermediate"]}),WordCloud.prototype.publish("offsetX",0,"number","X offset",null,{tags:["Advanced"]}),WordCloud.prototype.publish("offsetY",0,"number","Y offset",null,{tags:["Advanced"]}),WordCloud.prototype.publish("zoom",1,"number","Zoom",null,{tags:["Advanced"]}),exports2.Area=Area,exports2.Axis=Axis,exports2.BUILD_VERSION=BUILD_VERSION,exports2.Bar=Bar,exports2.Bubble=Bubble,exports2.BubbleXY=BubbleXY,exports2.Bullet=Bullet,exports2.Column=Column,exports2.Contour=Contour,exports2.Gantt=Gantt,exports2.Gauge=Gauge,exports2.HalfPie=HalfPie,exports2.Heat=Heat,exports2.HexBin=HexBin,exports2.Line=Line,exports2.PKG_NAME=PKG_NAME,exports2.PKG_VERSION=PKG_VERSION,exports2.Pie=Pie,exports2.QuarterPie=QuarterPie,exports2.QuartileCandlestick=QuartileCandlestick,exports2.Radar=Radar,exports2.RadialBar=RadialBar,exports2.Scatter=Scatter,exports2.StatChart=StatChart,exports2.Step=Step,exports2.Summary=Summary,exports2.SummaryC=SummaryC,exports2.WordCloud=WordCloud,exports2.XYAxis=XYAxis,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/api"),require("@hpcc-js/common"),require("@hpcc-js/util")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/api","@hpcc-js/common","@hpcc-js/util"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@hpcc-js/chart"]={},t["@hpcc-js/api"],t["@hpcc-js/common"],t["@hpcc-js/util"])}(this,function(t,e,i,n){"use strict";var s=Object.defineProperty,o=(t,e)=>s(t,"name",{value:e,configurable:!0}),a=(t,e,i)=>((t,e,i)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);var r=Math.PI,l=2*r,h=1e-6,c=l-h;function u(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function p(){return new u}function d(t){return o(function(){return t},"constant")}o(u,"Path"),o(p,"path"),u.prototype=p.prototype={constructor:u,moveTo:o(function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},"moveTo"),closePath:o(function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},"closePath"),lineTo:o(function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},"lineTo"),quadraticCurveTo:o(function(t,e,i,n){this._+="Q"+ +t+","+ +e+","+(this._x1=+i)+","+(this._y1=+n)},"quadraticCurveTo"),bezierCurveTo:o(function(t,e,i,n,s,o){this._+="C"+ +t+","+ +e+","+ +i+","+ +n+","+(this._x1=+s)+","+(this._y1=+o)},"bezierCurveTo"),arcTo:o(function(t,e,i,n,s){t=+t,e=+e,i=+i,n=+n,s=+s;var o=this._x1,a=this._y1,l=i-t,c=n-e,u=o-t,p=a-e,d=u*u+p*p;if(s<0)throw new Error("negative radius: "+s);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(d>h)if(Math.abs(p*l-c*u)>h&&s){var f=i-o,y=n-a,_=l*l+c*c,x=f*f+y*y,m=Math.sqrt(_),g=Math.sqrt(d),b=s*Math.tan((r-Math.acos((_+d-x)/(2*m*g)))/2),v=b/g,w=b/m;Math.abs(v-1)>h&&(this._+="L"+(t+v*u)+","+(e+v*p)),this._+="A"+s+","+s+",0,0,"+ +(p*f>u*y)+","+(this._x1=t+w*l)+","+(this._y1=e+w*c)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},"arcTo"),arc:o(function(t,e,i,n,s,o){t=+t,e=+e,o=!!o;var a=(i=+i)*Math.cos(n),u=i*Math.sin(n),p=t+a,d=e+u,f=1^o,y=o?n-s:s-n;if(i<0)throw new Error("negative radius: "+i);null===this._x1?this._+="M"+p+","+d:(Math.abs(this._x1-p)>h||Math.abs(this._y1-d)>h)&&(this._+="L"+p+","+d),i&&(y<0&&(y=y%l+l),y>c?this._+="A"+i+","+i+",0,1,"+f+","+(t-a)+","+(e-u)+"A"+i+","+i+",0,1,"+f+","+(this._x1=p)+","+(this._y1=d):y>h&&(this._+="A"+i+","+i+",0,"+ +(y>=r)+","+f+","+(this._x1=t+i*Math.cos(s))+","+(this._y1=e+i*Math.sin(s))))},"arc"),rect:o(function(t,e,i,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +i+"v"+ +n+"h"+-i+"Z"},"rect"),toString:o(function(){return this._},"toString")},o(d,"constant$3");var f=Math.abs,y=Math.atan2,_=Math.cos,x=Math.max,m=Math.min,g=Math.sin,b=Math.sqrt,v=1e-12,w=Math.PI,S=w/2,A=2*w;function k(t){return t>1?0:t<-1?w:Math.acos(t)}function M(t){return t>=1?S:t<=-1?-S:Math.asin(t)}function T(t){return t.innerRadius}function P(t){return t.outerRadius}function C(t){return t.startAngle}function I(t){return t.endAngle}function z(t){return t&&t.padAngle}function F(t,e,i,n,s,o,a,r){var l=i-t,h=n-e,c=a-s,u=r-o,p=u*l-c*h;if(!(p*p<v))return[t+(p=(c*(e-o)-u*(t-s))/p)*l,e+p*h]}function D(t,e,i,n,s,o,a){var r=t-i,l=e-n,h=(a?o:-o)/b(r*r+l*l),c=h*l,u=-h*r,p=t+c,d=e+u,f=i+c,y=n+u,_=(p+f)/2,m=(d+y)/2,g=f-p,v=y-d,w=g*g+v*v,S=s-o,A=p*y-f*d,k=(v<0?-1:1)*b(x(0,S*S*w-A*A)),M=(A*v-g*k)/w,T=(-A*g-v*k)/w,P=(A*v+g*k)/w,C=(-A*g+v*k)/w,I=M-_,z=T-m,F=P-_,D=C-m;return I*I+z*z>F*F+D*D&&(M=P,T=C),{cx:M,cy:T,x01:-c,y01:-u,x11:M*(s/S-1),y11:T*(s/S-1)}}function E(){var t=T,e=P,i=d(0),n=null,s=C,a=I,r=z,l=null;function h(){var o,h,c=+t.apply(this,arguments),u=+e.apply(this,arguments),d=s.apply(this,arguments)-S,x=a.apply(this,arguments)-S,T=f(x-d),P=x>d;if(l||(l=o=p()),u<c&&(h=u,u=c,c=h),u>v)if(T>A-v)l.moveTo(u*_(d),u*g(d)),l.arc(0,0,u,d,x,!P),c>v&&(l.moveTo(c*_(x),c*g(x)),l.arc(0,0,c,x,d,P));else{var C,I,z=d,E=x,O=d,R=x,j=T,N=T,L=r.apply(this,arguments)/2,B=L>v&&(n?+n.apply(this,arguments):b(c*c+u*u)),$=m(f(u-c)/2,+i.apply(this,arguments)),H=$,V=$;if(B>v){var q=M(B/c*g(L)),W=M(B/u*g(L));(j-=2*q)>v?(O+=q*=P?1:-1,R-=q):(j=0,O=R=(d+x)/2),(N-=2*W)>v?(z+=W*=P?1:-1,E-=W):(N=0,z=E=(d+x)/2)}var G=u*_(z),X=u*g(z),Y=c*_(R),U=c*g(R);if($>v){var Q,Z=u*_(E),J=u*g(E),K=c*_(O),tt=c*g(O);if(T<w&&(Q=F(G,X,K,tt,Z,J,Y,U))){var et=G-Q[0],it=X-Q[1],nt=Z-Q[0],st=J-Q[1],ot=1/g(k((et*nt+it*st)/(b(et*et+it*it)*b(nt*nt+st*st)))/2),at=b(Q[0]*Q[0]+Q[1]*Q[1]);H=m($,(c-at)/(ot-1)),V=m($,(u-at)/(ot+1))}}N>v?V>v?(C=D(K,tt,G,X,u,V,P),I=D(Z,J,Y,U,u,V,P),l.moveTo(C.cx+C.x01,C.cy+C.y01),V<$?l.arc(C.cx,C.cy,V,y(C.y01,C.x01),y(I.y01,I.x01),!P):(l.arc(C.cx,C.cy,V,y(C.y01,C.x01),y(C.y11,C.x11),!P),l.arc(0,0,u,y(C.cy+C.y11,C.cx+C.x11),y(I.cy+I.y11,I.cx+I.x11),!P),l.arc(I.cx,I.cy,V,y(I.y11,I.x11),y(I.y01,I.x01),!P))):(l.moveTo(G,X),l.arc(0,0,u,z,E,!P)):l.moveTo(G,X),c>v&&j>v?H>v?(C=D(Y,U,Z,J,c,-H,P),I=D(G,X,K,tt,c,-H,P),l.lineTo(C.cx+C.x01,C.cy+C.y01),H<$?l.arc(C.cx,C.cy,H,y(C.y01,C.x01),y(I.y01,I.x01),!P):(l.arc(C.cx,C.cy,H,y(C.y01,C.x01),y(C.y11,C.x11),!P),l.arc(0,0,c,y(C.cy+C.y11,C.cx+C.x11),y(I.cy+I.y11,I.cx+I.x11),P),l.arc(I.cx,I.cy,H,y(I.y11,I.x11),y(I.y01,I.x01),!P))):l.arc(0,0,c,R,O,P):l.lineTo(Y,U)}else l.moveTo(0,0);if(l.closePath(),o)return l=null,o+""||null}return o(h,"arc"),h.centroid=function(){var i=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,n=(+s.apply(this,arguments)+ +a.apply(this,arguments))/2-w/2;return[_(n)*i,g(n)*i]},h.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:d(+e),h):t},h.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:d(+t),h):e},h.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:d(+t),h):i},h.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:d(+t),h):n},h.startAngle=function(t){return arguments.length?(s="function"==typeof t?t:d(+t),h):s},h.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:d(+t),h):a},h.padAngle=function(t){return arguments.length?(r="function"==typeof t?t:d(+t),h):r},h.context=function(t){return arguments.length?(l=null==t?null:t,h):l},h}function O(t){this._context=t}function R(t){return new O(t)}function j(t){return t[0]}function N(t){return t[1]}function L(){var t=j,e=N,i=d(!0),n=null,s=R,a=null;function r(o){var r,l,h,c=o.length,u=!1;for(null==n&&(a=s(h=p())),r=0;r<=c;++r)!(r<c&&i(l=o[r],r,o))===u&&((u=!u)?a.lineStart():a.lineEnd()),u&&a.point(+t(l,r,o),+e(l,r,o));if(h)return a=null,h+""||null}return o(r,"line"),r.x=function(e){return arguments.length?(t="function"==typeof e?e:d(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:d(+t),r):e},r.defined=function(t){return arguments.length?(i="function"==typeof t?t:d(!!t),r):i},r.curve=function(t){return arguments.length?(s=t,null!=n&&(a=s(n)),r):s},r.context=function(t){return arguments.length?(null==t?n=a=null:a=s(n=t),r):n},r}function B(){var t=j,e=null,i=d(0),n=N,s=d(!0),a=null,r=R,l=null;function h(o){var h,c,u,d,f,y=o.length,_=!1,x=new Array(y),m=new Array(y);for(null==a&&(l=r(f=p())),h=0;h<=y;++h){if(!(h<y&&s(d=o[h],h,o))===_)if(_=!_)c=h,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),u=h-1;u>=c;--u)l.point(x[u],m[u]);l.lineEnd(),l.areaEnd()}_&&(x[h]=+t(d,h,o),m[h]=+i(d,h,o),l.point(e?+e(d,h,o):x[h],n?+n(d,h,o):m[h]))}if(f)return l=null,f+""||null}function c(){return L().defined(s).curve(r).context(a)}return o(h,"area"),o(c,"arealine"),h.x=function(i){return arguments.length?(t="function"==typeof i?i:d(+i),e=null,h):t},h.x0=function(e){return arguments.length?(t="function"==typeof e?e:d(+e),h):t},h.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:d(+t),h):e},h.y=function(t){return arguments.length?(i="function"==typeof t?t:d(+t),n=null,h):i},h.y0=function(t){return arguments.length?(i="function"==typeof t?t:d(+t),h):i},h.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:d(+t),h):n},h.lineX0=h.lineY0=function(){return c().x(t).y(i)},h.lineY1=function(){return c().x(t).y(n)},h.lineX1=function(){return c().x(e).y(i)},h.defined=function(t){return arguments.length?(s="function"==typeof t?t:d(!!t),h):s},h.curve=function(t){return arguments.length?(r=t,null!=a&&(l=r(a)),h):r},h.context=function(t){return arguments.length?(null==t?a=l=null:l=r(a=t),h):a},h}function $(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function H(t){return t}function V(){var t=H,e=$,i=null,n=d(0),s=d(A),a=d(0);function r(o){var r,l,h,c,u,p=o.length,d=0,f=new Array(p),y=new Array(p),_=+n.apply(this,arguments),x=Math.min(A,Math.max(-A,s.apply(this,arguments)-_)),m=Math.min(Math.abs(x)/p,a.apply(this,arguments)),g=m*(x<0?-1:1);for(r=0;r<p;++r)(u=y[f[r]=r]=+t(o[r],r,o))>0&&(d+=u);for(null!=e?f.sort(function(t,i){return e(y[t],y[i])}):null!=i&&f.sort(function(t,e){return i(o[t],o[e])}),r=0,h=d?(x-p*g)/d:0;r<p;++r,_=c)l=f[r],c=_+((u=y[l])>0?u*h:0)+g,y[l]={data:o[l],index:r,value:u,startAngle:_,endAngle:c,padAngle:m};return y}return o(r,"pie"),r.value=function(e){return arguments.length?(t="function"==typeof e?e:d(+e),r):t},r.sortValues=function(t){return arguments.length?(e=t,i=null,r):e},r.sort=function(t){return arguments.length?(i=t,e=null,r):i},r.startAngle=function(t){return arguments.length?(n="function"==typeof t?t:d(+t),r):n},r.endAngle=function(t){return arguments.length?(s="function"==typeof t?t:d(+t),r):s},r.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:d(+t),r):a},r}function q(t,e,i){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+i)/6)}function W(t){this._context=t}function G(t){return new W(t)}function X(t,e){this._basis=new W(t),this._beta=e}o(k,"acos"),o(M,"asin$1"),o(T,"arcInnerRadius$1"),o(P,"arcOuterRadius$1"),o(C,"arcStartAngle$1"),o(I,"arcEndAngle$1"),o(z,"arcPadAngle$1"),o(F,"intersect$1"),o(D,"cornerTangents$1"),o(E,"d3Arc"),o(O,"Linear$1"),O.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._point=0},"lineStart"),lineEnd:o(function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(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)}},"point")},o(R,"d3CurveLinear"),o(j,"x$1"),o(N,"y$1"),o(L,"d3Line"),o(B,"d3Area"),o($,"descending"),o(H,"identity$2"),o(V,"d3Pie"),o(q,"point$7"),o(W,"Basis$1"),W.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 3:q(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},"lineEnd"),point:o(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:q(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e},"point")},o(G,"d3CurveBasis"),o(X,"Bundle$1"),X.prototype={lineStart:o(function(){this._x=[],this._y=[],this._basis.lineStart()},"lineStart"),lineEnd:o(function(){var t=this._x,e=this._y,i=t.length-1;if(i>0)for(var n,s=t[0],o=e[0],a=t[i]-s,r=e[i]-o,l=-1;++l<=i;)n=l/i,this._basis.point(this._beta*t[l]+(1-this._beta)*(s+n*a),this._beta*e[l]+(1-this._beta)*(o+n*r));this._x=this._y=null,this._basis.lineEnd()},"lineEnd"),point:o(function(t,e){this._x.push(+t),this._y.push(+e)},"point")};const Y=o(function t(e){function i(t){return 1===e?new W(t):new X(t,e)}return o(i,"bundle"),i.beta=function(e){return t(+e)},i},"custom")(.85);function U(t,e,i){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-i),t._x2,t._y2)}function Q(t,e){this._context=t,this._k=(1-e)/6}o(U,"point$6"),o(Q,"Cardinal$1"),Q.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:U(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(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:U(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},"point")};const Z=o(function t(e){function i(t){return new Q(t,e)}return o(i,"cardinal"),i.tension=function(e){return t(+e)},i},"custom")(0);function J(t,e,i){var n=t._x1,s=t._y1,o=t._x2,a=t._y2;if(t._l01_a>v){var r=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);n=(n*r-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,s=(s*r-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>v){var h=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*h+t._x1*t._l23_2a-e*t._l12_2a)/c,a=(a*h+t._y1*t._l23_2a-i*t._l12_2a)/c}t._context.bezierCurveTo(n,s,o,a,t._x2,t._y2)}function K(t,e){this._context=t,this._alpha=e}o(J,"point$5"),o(K,"CatmullRom$1"),K.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(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},"lineStart"),lineEnd:o(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},"lineEnd"),point:o(function(t,e){if(t=+t,e=+e,this._point){var i=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,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:J(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},"point")};const tt=o(function t(e){function i(t){return e?new K(t,e):new Q(t,0)}return o(i,"catmullRom"),i.alpha=function(e){return t(+e)},i},"custom")(.5);function et(t){return t<0?-1:1}function it(t,e,i){var n=t._x1-t._x0,s=e-t._x1,o=(t._y1-t._y0)/(n||s<0&&-0),a=(i-t._y1)/(s||n<0&&-0),r=(o*s+a*n)/(n+s);return(et(o)+et(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(r))||0}function nt(t,e){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function st(t,e,i){var n=t._x0,s=t._y0,o=t._x1,a=t._y1,r=(o-n)/3;t._context.bezierCurveTo(n+r,s+r*e,o-r,a-r*i,o,a)}function ot(t){this._context=t}function at(t){return new ot(t)}function rt(t){this._context=t}function lt(t){var e,i,n=t.length-1,s=new Array(n),o=new Array(n),a=new Array(n);for(s[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e<n-1;++e)s[e]=1,o[e]=4,a[e]=4*t[e]+2*t[e+1];for(s[n-1]=2,o[n-1]=7,a[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)i=s[e]/o[e-1],o[e]-=i,a[e]-=i*a[e-1];for(s[n-1]=a[n-1]/o[n-1],e=n-2;e>=0;--e)s[e]=(a[e]-s[e+1])/o[e];for(o[n-1]=(t[n]+s[n-1])/2,e=0;e<n-1;++e)o[e]=2*t[e+1]-s[e+1];return[s,o]}function ht(t){return new rt(t)}function ct(t,e){this._context=t,this._t=e}function ut(t){return new ct(t,.5)}function pt(t){return new ct(t,0)}function dt(t){return new ct(t,1)}o(et,"sign$1"),o(it,"slope3$1"),o(nt,"slope2$1"),o(st,"point$4"),o(ot,"MonotoneX$1"),ot.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:st(this,this._t0,nt(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(t,e){var i=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,st(this,nt(this,i=it(this,t,e)),i);break;default:st(this,this._t0,i=it(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=i}},"point")},Object.create(ot.prototype).point=function(t,e){ot.prototype.point.call(this,e,t)},o(at,"monotoneX"),o(rt,"Natural"),rt.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x=[],this._y=[]},"lineStart"),lineEnd:o(function(){var t=this._x,e=this._y,i=t.length;if(i)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===i)this._context.lineTo(t[1],e[1]);else for(var n=lt(t),s=lt(e),o=0,a=1;a<i;++o,++a)this._context.bezierCurveTo(n[0][o],s[0][o],n[1][o],s[1][o],t[a],e[a]);(this._line||0!==this._line&&1===i)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},"lineEnd"),point:o(function(t,e){this._x.push(+t),this._y.push(+e)},"point")},o(lt,"controlPoints"),o(ht,"d3CurveNatural"),o(ct,"Step$1"),ct.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x=this._y=NaN,this._point=0},"lineStart"),lineEnd:o(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)},"lineEnd"),point:o(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 i=this._x*(1-this._t)+t*this._t;this._context.lineTo(i,this._y),this._context.lineTo(i,e)}}this._x=t,this._y=e},"point")},o(ut,"d3CurveStep"),o(pt,"stepBefore"),o(dt,"stepAfter");var ft=Array.prototype.slice;function yt(t){return t}o(yt,"identity$1");var _t=1e-6;function xt(t){return"translate("+(t+.5)+",0)"}function mt(t){return"translate(0,"+(t+.5)+")"}function gt(t){return function(e){return+t(e)}}function bt(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(i){return+t(i)+e}}function vt(){return!this.__axis}function wt(t,e){var i=[],n=null,s=null,a=6,r=6,l=3,h=1===t||4===t?-1:1,c=4===t||2===t?"x":"y",u=1===t||3===t?xt:mt;function p(o){var p=null==n?e.ticks?e.ticks.apply(e,i):e.domain():n,d=null==s?e.tickFormat?e.tickFormat.apply(e,i):yt:s,f=Math.max(a,0)+l,y=e.range(),_=+y[0]+.5,x=+y[y.length-1]+.5,m=(e.bandwidth?bt:gt)(e.copy()),g=o.selection?o.selection():o,b=g.selectAll(".domain").data([null]),v=g.selectAll(".tick").data(p,e).order(),w=v.exit(),S=v.enter().append("g").attr("class","tick"),A=v.select("line"),k=v.select("text");b=b.merge(b.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),v=v.merge(S),A=A.merge(S.append("line").attr("stroke","currentColor").attr(c+"2",h*a)),k=k.merge(S.append("text").attr("fill","currentColor").attr(c,h*f).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),o!==g&&(b=b.transition(o),v=v.transition(o),A=A.transition(o),k=k.transition(o),w=w.transition(o).attr("opacity",_t).attr("transform",function(t){return isFinite(t=m(t))?u(t):this.getAttribute("transform")}),S.attr("opacity",_t).attr("transform",function(t){var e=this.parentNode.__axis;return u(e&&isFinite(e=e(t))?e:m(t))})),w.remove(),b.attr("d",4===t||2==t?r?"M"+h*r+","+_+"H0.5V"+x+"H"+h*r:"M0.5,"+_+"V"+x:r?"M"+_+","+h*r+"V0.5H"+x+"V"+h*r:"M"+_+",0.5H"+x),v.attr("opacity",1).attr("transform",function(t){return u(m(t))}),A.attr(c+"2",h*a),k.attr(c,h*f).text(d),g.filter(vt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),g.each(function(){this.__axis=m})}return o(p,"axis"),p.scale=function(t){return arguments.length?(e=t,p):e},p.ticks=function(){return i=ft.call(arguments),p},p.tickArguments=function(t){return arguments.length?(i=null==t?[]:ft.call(t),p):i.slice()},p.tickValues=function(t){return arguments.length?(n=null==t?null:ft.call(t),p):n&&n.slice()},p.tickFormat=function(t){return arguments.length?(s=t,p):s},p.tickSize=function(t){return arguments.length?(a=r=+t,p):a},p.tickSizeInner=function(t){return arguments.length?(a=+t,p):a},p.tickSizeOuter=function(t){return arguments.length?(r=+t,p):r},p.tickPadding=function(t){return arguments.length?(l=+t,p):l},p}function St(t){return wt(1,t)}function At(t){return wt(2,t)}function kt(t){return wt(3,t)}function Mt(t){return wt(4,t)}o(xt,"translateX"),o(mt,"translateY"),o(gt,"number"),o(bt,"center"),o(vt,"entering"),o(wt,"axis"),o(St,"axisTop"),o(At,"axisRight"),o(kt,"axisBottom"),o(Mt,"axisLeft");const Tt=class _Axis extends i.SVGWidget{constructor(t="origin"){super(),a(this,"_origType"),a(this,"_origTimePattern"),a(this,"parser"),a(this,"parserInvert"),a(this,"formatter"),a(this,"d3Scale"),a(this,"d3Axis"),a(this,"d3Guides"),a(this,"_guideElement"),a(this,"svg"),a(this,"svgAxis"),a(this,"svgGuides"),a(this,"_prevOrientation"),this._drawStartPos=t,this.updateScale()}lowValue(){return this.parse(this.low())}highValue(){return this.parse(this.high())}parse(t,e){if(t instanceof Array)return t.map(function(t){return this.parse(t)},this);if(null!=t){if(this.parser)return this.parser("number"==typeof t?t.toString():t);if(e&&"string"==typeof t)return+t}return t}parseInvert(t){return t instanceof Array?t.map(function(t){return this.parseInvert(t)},this):this.parserInvert&&t?this.parserInvert(t):t}format(t){return t instanceof Array?t.map(function(t){return this.format(t)},this):null!=t&&this.formatter?this.formatter(t):t}parseFormat(t){return this.format(this.parse(t))}scalePos(t){let e=this.d3Scale(this.parse(t));return"ordinal"===this.type()&&(e+=this.bandwidth()/2),e}bandwidth(){return this.d3Scale.bandwidth?this.d3Scale.bandwidth():0}isHorizontal(){switch(this.orientation()){case"left":case"right":return!1}return!0}domain(t){return arguments.length?(this.d3Scale.domain(t),this):this.d3Scale.domain()}range(t){if(!arguments.length){if(this.d3Scale.rangeRoundBands)return this.d3Scale.rangeExtent();if(this.d3Scale.rangeRound)return this.d3Scale.range()}return this.d3Scale.rangeRoundBands?this.d3Scale.rangeRoundBands(t,.1):this.d3Scale.rangeRound&&this.d3Scale.range(t),this}invert(t){return this.d3Scale.invert(t)}guideTarget(t){return this._guideElement=i.select(t).attr("class",this._class),this}enter(t,e){super.enter(t,e),this.svg=e.append("g"),this.svgAxis=this.svg.append("g").attr("class","axis"),this.svgGuides=(this._guideElement||e).append("g").attr("class","guide")}updateScale(){switch(this.type()){case"ordinal":if(this.d3Scale=i.scaleBand().paddingInner(this.ordinalPaddingInner()).paddingOuter(this.ordinalPaddingOuter()),this.ordinals_exists()&&this.d3Scale.domain(this.ordinals()),this.parser=null,this.ordinalMappings_exists()){const t=this.ordinalMappings();this.formatter=e=>t[e]||e}else this.formatter=null;break;case"linear":this.d3Scale=i.scaleLinear(),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=null,this.formatter=this.tickFormat_exists()?i.format(this.tickFormat()):null;break;case"pow":this.d3Scale=i.scalePow().exponent(this.powExponent()),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=null,this.formatter=this.tickFormat_exists()?i.format(this.tickFormat()):null;break;case"log":this.d3Scale=i.scaleLog().base(this.logBase()),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=null,this.formatter=this.tickFormat_exists()?i.format(this.tickFormat()):null;break;case"time":this.d3Scale=i.scaleTime(),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=this.timePattern_exists()?i.timeParse(this.timePattern()):null,this.parserInvert=this.timePattern_exists()?i.timeFormat(this.timePattern()):null,this.formatter=this.tickFormat_exists()?i.timeFormat(this.tickFormat()):null}if(this._prevOrientation!==this.orientation()){switch(this.orientation()){case"left":this.d3Axis=Mt(this.d3Scale),this.d3Guides=Mt(this.d3Scale);break;case"top":this.d3Axis=St(this.d3Scale),this.d3Guides=St(this.d3Scale);break;case"right":this.d3Axis=At(this.d3Scale),this.d3Guides=At(this.d3Scale);break;default:this.d3Axis=kt(this.d3Scale),this.d3Guides=kt(this.d3Scale)}this._prevOrientation=this.orientation(),this.svgAxis&&this.svgAxis.html(""),this.svgGuides&&this.svgGuides.html("")}if(this.extend())if("ordinal"===this.type());else{let t,e,i,n,s,o;this.isHorizontal()?(t=this.width(),this.d3Scale.range([0,t]),e=t*this.extend()/100,i=this.d3Scale.invert(0),s=this.d3Scale.invert(-e),n=this.d3Scale.invert(t),o=this.d3Scale.invert(t+e)):(t=this.height(),this.d3Scale.range([t,0]),e=t*this.extend()/100,i=this.d3Scale.invert(t),s=this.d3Scale.invert(t+e),n=this.d3Scale.invert(0),o=this.d3Scale.invert(-e)),s===i&&(s=i-i*this.extend()/100),o===n&&(o=n+n*this.extend()/100),Math.sign(i)!==Math.sign(s)&&(s=0),Math.sign(n)!==Math.sign(o)&&(o=0),this.d3Scale.domain([s,o])}this.d3Axis.scale(this.d3Scale).tickFormat(this.formatter).ticks(this.tickCount()),this.d3Guides.scale(this.d3Scale).tickSize(this.tickLength_exists()?-this.tickLength():0).tickFormat("").ticks(this.tickCount());const t=this.ticks();return t.length&&(this.d3Axis.tickValues(t.map(t=>this.parse(t.value))).tickFormat((e,i)=>t[i].label),this.d3Guides.tickValues(t.map(t=>this.parse(t.value)))),this}adjustText(t,e){const n=this.isHorizontal(),s="left"===this.orientation(),o="bottom"===this.orientation(),a=this,r=t.selectAll(".tick > text").style("font-family",this.fontFamily()).style("font-size",this.fontSize_exists()?this.fontSize()+"px":null);if("linebreak"===this.overlapMode())"ordinal"===this.type()&&r.call(function(){return a.linebreak.apply(a,arguments)},this.bandwidth());else if("wrap"===this.overlapMode())"ordinal"===this.type()&&r.call(function(){return a.wrap.apply(a,arguments)},this.bandwidth());else switch(n?this.overlapMode():"none"){case"stagger":r.style("text-anchor","middle").attr("dy",function(t,i){return(o?1:-1)*((o?.71:0)+i%e)+"em"}).attr("dx",0).attr("visibility",null).attr("transform","rotate(0)");break;case"hide":r.style("text-anchor","middle").attr("dy",(o?.71:0)+"em").attr("dx",0).attr("visibility",function(t,i){return i%e?"hidden":null}).attr("transform","rotate(0)");break;case"rotate":const t=-this.labelRotation()||0;if(0!==t&&e>1){r.each(function(){const e=i.select(this),n=e.node().getBBox(),s=(o?1:-1)*Math.sin(Math.PI*(-Math.abs(t)/180));e.style("text-anchor",t>0?o?"start":"end":o?"end":"start").attr("dy",n.height/2*s+"px").attr("dx",t>0?o?"0.71em":"-0.71em":o?"-0.71em":"0.71em").attr("transform","rotate("+t+")").attr("visibility",null)});break}default:r.style("text-anchor",n?"middle":s?"end":"start").attr("dy",n?(o?.71:0)+"em":"0.32em").attr("dx",0).attr("visibility",null).attr("transform","rotate(0)")}}calcTickOverlapModulus(t){let e=1;switch(this.overlapMode()){case"rotate":case"stagger":case"hide":const i=[];t.selectAll(".tick > text").each(function(){const t=this.getBoundingClientRect();for(let n=i.length-1;n>=0&&!(i[n].right<t.left);--n)i.length+1-n>e&&(e=i.length+1-n);i.push(t)})}return e}calcOverflow(t,e){if(this.updateScale(),this.hidden())return{left:0,top:0,right:0,bottom:0,depth:0,tickOverlapModulus:1};const i=this.isHorizontal();this.range(i?[0,this.width()]:[this.height(),0]);const n=t.append("g").attr("class",this.classID()),s=n.append("g");s.attr("class",i?"x":"y").call(this.d3Axis),e&&t.selectAll(".tick > text").remove();const o={left:0,top:0,right:0,bottom:0,depth:0,tickOverlapModulus:this.calcTickOverlapModulus(s)};this.adjustText(s,o.tickOverlapModulus);const a=s.node().getBBox();switch(o.depth=i?a.height:a.width,this.shrinkToFit()){case"low":case"both":o.left=i?-a.x:0,o.bottom=i?0:-(this.height()-(a.height+a.y))}switch(this.shrinkToFit()){case"high":case"both":o.top=i?0:-a.y,o.right=i?-(this.width()-a.x-a.width):0}return n.remove(),o}wrap(t,e,n){n=n||/\s+/;const s=this;t.each(function(){const t=i.select(this),o=t.text().split(n).reverse();let a=[],r=0;const l=t.attr("x"),h=t.attr("y"),c=parseFloat(t.style("font-size"))||10,u=Math.floor(e/(1.1*c))-1,p=s.isHorizontal()?1:Math.ceil(o.length/u),d=parseFloat(t.attr("dy"));let f=t.text(null).append("tspan").attr("x",l).attr("y",h).attr("dy",d+"em"),y=0,_=o.pop();for(;_;)a.push(_),f.text(a.join(" ")),y++,f.node().getComputedTextLength()>e&&y>=p&&(a.pop(),f.text(a.join(" ")),a=[_],f=t.append("tspan").attr("x",l).attr("y",h).attr("dy",1.1*++r+d+"em").text(_),y=0),_=o.pop();s.isHorizontal()||t.selectAll("tspan").attr("y",-r/2+"em")})}linebreak(t,e){this.wrap(t,e,"\n")}update(t,e){super.update(t,e),this.svg.style("display",this.hidden()?"none":null);const i=this.calcOverflow(e),n=this.isHorizontal()?i.left:this.height()-i.top-i.bottom,s=this.isHorizontal()?this.width()-i.right-this.padding():0+this.padding();this.range(this.reverse()?[s,n]:[n,s]);const a=this;function r(t){t.attr("transform",function(){switch(a.orientation()){case"left":return"translate("+i.depth+", "+i.top+")";case"top":return"translate(0,"+i.depth+")";case"right":return"translate("+(a.width()-i.depth)+", "+i.top+")";case"bottom":return"translate(0,"+(a.height()-i.depth)+")"}return"translate(0,0)"})}o(r,"doPosition"),this.svg.style("visibility","none"===this.type()?"hidden":null).transition().call(r),this._guideElement&&this.svgGuides.transition().call(r),this.svgAxis.call(this.d3Axis),this.adjustText(this.svgAxis,i.tickOverlapModulus);this.pos().x;const l=this.width(),h=this.svgAxis.selectAll(".axisTitle").data(this.title()?[this.title()]:[]),c=h.enter().append("text").attr("class","axisTitle").merge(h).transition().attr("dx",null).style("text-anchor","end");switch(this.orientation()){case"left":c.attr("transform","rotate(-90)").attr("x",-2).attr("y",2).attr("dy",".71em");break;case"right":c.attr("transform","rotate(-90)").attr("x",-2).attr("y",4).attr("dx",null).attr("dy","-.71em");break;case"top":c.attr("transform","rotate(0)").attr("x",l-2).attr("y",2).attr("dx",null).attr("dy",".71em");break;case"bottom":c.attr("transform","rotate(0)").attr("x",l-2).attr("y",-2).attr("dy",null)}c.text(this.title_exists()?this.title():""),h.exit().remove(),this.svgGuides.call(this.d3Guides).selectAll(".tick").classed("guide-0",t=>0===t&&this.low()<0)}rerender(){this.svgAxis.call(this.d3Axis),this.svgGuides.call(this.d3Guides)}postUpdate(t,e){super.postUpdate(t,e),this._guideElement&&this._guideElement.attr("transform",this._element.attr("transform"))}};o(Tt,"Axis");let Pt=Tt;Pt.prototype._class+=" chart_Axis",Pt.prototype.publish("type","linear","set","Type",["none","ordinal","linear","pow","log","time"]),Pt.prototype.publish("timePattern","%Y-%m-%d","string","Time Series Pattern",null,{disable:o(t=>"time"!==t.type(),"disable")}),Pt.prototype.publish("reverse",!1,"boolean","Reverse"),Pt.prototype.publish("title",null,"string","Title"),Pt.prototype.publish("orientation","bottom","set","Placement/orientation of the axis",["left","top","right","bottom"]),Pt.prototype.publish("powExponent",2,"number","Power exponent (disabled when type is not 'pow')",null,{disable:o(t=>"pow"!==t.type(),"disable")}),Pt.prototype.publish("logBase",10,"number","Logarithmic base (disabled when type is not 'log')",null,{disable:o(t=>"log"!==t.type(),"disable")}),Pt.prototype.publish("ordinals",[],"array","Array of ordinal values to display (disabled when type is not 'ordinal')",null,{disable:o(t=>"ordinal"!==t.type(),"disable")}),Pt.prototype.publish("fontSize",null,"number","Size of tick label font (pixels)",null,{optional:!0}),Pt.prototype.publish("fontFamily",null,"string","Font family of tick labels",null,{optional:!0}),Pt.prototype.publish("tickCount",null,"number","Number of ticks to display (disabled when type is 'ordinal')",null,{optional:!0,disable:o(t=>"ordinal"===t.type(),"disable")}),Pt.prototype.publish("tickFormat",null,"string","Format rules for tick text (disabled when type is 'ordinal')",null,{optional:!0,disable:o(t=>"ordinal"===t.type(),"disable")}),Pt.prototype.publish("tickLength",null,"number","Height (or width for left/right orientations) of the axis ticks (in pixels)",null,{optional:!0}),Pt.prototype.publish("ticks",[],"array","Custom tick labels",null,{optional:!0}),Pt.prototype.publish("low",null,"any","Minimum tick value (disabled when type is ordinal)",null,{optional:!0,disable:o(t=>"ordinal"===t.type(),"disable")}),Pt.prototype.publish("high",null,"any","Maximum tick value (disabled when type is ordinal)",null,{optional:!0,disable:o(t=>"ordinal"===t.type(),"disable")}),Pt.prototype.publish("overlapMode","none","set","Specifies the behavior when tick labels overlap",["none","stagger","hide","rotate","linebreak","wrap"]),Pt.prototype.publish("labelRotation",33,"number","Angle of rotation for tick labels (disabled when overlapMode is not 'rotate')",null,{optional:!0,disable:o(t=>"rotate"!==t.overlapMode(),"disable")}),Pt.prototype.publish("shrinkToFit","both","set","shrinkToFit",["none","low","high","both"]),Pt.prototype.publish("extend",5,"number","Extend the axis range by this % beyond what is needed to display the data (disabled when type is 'ordinal')",null,{optional:!0,disable:o(t=>"ordinal"===t.type(),"disable")}),Pt.prototype.publish("hidden",!1,"boolean","Hides axis when 'true'"),Pt.prototype.publish("ordinalPaddingInner",.1,"number","Determines the ratio of the range that is reserved for blank space between band (0->1)",null,{disable:o(t=>"ordinal"!==t.type(),"disable")}),Pt.prototype.publish("ordinalPaddingOuter",.1,"number","Determines the ratio of the range that is reserved for blank space before the first band and after the last band (0->1)",null,{disable:o(t=>"ordinal"!==t.type(),"disable")}),Pt.prototype.publish("ordinalMappings",null,"object","Alternative label mappings (icons)",null,{optional:!0}),Pt.prototype.publish("padding",0,"number","Padding space at top of axis (pixels)",null,{optional:!0}),Pt.prototype._origType=Pt.prototype.type,Pt.prototype.type=function(t){const e=Pt.prototype._origType.apply(this,arguments);return void 0!==t&&(this._type=t,this.updateScale()),e},Pt.prototype._origTimePattern=Pt.prototype.timePattern,Pt.prototype.timePattern=function(t){const e=Pt.prototype._origTimePattern.apply(this,arguments);return void 0!==t&&(this._timePattern=t,this.updateScale()),e};const Ct=class _XYAxis extends i.SVGWidget{constructor(){super(),a(this,"domainAxis"),a(this,"valueAxis"),a(this,"xAxis"),a(this,"yAxis"),a(this,"xyBrush"),a(this,"xBrush"),a(this,"yBrush"),a(this,"margin"),a(this,"focusChart"),a(this,"_prevBrush"),a(this,"svg"),a(this,"svgRegions"),a(this,"svgDomainGuide"),a(this,"svgValueGuide"),a(this,"svgData"),a(this,"svgDataClipRect"),a(this,"svgFocus"),a(this,"svgBrush"),a(this,"_skipSelection",!1),a(this,"_prevXAxisType"),a(this,"_selection"),i.Utility.SimpleSelectionMixin.call(this),this._drawStartPos="origin",this.domainAxis=(new Pt).classed({domain:!0}).orientation_default("bottom").type("ordinal").overlapMode_default("stagger").shrinkToFit_default("high").extend_default(0),this.valueAxis=(new Pt).classed({value:!0}).orientation_default("left").type("linear").shrinkToFit_default("high"),this.xyBrush=i.brush().on("end",()=>this.brushMoved()).on("start.handle brush.handle end.handle",()=>this.brushMoved2()),this.xBrush=i.brushX().on("end",()=>this.brushMoved()).on("start.handle brush.handle end.handle",()=>this.brushMoved2()),this.yBrush=i.brushY().on("end",()=>this.brushMoved()).on("start.handle brush.handle end.handle",()=>this.brushMoved2())}resetSelection(){return this._prevBrush=null,this}parseData(t){return this.domainAxis.parse(t)}parseValue(t){return this.valueAxis.parse(t,!0)}formatData(t){return this.domainAxis.format(t)}formatValue(t){return this.valueAxis.format(t)}parsedData(){return this.data().map(function(t){let e=0;return t.map(function(t,i){if(0===i)return this.parseData(t);if(i>=this.columns().length)return t;const n=this.yAxisStacked()?[e,e+this.parseValue(t)]:this.parseValue(t);return e+=this.parseValue(t),n},this)},this)}bandwidth(){return this.domainAxis.bandwidth()}enter(t,e){super.enter(t,e),this.svg=e.append("g"),this.svgRegions=e.append("g"),this.svgDomainGuide=this.svg.append("g"),this.svgValueGuide=this.svg.append("g"),this.svgData=this.svg.append("g"),this.svgDataClipRect=this.svg.append("clipPath").attr("id",this.id()+"_clippath").append("rect").attr("x",0).attr("y",0),this.svgData=this.svg.append("g").attr("clip-path","url(#"+this.id()+"_clippath)"),this._selection.widgetElement(this.svgData),this.svgFocus=e.append("g"),this.domainAxis.target(this.svg.node()).guideTarget(this.svgDomainGuide.node()),this.valueAxis.target(this.svg.node()).guideTarget(this.svgValueGuide.node()),this.svgBrush=e.append("g").attr("class","brush"),this.chartsEnter(this,this.svgData,250)}resizeBrushHandle(t,e,i){let n,s,o;return"e"===t.type||"w"===t.type?(n=+("e"===t.type),s=n?1:-1,o=i/3,"M"+.5*s+","+o+"A6,6 0 0 "+n+" "+6.5*s+","+(o+6)+"V"+(2*o-6)+"A6,6 0 0 "+n+" "+.5*s+","+2*o+"ZM"+2.5*s+","+(o+8)+"V"+(2*o-8)+"M"+4.5*s+","+(o+8)+"V"+(2*o-8)):(n=+("s"===t.type),o=n?1:-1,s=e/3,"M"+s+", "+.5*o+"A6,6 0 0 "+(n+1)%2+" "+(s+6)+","+6.5*o+"H"+(2*s-6)+"A6,6 0 0 "+(n+1)%2+" "+2*s+","+.5*o+"ZM"+(s+8)+","+2.5*o+"H"+(2*s-8)+"M"+(s+8)+","+4.5*o+"H"+(2*s-8))}skipSelection(t){return arguments.length?(this._skipSelection=t,this):this._skipSelection}brushMoved(){if(this._skipSelection)return;let t=[];const e=this,n=i.brushSelection(this.svgBrush.node());n&&(t=this.data().filter(function(t){const i=e.dataPos(t[0]);if(e.use2dSelection()){const s=e.valuePos(t[1])+e.valueAxis.bandwidth()/2;return i>=n[0][0]&&i<=n[1][0]&&s>=n[0][1]&&s<=n[1][1]}return i>=n[0]&&i<=n[1]})),this.selection(t)}brushMoved2(){var t;const e="horizontal"===this.orientation(),n=this.use2dSelection()?[]:e?[{type:"w"},{type:"e"}]:[{type:"n"},{type:"s"}],s=this.svgBrush.selectAll(".handle--custom").data(n),o=null==(t=i.d3Event())?void 0:t.selection;null==o?s.attr("display","none"):e?s.attr("display",null).attr("transform",(t,e)=>"translate("+o[e]+",0)"):s.attr("display",null).attr("transform",(t,e)=>"translate(0, "+o[e]+")")}dataPos(t){return this.domainAxis.scalePos(t)}valuePos(t){return this.valueAxis.scalePos(t)}getAxisSize(t){return{width:this.xAxis?this.xAxis.width():t.xAxis.width(),height:this.yAxis?this.yAxis.height():t.yAxis.width()}}calcMargin(t,e,i){const n={top:!i&&this.selectionMode()?10:2,right:i&&(this.selectionMode()||this.xAxisFocus())?10:2,bottom:(this.xAxisFocus()?this.xAxisFocusHeight():0)+2,left:2},s=this.width()-n.left-n.right,o=this.height()-n.top-n.bottom;let a=0,r=30,l=0,h=30;for(let c=0;c<10;++c){this.xAxis.width(s-h).height(0);const t=this.xAxis.calcOverflow(e),i=t.depth;this.yAxis.width(0).height(o-r);const n=this.yAxis.calcOverflow(e),c=n.depth;if(a=t.right,l=n.top,i===r&&c===h)break;r=i,h=c}return this.xAxis.x(s/2+h/2+n.left).y(o+n.top).width(s-h),this.yAxis.x(n.left).y(o/2-r/2+n.top).height(o-r),n.left+=h,n.top+=l,n.right+=a,n.bottom+=r,n}updateRegions(t,e,n){const s=this,o=this.svgRegions.selectAll(".region").data(this.regions());o.enter().append("rect").attr("class","region"),n?o.attr("x",function(t){return s.dataPos(t.x0)}).attr("y",0).attr("width",function(t){return s.dataPos(t.x1)-s.dataPos(t.x0)}).attr("height",this.height()).style("stroke",function(t){return s._palette(t.colorID)}).style("fill",function(t){return i.hsl(s._palette(t.colorID)).brighter()}):o.attr("x",0).attr("y",function(t){return s.dataPos(t.x0)}).attr("width",this.width()).attr("height",function(t){return s.dataPos(t.x0)-s.dataPos(t.x1)}).style("stroke",function(t){return s._palette(t.colorID)}).style("fill",function(t){return i.hsl(s._palette(t.colorID)).brighter()}),o.exit().remove()}update(t,e){super.update(t,e);const n=this,s="horizontal"===this.orientation();if(this.updateRegions(t,e,s),this.domainAxis.orientation(s?"bottom":"left").title(this.xAxisTitle_exists()?this.xAxisTitle():this.columns()[0]),this.valueAxis.orientation(s?"left":"bottom"),this.xAxis=s?this.domainAxis:this.valueAxis,this.yAxis=s?this.valueAxis:this.domainAxis,"ordinal"===this.xAxisType()){const t=this.columns().length,e={};this.domainAxis.ordinals(this.data().map(function(i){return e[i[0]]=n.xAxisOrdinalMapping(i,i[t]),i[0]})).ordinalMappings(e)}else{const t=this.xAxisDomainLow()?this.xAxisDomainLow():this.domainAxis.parseInvert(i.min(this.parsedData(),function(t){return t[0]})),e=this.xAxisDomainHigh()?this.xAxisDomainHigh():this.domainAxis.parseInvert(i.max(this.parsedData(),function(t){return t[0]}));void 0!==t&&void 0!==e&&this.domainAxis.low(t).high(e)}const o=this.yAxisDomainLow()?this.yAxisDomainLow():this.valueAxis.parseInvert(i.min(this.parsedData(),function(t){return i.min(t.filter(function(t,e){return e>0&&n.columns()[e]&&0!==n.columns()[e].indexOf("__")&&null!==t}),function(t){return t instanceof Array?t[0]:t})})),a=this.yAxisDomainHigh()?this.yAxisDomainHigh():this.valueAxis.parseInvert(i.max(this.parsedData(),function(t){return i.max(t.filter(function(t,e){return e>0&&n.columns()[e]&&0!==n.columns()[e].indexOf("__")&&null!==t}),function(t){return t instanceof Array?t[1]:t})}));this.valueAxis.low(o).high(a),this.margin=this.calcMargin(t,e,s);let r=this.width()-this.margin.left-this.margin.right;r<0&&(r=0);let l=this.height()-this.margin.top-this.margin.bottom;l<0&&(l=0);const h=s?r:l,c=s?l:r;if(this.domainAxis.tickLength(this.xAxisGuideLines()?c:0).render(),this.valueAxis.tickLength(this.yAxisGuideLines()?h:0).render(),this.svgDataClipRect.attr("width",r).attr("height",l),this.svgData.transition().attr("transform","translate("+this.margin.left+","+this.margin.top+")"),this.updateBrush(r,l,h,s),this.updateFocusChart(t,e,this.margin,r,l,s),this.chartsUpdate(r,l,250),this.selectionMode())return this.brushMoved()}updateBrush(t,e,n,s){const o=this.use2dSelection()?this.xyBrush:s?this.xBrush:this.yBrush,a=i.brushSelection(this.svgBrush.node());o.extent([[0,0],[t,e]]),this.svgBrush.attr("transform","translate("+this.margin.left+", "+this.margin.top+")").style("display",this.selectionMode()?null:"none").call(o);const r=this.use2dSelection()?[]:s?[{type:"w"},{type:"e"}]:[{type:"n"},{type:"s"}],l=this.svgBrush.selectAll(".handle--custom").data(r);if(l.enter().append("path").attr("class","handle--custom").merge(l).attr("cursor",s?"ew-resize":"ns-resize").attr("d",i=>this.resizeBrushHandle(i,t,e)),this.selectionMode()){if(this._prevXAxisType!==this.xAxisType()&&(this._prevXAxisType=this.xAxisType(),this._prevBrush=null),this._prevBrush){if(a){if(this._prevBrush.orientation!==this.orientation()){const t=a[0];a[0]=this._prevBrush.maxCurrExtent-a[1],a[1]=this._prevBrush.maxCurrExtent-t}const t=n/this._prevBrush.maxCurrExtent;1!==t&&this.svgBrush.transition().on("start",function(){o.on("end",null)}).call(o.move,[a[0]*t,a[1]*t]).on("end",()=>{o.on("end",()=>this.brushMoved())})}}else this.svgBrush.call(o.move,[0,n]);this._prevBrush={orientation:this.orientation(),maxCurrExtent:n}}}updateFocusChart(t,e,i,n,s,o){const a=this,r=this.svgFocus.selectAll("#"+this.id()+"_focusChart").data(this.xAxisFocus()?[!0]:[]);r.enter().append("g").attr("id",this.id()+"_focusChart").attr("class","focus").each(function(){a.focusChart=(new a.constructor).target(this),a.focusChart.xBrush.on("brush.focus",function(){a.syncAxis(n),a.chartsUpdate(n,s,0)}),a.focusChart.layers(a.layers().map(t=>new t.constructor))}).merge(r).each(function(){a.copyPropsTo(a.focusChart,["layers"]);let t=0;for(const e of a.layers())e.copyPropsTo(a.focusChart.layers()[t]),t++;a.focusChart.xAxisFocus(!1).selectionMode(!0).skipSelection(!0).orientation("horizontal").xAxisGuideLines(!1).xAxisDomainLow(null).xAxisDomainHigh(null).yAxisGuideLines(!1).x(a.width()/2).y(a.height()-a.xAxisFocusHeight()/2).width(a.width()).height(a.xAxisFocusHeight()).columns(a.columns()).data(a.data()).render(),a.syncAxis(n)}),r.exit().each(function(){a.focusChart&&(a.focusChart.target(null),delete a.focusChart)}).remove()}syncAxis(t){const e=i.brushSelection(this.focusChart.svgBrush.node());if(e){if("ordinal"!==this.focusChart.xAxisType())this.xAxis.domain([this.focusChart.xAxis.invert(e[0]),this.focusChart.xAxis.invert(e[1])]);else{const i=(e[1]-e[0])/t;this.xAxis.range([-e[0]/i,(t-e[0])/i])}this.xAxis.rerender()}}layerColumns(t){const e=t.columns(),i=super.columns().filter(t=>t!==e[0]);return i.length?[e[0],...i]:e}layerColumnIndices(t){const e=t.columns();return this.layerColumns(t).map(t=>e.indexOf(t))}layerColumnIndex(t,e){return t.columns().indexOf(e)}layerData(t){if(1===arguments.length){const e=this.layerColumnIndices(t);return t.data().map(t=>{const i=e.map(e=>t[e]);return i.__hpcc_origRow=t,i})}throw new Error("Setting data on XYAxisLayer is not supported.")}layerEnter(t,e,i=250){}layerUpdate(t,e,i=250){}layerExit(t,e,i=250){}chartsEnter(t,e,i=250){this.layerEnter(this,e,i);for(const n of this.layers())n.__xyAxisElement=e.append("g").attr("class",n.class()),n.target(n.__xyAxisElement.node()).layerEnter(this,e,i)}chartsUpdate(t,e,i){this.layerUpdate(this,this.svgData,i);for(const n of this.layers())n.resize({width:t,height:e}).layerUpdate(this,n.__xyAxisElement,i)}exit(t,e){this.valueAxis.target(null),this.domainAxis.target(null),super.exit(t,e)}selection(t){const e=this;this._selection.widgetElement().selectAll(".selected,.deselected").each(function(n){const s=t.indexOf(n.origRow)>=0;i.select(this).classed("selected",s).classed("deselected",!s).attr("filter",e._selection.svgGlowID()&&s?`url(#${e._selection.svgGlowID()})`:null)});const n=t.map(t=>this.rowToObj(t));setTimeout(()=>{this.click(n,"",!0)},0)}xAxisOrdinalMapping(t,e){return t[0]}click(t,e,i){}};o(Ct,"XYAxis");let It=Ct;It.prototype._class+=" chart_XYAxis",It.prototype.mixin(i.Utility.SimpleSelectionMixin),It.prototype.publish("orientation","horizontal","set","Selects orientation for the axis",["horizontal","vertical"]),It.prototype.publish("pointSizeColumn",null,"string","pointSizeColumn",null,{optional:!0}),It.prototype.publish("minPointSize",6,"number","minPointSize"),It.prototype.publish("maxPointSize",26,"number","maxPointSize"),It.prototype.publish("use2dSelection",!1,"boolean","2D Range Selector"),It.prototype.publish("selectionMode",!1,"boolean","Range Selector"),It.prototype.publishProxy("xAxisTitle","domainAxis","title"),It.prototype.publishProxy("xAxisTickCount","domainAxis","tickCount"),It.prototype.publishProxy("xAxisTickFormat","domainAxis","tickFormat"),It.prototype.publishProxy("xAxisTicks","domainAxis","ticks"),It.prototype.publishProxy("xAxisType","domainAxis","type"),It.prototype.publishProxy("xAxisTypeTimePattern","domainAxis","timePattern"),It.prototype.publish("xAxisDomainLow",null,"string","X-Axis Low",null,{optional:!0,disable:o(t=>"ordinal"===t.xAxisType(),"disable")}),It.prototype.publish("xAxisDomainHigh",null,"string","X-Axis High",null,{optional:!0,disable:o(t=>"ordinal"===t.xAxisType(),"disable")}),It.prototype.publishProxy("xAxisFontSize","domainAxis","fontSize"),It.prototype.publishProxy("xAxisFontFamily","domainAxis","fontFamily"),It.prototype.publishProxy("xAxisOrdinalPaddingInner","domainAxis","ordinalPaddingInner"),It.prototype.publishProxy("xAxisOrdinalPaddingOuter","domainAxis","ordinalPaddingOuter"),It.prototype.publishProxy("xAxisOverlapMode","domainAxis","overlapMode"),It.prototype.publishProxy("xAxisLabelRotation","domainAxis","labelRotation"),It.prototype.publishProxy("xAxisDomainPadding","domainAxis","extend"),It.prototype.publish("xAxisGuideLines",!1,"boolean","Y-Axis Guide Lines"),It.prototype.publish("xAxisFocus",!1,"boolean","X-Axis Focus",null,{disable:o(t=>"horizontal"!==t.orientation(),"disable")}),It.prototype.publish("xAxisFocusHeight",80,"number","X-Axis Focus Height",null,{disable:o(t=>!t.xAxisFocus(),"disable")}),It.prototype.publishProxy("xAxisHidden","domainAxis","hidden"),It.prototype.publishProxy("yAxisFontSize","valueAxis","fontSize"),It.prototype.publishProxy("yAxisFontFamily","valueAxis","fontFamily"),It.prototype.publishProxy("yAxisTitle","valueAxis","title"),It.prototype.publishProxy("yAxisTickCount","valueAxis","tickCount"),It.prototype.publishProxy("yAxisTickFormat","valueAxis","tickFormat"),It.prototype.publishProxy("yAxisTicks","valueAxis","ticks"),It.prototype.publishProxy("yAxisType","valueAxis","type"),It.prototype.publishProxy("yAxisTypeTimePattern","valueAxis","timePattern"),It.prototype.publishProxy("yAxisTypePowExponent","valueAxis","powExponent"),It.prototype.publishProxy("yAxisTypeLogBase","valueAxis","logBase"),It.prototype.publish("yAxisStacked",!1,"boolean","Stacked Chart",null,{tags:["Basic"],disable:o(t=>"ordinal"!==t.xAxisType()||t._class.indexOf("chart_Column")<0,"disable")}),It.prototype.publish("yAxisDomainLow",null,"string","Y-Axis Low",null,{optional:!0,disable:o(t=>"ordinal"===t.yAxisType(),"disable")}),It.prototype.publish("yAxisDomainHigh",null,"string","Y-Axis High",null,{optional:!0,disable:o(t=>"ordinal"===t.yAxisType(),"disable")}),It.prototype.publishProxy("yAxisDomainPadding","valueAxis","extend"),It.prototype.publish("yAxisGuideLines",!0,"boolean","Y-Axis Guide Lines"),It.prototype.publishProxy("yAxisHidden","valueAxis","hidden"),It.prototype.publish("regions",[],"array","Regions"),It.prototype.publish("layers",[],"widgetArray","Layers",null,{render:!1}),It.prototype.publishProxy("xAxisPadding","domainAxis","padding"),It.prototype.publishProxy("yAxisPadding","valueAxis","padding");const zt=class _Scatter extends It{constructor(){super(),a(this,"_prevPointShape"),e.INDChart.call(this),e.ITooltip.call(this),this.xAxisGuideLines_default(!0).yAxisGuideLines_default(!0)}xPos(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)}yPos(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)}curve(){switch(this.interpolate()){case"linear":return R;case"step":return ut;case"step-before":return pt;case"step-after":return dt;case"basis":return G;case"bundle":return Y;case"cardinal":return Z;case"catmullRom":return tt;case"natural":return ht;default:return at}}getScale(){switch(this.pointSizeScale()){case"linear":return i.scaleLinear();case"pow":return i.scalePow().exponent(2);case"log":return i.scaleLog();case"sqrt":return i.scaleSqrt()}}pointColor(t,e,i,n){return this.interpolate()&&this.pointDarken()?this.strokeColor(t,e,i,n):this.fillColor(t,e,i,n)}lineColor(t,e,i,n){return this.interpolateFill()&&this.interpolateDarken()?this.strokeColor(t,e,i,n):this.fillColor(t,e,i,n)}areaColor(t,e,i,n){return this.fillColor(t,e,i,n)}layerEnter(t,e,i=250){super.layerEnter(t,e,i);const n=this;this.tooltipHTML(function(t){return"series-table"===n.tooltipStyle()?n.tooltipFormat({label:t.label,arr:n.columns().slice(1).map(function(e,i){return{label:e,color:n._palette(e),value:n.data()[t.rowIdx][i+1]}})}):n.tooltipFormat({label:t.label,series:t.column,value:t.value})})}layerUpdate(t,e,n=250){super.layerUpdate(t,e);const s="horizontal"===t.orientation(),a=s?this.height():this.width(),r=this;function l(t){switch(t){case"rectangle":return"rect";case"circle":return"circle";case"cross":return"path"}}this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._prevPointShape!==this.pointShape()&&(e.selectAll(".data").remove(),this._prevPointShape=this.pointShape()),o(l,"mapShape");let h,c,u;this.pointSizeColumn_exists()&&(h=this.columns().indexOf(this.pointSizeColumn()),c=i.extent(this.data(),t=>t[h]),u=this.getScale().domain(c));const p=this.layerColumns(t),d=this.layerData(t),f=this.flattenData(p,d).map(function(t){return t.shape=l(r.pointShape()),t.column=p[t.colIdx],t.row=d[t.rowIdx],t.origRow=d[t.rowIdx].__hpcc_origRow,c?(t.size=u(t.row[h])*(r.maxPointSize()-r.minPointSize())+r.minPointSize(),t.column!==r.pointSizeColumn()&&t):(t.size=r.pointSize(),t)}).filter(t=>t),y=e.selectAll(".area").data(p.filter(function(t,e){return r.interpolate()&&r.interpolateFill()&&e>0})),_=y.enter().append("path"),x=B().curve(this.curve());s?x.x(function(e){return r.xPos(t,e)}).y0(Math.min(a,this.yPos(t,{value:0}))).y1(function(e){return r.yPos(t,e)}):x.y(function(e){return r.yPos(t,e)}).x0(Math.max(0,this.xPos(t,{value:0}))).x1(function(e){return r.xPos(t,e)}),_.merge(y).attr("class",t=>"area series series-"+this.cssTag(t)).each(function(t,e){i.select(this).attr("d",x(f.filter(function(t){return t.colIdx===e+1}))).style("opacity",r.interpolateFillOpacity()).style("stroke","none").style("fill",r.areaColor([],t,void 0,[]))}),y.exit().remove();const m=e.selectAll(".line").data(p.filter(function(t,e){return r.interpolate()&&e>0})),g=m.enter().append("path"),b=L().x(function(e){return r.xPos(t,e)}).y(function(e){return r.yPos(t,e)}).curve(this.curve());g.merge(m).attr("class",t=>"line series series-"+this.cssTag(t)).each(function(t,e){const n=i.select(this),s=f.filter(function(t){return t.colIdx===e+1});n.attr("d",b(s)).style("stroke",r.lineColor([],t,void 0,[])).style("fill","none")}),m.exit().remove();const v=e.selectAll(".point").data(f,function(t,e){return t.shape+"_"+e});v.enter().append("g").each(function(e){const n=i.select(this);n.append(e.shape).attr("class","pointShape"),n.append("text").attr("class","pointValue").style("display","none").attr("text-anchor",r.valueAnchor()).attr("alignment-baseline",r.valueBaseline()).attr("fill",function(t,e){return"middle"===r.valueBaseline()||"central"===r.valueBaseline()?r.textColor(t.row,t.column,t.value,t.origRow):null}),n.append("circle").attr("class","pointSelection").on("mouseout.tooltip",r.tooltip.hide).on("mousemove.tooltip",r.tooltip.show).call(t._selection.enter.bind(t._selection)).on("click",function(e,i){r.click(t.rowToObj(t.data()[e.rowIdx]),e.column,t._selection.selected(this))}).on("dblclick",function(e,i){r.dblclick(t.rowToObj(t.data()[e.rowIdx]),e.column,t._selection.selected(this))})}).merge(v).attr("class",t=>"point series series-"+this.cssTag(t.column)).each(function(e){i.select(this).select(".pointValue").attr("x",function(e){return r.xPos(t,e)}).attr("y",function(e){return r.yPos(t,e)}).style("display",r.showValue()?"block":"none").attr("text-anchor",r.valueAnchor()).attr("alignment-baseline",r.valueBaseline()).text(function(t){return t.value});i.select(this).select(".pointSelection").attr("cx",function(e){return r.xPos(t,e)}).attr("cy",function(e){return r.yPos(t,e)}).attr("r",e.size);const n=i.select(this).select(".pointShape");switch(e.shape){case"rect":n.attr("x",function(i){return r.xPos(t,i)-e.size/2}).attr("y",function(i){return r.yPos(t,i)-e.size/2}).attr("width",e.size).attr("height",e.size).style("fill",r.pointColor(e.row,e.column,e.value,e.origRow));break;case"circle":n.attr("cx",function(e){return r.xPos(t,e)}).attr("cy",function(e){return r.yPos(t,e)}).attr("r",.9*e.size).style("fill",r.pointColor(e.row,e.column,e.value,e.origRow));break;case"path":n.attr("d",function(i){return"M"+(r.xPos(t,i)-e.size/2)+" "+(r.yPos(t,i)-e.size/2)+" L"+(r.xPos(t,i)+e.size/2)+" "+(r.yPos(t,i)+e.size/2)+" M"+(r.xPos(t,i)-e.size/2)+" "+(r.yPos(t,i)+e.size/2)+" L"+(r.xPos(t,i)+e.size/2)+" "+(r.yPos(t,i)-e.size/2)}).style("stroke",r.pointColor(e.row,e.column,e.value,e.origRow))}}),v.exit().remove()}exit(t,e){super.exit(t,e)}};o(zt,"Scatter"),a(zt,"__inputs",[{id:"label",type:"any"},{id:"values",type:"number",multi:!0}]);let Ft=zt;Ft.prototype._class+=" chart_Scatter",Ft.prototype.implements(e.INDChart.prototype),Ft.prototype.implements(e.ITooltip.prototype),Ft.prototype.publish("paletteID","default","set","Color palette for this widget",Ft.prototype._palette.switch(),{tags:["Basic","Shared"]}),Ft.prototype.publish("pointSizeScale","linear","set","pointSizeScale",["linear","pow","log","sqrt"]),Ft.prototype.publish("pointShape","cross","set","Shape of the data points",["circle","rectangle","cross"]),Ft.prototype.publish("pointSize",6,"number","Point Size",null,{range:{min:1,step:1,max:200}}),Ft.prototype.publish("interpolate","","set","Interpolate Data",["","linear","step","step-before","step-after","basis","bundle","cardinal","catmullRom","natural","monotone"]),Ft.prototype.publish("pointDarken",!0,"boolean","If true, and interpolate is set, then points will have a slightly darker color than their assigned palette color",null,{disable:o(t=>!t.interpolate(),"disable")}),Ft.prototype.publish("interpolateDarken",!0,"boolean","If true, and interpolateFill is true, then lines will have a slightly darker color than their assigned palette color",null,{disable:o(t=>!t.interpolateFill(),"disable")}),Ft.prototype.publish("interpolateFill",!1,"boolean","If true, the area between the line and zero will be filled"),Ft.prototype.publish("interpolateFillOpacity",.66,"number","Fill interpolation Opacity",null,{range:{min:0,step:.01,max:1}}),Ft.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Ft.prototype.publish("showValue",!1,"boolean"),Ft.prototype.publish("valueAnchor","middle","set","text-anchor for shown value text",["start","middle","end"]),Ft.prototype.publish("valueBaseline","ideographic","set","alignment-baseline for shown value text",["auto","baseline","before-edge","text-before-edge","middle","central","after-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical","inherit"]);const Dt=class _Area extends Ft{constructor(){super(),this.interpolate_default("linear").interpolateFill_default(!0)}};o(Dt,"Area");let Et=Dt;Et.prototype._class+=" chart_Area";const Ot=class _Column extends It{constructor(){super(),a(this,"_linearGap"),a(this,"textLocal",i.local()),a(this,"stackedTextLocal",i.local()),a(this,"isHorizontal"),e.INDChart.call(this),e.ITooltip.call(this),this._selection.skipBringToTop(!0),this._linearGap=25}layerEnter(t,e,i=250){super.layerEnter(t,e,i);const n=this;this.tooltipHTML(function(e){if("series-table"===n.tooltipStyle())return n.tooltipFormat({label:e.row[0],arr:n.columns().slice(1).map(function(t,i){return{label:t,color:n._palette(t),value:e.row[i+1]}})});{let i=e.row[e.idx];return i instanceof Array&&(i=i[1]-i[0]),n.tooltipFormat({label:e.row[0],series:n.layerColumns(t)[e.idx],value:i})}})}adjustedData(t){return this.layerData(t).map(e=>{let i=0;return e.map((e,n)=>{if(0===n)return e;if(n>=this.layerColumns(t).length)return e;const s=t.yAxisStacked()?[i,i+e]:e;return i+=e,s},this)},this)}layerUpdate(t,e,n=250){super.layerUpdate(t,e,n);const s="horizontal"===t.orientation();this.isHorizontal=s;const o=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));const a=i.format(o.showValueAsPercentFormat());let r=10,l=0;switch(t.xAxisType()){case"ordinal":r=t.bandwidth(),l=-r/2;break;case"linear":case"time":r=Math.max(Math.abs(t.dataPos(2)-t.dataPos(1))*(100-this._linearGap)/100,r),l=-r/2}this.tooltip.direction(s?"n":"e");const h=i.scaleBand().domain(o.layerColumns(t).filter(function(t,e){return e>0})).rangeRound(s?[0,r]:[r,0]).paddingInner(this.xAxisSeriesPaddingInner()).paddingOuter(0);let c=[];const u=[],p=this.columns().length,d=this.data();this.showValue()&&"series"===this.showValueAsPercent()&&d.forEach(t=>{t.filter((t,e)=>e>0&&e<p).forEach((t,e)=>{void 0===u[e+1]&&(u[e+1]=0),u[e+1]+=t})}),(this.showDomainTotal()||this.showValue()&&"domain"===this.showValueAsPercent())&&(c=d.map(t=>t.filter((t,e)=>e>0&&e<p).reduce((t,e)=>t+e,0)));const f=e.selectAll(".dataRow").data(this.adjustedData(t)),y=t.data(),_=this.getAxisSize(t);f.enter().append("g").attr("class","dataRow").merge(f).each(function(e,d){const f=i.select(this),x=f.selectAll(".dataCell").data(e.filter(function(e,i){return i<o.layerColumns(t).length}).map(function(i,n){return{column:o.layerColumns(t)[n],row:e,origRow:y[d],value:i,idx:n}}).filter(function(t){return null!==t.value&&t.idx>0}),t=>t.column),m=x.enter().append("g").attr("class","dataCell").on("mouseout.tooltip",function(t){(!o.tooltipInnerTextEllipsedOnly()||t.innerTextObj&&t.innerTextObj.isTruncated)&&o.tooltip.hide.apply(o,arguments)}).on("mousemove.tooltip",function(t){(!o.tooltipInnerTextEllipsedOnly()||t.innerTextObj&&t.innerTextObj.isTruncated)&&o.tooltip.show.apply(o,arguments)}).call(t._selection.enter.bind(t._selection)).on("click",function(e){o.click(t.rowToObj(e.origRow),e.column,t._selection.selected(this))}).on("dblclick",function(e){o.dblclick(t.rowToObj(e.origRow),e.column,t._selection.selected(this))}).style("opacity",0).each(function(t){const e=i.select(this);e.append("rect").attr("class","columnRect series series-"+o.cssTag(t.column)),e.append("text").attr("class","columnRectText").style("stroke","transparent")});m.transition().duration(n).style("opacity",1);const g=t.yAxisStacked()?r:h.bandwidth();m.merge(x).each(function(r){const f=i.select(this),y=t.dataPos(e[0])+(t.yAxisStacked()?0:h(r.column))+l,x=r.value instanceof Array?r.value[1]:r.value;let m=r.origRow[r.idx];if(o.showValue()){const t=o.dataMeta();switch(o.showValueAsPercent()){case"series":const e=void 0!==t.sum?t.sum:u[r.idx];m=a(m/e);break;case"domain":const n=void 0!==t.sum?t.sum:c[d];m=a(m/n);break;default:m=i.format(o.showValueFormat())(m)}}const b=t.valuePos(x),v=t.valuePos(r.value instanceof Array?r.value[0]:0),w=Math.min(v,b),S=Math.abs(b-v),A=o.innerTextFontSize(),k=o.innerTextPadding_exists()?o.innerTextPadding():A/2.5,M=o.intersectRectRect({x:s?y:w,y:s?w:y,width:s?g:S,height:s?S:g},{x:0,y:0,width:_.width,height:_.height}),T=f.select("rect").transition().duration(n).style("fill",t=>o.fillColor(t.row,t.column,t.value,t.origRow));s?T.attr("x",y).attr("y",w).attr("width",g).attr("height",S):T.attr("y",y).attr("x",w).attr("height",g).attr("width",S);const P=f.select("text").transition().duration(n).style("font-size",A+"px").style("fill",t=>o.textColor(t.row,t.column,t.value,t.origRow));P.style("font-family",o.innerTextFontFamily_exists()?o.innerTextFontFamily():null);const C=o.innerTextPadding_exists()?o.innerTextPadding():8,I=A/2.7;if(s){const t=M.y+M.height-k;P.attr("x",y+g/2).attr("y",t+I).attr("transform",`rotate(-90, ${y+g/2}, ${t})`)}else P.attr("x",M.x+C).attr("y",y+g/2+I);P.attr("height",g).attr("width",S),o.showInnerText()&&P.text(t=>{const e=o.innerText(t.origRow,t.origRow[p],t.idx);if(e){const i=s?M.height:M.width,n=o.calcInnerText(i,e,m);return t.innerTextObj=n,n.text}return""});const z=f.selectAll(".dataText").data(o.showValue()?[`${x}`]:[]);z.enter().append("g").attr("class","dataText").each(function(t){o.textLocal.set(this,(new i.Text).target(this).colorStroke_default("transparent"))}).merge(z).each(function(){const t={x:0,y:0},e=o.valueFontFamily(),i=o.valueFontSize(),n=o.textSize(m,e,i),a=parseFloat(m)>=0;let l=o.valueAnchor()?o.valueAnchor():s?"middle":"start";const h=M.x,c=_.width-(M.x+M.width),u=M.y,p=_.height-(M.y+M.height);let d,f,x;if(r.innerTextObj){const{padding:e,valueTextWidth:n}=r.innerTextObj;f=!1,s?(l="middle",t.x=y+g/2,4===r.innerTextObj.category?(f=!0,t.y=w-e-i/2):t.y=w+e+i/2):(l="start",4===r.innerTextObj.category?(f=!0,t.x=S+w+e):t.x=S+w-n-e,t.y=y+g/2)}else s?(d=M.height<n.height,f=!o.valueCentered()||d,t.x=M.x+M.width/2,f?a?(x=u<n.height+C,x?d?t.y=M.y+M.height+n.height:(f=!1,t.y=M.y+M.height/2):t.y=M.y-n.height/2-C):(x=p<n.height,x?d?t.y=M.y-n.height/2-C:(f=!1,t.y=M.y+M.height/2):t.y=M.y+n.height+C):t.y=M.y+M.height/2):(d=M.width<n.width,f=!o.valueCentered()||d,t.y=M.y+M.height/2,f?a?(x=c<n.width+C,x?o.showInnerText()||!d?(f=!1,t.x=M.x+M.width/2):t.x=M.x-(n.width-C):t.x=M.x+M.width+n.width/2+C):(x=h<n.width,x?o.showInnerText()||!d?(f=!1,t.x=M.x+M.width/2):t.x=M.x+M.width+(n.width-C):t.x=M.x-(n.width-C)):t.x=M.x+M.width/2);const b=f?null:o.textColor(r.row,r.column,r.value,r.origRow),v=o.columns(),A=o.yAxisStacked()&&d||f&&o.yAxisStacked()&&v.indexOf(r.column)!==v.length-1;o.textLocal.get(this).pos(t).anchor(l).fontFamily(e).fontSize(i).text(`${m}`).colorFill(b).visible(o.showValue()&&!A).render()}),z.exit().each(function(t){o.textLocal.get(this).target(null)}).remove()}),x.exit().transition().duration(n).style("opacity",0).remove();const b=t.yAxisStacked()?c[d]:Math.max(...e.filter((t,e)=>e>0&&e<p)),v=f.selectAll(".stackedTotalText").data(o.showDomainTotal()?[c[d]]:[]);v.enter().append("g").attr("class","stackedTotalText").each(function(t){o.stackedTextLocal.set(this,(new i.Text).target(this).colorStroke_default("transparent"))}).merge(v).each(function(i){const n={x:0,y:0},a=t.dataPos(e[0]),r=t.valuePos(b),l=o.valueFontFamily(),h=o.valueFontSize(),c=o.textSize(i,l,h),u=parseFloat(i)>=0;let p="middle";s?(n.x=a,n.y=u?r-c.height/2:r+c.height/2):(p="start",n.y=a,n.x=u?r+c.width/2:r-c.width/2),o.stackedTextLocal.get(this).pos(n).anchor(p).fontFamily(l).fontSize(h).text(i).render()}),v.exit().each(function(t){o.textLocal.get(this).target(null)}).remove()}),f.exit().transition().duration(n).remove()}calcInnerText(t,e,i){const n=this.innerTextFontFamily_exists()?this.innerTextFontFamily():"Verdana",s=this.innerTextFontSize(),o=this.valueFontFamily_exists()?this.valueFontFamily():"Verdana",a=this.valueFontSize(),r=this.innerTextPadding_exists()?this.innerTextPadding():s/2.5,l=this.isHorizontal?a:this.textSize(i,o,a).width,h=e,c=3*r+this.textSize("...",n,s).width+l,u=1*r+l;let p=4;if(3*r+this.textSize(e,n,s).width+l<t)p=1;else if(c<t){const i=t-c;let o="";for(const t of e){if(this.textSize(o+t,n,s).width>i){e=o+"...";break}o+=t}p=2}else u<t?(e="",p=3):e="";return{text:e,isTruncated:h!==e,padding:r,category:p,valueTextWidth:l}}innerText(t,e,i){return t[0]}};o(Ot,"Column"),a(Ot,"__inputs",[{id:"label",type:"string"},{id:"values",type:"number",multi:!0}]);let Rt=Ot;Rt.prototype._class+=" chart_Column",Rt.prototype.implements(e.INDChart.prototype),Rt.prototype.implements(e.ITooltip.prototype),Rt.prototype.publish("valueFontFamily",null,"string","Font family of value text",null,{optional:!0}),Rt.prototype.publish("valueFontSize",12,"number","Height of value text (pixels)"),Rt.prototype.publish("innerTextFontFamily",null,"string","Font family of inner text",null,{optional:!0}),Rt.prototype.publish("innerTextPadding",8,"number","Offset of inner text (pixels)",null,{optional:!0}),Rt.prototype.publish("innerTextFontSize",12,"number","Height of inner text (pixels)"),Rt.prototype.publish("paletteID","default","set","Color palette for this widget",()=>Rt.prototype._palette.switch(),{tags:["Basic","Shared"]}),Rt.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Rt.prototype.publish("showValue",!1,"boolean","Show Value in column"),Rt.prototype.publish("showInnerText",!1,"boolean","Show Label in column"),Rt.prototype.publish("showValueFormat",",","string","D3 Format for Value",null,{disable:o(t=>!t.showValue()||!!t.showValueAsPercent(),"disable")}),Rt.prototype.publish("showValueAsPercent",null,"set","If showValue is true, optionally show value as a percentage by Series or Domain",[null,"series","domain"],{disable:o(t=>!t.showValue(),"disable"),optional:!0}),Rt.prototype.publish("showValueAsPercentFormat",".0%","string","D3 Format for %",null,{disable:o(t=>!t.showValue()||!t.showValueAsPercent(),"disable")}),Rt.prototype.publish("showDomainTotal",!1,"boolean","Show Total Value for Stacked Columns",null),Rt.prototype.publish("valueCentered",!1,"boolean","Show Value in center of column"),Rt.prototype.publish("valueAnchor","middle","set","text-anchor for shown value text",["start","middle","end"]),Rt.prototype.publish("xAxisSeriesPaddingInner",0,"number","Determines the ratio of the range that is reserved for blank space between band (0->1)"),Rt.prototype.publish("tooltipInnerTextEllipsedOnly",!1,"boolean","Show tooltip only when inner text is truncated with an ellipsis");const jt=class _Bar extends Rt{constructor(){super(),this.orientation_default("vertical")}};o(jt,"Bar");let Nt=jt;function Lt(t){var e=0,i=t.children,n=i&&i.length;if(n)for(;--n>=0;)e+=i[n].value;else e=1;t.value=e}function Bt(){return this.eachAfter(Lt)}function $t(t){var e,i,n,s,o=this,a=[o];do{for(e=a.reverse(),a=[];o=e.pop();)if(t(o),i=o.children)for(n=0,s=i.length;n<s;++n)a.push(i[n])}while(a.length);return this}function Ht(t){for(var e,i,n=this,s=[n];n=s.pop();)if(t(n),e=n.children)for(i=e.length-1;i>=0;--i)s.push(e[i]);return this}function Vt(t){for(var e,i,n,s=this,o=[s],a=[];s=o.pop();)if(a.push(s),e=s.children)for(i=0,n=e.length;i<n;++i)o.push(e[i]);for(;s=a.pop();)t(s);return this}function qt(t){return this.eachAfter(function(e){for(var i=+t(e.data)||0,n=e.children,s=n&&n.length;--s>=0;)i+=n[s].value;e.value=i})}function Wt(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function Gt(t){for(var e=this,i=Xt(e,t),n=[e];e!==i;)e=e.parent,n.push(e);for(var s=n.length;t!==i;)n.splice(s,0,t),t=t.parent;return n}function Xt(t,e){if(t===e)return t;var i=t.ancestors(),n=e.ancestors(),s=null;for(t=i.pop(),e=n.pop();t===e;)s=t,t=i.pop(),e=n.pop();return s}function Yt(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function Ut(){var t=[];return this.each(function(e){t.push(e)}),t}function Qt(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function Zt(){var t=this,e=[];return t.each(function(i){i!==t&&e.push({source:i.parent,target:i})}),e}function Jt(t,e){var i,n,s,o,a,r=new ne(t),l=+t.value&&(r.value=t.value),h=[r];for(null==e&&(e=te);i=h.pop();)if(l&&(i.value=+i.data.value),(s=e(i.data))&&(a=s.length))for(i.children=new Array(a),o=a-1;o>=0;--o)h.push(n=i.children[o]=new ne(s[o])),n.parent=i,n.depth=i.depth+1;return r.eachBefore(ie)}function Kt(){return Jt(this).eachBefore(ee)}function te(t){return t.children}function ee(t){t.data=t.data.data}function ie(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function ne(t){this.data=t,this.depth=this.height=0,this.parent=null}Nt.prototype._class+=" chart_Bar",o(Lt,"count"),o(Bt,"node_count"),o($t,"node_each"),o(Ht,"node_eachBefore"),o(Vt,"node_eachAfter"),o(qt,"node_sum"),o(Wt,"node_sort"),o(Gt,"node_path"),o(Xt,"leastCommonAncestor"),o(Yt,"node_ancestors"),o(Ut,"node_descendants"),o(Qt,"node_leaves"),o(Zt,"node_links"),o(Jt,"hierarchy"),o(Kt,"node_copy"),o(te,"defaultChildren"),o(ee,"copyData"),o(ie,"computeHeight"),o(ne,"Node$1"),ne.prototype=Jt.prototype={constructor:ne,count:Bt,each:$t,eachAfter:Vt,eachBefore:Ht,sum:qt,sort:Wt,path:Gt,ancestors:Yt,descendants:Ut,leaves:Qt,links:Zt,copy:Kt};var se=Array.prototype.slice;function oe(t){for(var e,i,n=t.length;n;)i=Math.random()*n--|0,e=t[n],t[n]=t[i],t[i]=e;return t}function ae(t){for(var e,i,n=0,s=(t=oe(se.call(t))).length,o=[];n<s;)e=t[n],i&&he(i,e)?++n:(i=ue(o=re(o,e)),n=0);return i}function re(t,e){var i,n;if(ce(e,t))return[e];for(i=0;i<t.length;++i)if(le(e,t[i])&&ce(de(t[i],e),t))return[t[i],e];for(i=0;i<t.length-1;++i)for(n=i+1;n<t.length;++n)if(le(de(t[i],t[n]),e)&&le(de(t[i],e),t[n])&&le(de(t[n],e),t[i])&&ce(fe(t[i],t[n],e),t))return[t[i],t[n],e];throw new Error}function le(t,e){var i=t.r-e.r,n=e.x-t.x,s=e.y-t.y;return i<0||i*i<n*n+s*s}function he(t,e){var i=t.r-e.r+1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function ce(t,e){for(var i=0;i<e.length;++i)if(!he(t,e[i]))return!1;return!0}function ue(t){switch(t.length){case 1:return pe(t[0]);case 2:return de(t[0],t[1]);case 3:return fe(t[0],t[1],t[2])}}function pe(t){return{x:t.x,y:t.y,r:t.r}}function de(t,e){var i=t.x,n=t.y,s=t.r,o=e.x,a=e.y,r=e.r,l=o-i,h=a-n,c=r-s,u=Math.sqrt(l*l+h*h);return{x:(i+o+l/u*c)/2,y:(n+a+h/u*c)/2,r:(u+s+r)/2}}function fe(t,e,i){var n=t.x,s=t.y,o=t.r,a=e.x,r=e.y,l=e.r,h=i.x,c=i.y,u=i.r,p=n-a,d=n-h,f=s-r,y=s-c,_=l-o,x=u-o,m=n*n+s*s-o*o,g=m-a*a-r*r+l*l,b=m-h*h-c*c+u*u,v=d*f-p*y,w=(f*b-y*g)/(2*v)-n,S=(y*_-f*x)/v,A=(d*g-p*b)/(2*v)-s,k=(p*x-d*_)/v,M=S*S+k*k-1,T=2*(o+w*S+A*k),P=w*w+A*A-o*o,C=-(M?(T+Math.sqrt(T*T-4*M*P))/(2*M):P/T);return{x:n+w+S*C,y:s+A+k*C,r:C}}function ye(t,e,i){var n,s,o,a,r=t.x-e.x,l=t.y-e.y,h=r*r+l*l;h?(s=e.r+i.r,s*=s,a=t.r+i.r,s>(a*=a)?(n=(h+a-s)/(2*h),o=Math.sqrt(Math.max(0,a/h-n*n)),i.x=t.x-n*r-o*l,i.y=t.y-n*l+o*r):(n=(h+s-a)/(2*h),o=Math.sqrt(Math.max(0,s/h-n*n)),i.x=e.x+n*r-o*l,i.y=e.y+n*l+o*r)):(i.x=e.x+i.r,i.y=e.y)}function _e(t,e){var i=t.r+e.r-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function xe(t){var e=t._,i=t.next._,n=e.r+i.r,s=(e.x*i.r+i.x*e.r)/n,o=(e.y*i.r+i.y*e.r)/n;return s*s+o*o}function me(t){this._=t,this.next=null,this.previous=null}function ge(t){if(!(s=t.length))return 0;var e,i,n,s,o,a,r,l,h,c,u;if((e=t[0]).x=0,e.y=0,!(s>1))return e.r;if(i=t[1],e.x=-i.r,i.x=e.r,i.y=0,!(s>2))return e.r+i.r;ye(i,e,n=t[2]),e=new me(e),i=new me(i),n=new me(n),e.next=n.previous=i,i.next=e.previous=n,n.next=i.previous=e;t:for(r=3;r<s;++r){ye(e._,i._,n=t[r]),n=new me(n),l=i.next,h=e.previous,c=i._.r,u=e._.r;do{if(c<=u){if(_e(l._,n._)){i=l,e.next=i,i.previous=e,--r;continue t}c+=l._.r,l=l.next}else{if(_e(h._,n._)){(e=h).next=i,i.previous=e,--r;continue t}u+=h._.r,h=h.previous}}while(l!==h.next);for(n.previous=e,n.next=i,e.next=i.previous=i=n,o=xe(e);(n=n.next)!==i;)(a=xe(n))<o&&(e=n,o=a);i=e.next}for(e=[i._],n=i;(n=n.next)!==i;)e.push(n._);for(n=ae(e),r=0;r<s;++r)(e=t[r]).x-=n.x,e.y-=n.y;return n.r}function be(t){return null==t?null:ve(t)}function ve(t){if("function"!=typeof t)throw new Error;return t}function we(){return 0}function Se(t){return function(){return t}}function Ae(t){return Math.sqrt(t.value)}function ke(){var t=null,e=1,i=1,n=we;function s(s){return s.x=e/2,s.y=i/2,t?s.eachBefore(Me(t)).eachAfter(Te(n,.5)).eachBefore(Pe(1)):s.eachBefore(Me(Ae)).eachAfter(Te(we,1)).eachAfter(Te(n,s.r/Math.min(e,i))).eachBefore(Pe(Math.min(e,i)/(2*s.r))),s}return o(s,"pack"),s.radius=function(e){return arguments.length?(t=be(e),s):t},s.size=function(t){return arguments.length?(e=+t[0],i=+t[1],s):[e,i]},s.padding=function(t){return arguments.length?(n="function"==typeof t?t:Se(+t),s):n},s}function Me(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function Te(t,e){return function(i){if(n=i.children){var n,s,o,a=n.length,r=t(i)*e||0;if(r)for(s=0;s<a;++s)n[s].r+=r;if(o=ge(n),r)for(s=0;s<a;++s)n[s].r-=r;i.r=o+r}}}function Pe(t){return function(e){var i=e.parent;e.r*=t,i&&(e.x=i.x+t*e.x,e.y=i.y+t*e.y)}}o(oe,"shuffle"),o(ae,"enclose"),o(re,"extendBasis"),o(le,"enclosesNot"),o(he,"enclosesWeak"),o(ce,"enclosesWeakAll"),o(ue,"encloseBasis"),o(pe,"encloseBasis1"),o(de,"encloseBasis2"),o(fe,"encloseBasis3"),o(ye,"place"),o(_e,"intersects"),o(xe,"score"),o(me,"Node"),o(ge,"packEnclose"),o(be,"optional"),o(ve,"required"),o(we,"constantZero"),o(Se,"constant$2"),o(Ae,"defaultRadius"),o(ke,"d3Pack"),o(Me,"radiusLeaf"),o(Te,"packChildren"),o(Pe,"translateChild");const Ce=class _Bubble extends i.SVGWidget{constructor(){super(),a(this,"labelWidgets"),a(this,"d3Pack"),e.I2DChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this),this._drawStartPos="origin",this.labelWidgets={},this.d3Pack=ke().size([this.width(),this.height()]).padding(1.5)}size(t){const e=super.size.apply(this,arguments);return arguments.length&&this.d3Pack.size([this.width(),this.height()]),e}enter(t,e){super.enter(t,e),this._selection.widgetElement(e);const i=this;this.tooltipHTML(function(t){return"series-table"===i.tooltipStyle()?i.tooltipFormat({label:t[0],arr:i.columns().slice(1).map(function(e,n){return{label:e,color:i._palette(t[0]),value:t[1]}})}):i.tooltipFormat({label:t.data[0],value:t.data[1]})})}update(t,e){super.update(t,e);const n=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));const s=Jt({children:this.cloneData()}).sum(function(t){return t[1]}).sort(function(t,e){return e[1]<t[1]?-1:e[1]>t[1]?1:0});this.d3Pack(s);const o=e.selectAll(".node").data(s.children||[],t=>t.data[0]);o.enter().append("g").attr("class",(t,e)=>"node series series-"+this.cssTag(t.data[0])).attr("opacity",0).call(this._selection.enter.bind(this._selection)).on("click",function(t){n.click(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))}).on("dblclick",function(t){n.dblclick(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))}).each(function(t){const e=i.select(this),s=t.x,o=t.y;e.append("circle").attr("transform","translate("+s+","+o+")").attr("r",0).on("mouseout.tooltip",n.tooltip.hide).on("mousemove.tooltip",n.tooltip.show),t.__viz_faChar?n.labelWidgets[t.data[0]]=(new i.FAChar).char(t.__viz_faChar).target(this).render():n.labelWidgets[t.data[0]]=(new i.Text).text(t.data[0]).target(this).render()}).merge(o).transition().attr("opacity",1).each(function(t){const e=i.select(this),s={x:t.x,y:t.y};e.select("circle").transition().attr("transform","translate("+s.x+","+s.y+")").style("fill",n.fillColor(t.data,n.columns()[1],t.data[1])).attr("r",t.r).select("title").text(t.data[0]+" ("+t.data[1]+")"),t.__viz_faChar?n.labelWidgets[t.data[0]].pos(s).render():n.labelWidgets[t.data[0]].pos(s).colorFill_default(n.textColor(t.data,n.columns()[1],t.data[1])).width(2*t.r).text(t.data[0]).render()}),o.exit().transition().style("opacity",0).remove()}exit(t,e){super.exit(t,e)}};o(Ce,"Bubble"),a(Ce,"__inputs",[{id:"label",type:"string"},{id:"value",type:"number"}]);let Ie=Ce;Ie.prototype._class+=" chart_Bubble",Ie.prototype.implements(e.I2DChart.prototype),Ie.prototype.implements(e.ITooltip.prototype),Ie.prototype.mixin(i.Utility.SimpleSelectionMixin),Ie.prototype.publish("paletteID","default","set","Color palette for this widget",Ie.prototype._palette.switch(),{tags:["Basic","Shared"]}),Ie.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]});const ze=class _BubbleXY extends Ft{constructor(){super()}enter(t,e){this.pointSizeColumn_exists()||this.pointSizeColumn(this.columns()[this.columns().length-1]),super.enter(t,e)}};o(ze,"BubbleXY");let Fe=ze;Fe.prototype._class+=" chart_BubbleXY";var De,Ee,Oe=0,Re=0,je=0,Ne=0,Le=0,Be=0,$e="object"==typeof performance&&performance.now?performance:Date,He="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ve(){return Le||(He(qe),Le=$e.now()+Be)}function qe(){Le=0}function We(){this._call=this._time=this._next=null}function Ge(){Ve(),++Oe;for(var t,e=De;e;)(t=Le-e._time)>=0&&e._call.call(null,t),e=e._next;--Oe}function Xe(){Le=(Ne=$e.now())+Be,Oe=Re=0;try{Ge()}finally{Oe=0,Ue(),Le=0}}function Ye(){var t=$e.now(),e=t-Ne;e>1e3&&(Be-=e,Ne=t)}function Ue(){for(var t,e,i=De,n=1/0;i;)i._call?(n>i._time&&(n=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:De=e);Ee=t,Qe(n)}function Qe(t){Oe||(Re&&(Re=clearTimeout(Re)),t-Le>24?(t<1/0&&(Re=setTimeout(Xe,t-$e.now()-Be)),je&&(je=clearInterval(je))):(je||(Ne=$e.now(),je=setInterval(Ye,1e3)),Oe=1,He(Xe)))}function Ze(){var t="left",e=!1,n=!1,s=Je,a=Ke,r=ti,l=380,h=30,c=Mt();function u(t){t.each(function(t,o){var u,p,d=s.call(this,t,o).slice().sort(i.descending),f=a.call(this,t,o).slice().sort(i.descending),y=r.call(this,t,o).slice().sort(i.descending),_=i.select(this),x=_.select("g.wrap");x.empty()&&(x=_.append("g").attr("class","wrap")),n?(u=h,p=l,x.attr("transform","rotate(90)translate(0,"+-l+")")):(u=l,p=h,x.attr("transform",null));var m=i.scaleLinear().domain([0,Math.max(d[0],f[0],y[0])]).range(e?[u,0]:[0,u]),g=this.__chart__||i.scaleLinear().domain([0,1/0]).range(m.range());this.__chart__=m;var b=ei(g),v=ei(m),w=x.selectAll("rect.range").data(d);w.enter().append("rect").attr("class",function(t,e){return"range s"+e}).attr("width",b).attr("height",p).attr("x",e?g:0).merge(w).transition(w).attr("x",e?m:0).attr("width",v).attr("height",p);var S=x.selectAll("rect.measure").data(y);S.enter().append("rect").attr("class",function(t,e){return"measure s"+e}).attr("width",b).attr("height",p/3).attr("x",e?g:0).attr("y",p/3).merge(S).transition(S).attr("width",v).attr("height",p/3).attr("x",e?m:0).attr("y",p/3);var A=x.selectAll("line.marker").data(f);A.enter().append("line").attr("class","marker").attr("x1",g).attr("x2",g).attr("y1",p/6).attr("y2",5*p/6).merge(A).transition(A).attr("x1",m).attr("x2",m).attr("y1",p/6).attr("y2",5*p/6);var k=_.selectAll("g.axis").data([0]);k.enter().append("g").attr("class","axis"),k.attr("transform",n?null:"translate(0,"+p+")").call(c.scale(m))}),Ge()}return o(u,"bulvar"),u.orient=function(i){return arguments.length?(e="right"===(t=i+"")||"bottom"===t,c.orient((n="top"===t||"bottom"===t)?"left":"bottom"),u):t},u.ranges=function(t){return arguments.length?(s=t,u):s},u.markers=function(t){return arguments.length?(a=t,u):a},u.measures=function(t){return arguments.length?(r=t,u):r},u.width=function(t){return arguments.length?(l=+t,u):l},u.height=function(t){return arguments.length?(h=+t,u):h},u.tickFormat=function(t){return arguments.length?(c.tickFormat(t),u):c.tickFormat()},u}function Je(t){return t.ranges}function Ke(t){return t.markers}function ti(t){return t.measures}function ei(t){var e=t(0);return function(i){return Math.abs(t(i)-e)}}o(Ve,"now"),o(qe,"clearNow"),o(We,"Timer"),We.prototype={constructor:We,restart:o(function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?Ve():+i)+(null==e?0:+e),this._next||Ee===this||(Ee?Ee._next=this:De=this,Ee=this),this._call=t,this._time=i,Qe()},"restart"),stop:o(function(){this._call&&(this._call=null,this._time=1/0,Qe())},"stop")},o(Ge,"timerFlush"),o(Xe,"wake"),o(Ye,"poke"),o(Ue,"nap"),o(Qe,"sleep"),o(Ze,"d3Bullet"),o(Je,"bulvarRanges"),o(Ke,"bulvarMarkers"),o(ti,"bulvarMeasures"),o(ei,"bulvarWidth");const ii=class _Bullet extends i.HTMLWidget{constructor(){super(),a(this,"_hiddenColumns",{}),a(this,"_selection"),i.Utility.SimpleSelectionMixin.call(this,!0)}bulletData(){const t=this;this._hiddenColumns={};const e=this.columns();return this.data().map(function(t){return{title:i(t,this.titleColumn()),subtitle:i(t,this.subtitleColumn()),ranges:i(t,this.rangesColumn(),"range"),measures:i(t,this.measuresColumn(),"measure"),markers:i(t,this.markersColumn(),"marker"),origRow:t}},this);function i(i,n,s){const o=e.indexOf(n);return o>=0?i[o]instanceof Array?i[o]:[i[o]]:(s&&(t._hiddenColumns[s]=!0),[0])}}enter(t,e){super.enter(t,e),i.select(t.parentNode).style("overflow","auto"),this._selection.widgetElement(e)}update(t,e){super.update(t,e);const n=this;e.selectAll(".axis").style("display","none"),e.selectAll(".range,.measure,.marker").style("display",null);const s=2,o=8,a=2,r=8,l=this.width()-s-a,h=40-o-r,c=e.selectAll("svg").data(this.bulletData()),u=c.enter().append("svg").attr("class","bullet").call(this._selection.enter.bind(this._selection)).on("click",function(t){n.click(n.rowToObj(t.origRow),n.titleColumn(),n._selection.selected(this))}).on("dblclick",function(t){n.dblclick(n.rowToObj(t.origRow),n.titleColumn(),n._selection.selected(this))}).each(function(){const t=i.select(this).append("g").attr("class",(t,e)=>"bulletBar series series-"+n.cssTag(n.titleColumn())).append("g").attr("class","bulletTitle");t.append("text").attr("class","title"),t.append("text").attr("class","subtitle").attr("dy","1em")}).merge(c),p=u.select(".bulletTitle").style("text-anchor","end").attr("transform","translate(-6,"+h/2+")");p.select(".title").text(function(t){return t.title}),p.select(".subtitle").text(function(t){return t.subtitle});let d=0;p.each(function(){const t=this.getBBox();t.width>d&&(d=t.width)});const f=Ze().width(l-d-6).height(h);u.attr("width",l).attr("height",h+o+r).style("margin-left",`${s}px`),u.select(".bulletBar").attr("transform","translate("+(d+6)+","+o+")").call(f),c.exit().remove(),Object.keys(this._hiddenColumns).length>0&&e.selectAll(`.${Object.keys(this._hiddenColumns).join(",.")}`).style("display","none")}exit(t,e){super.exit(t,e)}click(t,e,i){}dblclick(t,e,i){}};o(ii,"Bullet");let ni=ii;ni.prototype._class+=" chart_Bullet",ni.prototype.publish("titleColumn",null,"set","Title Column",function(){return this.columns()},{optional:!0}),ni.prototype.publish("subtitleColumn",null,"set","Subtitle Column",function(){return this.columns()},{optional:!0}),ni.prototype.publish("rangesColumn",null,"set","Ranges Column",function(){return this.columns()},{optional:!0}),ni.prototype.publish("measuresColumn",null,"set","Measures Column",function(){return this.columns()},{optional:!0}),ni.prototype.publish("markersColumn",null,"set","Markers Column",function(){return this.columns()},{optional:!0});var si=Array.prototype.slice;function oi(t,e){return t-e}function ai(t){for(var e=0,i=t.length,n=t[i-1][1]*t[0][0]-t[i-1][0]*t[0][1];++e<i;)n+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return n}function ri(t){return function(){return t}}function li(t,e){for(var i,n=-1,s=e.length;++n<s;)if(i=hi(t,e[n]))return i;return 0}function hi(t,e){for(var i=e[0],n=e[1],s=-1,o=0,a=t.length,r=a-1;o<a;r=o++){var l=t[o],h=l[0],c=l[1],u=t[r],p=u[0],d=u[1];if(ci(l,u,e))return 0;c>n!=d>n&&i<(p-h)*(n-c)/(d-c)+h&&(s=-s)}return s}function ci(t,e,i){var n;return ui(t,e,i)&&pi(t[n=+(t[0]===e[0])],i[n],e[n])}function ui(t,e,i){return(e[0]-t[0])*(i[1]-t[1])===(i[0]-t[0])*(e[1]-t[1])}function pi(t,e,i){return t<=e&&e<=i||i<=e&&e<=t}function di(){}o(oi,"ascending"),o(ai,"area"),o(ri,"constant$1"),o(li,"contains"),o(hi,"ringContains"),o(ci,"segmentContains"),o(ui,"collinear"),o(pi,"within"),o(di,"noop$2");var fi=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function yi(){var t=1,e=1,n=i.thresholdSturges,s=c;function a(t){var e=n(t);if(Array.isArray(e))e=e.slice().sort(oi);else{var s=i.extent(t),o=s[0],a=s[1];e=i.tickStep(o,a,e),e=i.range(Math.floor(o/e)*e,Math.floor(a/e)*e,e)}return e.map(function(e){return r(t,e)})}function r(t,e){var i=[],n=[];return l(t,e,function(o){s(o,t,e),ai(o)>0?i.push([o]):n.push(o)}),n.forEach(function(t){for(var e,n=0,s=i.length;n<s;++n)if(-1!==li((e=i[n])[0],t))return void e.push(t)}),{type:"MultiPolygon",value:e,coordinates:i}}function l(i,n,s){var a,r,l,c,u,p,d=new Array,f=new Array;for(a=r=-1,c=i[0]>=n,fi[c<<1].forEach(y);++a<t-1;)l=c,c=i[a+1]>=n,fi[l|c<<1].forEach(y);for(fi[c|0].forEach(y);++r<e-1;){for(a=-1,c=i[r*t+t]>=n,u=i[r*t]>=n,fi[c<<1|u<<2].forEach(y);++a<t-1;)l=c,c=i[r*t+t+a+1]>=n,p=u,u=i[r*t+a+1]>=n,fi[l|c<<1|u<<2|p<<3].forEach(y);fi[c|u<<3].forEach(y)}for(a=-1,u=i[r*t]>=n,fi[u<<2].forEach(y);++a<t-1;)p=u,u=i[r*t+a+1]>=n,fi[u<<2|p<<3].forEach(y);function y(t){var e,i,n=[t[0][0]+a,t[0][1]+r],o=[t[1][0]+a,t[1][1]+r],l=h(n),c=h(o);(e=f[l])?(i=d[c])?(delete f[e.end],delete d[i.start],e===i?(e.ring.push(o),s(e.ring)):d[e.start]=f[i.end]={start:e.start,end:i.end,ring:e.ring.concat(i.ring)}):(delete f[e.end],e.ring.push(o),f[e.end=c]=e):(e=d[c])?(i=f[l])?(delete d[e.start],delete f[i.end],e===i?(e.ring.push(o),s(e.ring)):d[i.start]=f[e.end]={start:i.start,end:e.end,ring:i.ring.concat(e.ring)}):(delete d[e.start],e.ring.unshift(n),d[e.start=l]=e):d[l]=f[c]={start:l,end:c,ring:[n,o]}}fi[u<<3].forEach(y),o(y,"stitch")}function h(e){return 2*e[0]+e[1]*(t+1)*4}function c(i,n,s){i.forEach(function(i){var o,a=i[0],r=i[1],l=0|a,h=0|r,c=n[h*t+l];a>0&&a<t&&l===a&&(o=n[h*t+l-1],i[0]=a+(s-o)/(c-o)-.5),r>0&&r<e&&h===r&&(o=n[(h-1)*t+l],i[1]=r+(s-o)/(c-o)-.5)})}return o(a,"contours"),o(r,"contour"),o(l,"isorings"),o(h,"index"),o(c,"smoothLinear"),a.contour=r,a.size=function(i){if(!arguments.length)return[t,e];var n=Math.ceil(i[0]),s=Math.ceil(i[1]);if(!(n>0&&s>0))throw new Error("invalid size");return t=n,e=s,a},a.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:Array.isArray(t)?ri(si.call(t)):ri(t),a):n},a.smooth=function(t){return arguments.length?(s=t?c:di,a):s===c},a}function _i(t,e,i){for(var n=t.width,s=t.height,o=1+(i<<1),a=0;a<s;++a)for(var r=0,l=0;r<n+i;++r)r<n&&(l+=t.data[r+a*n]),r>=i&&(r>=o&&(l-=t.data[r-o+a*n]),e.data[r-i+a*n]=l/Math.min(r+1,n-1+o-r,o))}function xi(t,e,i){for(var n=t.width,s=t.height,o=1+(i<<1),a=0;a<n;++a)for(var r=0,l=0;r<s+i;++r)r<s&&(l+=t.data[a+r*n]),r>=i&&(r>=o&&(l-=t.data[a+(r-o)*n]),e.data[a+(r-i)*n]=l/Math.min(r+1,s-1+o-r,o))}function mi(t){return t[0]}function gi(t){return t[1]}function bi(){return 1}function vi(){var t=mi,e=gi,n=bi,s=960,a=500,r=20,l=2,h=3*r,c=s+2*h>>l,u=a+2*h>>l,p=ri(20);function d(s){var o=new Float32Array(c*u),a=new Float32Array(c*u);s.forEach(function(i,s,a){var r=+t(i,s,a)+h>>l,p=+e(i,s,a)+h>>l,d=+n(i,s,a);r>=0&&r<c&&p>=0&&p<u&&(o[r+p*c]+=d)}),_i({width:c,height:u,data:o},{data:a},r>>l),xi({width:c,height:u,data:a},{data:o},r>>l),_i({width:c,height:u,data:o},{data:a},r>>l),xi({width:c,height:u,data:a},{data:o},r>>l),_i({width:c,height:u,data:o},{data:a},r>>l),xi({width:c,height:u,data:a},{data:o},r>>l);var d=p(o);if(!Array.isArray(d)){var y=i.max(o);d=i.tickStep(0,y,d),(d=i.range(0,Math.floor(y/d)*d,d)).shift()}return yi().thresholds(d).size([c,u])(o).map(f)}function f(t){return t.value*=Math.pow(2,-2*l),t.coordinates.forEach(y),t}function y(t){t.forEach(_)}function _(t){t.forEach(x)}function x(t){t[0]=t[0]*Math.pow(2,l)-h,t[1]=t[1]*Math.pow(2,l)-h}function m(){return c=s+2*(h=3*r)>>l,u=a+2*h>>l,d}return o(d,"density"),o(f,"transform"),o(y,"transformPolygon"),o(_,"transformRing"),o(x,"transformPoint"),o(m,"resize"),d.x=function(e){return arguments.length?(t="function"==typeof e?e:ri(+e),d):t},d.y=function(t){return arguments.length?(e="function"==typeof t?t:ri(+t),d):e},d.weight=function(t){return arguments.length?(n="function"==typeof t?t:ri(+t),d):n},d.size=function(t){if(!arguments.length)return[s,a];var e=Math.ceil(t[0]),i=Math.ceil(t[1]);if(!(e>=0||e>=0))throw new Error("invalid size");return s=e,a=i,m()},d.cellSize=function(t){if(!arguments.length)return 1<<l;if(!((t=+t)>=1))throw new Error("invalid cell size");return l=Math.floor(Math.log(t)/Math.LN2),m()},d.thresholds=function(t){return arguments.length?(p="function"==typeof t?t:Array.isArray(t)?ri(si.call(t)):ri(t),d):p},d.bandwidth=function(t){if(!arguments.length)return Math.sqrt(r*(r+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return r=Math.round((Math.sqrt(4*t*t+1)-1)/2),m()},d}function wi(){return new Si}function Si(){this.reset()}o(yi,"contours"),o(_i,"blurX"),o(xi,"blurY"),o(mi,"defaultX"),o(gi,"defaultY"),o(bi,"defaultWeight"),o(vi,"d3ContourDensity"),o(wi,"adder"),o(Si,"Adder"),Si.prototype={constructor:Si,reset:o(function(){this.s=this.t=0},"reset"),add:o(function(t){ki(Ai,t,this.t),ki(this,Ai.s,this.s),this.s?this.t+=Ai.t:this.s=Ai.t},"add"),valueOf:o(function(){return this.s},"valueOf")};var Ai=new Si;function ki(t,e,i){var n=t.s=e+i,s=n-e,o=n-s;t.t=e-o+(i-s)}o(ki,"add");var Mi=2*Math.PI,Ti=Math.abs,Pi=Math.sqrt;function Ci(){}function Ii(t,e){t&&Fi.hasOwnProperty(t.type)&&Fi[t.type](t,e)}o(Ci,"noop$1"),o(Ii,"streamGeometry");var zi={Feature:o(function(t,e){Ii(t.geometry,e)},"Feature"),FeatureCollection:o(function(t,e){for(var i=t.features,n=-1,s=i.length;++n<s;)Ii(i[n].geometry,e)},"FeatureCollection")},Fi={Sphere:o(function(t,e){e.sphere()},"Sphere"),Point:o(function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},"Point"),MultiPoint:o(function(t,e){for(var i=t.coordinates,n=-1,s=i.length;++n<s;)t=i[n],e.point(t[0],t[1],t[2])},"MultiPoint"),LineString:o(function(t,e){Di(t.coordinates,e,0)},"LineString"),MultiLineString:o(function(t,e){for(var i=t.coordinates,n=-1,s=i.length;++n<s;)Di(i[n],e,0)},"MultiLineString"),Polygon:o(function(t,e){Ei(t.coordinates,e)},"Polygon"),MultiPolygon:o(function(t,e){for(var i=t.coordinates,n=-1,s=i.length;++n<s;)Ei(i[n],e)},"MultiPolygon"),GeometryCollection:o(function(t,e){for(var i=t.geometries,n=-1,s=i.length;++n<s;)Ii(i[n],e)},"GeometryCollection")};function Di(t,e,i){var n,s=-1,o=t.length-i;for(e.lineStart();++s<o;)n=t[s],e.point(n[0],n[1],n[2]);e.lineEnd()}function Ei(t,e){var i=-1,n=t.length;for(e.polygonStart();++i<n;)Di(t[i],e,1);e.polygonEnd()}function Oi(t,e){t&&zi.hasOwnProperty(t.type)?zi[t.type](t,e):Ii(t,e)}function Ri(t){return t}o(Di,"streamLine"),o(Ei,"streamPolygon"),o(Oi,"geoStream"),o(Ri,"identity");var ji,Ni,Li,Bi,$i=wi(),Hi=wi(),Vi={point:Ci,lineStart:Ci,lineEnd:Ci,polygonStart:o(function(){Vi.lineStart=qi,Vi.lineEnd=Xi},"polygonStart"),polygonEnd:o(function(){Vi.lineStart=Vi.lineEnd=Vi.point=Ci,$i.add(Ti(Hi)),Hi.reset()},"polygonEnd"),result:o(function(){var t=$i/2;return $i.reset(),t},"result")};function qi(){Vi.point=Wi}function Wi(t,e){Vi.point=Gi,ji=Li=t,Ni=Bi=e}function Gi(t,e){Hi.add(Bi*t-Li*e),Li=t,Bi=e}function Xi(){Gi(ji,Ni)}o(qi,"areaRingStart"),o(Wi,"areaPointFirst"),o(Gi,"areaPoint"),o(Xi,"areaRingEnd");var Yi=1/0,Ui=Yi,Qi=-Yi,Zi=Qi,Ji={point:Ki,lineStart:Ci,lineEnd:Ci,polygonStart:Ci,polygonEnd:Ci,result:o(function(){var t=[[Yi,Ui],[Qi,Zi]];return Qi=Zi=-(Ui=Yi=1/0),t},"result")};function Ki(t,e){t<Yi&&(Yi=t),t>Qi&&(Qi=t),e<Ui&&(Ui=e),e>Zi&&(Zi=e)}o(Ki,"boundsPoint");var tn,en,nn,sn,on=0,an=0,rn=0,ln=0,hn=0,cn=0,un=0,pn=0,dn=0,fn={point:yn,lineStart:_n,lineEnd:gn,polygonStart:o(function(){fn.lineStart=bn,fn.lineEnd=vn},"polygonStart"),polygonEnd:o(function(){fn.point=yn,fn.lineStart=_n,fn.lineEnd=gn},"polygonEnd"),result:o(function(){var t=dn?[un/dn,pn/dn]:cn?[ln/cn,hn/cn]:rn?[on/rn,an/rn]:[NaN,NaN];return on=an=rn=ln=hn=cn=un=pn=dn=0,t},"result")};function yn(t,e){on+=t,an+=e,++rn}function _n(){fn.point=xn}function xn(t,e){fn.point=mn,yn(nn=t,sn=e)}function mn(t,e){var i=t-nn,n=e-sn,s=Pi(i*i+n*n);ln+=s*(nn+t)/2,hn+=s*(sn+e)/2,cn+=s,yn(nn=t,sn=e)}function gn(){fn.point=yn}function bn(){fn.point=wn}function vn(){Sn(tn,en)}function wn(t,e){fn.point=Sn,yn(tn=nn=t,en=sn=e)}function Sn(t,e){var i=t-nn,n=e-sn,s=Pi(i*i+n*n);ln+=s*(nn+t)/2,hn+=s*(sn+e)/2,cn+=s,un+=(s=sn*t-nn*e)*(nn+t),pn+=s*(sn+e),dn+=3*s,yn(nn=t,sn=e)}function An(t){this._context=t}o(yn,"centroidPoint"),o(_n,"centroidLineStart"),o(xn,"centroidPointFirstLine"),o(mn,"centroidPointLine"),o(gn,"centroidLineEnd"),o(bn,"centroidRingStart"),o(vn,"centroidRingEnd"),o(wn,"centroidPointFirstRing"),o(Sn,"centroidPointRing"),o(An,"PathContext"),An.prototype={_radius:4.5,pointRadius:o(function(t){return this._radius=t,this},"pointRadius"),polygonStart:o(function(){this._line=0},"polygonStart"),polygonEnd:o(function(){this._line=NaN},"polygonEnd"),lineStart:o(function(){this._point=0},"lineStart"),lineEnd:o(function(){0===this._line&&this._context.closePath(),this._point=NaN},"lineEnd"),point:o(function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Mi)}},"point"),result:Ci};var kn,Mn,Tn,Pn,Cn,In=wi(),zn={point:Ci,lineStart:o(function(){zn.point=Fn},"lineStart"),lineEnd:o(function(){kn&&Dn(Mn,Tn),zn.point=Ci},"lineEnd"),polygonStart:o(function(){kn=!0},"polygonStart"),polygonEnd:o(function(){kn=null},"polygonEnd"),result:o(function(){var t=+In;return In.reset(),t},"result")};function Fn(t,e){zn.point=Dn,Mn=Pn=t,Tn=Cn=e}function Dn(t,e){Pn-=t,Cn-=e,In.add(Pi(Pn*Pn+Cn*Cn)),Pn=t,Cn=e}function En(){this._string=[]}function On(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Rn(t,e){var i,n,s=4.5;function a(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Oi(t,i(n))),n.result()}return o(a,"path"),a.area=function(t){return Oi(t,i(Vi)),Vi.result()},a.measure=function(t){return Oi(t,i(zn)),zn.result()},a.bounds=function(t){return Oi(t,i(Ji)),Ji.result()},a.centroid=function(t){return Oi(t,i(fn)),fn.result()},a.projection=function(e){return arguments.length?(i=null==e?(t=null,Ri):(t=e).stream,a):t},a.context=function(t){return arguments.length?(n=null==t?(e=null,new En):new An(e=t),"function"!=typeof s&&n.pointRadius(s),a):e},a.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),a):s},a.projection(t).context(e)}o(Fn,"lengthPointFirst"),o(Dn,"lengthPoint"),o(En,"PathString"),En.prototype={_radius:4.5,_circle:On(4.5),pointRadius:o(function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},"pointRadius"),polygonStart:o(function(){this._line=0},"polygonStart"),polygonEnd:o(function(){this._line=NaN},"polygonEnd"),lineStart:o(function(){this._point=0},"lineStart"),lineEnd:o(function(){0===this._line&&this._string.push("Z"),this._point=NaN},"lineEnd"),point:o(function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=On(this._radius)),this._string.push("M",t,",",e,this._circle)}},"point"),result:o(function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null},"result")},o(On,"circle"),o(Rn,"geoPath");const jn=class _Contour extends It{constructor(){super(),a(this,"_dataMinWeight"),a(this,"_dataMaxWeight"),this.xAxisGuideLines_default(!1).yAxisGuideLines_default(!1).xAxisType_default("linear")}xPos(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)}yPos(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)}layerEnter(t,e,i=250){super.layerEnter(t,e,i)}layerUpdate(t,e,i=250){super.layerUpdate(t,e,i),this._palette=this._palette.switch(this.paletteID());const n=this.flattenData(this.layerColumns(t),this.layerData(t)),s=vi().x(e=>this.xPos(t,e)).y(e=>this.yPos(t,e)).size([this.width(),this.height()]).bandwidth(this.contourBandwidth())(n),o=s.map(t=>t.value),a=Math.min.apply(this,o),r=Math.max.apply(this,o);this._dataMinWeight=a,this._dataMaxWeight=r;const l=e.selectAll("path").data(s);l.enter().append("path").merge(l).attr("d",Rn()).attr("fill",t=>this.showContourFill()?this._palette(t.value,a,r):"none").attr("stroke",this.contourStrokeColor()).attr("stroke-linejoin","round").attr("stroke-width",this.contourStrokeWidth()),l.exit().remove()}exit(t,e){super.exit(t,e)}};o(jn,"Contour"),a(jn,"__inputs",[{id:"x",type:"any"},{id:"y",type:"number"}]);let Nn=jn;Nn.prototype._class+=" chart_Contour",Nn.prototype.implements(e.I1DChart.prototype),Nn.prototype.publish("paletteID","YlGnBu","string","Color palette for this widget"),Nn.prototype.publish("useClonedPalette",!0,"boolean","Enable or disable using a cloned palette"),Nn.prototype.publish("showContourFill",!0,"boolean","Show/hide the contour background colors"),Nn.prototype.publish("showContour",!0,"boolean","Show/hide the contour border lines"),Nn.prototype.publish("contourBandwidth",40,"number","Controls the sensitivity of the contour grouping algorithm"),Nn.prototype.publish("contourStrokeColor","#2C3A47","html-color","Color of the contour border lines"),Nn.prototype.publish("contourStrokeWidth",1,"number","Width of the contour border lines");const Ln=class _Gantt extends Nt{constructor(){super(),this.orientation_default("vertical").xAxisType_default("ordinal").yAxisType_default("time")}};o(Ln,"Gantt");let Bn=Ln;function $n(t){return o(function(){return t},"constant")}Bn.prototype._class+=" chart_Gantt",o($n,"constant");var Hn=1e-12,Vn=Math.PI,qn=Vn/2,Wn=2*Vn;function Gn(t){return t.innerRadius}function Xn(t){return t.outerRadius}function Yn(t){return t.startAngle}function Un(t){return t.endAngle}function Qn(t){return t&&t.padAngle}function Zn(t){return t>=1?qn:t<=-1?-qn:Math.asin(t)}function Jn(t,e,i,n,s,o,a,r){var l=i-t,h=n-e,c=a-s,u=r-o,p=(c*(e-o)-u*(t-s))/(u*l-c*h);return[t+p*l,e+p*h]}function Kn(t,e,i,n,s,o,a){var r=t-i,l=e-n,h=(a?o:-o)/Math.sqrt(r*r+l*l),c=h*l,u=-h*r,p=t+c,d=e+u,f=i+c,y=n+u,_=(p+f)/2,x=(d+y)/2,m=f-p,g=y-d,b=m*m+g*g,v=s-o,w=p*y-f*d,S=(g<0?-1:1)*Math.sqrt(Math.max(0,v*v*b-w*w)),A=(w*g-m*S)/b,k=(-w*m-g*S)/b,M=(w*g+m*S)/b,T=(-w*m+g*S)/b,P=A-_,C=k-x,I=M-_,z=T-x;return P*P+C*C>I*I+z*z&&(A=M,k=T),{cx:A,cy:k,x01:-c,y01:-u,x11:A*(s/v-1),y11:k*(s/v-1)}}function ts(){var t=Gn,e=Xn,i=$n(0),n=null,s=Yn,a=Un,r=Qn,l=null;function h(){var o,h,c=+t.apply(this,arguments),u=+e.apply(this,arguments),d=s.apply(this,arguments)-qn,f=a.apply(this,arguments)-qn,y=Math.abs(f-d),_=f>d;if(l||(l=o=p()),u<c&&(h=u,u=c,c=h),u>Hn)if(y>Wn-Hn)l.moveTo(u*Math.cos(d),u*Math.sin(d)),l.arc(0,0,u,d,f,!_),c>Hn&&(l.moveTo(c*Math.cos(f),c*Math.sin(f)),l.arc(0,0,c,f,d,_));else{var x,m,g=d,b=f,v=d,w=f,S=y,A=y,k=r.apply(this,arguments)/2,M=k>Hn&&(n?+n.apply(this,arguments):Math.sqrt(c*c+u*u)),T=Math.min(Math.abs(u-c)/2,+i.apply(this,arguments)),P=T,C=T;if(M>Hn){var I=Zn(M/c*Math.sin(k)),z=Zn(M/u*Math.sin(k));(S-=2*I)>Hn?(v+=I*=_?1:-1,w-=I):(S=0,v=w=(d+f)/2),(A-=2*z)>Hn?(g+=z*=_?1:-1,b-=z):(A=0,g=b=(d+f)/2)}var F=u*Math.cos(g),D=u*Math.sin(g),E=c*Math.cos(w),O=c*Math.sin(w);if(T>Hn){var R=u*Math.cos(b),j=u*Math.sin(b),N=c*Math.cos(v),L=c*Math.sin(v);if(y<Vn){var B=S>Hn?Jn(F,D,N,L,R,j,E,O):[E,O],$=F-B[0],H=D-B[1],V=R-B[0],q=j-B[1],W=1/Math.sin(Math.acos(($*V+H*q)/(Math.sqrt($*$+H*H)*Math.sqrt(V*V+q*q)))/2),G=Math.sqrt(B[0]*B[0]+B[1]*B[1]);P=Math.min(T,(c-G)/(W-1)),C=Math.min(T,(u-G)/(W+1))}}A>Hn?C>Hn?(x=Kn(N,L,F,D,u,C,_),m=Kn(R,j,E,O,u,C,_),l.moveTo(x.cx+x.x01,x.cy+x.y01),C<T?l.arc(x.cx,x.cy,C,Math.atan2(x.y01,x.x01),Math.atan2(m.y01,m.x01),!_):(l.arc(x.cx,x.cy,C,Math.atan2(x.y01,x.x01),Math.atan2(x.y11,x.x11),!_),l.arc(0,0,u,Math.atan2(x.cy+x.y11,x.cx+x.x11),Math.atan2(m.cy+m.y11,m.cx+m.x11),!_),l.arc(m.cx,m.cy,C,Math.atan2(m.y11,m.x11),Math.atan2(m.y01,m.x01),!_))):(l.moveTo(F,D),l.arc(0,0,u,g,b,!_)):l.moveTo(F,D),c>Hn&&S>Hn?P>Hn?(x=Kn(E,O,R,j,c,-P,_),m=Kn(F,D,N,L,c,-P,_),l.lineTo(x.cx+x.x01,x.cy+x.y01),P<T?l.arc(x.cx,x.cy,P,Math.atan2(x.y01,x.x01),Math.atan2(m.y01,m.x01),!_):(l.arc(x.cx,x.cy,P,Math.atan2(x.y01,x.x01),Math.atan2(x.y11,x.x11),!_),l.arc(0,0,c,Math.atan2(x.cy+x.y11,x.cx+x.x11),Math.atan2(m.cy+m.y11,m.cx+m.x11),_),l.arc(m.cx,m.cy,P,Math.atan2(m.y11,m.x11),Math.atan2(m.y01,m.x01),!_))):l.arc(0,0,c,w,v,_):l.lineTo(E,O)}else l.moveTo(0,0);if(l.closePath(),o)return l=null,o+""||null}return o(h,"arc"),h.centroid=function(){var i=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,n=(+s.apply(this,arguments)+ +a.apply(this,arguments))/2-Vn/2;return[Math.cos(n)*i,Math.sin(n)*i]},h.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:$n(+e),h):t},h.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:$n(+t),h):e},h.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:$n(+t),h):i},h.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:$n(+t),h):n},h.startAngle=function(t){return arguments.length?(s="function"==typeof t?t:$n(+t),h):s},h.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:$n(+t),h):a},h.padAngle=function(t){return arguments.length?(r="function"==typeof t?t:$n(+t),h):r},h.context=function(t){return arguments.length?(l=null==t?null:t,h):l},h}function es(t){this._context=t}function is(t){return new es(t)}function ns(t){return t[0]}function ss(t){return t[1]}function os(){var t=ns,e=ss,i=$n(!0),n=null,s=is,a=null;function r(o){var r,l,h,c=o.length,u=!1;for(null==n&&(a=s(h=p())),r=0;r<=c;++r)!(r<c&&i(l=o[r],r,o))===u&&((u=!u)?a.lineStart():a.lineEnd()),u&&a.point(+t(l,r,o),+e(l,r,o));if(h)return a=null,h+""||null}return o(r,"line"),r.x=function(e){return arguments.length?(t="function"==typeof e?e:$n(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:$n(+t),r):e},r.defined=function(t){return arguments.length?(i="function"==typeof t?t:$n(!!t),r):i},r.curve=function(t){return arguments.length?(s=t,null!=n&&(a=s(n)),r):s},r.context=function(t){return arguments.length?(null==t?n=a=null:a=s(n=t),r):n},r}function as(){}function rs(t,e,i){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+i)/6)}function ls(t){this._context=t}function hs(t,e){this._basis=new ls(t),this._beta=e}function cs(t,e,i){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-i),t._x2,t._y2)}function us(t,e){this._context=t,this._k=(1-e)/6}function ps(t,e){this._context=t,this._k=(1-e)/6}function ds(t,e){this._context=t,this._k=(1-e)/6}function fs(t,e,i){var n=t._x1,s=t._y1,o=t._x2,a=t._y2;if(t._l01_a>Hn){var r=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);n=(n*r-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,s=(s*r-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>Hn){var h=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*h+t._x1*t._l23_2a-e*t._l12_2a)/c,a=(a*h+t._y1*t._l23_2a-i*t._l12_2a)/c}t._context.bezierCurveTo(n,s,o,a,t._x2,t._y2)}function ys(t,e){this._context=t,this._alpha=e}o(Gn,"arcInnerRadius"),o(Xn,"arcOuterRadius"),o(Yn,"arcStartAngle"),o(Un,"arcEndAngle"),o(Qn,"arcPadAngle"),o(Zn,"asin"),o(Jn,"intersect"),o(Kn,"cornerTangents"),o(ts,"arc"),o(es,"Linear"),es.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._point=0},"lineStart"),lineEnd:o(function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(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)}},"point")},o(is,"curveLinear"),o(ns,"x"),o(ss,"y"),o(os,"line"),o(as,"noop"),o(rs,"point$3"),o(ls,"Basis"),ls.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 3:rs(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},"lineEnd"),point:o(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:rs(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e},"point")},o(hs,"Bundle"),hs.prototype={lineStart:o(function(){this._x=[],this._y=[],this._basis.lineStart()},"lineStart"),lineEnd:o(function(){var t=this._x,e=this._y,i=t.length-1;if(i>0)for(var n,s=t[0],o=e[0],a=t[i]-s,r=e[i]-o,l=-1;++l<=i;)n=l/i,this._basis.point(this._beta*t[l]+(1-this._beta)*(s+n*a),this._beta*e[l]+(1-this._beta)*(o+n*r));this._x=this._y=null,this._basis.lineEnd()},"lineEnd"),point:o(function(t,e){this._x.push(+t),this._y.push(+e)},"point")},o(function t(e){function i(t){return 1===e?new ls(t):new hs(t,e)}return o(i,"bundle"),i.beta=function(e){return t(+e)},i},"custom")(.85),o(cs,"point$2"),o(us,"Cardinal"),us.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:cs(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(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:cs(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},"point")},o(function t(e){function i(t){return new us(t,e)}return o(i,"cardinal"),i.tension=function(e){return t(+e)},i},"custom")(0),o(ps,"CardinalClosed"),ps.prototype={areaStart:as,areaEnd:as,lineStart:o(function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},"lineEnd"),point:o(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:cs(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},"point")},o(function t(e){function i(t){return new ps(t,e)}return o(i,"cardinal"),i.tension=function(e){return t(+e)},i},"custom")(0),o(ds,"CardinalOpen"),ds.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},"lineStart"),lineEnd:o(function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:cs(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},"point")},o(function t(e){function i(t){return new ds(t,e)}return o(i,"cardinal"),i.tension=function(e){return t(+e)},i},"custom")(0),o(fs,"point$1"),o(ys,"CatmullRom"),ys.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(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},"lineStart"),lineEnd:o(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},"lineEnd"),point:o(function(t,e){if(t=+t,e=+e,this._point){var i=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,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:fs(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},"point")};const _s=o(function t(e){function i(t){return e?new ys(t,e):new us(t,0)}return o(i,"catmullRom"),i.alpha=function(e){return t(+e)},i},"custom")(.5);function xs(t,e){this._context=t,this._alpha=e}function ms(t,e){this._context=t,this._alpha=e}function gs(t){return t<0?-1:1}function bs(t,e,i){var n=t._x1-t._x0,s=e-t._x1,o=(t._y1-t._y0)/(n||s<0&&-0),a=(i-t._y1)/(s||n<0&&-0),r=(o*s+a*n)/(n+s);return(gs(o)+gs(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(r))||0}function vs(t,e){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function ws(t,e,i){var n=t._x0,s=t._y0,o=t._x1,a=t._y1,r=(o-n)/3;t._context.bezierCurveTo(n+r,s+r*e,o-r,a-r*i,o,a)}function Ss(t){this._context=t}o(xs,"CatmullRomClosed"),xs.prototype={areaStart:as,areaEnd:as,lineStart:o(function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},"lineEnd"),point:o(function(t,e){if(t=+t,e=+e,this._point){var i=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:fs(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},"point")},o(function t(e){function i(t){return e?new xs(t,e):new ps(t,0)}return o(i,"catmullRom"),i.alpha=function(e){return t(+e)},i},"custom")(.5),o(ms,"CatmullRomOpen"),ms.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(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},"lineStart"),lineEnd:o(function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(t,e){if(t=+t,e=+e,this._point){var i=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:fs(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},"point")},o(function t(e){function i(t){return e?new ms(t,e):new ds(t,0)}return o(i,"catmullRom"),i.alpha=function(e){return t(+e)},i},"custom")(.5),o(gs,"sign"),o(bs,"slope3"),o(vs,"slope2"),o(ws,"point"),o(Ss,"MonotoneX"),Ss.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:ws(this,this._t0,vs(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(t,e){var i=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,ws(this,vs(this,i=bs(this,t,e)),i);break;default:ws(this,this._t0,i=bs(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=i}},"point")},Object.create(Ss.prototype).point=function(t,e){Ss.prototype.point.call(this,e,t)};var As="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},ks=o(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},"classCallCheck"),Ms=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return o(t,"defineProperties"),function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),Ts=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},Ps=o(function t(e,i,n){null===e&&(e=Function.prototype);var s=Object.getOwnPropertyDescriptor(e,i);if(void 0===s){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,i,n)}if("value"in s)return s.value;var a=s.get;return void 0!==a?a.call(n):void 0},"get"),Cs=o(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},"inherits"),Is=o(function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},"possibleConstructorReturn"),zs=o(function(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)},"toConsumableArray"),Fs=function(){function t(e){var i=e.x,n=void 0===i?0:i,s=e.y,o=void 0===s?0:s,a=e.nx,r=e.ny,l=e.dy,h=void 0===l?0:l,c=e.dx,u=void 0===c?0:c,p=e.color,d=void 0===p?"grey":p,f=e.data,y=e.type,_=e.subject,x=e.connector,m=e.note,g=e.disable,b=e.id,v=e.className;ks(this,t),this._dx=void 0!==a?a-n:u,this._dy=void 0!==r?r-o:h,this._x=n,this._y=o,this._color=d,this.id=b,this._className=v||"",this._type=y||"",this.data=f,this.note=m||{},this.connector=x||{},this.subject=_||{},this.disable=g||[]}return o(t,"Annotation"),Ms(t,[{key:"updatePosition",value:o(function(){this.type.setPosition&&(this.type.setPosition(),this.type.subject&&0!==this.type.subject.selectAll(":not(.handle)").nodes().length&&this.type.redrawSubject())},"updatePosition")},{key:"clearComponents",value:o(function(){this.type.clearComponents&&this.type.clearComponents()},"clearComponents")},{key:"updateOffset",value:o(function(){this.type.setOffset&&(this.type.setOffset(),0!==this.type.connector.selectAll(":not(.handle)").nodes().length&&this.type.redrawConnector(),this.type.redrawNote())},"updateOffset")},{key:"className",get:o(function(){return this._className},"get$$1"),set:o(function(t){this._className=t,this.type.setClassName&&this.type.setClassName()},"set$$1")},{key:"type",get:o(function(){return this._type},"get$$1"),set:o(function(t){this._type=t,this.clearComponents()},"set$$1")},{key:"x",get:o(function(){return this._x},"get$$1"),set:o(function(t){this._x=t,this.updatePosition()},"set$$1")},{key:"y",get:o(function(){return this._y},"get$$1"),set:o(function(t){this._y=t,this.updatePosition()},"set$$1")},{key:"color",get:o(function(){return this._color},"get$$1"),set:o(function(t){this._color=t,this.updatePosition()},"set$$1")},{key:"dx",get:o(function(){return this._dx},"get$$1"),set:o(function(t){this._dx=t,this.updateOffset()},"set$$1")},{key:"dy",get:o(function(){return this._dy},"get$$1"),set:o(function(t){this._dy=t,this.updateOffset()},"set$$1")},{key:"nx",set:o(function(t){this._dx=t-this._x,this.updateOffset()},"set$$1")},{key:"ny",set:o(function(t){this._dy=t-this._y,this.updateOffset()},"set$$1")},{key:"offset",get:o(function(){return{x:this._dx,y:this._dy}},"get$$1"),set:o(function(t){var e=t.x,i=t.y;this._dx=e,this._dy=i,this.updateOffset()},"set$$1")},{key:"position",get:o(function(){return{x:this._x,y:this._y}},"get$$1"),set:o(function(t){var e=t.x,i=t.y;this._x=e,this._y=i,this.updatePosition()},"set$$1")},{key:"translation",get:o(function(){return{x:this._x+this._dx,y:this._y+this._dy}},"get$$1")},{key:"json",get:o(function(){var t={x:this._x,y:this._y,dx:this._dx,dy:this._dy};return this.data&&Object.keys(this.data).length>0&&(t.data=this.data),this.type&&(t.type=this.type),this._className&&(t.className=this._className),Object.keys(this.connector).length>0&&(t.connector=this.connector),Object.keys(this.subject).length>0&&(t.subject=this.subject),Object.keys(this.note).length>0&&(t.note=this.note),t},"get$$1")}]),t}(),Ds=function(){function t(e){var i=e.annotations,n=e.accessors,s=e.accessorsInverse;ks(this,t),this.accessors=n,this.accessorsInverse=s,this.annotations=i}return o(t,"AnnotationCollection"),Ms(t,[{key:"clearTypes",value:o(function(t){this.annotations.forEach(function(e){e.type=void 0,e.subject=t&&t.subject||e.subject,e.connector=t&&t.connector||e.connector,e.note=t&&t.note||e.note})},"clearTypes")},{key:"setPositionWithAccessors",value:o(function(){var t=this;this.annotations.forEach(function(e){e.type.setPositionWithAccessors(t.accessors)})},"setPositionWithAccessors")},{key:"editMode",value:o(function(t){this.annotations.forEach(function(e){e.type&&(e.type.editMode=t,e.type.updateEditMode())})},"editMode")},{key:"updateDisable",value:o(function(t){this.annotations.forEach(function(e){e.disable=t,e.type&&t.forEach(function(t){e.type[t]&&(e.type[t].remove&&e.type[t].remove(),e.type[t]=void 0)})})},"updateDisable")},{key:"updateTextWrap",value:o(function(t){this.annotations.forEach(function(e){e.type&&e.type.updateTextWrap&&e.type.updateTextWrap(t)})},"updateTextWrap")},{key:"updateText",value:o(function(){this.annotations.forEach(function(t){t.type&&t.type.drawText&&t.type.drawText()})},"updateText")},{key:"updateNotePadding",value:o(function(t){this.annotations.forEach(function(e){e.type&&(e.type.notePadding=t)})},"updateNotePadding")},{key:"json",get:o(function(){var t=this;return this.annotations.map(function(e){var i=e.json;return t.accessorsInverse&&e.data&&(i.data={},Object.keys(t.accessorsInverse).forEach(function(n){i.data[n]=t.accessorsInverse[n]({x:e.x,y:e.y})})),i})},"get$$1")},{key:"noteNodes",get:o(function(){return this.annotations.map(function(t){return Ts({},t.type.getNoteBBoxOffset(),{positionX:t.x,positionY:t.y})})},"get$$1")}]),t}(),Es=o(function(t){var e=t.cx,i=void 0===e?0:e,n=t.cy;return{move:{x:i,y:void 0===n?0:n}}},"pointHandle"),Os=o(function(t){var e=t.cx,i=void 0===e?0:e,n=t.cy,s=void 0===n?0:n,o=t.r1,a=t.r2,r=t.padding,l={move:{x:i,y:s}};return void 0!==o&&(l.r1={x:i+o/Math.sqrt(2),y:s+o/Math.sqrt(2)}),void 0!==a&&(l.r2={x:i+a/Math.sqrt(2),y:s+a/Math.sqrt(2)}),void 0!==r&&(l.padding={x:i+o+r,y:s}),l},"circleHandles"),Rs=o(function(t){var e=t.group,n=t.handles,s=t.r,o=void 0===s?10:s,a=e.selectAll("circle.handle").data(n);a.enter().append("circle").attr("class","handle").attr("fill","grey").attr("fill-opacity",.1).attr("cursor","move").attr("stroke-dasharray",5).attr("stroke","grey").call(i.drag().container(i.select("g.annotations").node()).on("start",function(t){return t.start&&t.start(t)}).on("drag",function(t){return t.drag&&t.drag(t)}).on("end",function(t){return t.end&&t.end(t)})),e.selectAll("circle.handle").attr("cx",function(t){return t.x}).attr("cy",function(t){return t.y}).attr("r",function(t){return t.r||o}).attr("class",function(t){return"handle "+(t.className||"")}),a.exit().remove()},"addHandles"),js=o(function(t,e){return"dynamic"!==t&&"left"!==t&&"right"!==t||(t=e<0?"top":"bottom"),t},"leftRightDynamic"),Ns=o(function(t,e){return"dynamic"!==t&&"top"!==t&&"bottom"!==t||(t=e<0?"right":"left"),t},"topBottomDynamic"),Ls=["topBottom","top","bottom"],Bs=["leftRight","left","right"],$s=o(function(t){var e=t.padding,i=void 0===e?0:e,n=t.bbox,s=void 0===n?{x:0,width:0,height:0}:n,o=t.align,a=t.orientation,r=t.offset,l=void 0===r?{x:0,y:0}:r,h=-s.x,c=0;return-1!==Ls.indexOf(a)?(o=Ns(o,l.x),l.y<0&&"topBottom"===a||"top"===a?c-=s.height+i:c+=i,"middle"===o?h-=s.width/2:"right"===o&&(h-=s.width)):-1!==Bs.indexOf(a)&&(o=js(o,l.y),l.x<0&&"leftRight"===a||"left"===a?h-=s.width+i:h+=i,"middle"===o?c-=s.height/2:"top"===o&&(c-=s.height)),{x:h,y:c}},"noteAlignment"),Hs=o(function(t){var e=t.data,i=t.curve,n=void 0===i?is:i,s=t.canvasContext,o=t.className,a=t.classID,r=os().curve(n),l={type:"path",className:o,classID:a,data:e};return s?(r.context(s),l.pathMethods=r):l.attrs={d:r(e)},l},"lineBuilder"),Vs=o(function(t){var e=t.data,i=t.canvasContext,n={type:"path",className:t.className,classID:t.classID,data:e},s=ts().innerRadius(e.innerRadius||0).outerRadius(e.outerRadius||e.radius||2).startAngle(e.startAngle||0).endAngle(e.endAngle||2*Math.PI);return i?(s.context(i),n.pathMethods=lineGen):n.attrs={d:s()},n},"arcBuilder"),qs=o(function(t){var e=t.align,i=t.x,n=void 0===i?0:i,s=t.y,o=void 0===s?0:s,a=t.bbox,r=t.offset;"top"===(e=js(e,r.y))?o-=a.height:"middle"===e&&(o-=a.height/2);var l=[[n,o],[n,o+a.height]];return{components:[Hs({data:l,className:"note-line"})]}},"noteVertical"),Ws=o(function(t){var e=t.align,i=t.x,n=void 0===i?0:i,s=t.y,o=void 0===s?0:s,a=t.offset,r=t.bbox;"right"===(e=Ns(e,a.x))?n-=r.width:"middle"===e&&(n-=r.width/2);var l=[[n,o],[n+r.width,o]];return{components:[Hs({data:l,className:"note-line"})]}},"noteHorizontal"),Gs=o(function(t){var e=t.type,i=t.subjectType,n=e.annotation,s=n.position,o=n.x-s.x,a=o+n.dx,r=n.y-s.y,l=r+n.dy,h=n.subject;if("circle"===i&&(h.outerRadius||h.radius)){var c=Math.sqrt((o-a)*(o-a)+(r-l)*(r-l)),u=Math.asin(-l/c),p=h.outerRadius||h.radius+(h.radiusPadding||0);o=Math.abs(Math.cos(u)*p)*(a<0?-1:1),r=Math.abs(Math.sin(u)*p)*(l<0?-1:1)}if("rect"===i){var d=h.width,f=h.height;(d>0&&n.dx>0||d<0&&n.dx<0)&&(o=Math.abs(d)>Math.abs(n.dx)?d/2:d),(f>0&&n.dy>0||f<0&&n.dy<0)&&(r=Math.abs(f)>Math.abs(n.dy)?f/2:f),o===d/2&&r===f/2&&(o=a,r=l)}return[[o,r],[a,l]]},"lineSetup"),Xs=o(function(t){var e=Gs(t);return{components:[Hs({data:e,className:"connector"})]}},"connectorLine"),Ys=o(function(t){var e=t.type,i=t.subjectType,n=e.annotation,s=n.position,o=n.x-s.x,a=o+n.dx,r=n.y-s.y,l=r+n.dy,h=n.subject;if("rect"===i){var c=h.width,u=h.height;(c>0&&n.dx>0||c<0&&n.dx<0)&&(o=Math.abs(c)>Math.abs(n.dx)?c/2:c),(u>0&&n.dy>0||u<0&&n.dy<0)&&(r=Math.abs(u)>Math.abs(n.dy)?u/2:u),o===c/2&&r===u/2&&(o=a,r=l)}var p=[[o,r],[a,l]],d=l-r,f=a-o,y=a,_=l,x=l<r&&a>o||a<o&&l>r?-1:1;if(Math.abs(f)<Math.abs(d)?(y=a,_=r+f*x):(_=l,y=o+d*x),"circle"===i&&(h.outerRadius||h.radius)){var m=(h.outerRadius||h.radius)+(h.radiusPadding||0),g=m/Math.sqrt(2);if(Math.abs(f)>g&&Math.abs(d)>g)p=[[o=g*(a<0?-1:1),r=g*(l<0?-1:1)],[y,_],[a,l]];else if(Math.abs(f)>Math.abs(d)){var b=Math.asin(-l/m);p=[[o=Math.abs(Math.cos(b)*m)*(a<0?-1:1),l],[a,l]]}else{var v=Math.acos(a/m);p=[[a,r=Math.abs(Math.sin(v)*m)*(l<0?-1:1)],[a,l]]}}else p=[[o,r],[y,_],[a,l]];return{components:[Hs({data:p,className:"connector"})]}},"connectorElbow"),Us=o(function(t){var e=t.type,n=t.connectorData,s=t.subjectType;n||(n={}),n.points&&"number"!=typeof n.points||(n.points=Qs(e.annotation.offset,n.points)),n.curve||(n.curve=_s);var a=[];if(e.editMode){var r=n.points.map(function(t,e){return Ts({},Es({cx:t[0],cy:t[1]}),{index:e})}),l=o(function(t){n.points[t][0]+=i.event.dx,n.points[t][1]+=i.event.dy,e.redrawConnector()},"updatePoint");a=e.mapHandles(r.map(function(t){return Ts({},t.move,{drag:l.bind(e,t.index)})}))}var h=Gs({type:e,subjectType:s});return h=[h[0]].concat(zs(n.points),[h[1]]),{components:[Hs({data:h,curve:n.curve,className:"connector"})],handles:a}},"connectorCurve"),Qs=o(function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,i=t.x/(e+1),n=t.y/(e+1),s=[],o=1;o<=e;o++)s.push([i*o+o%2*20,n*o-o%2*20]);return s},"createPoints"),Zs=o(function(t){var e=t.annotation,i=t.start,n=t.end,s=t.scale,o=void 0===s?1:s,a=e.position;i=i?[-n[0]+i[0],-n[1]+i[1]]:[e.dx,e.dy],n||(n=[e.x-a.x,e.y-a.y]);var r=n[0],l=n[1],h=i[0],c=i[1],u=10*o,p=16/180*Math.PI,d=Math.atan(c/h);h<0&&(d+=Math.PI);var f=[[r,l],[Math.cos(d+p)*u+r,Math.sin(d+p)*u+l],[Math.cos(d-p)*u+r,Math.sin(d-p)*u+l],[r,l]];return{components:[Hs({data:f,className:"connector-end connector-arrow",classID:"connector-end"})]}},"connectorArrow"),Js=o(function(t){var e=t.line,i=t.scale,n=void 0===i?1:i,s=Vs({className:"connector-end connector-dot",classID:"connector-end",data:{radius:3*Math.sqrt(n)}});return s.attrs.transform="translate("+e.data[0][0]+", "+e.data[0][1]+")",{components:[s]}},"connectorDot"),Ks=o(function(t){var e=t.subjectData,n=t.type;e.radius||e.outerRadius||(e.radius=20);var s=[],a=Vs({data:e,className:"subject"});if(n.editMode){var r=Os({r1:a.data.outerRadius||a.data.radius,r2:a.data.innerRadius,padding:e.radiusPadding}),l=o(function(t){var s=e[t]+i.event.dx*Math.sqrt(2);e[t]=s,n.redrawSubject(),n.redrawConnector()},"updateRadius"),h=[Ts({},r.r1,{drag:l.bind(n,void 0!==e.outerRadius?"outerRadius":"radius")})];e.innerRadius&&h.push(Ts({},r.r2,{drag:l.bind(n,"innerRadius")})),s=n.mapHandles(h)}return a.attrs["fill-opacity"]=0,{components:[a],handles:s}},"subjectCircle"),to=o(function(t){var e=t.subjectData,n=t.type;e.width||(e.width=100),e.height||(e.height=100);var s=[],a=e.width,r=e.height,l=Hs({data:[[0,0],[a,0],[a,r],[0,r],[0,0]],className:"subject"});if(n.editMode){var h=o(function(){e.width=i.event.x,n.redrawSubject(),n.redrawConnector()},"updateWidth"),c=o(function(){e.height=i.event.y,n.redrawSubject(),n.redrawConnector()},"updateHeight"),u=[{x:a,y:r/2,drag:h.bind(n)},{x:a/2,y:r,drag:c.bind(n)}];s=n.mapHandles(u)}return l.attrs["fill-opacity"]=.1,{components:[l],handles:s}},"subjectRect"),eo=o(function(t){var e=t.subjectData,i=t.type.annotation.position,n=(void 0!==e.x1?e.x1:i.x)-i.x,s=(void 0!==e.x2?e.x2:i.x)-i.x,o=(void 0!==e.y1?e.y1:i.y)-i.y,a=(void 0!==e.y2?e.y2:i.y)-i.y;return{components:[Hs({data:[[n,o],[s,a]],className:"subject"})]}},"subjectThreshold"),io=o(function(t){var e=t.subjectData,n=void 0===e?{}:e,s=t.type,a=void 0===s?{}:s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=a.typeSettings&&a.typeSettings.subject;n.radius||(l&&l.radius?n.radius=l.radius:n.radius=14),n.x||l&&l.x&&(n.x=l.x),n.y||l&&l.y&&(n.y=l.y);var h=[],c=[],u=n.radius,p=.7*u,d=0,f=0,y=Math.sqrt(2)*u,_={xleftcorner:-u,xrightcorner:u,ytopcorner:-u,ybottomcorner:u,xleft:-y,xright:y,ytop:-y,ybottom:y};n.x&&!n.y?d=_["x"+n.x]:n.y&&!n.x?f=_["y"+n.y]:n.x&&n.y&&(d=_["x"+n.x+"corner"],f=_["y"+n.y+"corner"]);var x="translate("+d+", "+f+")",m=Vs({className:"subject",data:{radius:u}});m.attrs.transform=x,m.attrs.fill=r.color,m.attrs["stroke-linecap"]="round",m.attrs["stroke-width"]="3px";var g=Vs({className:"subject-ring",data:{outerRadius:u,innerRadius:p}});g.attrs.transform=x,g.attrs["stroke-width"]="3px",g.attrs.fill="white";var b=void 0;if(d&&f||!d&&!f)b=Hs({className:"subject-pointer",data:[[0,0],[d||0,0],[0,f||0],[0,0]]});else if(d||f){var v=o(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t&&t/Math.sqrt(2)/Math.sqrt(2)||e*u/Math.sqrt(2)},"notCornerPointerXY");b=Hs({className:"subject-pointer",data:[[0,0],[v(d),v(f)],[v(d,-1),v(f,-1)],[0,0]]})}if(b&&(b.attrs.fill=r.color,b.attrs["stroke-linecap"]="round",b.attrs["stroke-width"]="3px",c.push(b)),a.editMode){var w={x:2*d,y:2*f,drag:o(function(){n.x=i.event.x<2*-u?"left":i.event.x>2*u?"right":void 0,n.y=i.event.y<2*-u?"top":i.event.y>2*u?"bottom":void 0,a.redrawSubject()},"dragBadge").bind(a)};w.x||w.y||(w.y=-u),h=a.mapHandles([w])}var S=void 0;return n.text&&(S={type:"text",className:"badge-text",attrs:{fill:"white",stroke:"none","font-size":".7em",text:n.text,"text-anchor":"middle",dy:".25em",x:d,y:f}}),c.push(m),c.push(g),c.push(S),{components:c,handles:h}},"subjectBadge"),no=function(){function t(e){var i=e.a,n=e.annotation,s=e.editMode,o=e.dispatcher,a=e.notePadding,r=e.accessors;if(ks(this,t),this.a=i,this.note=-1===n.disable.indexOf("note")&&i.select("g.annotation-note"),this.noteContent=this.note&&i.select("g.annotation-note-content"),this.connector=-1===n.disable.indexOf("connector")&&i.select("g.annotation-connector"),this.subject=-1===n.disable.indexOf("subject")&&i.select("g.annotation-subject"),this.dispatcher=o,o){var l=co.bind(null,o,n);l({component:this.note,name:"note"}),l({component:this.connector,name:"connector"}),l({component:this.subject,name:"subject"})}this.annotation=n,this.editMode=n.editMode||s,this.notePadding=void 0!==a?a:3,this.offsetCornerX=0,this.offsetCornerY=0,r&&n.data&&this.init(r)}return o(t,"Type"),Ms(t,[{key:"init",value:o(function(t){this.annotation.x||this.mapX(t),this.annotation.y||this.mapY(t)},"init")},{key:"mapY",value:o(function(t){t.y&&(this.annotation.y=t.y(this.annotation.data))},"mapY")},{key:"mapX",value:o(function(t){t.x&&(this.annotation.x=t.x(this.annotation.data))},"mapX")},{key:"updateEditMode",value:o(function(){this.a.selectAll("circle.handle").remove()},"updateEditMode")},{key:"drawOnSVG",value:o(function(t,e){var i=this;Array.isArray(e)||(e=[e]),e.filter(function(t){return t}).forEach(function(e){var n=e.type,s=e.className,o=e.attrs,a=e.handles,r=e.classID;if("handle"===n)Rs({group:t,r:o&&o.r,handles:a});else{ho(t,[i.annotation],n,s,r);for(var l=t.select(n+"."+(r||s)),h=Object.keys(o),c=[],u=l.node().attributes,p=u.length-1;p>=0;p--){var d=u[p].name;-1===h.indexOf(d)&&"class"!==d&&c.push(d)}h.forEach(function(t){"text"===t?l.text(o[t]):l.attr(t,o[t])}),c.forEach(function(t){return l.attr(t,null)})}})},"drawOnSVG")},{key:"getNoteBBox",value:o(function(){return po(this.note,".annotation-note-content text")},"getNoteBBox")},{key:"getNoteBBoxOffset",value:o(function(){var t=po(this.note,".annotation-note-content"),e=this.noteContent.attr("transform").split(/\(|\,|\)/g);return t.offsetCornerX=parseFloat(e[1])+this.annotation.dx,t.offsetCornerY=parseFloat(e[2])+this.annotation.dy,t.offsetX=this.annotation.dx,t.offsetY=this.annotation.dy,t},"getNoteBBoxOffset")},{key:"drawSubject",value:o(function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=this.annotation.subject,n=e.type,s={type:this,subjectData:i},o={};"circle"===n?o=Ks(s):"rect"===n?o=to(s):"threshold"===n?o=eo(s):"badge"===n&&(o=io(s,this.annotation));var a=o,r=a.components,l=void 0===r?[]:r,h=a.handles,c=void 0===h?[]:h;return l.forEach(function(e){e&&e.attrs&&!e.attrs.stroke&&(e.attrs.stroke=t.annotation.color)}),this.editMode&&(c=c.concat(this.mapHandles([{drag:this.dragSubject.bind(this)}])),l.push({type:"handle",handles:c})),l},"drawSubject")},{key:"drawConnector",value:o(function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=this.annotation.connector,n=i.type||e.type,s={type:this,connectorData:i};s.subjectType=this.typeSettings&&this.typeSettings.subject&&this.typeSettings.subject.type;var o="curve"===n?Us(s):"elbow"===n?Ys(s):Xs(s),a=o.components,r=void 0===a?[]:a,l=o.handles,h=void 0===l?[]:l,c=r[0];c&&(c.attrs.stroke=this.annotation.color,c.attrs.fill="none");var u=i.end||e.end,p={};if("arrow"===u){var d=c.data[1],f=c.data[0];Math.sqrt(Math.pow(d[0]-f[0],2)+Math.pow(d[1]-f[1],2))<5&&c.data[2]&&(d=c.data[2]),p=Zs({annotation:this.annotation,start:d,end:f,scale:i.endScale})}else"dot"===u?p=Js({line:c,scale:i.endScale}):u&&"none"!==u||this.connector&&this.connector.select(".connector-end").remove();return p.components&&(p.components.forEach(function(e){e.attrs.fill=t.annotation.color,e.attrs.stroke=t.annotation.color}),r=r.concat(p.components)),this.editMode&&0!==h.length&&r.push({type:"handle",handles:h}),r},"drawConnector")},{key:"drawNote",value:o(function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.annotation.note,s=n.align||e.align||"dynamic",o={bbox:e.bbox,align:s,offset:this.annotation.offset},a=n.lineType||e.lineType,r={};"vertical"===a?r=qs(o):"horizontal"===a&&(r=Ws(o));var l=r,h=l.components,c=void 0===h?[]:h,u=l.handles,p=void 0===u?[]:u;if(c.forEach(function(e){e.attrs.stroke=t.annotation.color}),this.editMode){p=this.mapHandles([{x:0,y:0,drag:this.dragNote.bind(this)}]),c.push({type:"handle",handles:p});var d=this.dragNote.bind(this),f=this.dragstarted.bind(this),y=this.dragended.bind(this);this.note.call(i.drag().container(i.select("g.annotations").node()).on("start",function(t){return f(t)}).on("drag",function(t){return d(t)}).on("end",function(t){return y(t)}))}else this.note.on("mousedown.drag",null);return c},"drawNote")},{key:"drawNoteContent",value:o(function(t){var e=this.annotation.note,i=void 0!==e.padding?e.padding:this.notePadding,n=e.orientation||t.orientation||"topBottom",s=e.lineType||t.lineType,o=e.align||t.align||"dynamic";"vertical"===s?n="leftRight":"horizontal"===s&&(n="topBottom");var a={padding:i,bbox:t.bbox,offset:this.annotation.offset,orientation:n,align:o},r=$s(a),l=r.x,h=r.y;return this.offsetCornerX=l+this.annotation.dx,this.offsetCornerY=h+this.annotation.dy,this.note&&this.noteContent.attr("transform","translate("+l+", "+h+")"),[]},"drawNoteContent")},{key:"drawOnScreen",value:o(function(t,e){return this.drawOnSVG(t,e)},"drawOnScreen")},{key:"redrawSubject",value:o(function(){this.subject&&this.drawOnScreen(this.subject,this.drawSubject())},"redrawSubject")},{key:"redrawConnector",value:o(function(){this.connector&&this.drawOnScreen(this.connector,this.drawConnector())},"redrawConnector")},{key:"redrawNote",value:o(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getNoteBBox();this.noteContent&&this.drawOnScreen(this.noteContent,this.drawNoteContent({bbox:t})),this.note&&this.drawOnScreen(this.note,this.drawNote({bbox:t}))},"redrawNote")},{key:"setPosition",value:o(function(){var t=this.annotation.position;this.a.attr("transform","translate("+t.x+", "+t.y+")")},"setPosition")},{key:"clearComponents",value:o(function(){this.subject&&this.subject.select("*").remove(),this.connector&&this.connector.select("*").remove()},"clearComponents")},{key:"setOffset",value:o(function(){if(this.note){var t=this.annotation.offset;this.note.attr("transform","translate("+t.x+", "+t.y+")")}},"setOffset")},{key:"setPositionWithAccessors",value:o(function(t){t&&this.annotation.data&&(this.mapX(t),this.mapY(t)),this.setPosition()},"setPositionWithAccessors")},{key:"setClassName",value:o(function(){this.a.attr("class","annotation "+(this.className&&this.className())+" "+(this.editMode?"editable":"")+" "+(this.annotation.className||""))},"setClassName")},{key:"draw",value:o(function(){this.setClassName(),this.setPosition(),this.setOffset(),this.redrawSubject(),this.redrawConnector(),this.redrawNote()},"draw")},{key:"dragstarted",value:o(function(){i.event.sourceEvent.stopPropagation(),this.dispatcher&&this.dispatcher.call("dragstart",this.a,this.annotation),this.a.classed("dragging",!0),this.a.selectAll("circle.handle").style("pointer-events","none")},"dragstarted")},{key:"dragended",value:o(function(){this.dispatcher&&this.dispatcher.call("dragend",this.a,this.annotation),this.a.classed("dragging",!1),this.a.selectAll("circle.handle").style("pointer-events","all")},"dragended")},{key:"dragSubject",value:o(function(){var t=this.annotation.position;t.x+=i.event.dx,t.y+=i.event.dy,this.annotation.position=t},"dragSubject")},{key:"dragNote",value:o(function(){var t=this.annotation.offset;t.x+=i.event.dx,t.y+=i.event.dy,this.annotation.offset=t},"dragNote")},{key:"mapHandles",value:o(function(t){var e=this;return t.map(function(t){return Ts({},t,{start:e.dragstarted.bind(e),end:e.dragended.bind(e)})})},"mapHandles")}]),t}(),so=o(function(t,e,i){return function(t){function n(t){ks(this,n);var i=Is(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t));return i.typeSettings=e,e.disable&&e.disable.forEach(function(t){i[t]&&i[t].remove(),i[t]=void 0,"note"===t&&(i.noteContent=void 0)}),i}return Cs(n,t),o(n,"customType"),Ms(n,[{key:"className",value:o(function(){return""+(e.className||Ps(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"className",this)&&Ps(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"className",this).call(this)||"")},"className")},{key:"drawSubject",value:o(function(t){return this.typeSettings.subject=Ts({},e.subject,this.typeSettings.subject),Ps(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawSubject",this).call(this,Ts({},t,this.typeSettings.subject))},"drawSubject")},{key:"drawConnector",value:o(function(t){return this.typeSettings.connector=Ts({},e.connector,this.typeSettings.connector),Ps(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawConnector",this).call(this,Ts({},t,e.connector,this.typeSettings.connector))},"drawConnector")},{key:"drawNote",value:o(function(t){return this.typeSettings.note=Ts({},e.note,this.typeSettings.note),Ps(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawNote",this).call(this,Ts({},t,e.note,this.typeSettings.note))},"drawNote")},{key:"drawNoteContent",value:o(function(t){return Ps(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawNoteContent",this).call(this,Ts({},t,e.note,this.typeSettings.note))},"drawNoteContent")}],[{key:"init",value:o(function(t,e){return Ps(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,t,e),i&&(t=i(t,e)),t},"init")}]),n}(t)},"customType"),oo=function(t){function e(t){ks(this,e);var i=Is(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.textWrap=t.textWrap||120,i.drawText(),i}return Cs(e,t),o(e,"d3NoteText"),Ms(e,[{key:"updateTextWrap",value:o(function(t){this.textWrap=t,this.drawText()},"updateTextWrap")},{key:"drawText",value:o(function(){if(this.note){ho(this.note,[this.annotation],"g","annotation-note-content");var t=this.note.select("g.annotation-note-content");ho(t,[this.annotation],"rect","annotation-note-bg"),ho(t,[this.annotation],"text","annotation-note-label"),ho(t,[this.annotation],"text","annotation-note-title");var e={height:0},i=this.a.select("text.annotation-note-label"),n=this.annotation.note&&this.annotation.note.wrap||this.typeSettings&&this.typeSettings.note&&this.typeSettings.note.wrap||this.textWrap,s=this.annotation.note&&this.annotation.note.wrapSplitter||this.typeSettings&&this.typeSettings.note&&this.typeSettings.note.wrapSplitter,o=this.annotation.note&&this.annotation.note.bgPadding||this.typeSettings&&this.typeSettings.note&&this.typeSettings.note.bgPadding,a={top:0,bottom:0,left:0,right:0};if("number"==typeof o?a={top:o,bottom:o,left:o,right:o}:o&&"object"===(void 0===o?"undefined":As(o))&&(a=Ts(a,o)),this.annotation.note.title){var r=this.a.select("text.annotation-note-title");r.text(this.annotation.note.title),r.attr("fill",this.annotation.color),r.attr("font-weight","bold"),r.call(uo,n,s),e=r.node().getBBox()}i.text(this.annotation.note.label).attr("dx","0"),i.call(uo,n,s),i.attr("y",1.1*e.height||0),i.attr("fill",this.annotation.color);var l=this.getNoteBBox();this.a.select("rect.annotation-note-bg").attr("width",l.width+a.left+a.right).attr("height",l.height+a.top+a.bottom).attr("x",l.x-a.left).attr("y",-a.top).attr("fill","white").attr("fill-opacity",0)}},"drawText")}]),e}(no);so(oo,{className:"label",note:{align:"middle"}});var ao=so(oo,{className:"callout",note:{lineType:"horizontal"}}),ro=so(ao,{className:"callout elbow",connector:{type:"elbow"}});so(ao,{className:"callout curve",connector:{type:"curve"}}),so(no,{className:"badge",subject:{type:"badge"},disable:["connector","note"]}),so(oo,{className:"callout circle",subject:{type:"circle"},note:{lineType:"horizontal"},connector:{type:"elbow"}}),so(oo,{className:"callout rect",subject:{type:"rect"},note:{lineType:"horizontal"},connector:{type:"elbow"}});var lo=function(t){function e(){return ks(this,e),Is(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return Cs(e,t),o(e,"ThresholdMap"),Ms(e,[{key:"mapY",value:o(function(t){Ps(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"mapY",this).call(this,t);var i=this.annotation;(i.subject.x1||i.subject.x2)&&i.data&&t.y&&(i.y=t.y(i.data)),!i.subject.x1&&!i.subject.x2||i.x||(i.x=i.subject.x1||i.subject.x2)},"mapY")},{key:"mapX",value:o(function(t){Ps(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"mapX",this).call(this,t);var i=this.annotation;(i.subject.y1||i.subject.y2)&&i.data&&t.x&&(i.x=t.x(i.data)),!i.subject.y1&&!i.subject.y2||i.y||(i.y=i.subject.y1||i.subject.y2)},"mapX")}]),e}(ao);so(lo,{className:"callout xythreshold",subject:{type:"threshold"}});var ho=o(function(t,e,i,n,s){var o=t.selectAll(i+"."+(s||n)).data(e);return o.enter().append(i).merge(o).attr("class",n),o.exit().remove(),t},"newWithClass"),co=o(function(t,e,i){var n=i.component,s=i.name;n&&n.on("mouseover.annotations",function(){t.call(s+"over",n,e)}).on("mouseout.annotations",function(){return t.call(s+"out",n,e)}).on("click.annotations",function(){return t.call(s+"click",n,e)})},"addHandlers"),uo=o(function(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.2;t.each(function(){for(var t=i.select(this),o=t.text().split(n||/[ \t\r\n]+/).reverse().filter(function(t){return""!==t}),a=void 0,r=[],l=t.text(null).append("tspan").attr("x",0).attr("dy","0.8em");a=o.pop();)r.push(a),l.text(r.join(" ")),l.node().getComputedTextLength()>e&&r.length>1&&(r.pop(),l.text(r.join(" ")),r=[a],l=t.append("tspan").attr("x",0).attr("dy",s+"em").text(a))})},"wrap"),po=o(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:":not(.handle)";return t?t.selectAll(e).nodes().reduce(function(t,e){var i=e.getBBox();t.x=Math.min(t.x,i.x),t.y=Math.min(t.y,i.y),t.width=Math.max(t.width,i.width);var n=e&&e.attributes&&e.attributes.y;return t.height=Math.max(t.height,(n&&parseFloat(n.value)||0)+i.height),t},{x:0,y:0,width:0,height:0}):{x:0,y:0,width:0,height:0}},"bboxWithoutHandles");function fo(){var t=[],e=void 0,n=void 0,s=[],a={},r={},l=!1,h=void 0,c=ao,u=void 0,p=void 0,d=i.dispatch("subjectover","subjectout","subjectclick","connectorover","connectorout","connectorclick","noteover","noteout","noteclick","dragend","dragstart"),f=void 0,y=o(function(n){f=n,l||n.selectAll("circle.handle").remove();var o=t.map(function(t){return t.type||(t.type=c),t.disable||(t.disable=s),new Fs(t)});e=e||new Ds({annotations:o,accessors:a,accessorsInverse:r,ids:h}),n.selectAll("g").data([e]).enter().append("g").attr("class","annotations");var y=n.select("g.annotations");ho(y,e.annotations,"g","annotation"),y.selectAll("g.annotation").each(function(t){var e=i.select(this);e.attr("class","annotation"),ho(e,[t],"g","annotation-connector"),ho(e,[t],"g","annotation-subject"),ho(e,[t],"g","annotation-note"),ho(e.select("g.annotation-note"),[t],"g","annotation-note-content"),t.type="[object Object]"===t.type.toString()?t.type:new t.type({a:e,annotation:t,textWrap:u,notePadding:p,editMode:l,dispatcher:d,accessors:a}),t.type.draw(),t.type.drawText&&t.type.drawText()})},"annotation");return y.json=function(){return console.log("Annotations JSON was copied to your clipboard. Please note the annotation type is not JSON compatible. It appears in the objects array in the console, but not in the copied JSON.",e.json),window.copy(JSON.stringify(e.json.map(function(t){return delete t.type,t}))),y},y.update=function(){return t&&e&&(t=e.annotations.map(function(t){return t.type.draw(),t})),y},y.updateText=function(){return e&&(e.updateText(u),t=e.annotations),y},y.updatedAccessors=function(){return e.setPositionWithAccessors(),t=e.annotations,y},y.disable=function(i){return arguments.length?(s=i,e&&(e.updateDisable(s),t=e.annotations),y):s},y.textWrap=function(i){return arguments.length?(u=i,e&&(e.updateTextWrap(u),t=e.annotations),y):u},y.notePadding=function(i){return arguments.length?(p=i,e&&(e.updateNotePadding(p),t=e.annotations),y):p},y.type=function(i,n){return arguments.length?(c=i,e&&(e.annotations.map(function(t){t.type.note&&t.type.note.selectAll("*:not(.annotation-note-content)").remove(),t.type.noteContent&&t.type.noteContent.selectAll("*").remove(),t.type.subject&&t.type.subject.selectAll("*").remove(),t.type.connector&&t.type.connector.selectAll("*").remove(),t.type.typeSettings={},t.type=c,t.subject=n&&n.subject||t.subject,t.connector=n&&n.connector||t.connector,t.note=n&&n.note||t.note}),t=e.annotations),y):c},y.annotations=function(i){if(!arguments.length)return e&&e.annotations||t;(t=i,e&&e.annotations)&&(t.some(function(t){return!t.type||"[object Object]"!==t.type.toString()})?(e=null,y(f)):e.annotations=t);return y},y.context=function(t){return arguments.length?(n=t,y):n},y.accessors=function(t){return arguments.length?(a=t,y):a},y.accessorsInverse=function(t){return arguments.length?(r=t,y):r},y.ids=function(t){return arguments.length?(h=t,y):h},y.editMode=function(i){return arguments.length?(l=i,f&&f.selectAll("g.annotation").classed("editable",l),e&&(e.editMode(l),t=e.annotations),y):l},y.collection=function(t){return arguments.length?(e=t,y):e},y.on=function(){var t=d.on.apply(d,arguments);return t===d?y:t},y}function yo(t){return.65*(t-.5)*2*Math.PI}function _o(t,e){return{x:Math.cos(t-Math.PI/2)*e,y:Math.sin(t-Math.PI/2)*e}}function xo(t,e,i=!1){const n=_o(t,e),s=180*t/Math.PI+(!0===i?180:0);return`translate(${n.x}, ${n.y}) rotate(${s})`}function mo(t,e,n=!1){return function(s){const o=i.interpolate(s.angle,t);return s.angle=t,function(t){return xo(o(t),e,n)}}}function go(t,e,n){return function(s){const o=i.interpolate(s.startAngle,t),a=i.interpolate(s.endAngle,e);return function(t){return s.startAngle=o(t),s.endAngle=a(t),n(s)}}}o(fo,"annotation"),o(yo,"value2Angle"),o(_o,"pointOnArc"),o(xo,"indicatorTranslate"),o(mo,"indicatorTween"),o(go,"arcTween");const bo=class _Gauge extends i.SVGWidget{constructor(){super(),a(this,"_d3Arc",E().innerRadius(85).outerRadius(100)),a(this,"_colorScale",i.scaleLinear().interpolate(i.interpolateHcl)),a(this,"_usageArc"),a(this,"_meanArc"),a(this,"_freeArc"),a(this,"_indInner"),a(this,"_indOuter"),a(this,"_centerTextG"),a(this,"_centerText"),a(this,"_bottomText"),a(this,"_tooltipG"),a(this,"_mainTooltip")}tip(t){if(null===t||""===t.label)this._tooltipG.transition().style("opacity",0).on("interrupt end",()=>{this._tooltipG.selectAll("g").remove()});else{this._tooltipG.interrupt().style("opacity",1),t.w=this._centerText.datum().w+10;let e="horizontal",i=0,n=5,s=5;t.y>=5&&t.y<=25?(i=t.x<0?-t.w/2:t.w/2,n=12.5,s=void 0,e="vertical"):t.y>25&&(n=25,s=0);const a=fo().type(ro).annotations([{data:t,dx:-t.x+i,dy:-t.y+n,color:"black",note:{label:t.label,lineType:e,padding:s,align:"middle"}}]).accessors({x:o(t=>t.x,"x"),y:o(t=>t.y,"y")});this._tooltipG.call(a)}}calcSize(t,e,i){const n=t.node().getBBox(),s=e/n.width,o=i/n.height,a=s<o?s:o;return{width:n.width,height:n.height,scale:a}}updateText(t,e,i,n,s){t.datum({x:e,y:i,w:n,h:s}).attr("transform",null);const o=this.calcSize(t,n,s),a=e+n/2-o.width/2*o.scale,r=i+s/2-o.height/2*o.scale;t.attr("transform",`translate(${a}, ${r}) scale(${o.scale})`)}calcWidth(){return Math.min(this.width(),this.height(),this.maxDiameter())}enter(t,e){super.enter(t,e),e.on("click",t=>{this.click(t)}),this._usageArc=e.append("path").datum({startAngle:yo(0),endAngle:yo(0)}).style("fill","green").on("mousemove",t=>{const[e,i]=this._d3Arc.centroid(t);this.tip({x:e,y:i,label:this.valueDescription()})}).on("mouseout",t=>{this.tip(null)}),this._freeArc=e.append("path").datum({startAngle:yo(0),endAngle:yo(1)}).style("fill","lightGrey"),this._meanArc=e.append("path").datum({startAngle:yo(0),endAngle:yo(0)}).style("fill","black").on("mousemove",t=>{const[e,i]=this._d3Arc.centroid(t);this.tip({x:e,y:i,label:this.tickValueDescription()})}).on("mouseout",t=>{this.tip(null)}),this._mainTooltip=e.append("title");const i=this;function n(){return e.append("path").datum({angle:yo(0)}).style("fill","black").style("stroke","black").attr("d","M 0 0 l -3 -3 l 6 0 z").on("mousemove",t=>{const[e,n]=i._d3Arc.centroid(i._meanArc.datum());i.tip({x:e,y:n,label:i.tickValueDescription()})}).on("mouseout",t=>{i.tip(null)})}o(n,"appendIndicator"),this._indInner=n(),this._indOuter=n(),this._centerText=e.append("text").attr("dy",".66em").style("fill","green").on("mousemove",t=>{this.tip({x:0,y:0,label:this.valueDescription()})}).on("mouseout",t=>{this.tip(null)}),this._bottomText=e.append("text").attr("dy",".66em").on("mousemove",t=>{this.tip({x:0,y:t.y,label:this.titleDescription()})}).on("mouseout",t=>{this.tip(null)}),this._tooltipG=e.append("g").attr("class","annotation-tip")}update(t,e){super.update(t,e),this._colorScale.domain(this.colorDomain()).range(this.colorRange()),e.attr("title",this.tooltip()).style("cursor",this.click!==_Gauge.prototype.click?"pointer":null);const n=this.calcWidth()/3,s=this.calcWidth()/2-5;this._d3Arc.innerRadius(n).outerRadius(s);const o=this.value(),a=this.tickValue();this._usageArc.style("fill",this._colorScale(o)).transition().duration(750).attrTween("d",go(yo(0),yo(o),this._d3Arc)),this._freeArc.style("fill",this.emptyColor()).transition().duration(750).attrTween("d",go(yo(o),yo(1),this._d3Arc)),this._meanArc.style("fill",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("d",go(yo(a-.001),yo(a+.001),this._d3Arc)),this._indInner.style("fill",this.tickColor()).style("stroke",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("transform",mo(yo(a),n,!0)),this._indOuter.style("fill",this.tickColor()).style("stroke",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("transform",mo(yo(a),s)),this._centerText.style("fill",this._colorScale(o)).text(i.format(".0%")(o)),this._bottomText.style("fill",this.click!==_Gauge.prototype.click?"blue":"black").style("text-decoration",this.click!==_Gauge.prototype.click?"underline":null).text(this.title());const r=_o(yo(1),n-8);this.updateText(this._centerText,-r.x,-r.y,2*r.x,2*r.y);const l=_o(yo(1),s);l.y+=5;const h=this.calcWidth()-20,c=this.calcWidth()/2-l.y-5;this.updateText(this._bottomText,-h/2,l.y,h,c),this._mainTooltip.text(this.tooltip())}click(t){}};o(bo,"Gauge");let vo=bo;vo.prototype._class+=" chart_Gauge",vo.prototype.publish("title","","string","Title"),vo.prototype.publish("titleDescription","","string","Title Description"),vo.prototype.publish("maxDiameter",128,"number","Max Diameter"),vo.prototype.publish("value",0,"number","Value"),vo.prototype.publish("valueDescription","","string","Value Description"),vo.prototype.publish("showTick",!1,"boolean","Show Tick"),vo.prototype.publish("tickValue",0,"number","Tick Value"),vo.prototype.publish("tickValueDescription","","string","Tick Value Description"),vo.prototype.publish("tooltip","","string","Tooltip"),vo.prototype.publish("colorRange",["green","green","green","green","green","green","green","green","orange","red","red"],"array","Array of colors for the filled gauge portion. The fill color will be relative to the gauge value."),vo.prototype.publish("colorDomain",[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1],"array","This array augments the mapping of the value to the fill colorRange."),vo.prototype.publish("emptyColor","lightgrey","html-color","Color of the empty portion of the gauge"),vo.prototype.publish("tickColor","black","html-color","Color of the tick");const wo=o((t,e)=>t[1]-e[1]>0?1:-1,"sortAscending"),So=o((t,e)=>t[1]-e[1]>0?-1:1,"sortDescending"),Ao=class _Pie extends i.SVGWidget{constructor(){super(),a(this,"_totalValue"),a(this,"d3Pie"),a(this,"d3Arc"),a(this,"d3LabelArc"),a(this,"_labelPositions"),a(this,"_smallValueLabelHeight"),a(this,"_labelWidthLimit"),a(this,"_quadIdxArr"),a(this,"_minLabelTop",0),a(this,"_maxLabelBottom",0),a(this,"_seriesValueFormatter"),a(this,"_seriesPercentageFormatter"),a(this,"_slices"),a(this,"_labels"),e.I2DChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this),this.d3Pie=V(),this.d3Arc=E(),this.d3LabelArc=E(),this.tooltipTick_default(!1).tooltipOffset_default(0)}intersection(t,e){return this.intersectCircle(this.calcOuterRadius(),t,e)}calcInnerRadius(){return this.innerRadius_exists()?this.calcOuterRadius()*this.innerRadius()/100:0}calcOuterRadius(){const t=this.textSize(this.data().map(t=>this.getLabelText({data:t},!1)),"Verdana",12).width,e=this._size.width-(this.showLabels()?2*t:0)-20,i=this._size.height-36-(this.showLabels()?this._smallValueLabelHeight:0),n=Math.min(e,i)/2-2;return e/2-2<this.minOuterRadius()?this._labelWidthLimit=t-(this.minOuterRadius()-(e/2-2)):this._labelWidthLimit=t,n<this.minOuterRadius()?this.minOuterRadius():n}calcSmallValueLabelHeight(){const t=this.data().reduce((t,e)=>t+e[1],0);let e=0;return this.data().forEach(i=>{i[1]/t<.1&&e++}),this.labelHeight()*e}calcTotalValue(){return this.data().reduce((t,e)=>t+e[1],0)}getLabelText(t,e){let i,n=t.data[0];if(void 0!==this._labelWidthLimit&&e){const t=this.textSize(n,"Verdana",this.labelHeight()).width;this._labelWidthLimit<t&&(i=n.length*(this._labelWidthLimit/t)-3,n=i<n.length?n.slice(0,i)+"...":n)}if(this.showSeriesValue()&&(n+=` : ${this._seriesValueFormatter(t.data[1])}`),this.showSeriesPercentage()){let e=this._totalValue;const i=this.dataMeta();void 0!==i.sum&&(e=i.sum);const s=t.data[1]/e*100;n+=` : ${this._seriesPercentageFormatter(s)}%`}return n}selection(t){var e;if(!arguments.length)try{return null==(e=this._selection.selection2()[0])?void 0:e.data}catch(n){return}const i=JSON.stringify(t);this._selection.selection2(t=>i===JSON.stringify(t.data))}selectByLabel(t){const e=this.data().filter(e=>e[0]===t)[0];e&&this.selection(e)}enter(t,e){super.enter(t,e),this._selection.widgetElement(e),this._slices=e.append("g"),this._labels=e.append("g");const i=this;this.tooltipHTML(function(t){return"series-table"===i.tooltipStyle()?i.tooltipFormat({label:t.data[0],arr:i.columns().slice(1).map(function(e,n){return{label:e,color:i._palette(t.data[0]),value:t.data[n+1]}})}):i.tooltipFormat({label:t.data[0],value:t.data[1]})})}update(t,e){super.update(t,e);const n=this;this.updateD3Pie(),this._palette=this._palette.switch(this.paletteID()),this._seriesValueFormatter=i.format(this.seriesValueFormat()),this._seriesPercentageFormatter=i.format(this.seriesPercentageFormat()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._smallValueLabelHeight=this.calcSmallValueLabelHeight(),this._totalValue=this.calcTotalValue();const s=this.calcInnerRadius(),a=this.calcOuterRadius(),r=a+12;this.d3Arc.innerRadius(s).padRadius(a).outerRadius(a),this._quadIdxArr=[[],[],[],[]];const l=[...this.data()];switch(this.sortDataByValue()){case"ascending":l.sort(wo);break;case"descending":l.sort(So)}const h=this._slices.selectAll(".arc").data(this.d3Pie(l),t=>t.data[0]);this._labelPositions=[],h.enter().append("g").attr("class",(t,e)=>"arc series series-"+this.cssTag(t.data[0])).attr("opacity",0).call(this._selection.enter.bind(this._selection)).on("click",function(t){n.click(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))}).on("dblclick",function(t){n.dblclick(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))}).each(function(t,e){i.select(this).append("path").on("mouseout.tooltip",n.tooltip.hide).on("mousemove.tooltip",n.tooltip.show).on("mouseover",f(0,0)).on("mouseout",f(-5,150))}).merge(h).transition().attr("opacity",1).each(function(t,e){const s=n.getQuadrant(d(t));n._quadIdxArr[s].push(e),t.outerRadius=a-5;i.select(this).select("path").transition().attr("d",n.d3Arc).style("fill",n.fillColor(t.data,n.columns()[1],t.data[1]))}),h.exit().transition().style("opacity",0).remove(),this.d3LabelArc.innerRadius(r).outerRadius(r);const c=this._labels.selectAll("text").data(this.showLabels()?this.d3Pie(l):[],t=>t.data[0]),u=c.enter().append("text").on("mouseout.tooltip",n.tooltip.hide).on("mousemove.tooltip",n.tooltip.show).attr("dy",".5em").on("click",function(t){n._slices.selectAll("g").filter(function(e){t.data===e.data&&(n._selection.click(this),n.click(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this)))})}).on("dblclick",function(t){n._slices.selectAll("g").filter(function(e){t.data===e.data&&n.dblclick(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))})}).merge(c).text(t=>this.getLabelText(t,!0)).each(function(t,e){const i=n.d3LabelArc.centroid(t),s=d(t);i[0]=r*(n.isLeftSide(s)?1:-1),n._labelPositions.push({top:i[1],bottom:i[1]+n.labelHeight()})});this.showLabels()&&(this.adjustForOverlap(),u.transition().style("font-size",this.labelHeight()+"px").attr("transform",(t,e)=>{const i=n.d3LabelArc.centroid(t);return i[0]=r*(n.isLeftSide(d(t))?1:-1),i[1]=n._labelPositions[e].top,"translate("+i+")"}).style("text-anchor",t=>this.isLeftSide(d(t))?"start":"end")),c.exit().remove();const p=this._labels.selectAll("polyline").data(this.showLabels()?this.d3Pie(l):[],t=>this.getLabelText(t,!0));function d(t){return t.startAngle+(t.endAngle-t.startAngle)/2}function f(t,e){return function(){i.select(this).transition().delay(e).attrTween("d",function(e){const s=i.interpolate(e.outerRadius,a+t);return function(t){return e.outerRadius=s(t),n.d3Arc(e)}})}}p.enter().append("polyline").merge(p).transition().attr("points",function(t,e){const i=n.d3LabelArc.centroid(t),s=n.d3Arc.centroid(t),o=[...i];return i[0]=r*(n.isLeftSide(d(t))?1:-1),i[1]=n._labelPositions[e].top,[s,o,i]}),p.exit().remove(),this.showLabels()&&this.centerOnLabels(),o(d,"midAngle"),o(f,"arcTween")}isLeftSide(t){return(t=n.normalizeRadians(t))>2*Math.PI?t:t<Math.PI&&t>0}getQuadrant(t){let e=0;const i=n.normalizeRadians(t);return e=i<=1*Math.PI&&i>=.5*Math.PI?3:e,e=i<=.5*Math.PI&&i>=0*Math.PI?2:e,e=i<=0*Math.PI&&i>=-.5*Math.PI?1:e,e}centerOnLabels(){const t=this.pos().y,e=2*t,i=this.calcOuterRadius(),n=Math.min(this._minLabelTop,-i),s=Math.max(this._maxLabelBottom,i),o=e-(s-n),a=Math.abs(this._minLabelTop);let r=0;s>t?(r=t-s+this.labelHeight()/2,r-=o/2):n<0&&a>t&&(r=a-t+this.labelHeight()/2,r+=o/2);const l=this.pos();this.pos({y:l.y+r,x:l.x})}adjustForOverlap(){const t=this.labelHeight();this._quadIdxArr.forEach((e,i)=>{let n;this._quadIdxArr[i].sort((t,e)=>1===i||2===i?this._labelPositions[t].top>this._labelPositions[e].top?-1:1:0===i||3===i?this._labelPositions[t].top>this._labelPositions[e].top?1:-1:void 0),this._quadIdxArr[i].forEach((e,s)=>{if(s>0)if(1===i||2===i){if(n<this._labelPositions[e].bottom){const t=this._labelPositions[e].bottom-n;this._labelPositions[e].top-=t,this._labelPositions[e].bottom-=t}}else if((0===i||3===i)&&n+t>this._labelPositions[e].top){const i=Math.abs(this._labelPositions[e].top)-Math.abs(n+t);this._labelPositions[e].top-=i,this._labelPositions[e].bottom-=i}n=this._labelPositions[e].top})}),this._minLabelTop=0,this._maxLabelBottom=0,this._quadIdxArr.forEach((t,e)=>{this._quadIdxArr[e].forEach((t,e)=>{this._minLabelTop>this._labelPositions[t].top&&(this._minLabelTop=this._labelPositions[t].top),this._maxLabelBottom<this._labelPositions[t].bottom&&(this._maxLabelBottom=this._labelPositions[t].bottom)})})}exit(t,e){super.exit(t,e)}updateD3Pie(){const t=n.normalizeRadians(n.degreesToRadians(this.startAngle()));switch(this.sortDataByValue()){case"ascending":this.d3Pie.sort(wo);break;case"descending":this.d3Pie.sort(So);break;default:this.d3Pie.sort(null)}this.d3Pie.padAngle(.0025).startAngle(t).endAngle(2*Math.PI+t).value(function(t){return t[1]})}};o(Ao,"Pie"),a(Ao,"__inputs",[{id:"label",type:"string"},{id:"value",type:"number"}]);let ko=Ao;ko.prototype._class+=" chart_Pie",ko.prototype.implements(e.I2DChart.prototype),ko.prototype.implements(e.ITooltip.prototype),ko.prototype.mixin(i.Utility.SimpleSelectionMixin),ko.prototype.publish("showLabels",!0,"boolean","If true, wedge labels will display"),ko.prototype.publish("showSeriesValue",!1,"boolean","Append data series value next to label",null,{disable:o(t=>!t.showLabels(),"disable")}),ko.prototype.publish("seriesValueFormat",",.0f","string","Number format used for formatting series values",null,{disable:o(t=>!t.showSeriesValue(),"disable")}),ko.prototype.publish("showSeriesPercentage",!1,"boolean","Append data series percentage next to label",null,{disable:o(t=>!t.showLabels(),"disable")}),ko.prototype.publish("seriesPercentageFormat",",.0f","string","Number format used for formatting series percentages",null,{disable:o(t=>!t.showSeriesPercentage(),"disable")}),ko.prototype.publish("paletteID","default","set","Color palette for this widget",ko.prototype._palette.switch(),{tags:["Basic","Shared"]}),ko.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),ko.prototype.publish("innerRadius",0,"number","Sets inner pie hole radius as a percentage of the radius of the pie chart",null,{tags:["Basic"],range:{min:0,step:1,max:100}}),ko.prototype.publish("minOuterRadius",20,"number","Minimum outer radius (pixels)"),ko.prototype.publish("startAngle",0,"number","Starting angle of the first (and largest) wedge (degrees)"),ko.prototype.publish("labelHeight",12,"number","Font size of labels (pixels)",null,{disable:o(t=>!t.showLabels(),"disable")}),ko.prototype.publish("sortDataByValue","descending","set","Sort data by value",["none","ascending","descending"]);const Mo=class _HalfPie extends ko{constructor(){super()}postUpdate(t,e){super.postUpdate(t,e);let i=this._pos.x,n=this._pos.y;"origin"===this._drawStartPos&&this._target instanceof SVGElement&&(i-=this._size.width/2,n-=this._size.height/2),n+=this._size.height/4,this._element.attr("transform","translate("+i+","+n+")scale("+this._widgetScale+")")}updateD3Pie(){super.updateD3Pie(),this.d3Pie.startAngle(-Math.PI/2).endAngle(Math.PI/2)}};o(Mo,"HalfPie");let To=Mo;To.prototype._class+=" chart_HalfPie";const Po=class _Heat extends It{constructor(){super(),a(this,"_domForeignObject"),a(this,"_domCanvas"),a(this,"_heat"),this.xAxisGuideLines_default(!0).yAxisGuideLines_default(!0)}radius(t){return this.radiusX(t),this.radiusY(t),this}layerEnter(t,e,i=250){super.layerEnter(t,e,i),this._domForeignObject=this.svg.insert("foreignObject","#"+(this.id()+"_clippath")),this._domCanvas=this._domForeignObject.append("xhtml:body").style("margin","0px").style("padding","0px").style("background-color","transparent").append("canvas"),this._heat=Io(this._domCanvas.node())}layerUpdate(t,e,n=250){super.layerUpdate(t,e),this._palette=this._palette.switch(this.paletteID());let s=this.width()-this.margin.left-this.margin.right;s<0&&(s=0);let o=this.height()-this.margin.top-this.margin.bottom;o<0&&(o=0),this._domForeignObject.attr("x",this.margin.left).attr("y",this.margin.top).attr("width",s).attr("height",o),this._domCanvas.attr("width",s).attr("height",o);const a="horizontal"===t.orientation()?this.data().map(e=>[t.dataPos(e[0]),t.valuePos(e[1]),e[2]]):this.data().map(e=>[t.valuePos(e[1]),t.dataPos(e[0]),e[2]]),r=this.maxWeight_exists()?this.maxWeight():i.max(a,t=>t[2]);if("default"!==this.paletteID()){const t={},e=8,i=this.reversePalette();for(let n=0;n<e;++n)t[n/e]=this._palette((i?e-n:n)/e,0,1);this._heat.gradient(t)}else this._heat.gradient(this._heat.defaultGradient);this._heat.resize();const l=this.radiusAsPercent()?this.radiusX()*s/100:this.radiusX(),h=this.radiusAsPercent()?this.radiusY()*o/100:this.radiusY();this._heat.clear().radius(l,h,this.blur()).max(r).data(a).draw(this.minOpacity())}};o(Po,"Heat");let Co=Po;function Io(t){if(!(this instanceof Io))return new Io(t);this._canvas=t="string"==typeof t?document.getElementById(t):t,this._ctx=t.getContext("2d"),this._width=t.width,this._height=t.height,this._max=1,this._data=[]}Co.prototype._class+=" chart_Heat",Co.prototype._palette=i.Palette.rainbow("default"),Co.prototype.publish("paletteID","default","set","Color palette for this widget",Co.prototype._palette.switch(),{tags:["Basic"]}),Co.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Co.prototype.publish("reversePalette",!1,"boolean","Reverse Palette Colors",null,{disable:o(t=>"default"===t.paletteID(),"disable")}),Co.prototype.publish("radiusX",25,"number","Point X radius (25 by default)"),Co.prototype.publish("radiusY",25,"number","Point Y radius (25 by default)"),Co.prototype.publish("radiusAsPercent",!1,"boolean","Calculate RadiusX + RadiusY as % of size"),Co.prototype.publish("blur",15,"number","Point blur radius (15 by default)"),Co.prototype.publish("maxWeight",void 0,"number","Clamp max weight to value (optional), omitting uses max data point",void 0,{optional:!0}),Co.prototype.publish("minOpacity",.05,"number","Minimum point opacity (0.05 by default)"),o(Io,"simpleheat"),Io.prototype={defaultRadius:25,defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"},data:o(function(t){return this._data=t,this},"data"),max:o(function(t){return this._max=t,this},"max"),add:o(function(t){return this._data.push(t),this},"add"),clear:o(function(){return this._data=[],this},"clear"),radius:o(function(t,e,i){i=void 0===i?15:i;const n=this._ellipse=this._createCanvas(),s=n.getContext("2d"),o=this._r=t+i,a=this._r=e+i;return n.width=2*o,n.height=2*a,s.shadowOffsetX=s.shadowOffsetY=2*o,s.shadowOffsetY=s.shadowOffsetY=2*a,s.shadowBlur=i,s.shadowColor="black",s.beginPath(),s.ellipse(-o,-a,t,e,0,0,2*Math.PI,!0),s.closePath(),s.fill(),this},"radius"),resize:o(function(){this._width=this._canvas.width,this._height=this._canvas.height},"resize"),gradient:o(function(t){const e=this._createCanvas(),i=e.getContext("2d"),n=i.createLinearGradient(0,0,0,256);e.width=1,e.height=256;for(const s in t)n.addColorStop(+s,t[s]);return i.fillStyle=n,i.fillRect(0,0,1,256),this._grad=i.getImageData(0,0,1,256).data,this},"gradient"),draw:o(function(t){this._ellipse||this.radius(this.defaultRadius,this.defaultRadius),this._grad||this.gradient(this.defaultGradient);const e=this._ctx;e.clearRect(0,0,this._width,this._height);for(let n,s=0,o=this._data.length;s<o;s++)n=this._data[s],n[2]<0?n[2]=0:n[2]>this._max&&(n[2]=this._max),e.globalAlpha=Math.max(n[2]/this._max,void 0===t?.05:t),e.drawImage(this._ellipse,n[0]-this._r,n[1]-this._r);const i=e.getImageData(0,0,this._width,this._height);return this._colorize(i.data,this._grad),e.putImageData(i,0,0),this},"draw"),_colorize:o(function(t,e){for(let i,n=0,s=t.length;n<s;n+=4)i=4*t[n+3],i&&(t[n]=e[i],t[n+1]=e[i+1],t[n+2]=e[i+2])},"_colorize"),_createCanvas:o(function(){return"undefined"!=typeof document?document.createElement("canvas"):new this._canvas.constructor},"_createCanvas")};var zo=Math.PI/3,Fo=[0,zo,2*zo,3*zo,4*zo,5*zo];function Do(t){return t[0]}function Eo(t){return t[1]}function Oo(){var t,e,i,n=0,s=0,a=1,r=1,l=Do,h=Eo;function c(t){var n,s={},o=[],a=t.length;for(n=0;n<a;++n)if(!isNaN(c=+l.call(null,r=t[n],n,t))&&!isNaN(u=+h.call(null,r,n,t))){var r,c,u,p=Math.round(u/=i),d=Math.round(c=c/e-(1&p)/2),f=u-p;if(3*Math.abs(f)>1){var y=c-d,_=d+(c<d?-1:1)/2,x=p+(u<p?-1:1),m=c-_,g=u-x;y*y+f*f>m*m+g*g&&(d=_+(1&p?1:-1)/2,p=x)}var b=d+"-"+p,v=s[b];v?v.push(r):(o.push(v=s[b]=[r]),v.x=(d+(1&p)/2)*e,v.y=p*i)}return o}function u(t){var e=0,i=0;return Fo.map(function(n){var s=Math.sin(n)*t,o=-Math.cos(n)*t,a=s-e,r=o-i;return e=s,i=o,[a,r]})}return o(c,"hexbin"),o(u,"hexagon"),c.hexagon=function(e){return"m"+u(null==e?t:+e).join("l")+"z"},c.centers=function(){for(var o=[],l=Math.round(s/i),h=Math.round(n/e),c=l*i;c<r+t;c+=i,++l)for(var u=h*e+(1&l)*e/2;u<a+e/2;u+=e)o.push([u,c]);return o},c.mesh=function(){var e=u(t).slice(0,4).join("l");return c.centers().map(function(t){return"M"+t+"m"+e}).join("")},c.x=function(t){return arguments.length?(l=t,c):l},c.y=function(t){return arguments.length?(h=t,c):h},c.radius=function(n){return arguments.length?(e=2*(t=+n)*Math.sin(zo),i=1.5*t,c):t},c.size=function(t){return arguments.length?(n=s=0,a=+t[0],r=+t[1],c):[a-n,r-s]},c.extent=function(t){return arguments.length?(n=+t[0][0],s=+t[0][1],a=+t[1][0],r=+t[1][1],c):[[n,s],[a,r]]},c.radius(1)}o(Do,"pointX"),o(Eo,"pointY"),o(Oo,"d3HexBin");const Ro=class _HexBin extends It{constructor(){super(),a(this,"_hexbin"),a(this,"_dataMinWeight"),a(this,"_dataMaxWeight"),e.I2DAggrChart.call(this),this.tooltipValueFormat_default(",.0f"),e.ITooltip.call(this),this.tooltipHTML(t=>{const e=i.extent(t,t=>t.label),n=i.extent(t,t=>t.value);return this.tooltipFormat({series:e[0]===e[1]?e[0]:`${e[0]} -> ${e[1]}`,label:n[0]===n[1]?n[0]:`${n[0]} -> ${n[1]}`,value:t.length})}),this._hexbin=Oo().x(t=>t.x).y(t=>t.y),this.xAxisGuideLines_default(!1).yAxisGuideLines_default(!1).xAxisType_default("linear")}xPos(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)}yPos(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)}layerUpdate(t,e,n=250){super.layerUpdate(t,e,n);const s=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._hexbin.extent([0,0],[this.width(),this.height()]).radius(this.binSize());const o=this.flattenData().map(e=>({x:s.xPos(t,e),y:s.yPos(t,e),label:t.parseData(e.label),value:t.parseValue(e.value),origRow:e})),a=this._hexbin(o),r=i.min(a,function(t){return t.length}),l=i.max(a,function(t){return t.length});this._dataMinWeight=r,this._dataMaxWeight=l;const h=e.selectAll(".hexagon").data(a,function(t){return t.i+"_"+t.j});h.enter().append("path").attr("class","hexagon").call(t._selection.enter.bind(t._selection)).on("click",function(e){const i=s.data();s.click(e.map(e=>t.rowToObj(i[e.origRow.rowIdx])),s.columns()[1],t._selection.selected(this))}).on("dblclick",function(e){const i=s.data();s.dblclick(e.map(e=>t.rowToObj(i[e.origRow.rowIdx])),s.columns()[1],t._selection.selected(this))}).on("mouseout.tooltip",s.tooltip.hide).on("mousemove.tooltip",s.tooltip.show).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(0)"}).merge(h).transition().duration(n).attr("d",this._hexbin.hexagon()).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(1)"}).style("fill",function(t){return s._palette(t.length,r,l)}),h.exit().transition().duration(n).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(0)"}).remove()}exit(t,e){super.exit(t,e)}click(t,e,i){}dblclick(t,e,i){}};o(Ro,"HexBin"),a(Ro,"__inputs",[{id:"x",type:"any"},{id:"y",type:"number"}]);let jo=Ro;jo.prototype._class+=" chart_HexBin",jo.prototype.implements(e.I2DAggrChart.prototype),jo.prototype.implements(e.ITooltip.prototype),jo.prototype.publish("paletteID","Blues","set","Color palette for this widget",jo.prototype._palette.switch(),{tags:["Basic","Shared"]}),jo.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),jo.prototype.publish("binSize",20,"number","Bin radius",null,{range:{min:1,max:300,step:1}});const No=class _Line extends Ft{constructor(){super(),this.interpolate_default("linear")}};o(No,"Line");let Lo=No;Lo.prototype._class+=" chart_Line";const Bo=class _QuarterPie extends ko{constructor(){super()}postUpdate(t,e){super.postUpdate(t,e);let i="left"===this.orientation()?0:this._size.width,n=this._size.height;"origin"===this._drawStartPos&&this._target instanceof SVGElement&&(i-=this._size.width/2,n-=this._size.height/2),this._element.attr("transform","translate("+i+","+n+")scale("+this._widgetScale+")")}updateD3Pie(){super.updateD3Pie(),this.d3Pie.startAngle("left"===this.orientation()?0:-Math.PI/2).endAngle("left"===this.orientation()?Math.PI/2:0)}calcOuterRadius(){const t=this.textSize(this.data().map(t=>this.getLabelText({data:t})),"Verdana",12).width;return Math.min(this._size.width-t-10,this._size.height-36)-2}};o(Bo,"QuarterPie");let $o=Bo;$o.prototype._class+=" chart_QuarterPie",$o.prototype.publish("orientation","left","set","Determines the placement and start/end angle.",["left","right"]);const Ho=class _QuartileCandlestick extends i.SVGWidget{constructor(){super(),a(this,"_g"),a(this,"_leftLine"),a(this,"_rightLine"),a(this,"_midLine"),a(this,"_midOuterRect"),a(this,"_midInnerRect1"),a(this,"_midInnerRect2"),a(this,"_q0text"),a(this,"_q1text"),a(this,"_q2text"),a(this,"_q3text"),a(this,"_q4text"),a(this,"_q0val"),a(this,"_q1val"),a(this,"_q2val"),a(this,"_q3val"),a(this,"_q4val")}enter(t,e){super.enter(t,e),this._g=e.append("g"),this._leftLine=this._g.append("rect"),this._rightLine=this._g.append("rect"),this._midLine=this._g.append("rect"),this._midOuterRect=this._g.append("rect"),this._midInnerRect1=this._g.append("rect"),this._midInnerRect2=this._g.append("rect"),this._q0text=this._g.append("text"),this._q1text=this._g.append("text"),this._q2text=this._g.append("text"),this._q3text=this._g.append("text"),this._q4text=this._g.append("text"),this._q0val=this._g.append("text"),this._q1val=this._g.append("text"),this._q2val=this._g.append("text"),this._q3val=this._g.append("text"),this._q4val=this._g.append("text")}update(t,e){super.update(t,e);const n=("horizontal"===this.orientation()?this.width():this.height())-this.lineWidth(),s="horizontal"===this.orientation()?this.height():this.width(),o=i.scaleLinear().domain([this.data()[0],this.data()[4]]).range([this.edgePadding(),n-this.edgePadding()]),a=this.candleWidth_exists()?this.candleWidth():s,r=this.lineWidth(),l=this.lineColor(),h=this.roundedCorners(),c=this.edgePadding();let u=o(this.data()[1]),p=o(this.data()[2]),d=o(this.data()[3]);const f=-a/2,y=a/2,_=this.upperTextRotation(),x=this.lowerTextRotation(),m=this.textPadding(),g=this.labelFontSize(),b=this.valueFontSize(),v=Math.max(g,b),w=n-c;if(v>0){for(;u-c<v;)u+=v;for(;p-u<v;)p+=v;for(;d-p<v;)d+=v;for(;w-d<v;)d-=v;for(;d-p<v;)p-=v;for(;p-u<v;)u-=v}let S=-n/2-this.lineWidth()/2,A=0,k=0;let M=1,T="start",P="end";"vertical"===this.orientation()&&(S=0,A=n/2+this.lineWidth()/2,k=-90,T="end",P="start",M=-1),this._g.style("shape-rendering","crispEdges").attr("transform",`translate(${S},${A})rotate(${k})scale(1)`),this._leftLine.attr("fill",l).attr("height",a).attr("width",r).attr("x",c).attr("y",f).attr("rx",h).attr("ry",h),this._rightLine.attr("class","right-line").attr("fill",l).attr("height",a).attr("width",r).attr("x",w).attr("y",f).attr("rx",h).attr("ry",h),this._midLine.attr("fill",l).attr("height",r).attr("width",w-c).attr("x",c).attr("y",-r/2),this._midOuterRect.attr("fill",l).attr("height",a).attr("width",d-u).attr("x",u).attr("y",f).attr("rx",h).attr("ry",h),this._midInnerRect1.attr("fill",this.innerRectColor()).attr("height",a-2*r).attr("width",p-(u+2*r)).attr("x",u+r).attr("y",r-a/2).attr("rx",.618*h).attr("ry",.618*h),this._midInnerRect2.attr("fill",this.innerRectColor()).attr("height",a-2*r).attr("width",d-p-r).attr("x",p).attr("y",r-a/2).attr("rx",.618*h).attr("ry",.618*h),this._q0text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${c}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","hanging").text(this.columns()[0]),this._q1text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${u}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","middle").text(this.columns()[1]),this._q2text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${p}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","middle").text(this.columns()[2]),this._q3text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${d}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","middle").text(this.columns()[3]),this._q4text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${w+r}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","baseline").text(this.columns()[4]),this._q0val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${c}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","hanging").text(this.data()[0]),this._q1val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${u}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.data()[1]),this._q2val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${p}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.data()[2]),this._q3val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${d}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.data()[3]),this._q4val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${w+r}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","baseline").text(this.data()[4])}};o(Ho,"QuartileCandlestick");let Vo=Ho;Vo.prototype._class+=" chart_QuartileCandlestick",Vo.prototype.publish("textColor","black","html-color","Color of label and value text"),Vo.prototype.publish("showLabels",!0,"boolean","If true, labels will be shown"),Vo.prototype.publish("showValues",!0,"boolean","If true, values will be shown"),Vo.prototype.publish("orientation","horizontal","set","Determines layout",["horizontal","vertical"]),Vo.prototype.publish("valueFontSize",12,"number","Font size of value text (pixels)"),Vo.prototype.publish("labelFontSize",12,"number","Font size of label text (pixels)"),Vo.prototype.publish("roundedCorners",8,"number","Radius of rounded rect corners (pixels)"),Vo.prototype.publish("lineWidth",4,"number","Width of lines (pixels)"),Vo.prototype.publish("candleWidth",null,"number","Height of outer rect (pixels)",null,{optional:!0}),Vo.prototype.publish("textPadding",8,"number","Padding between outer rect and text (pixels)"),Vo.prototype.publish("edgePadding",30,"number","Padding between outer rect and left/right sides (pixels)"),Vo.prototype.publish("lineColor","#333","html-color","Color of outer rect and lines"),Vo.prototype.publish("innerRectColor","white","html-color","Color of the inner rects"),Vo.prototype.publish("upperTextRotation",-60,"number","Rotation of label text (degrees)"),Vo.prototype.publish("lowerTextRotation",-60,"number","Rotation of value text (degrees)");const qo=class _Radar extends i.SVGWidget{constructor(){super(),e.INDChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this)}mapShape(t){switch(t){case"rectangle":return"rect";case"circle":return"circle";case"cross":return"path"}}setPointAttributes(t,e,i){const n=this;switch(this.mapShape(this.pointShape())){case"rect":t.attr("width",n.pointSize()).attr("height",n.pointSize()).style("fill",t=>this.strokeColor(t.data,t.column,t.value));break;case"circle":t.attr("r",n.pointSize()/2).attr("cx",e).attr("cy",i).style("fill",t=>this.strokeColor(t.data,t.column,t.value));break;case"path":const s=n.pointSize()/2;t.attr("d",function(t){return"M"+(e-s)+" "+(i-s)+" L"+(e+s)+" "+(i+s)+" M"+(e-s)+" "+(i+s)+" L"+(e+s)+" "+(i-s)}).style("stroke",t=>this.strokeColor(t.data,t.column,t.value))}}enter(t,e){super.enter(t,e),this._selection.widgetElement(e),this.tooltipHTML(t=>this.tooltipFormat({label:t.label,series:t.column,value:t.value}))}update(t,e){super.update(t,e),this._palette=this._palette.switch(this.paletteID());const n=this,s=this.height()/2,o=this.width()/2,a=this.columns(),r=this.data(),l=this.flattenData(a,r).map((t,e)=>(t.shape=this.mapShape(this.pointShape()),t.column=a[t.colIdx],t.row=r[e],t)),h=[],c=this.degrees2radians(360/this.data().length),u=this.fontSize();let p=0;l.filter(t=>1===t.colIdx).forEach(t=>{const e=super.textSize(t.label,`${this.fontFamily()}`,this.fontSize());p<e.width&&(p=e.width)});const d=Math.min(s-u,o-p),f=e.selectAll(".label").data(l.filter(t=>1===t.colIdx)),y=Math.max.apply(n,l.map(t=>t.value));f.enter().append("text").attr("class","label").attr("text-anchor","middle").merge(f).attr("font-size",this.fontSize()).attr("font-family",this.fontFamily()).each(function(t,e){const s=n.polar2cartesian(d,e*c-Math.PI/2);h.push(s.map(t=>t*n.labelPaddingRatio()));let o="middle";const a=Math.round(s[0]);o=a>0?"start":o,o=a<0?"end":o,i.select(this).attr("text-anchor",o).attr("x",s[0]).attr("y",s[1])}).text(t=>t.label),f.exit().remove();const _=e.selectAll(".domain").data(l.filter(t=>1===t.colIdx));_.enter().append("line").classed("domain",!0).style("stroke","#000").style("stroke-opacity","0.75").style("stroke-width","1px").merge(_).attr("x1",0).attr("y1",0).attr("x2",(t,e)=>h[e][0]).attr("y2",(t,e)=>h[e][1]),_.exit().remove();const x=e.selectAll(".value_guide").data(this.valueGuideRatios());x.enter().append("polygon").classed("value_guide",!0).style("stroke","grey").style("stroke-opacity","0.75").style("stroke-width","0.3px").merge(x).each(function(t,e){const n=[];h.forEach((e,i)=>{n.push([e[0]*t,e[1]*t])}),i.select(this).attr("points",n.join(" ")).attr("stroke","rgb(0, 0, 0)").attr("stroke-opacity",.75).attr("stroke-width",.3).attr("fill-opacity",0)}),x.exit().remove();const m=e.selectAll(".value_guide_text").data(this.valueGuideRatios());m.enter().append("text").attr("class","value_guide_text").attr("text-anchor","start").attr("font-size",this.fontSize()).attr("font-family",this.fontFamily()).merge(m).attr("x",2).attr("y",t=>h[0][1]*t).text((t,e)=>Math.round(t*y)),x.exit().remove();const g=e.selectAll(".area").data(a.filter((t,e)=>e>0));g.enter().append("polygon").attr("class","area").style("stroke-opacity","0.75").style("stroke-width","0.3px").merge(g).style("stroke",t=>this.strokeColor([],t,0)).style("fill",t=>this.fillColor([],t,0)).style("fill-opacity",this.fillOpacity()).attr("points",(t,e)=>h.map((t,i)=>{const n=r[i][e+1],s=0===n?0:n/y;return t[0]*s+","+t[1]*s}).join(" ")),g.exit().remove();const b=e.selectAll(".point").data(l);b.enter().append("g").attr("class","point").on("mouseout.tooltip",n.tooltip.hide).on("mousemove.tooltip",n.tooltip.show).on("click",function(t,e){const i=n.data()[t.rowIdx],s=n.rowToObj(i),o=n._selection.selected(this);n.click(s,n.columns()[t.colIdx],o)}).on("dblclick",function(t,e){n.dblclick(n.rowToObj(n.data()[t.rowIdx]),t.column,n._selection.selected(this))}).each(function(t){const e=i.select(this);e.append("circle").attr("class","pointSelection").attr("r",n.pointSize()).call(n._selection.enter.bind(n._selection)),e.append(n.mapShape(n.pointShape())).attr("class","pointShape")}).merge(b).each(function(t){const e=i.select(this),s=0===t.value?0:t.value/y,o=h[t.rowIdx][0]*s,a=h[t.rowIdx][1]*s;e.select(".pointSelection").attr("cx",o).attr("cy",a);const r=e.select(".pointShape").style("stroke",n.strokeColor(t.row,t.column,t.value)).style("fill",n.fillColor(t.row,t.column,t.value));n.setPointAttributes(r,o,a)}),b.exit().remove()}polar2cartesian(t,e){return[t*Math.cos(e),t*Math.sin(e)]}cartesian2polar(t,e){return[Math.atan2(e,t),Math.sqrt(t*t+e*e)]}degrees2radians(t){return t/57.295779513}radians2degrees(t){return 57.295779513*t}point_in_polygon(t,e){const i=t[0],n=t[1];let s=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){const t=e[o][0],r=e[o][1],l=e[a][0],h=e[a][1];r>n!=h>n&&i<(l-t)*(n-r)/(h-r)+t&&(s=!s)}return s}};o(qo,"Radar");let Wo=qo;Wo.prototype._class+=" chart_Radar",Wo.prototype.implements(e.INDChart.prototype),Wo.prototype.implements(e.ITooltip.prototype),Wo.prototype.mixin(i.Utility.SimpleSelectionMixin),Wo.prototype.publish("paletteID","default","set","Color palette for this widget",Wo.prototype._palette.switch()),Wo.prototype.publish("pointShape","cross","set","pointShape",["circle","rectangle","cross"]),Wo.prototype.publish("pointSize",6,"number","Point Size",null,{range:{min:1,step:1,max:200}}),Wo.prototype.publish("valueGuideRatios",[.2,.4,.6,.8,1],"array","Array of values between 0 and 1 that are multiplied by the widget radius to produce guide lines"),Wo.prototype.publish("fillOpacity",.66,"number","Opacity of the data polygon(s)"),Wo.prototype.publish("fontFamily","","string","fontFamily"),Wo.prototype.publish("fontSize",16,"number","fontSize"),Wo.prototype.publish("labelPaddingRatio",.9,"number","labelPaddingRatio");const Go=class _RadialBar extends i.SVGWidget{constructor(){super(),a(this,"_domainScale",i.scaleBand()),a(this,"_valueScale",i.scaleLinear()),a(this,"_d3Arc",E().startAngle(0).endAngle(t=>this._valueScale(t[1]))),a(this,"_arcs"),a(this,"_axialAxis"),a(this,"_radialAxis"),e.INDChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this)}enter(t,e){super.enter(t,e),this._selection.widgetElement(e),this.tooltipHTML(t=>this.tooltipFormat({label:t[0],value:t[1]})),this._radialAxis=e.append("g").attr("class","r axis"),this._axialAxis=e.append("g").attr("class","a axis"),this._arcs=e.append("g").attr("class","data")}update(t,e){super.update(t,e);const n=this,s=Math.max(this.valueDomainHigh_exists()?this.valueDomainHigh():0,...this.data().map(t=>t[1]));this._valueScale.domain([0,s]).range([0,this.radians(this.valueMaxAngle())]);const o=this._valueScale.ticks(this.tickCount()),a=this.textSize(o.map(t=>""+t),"Verdana",12).width,r=Math.min(this.width()-2*(10+a),this.height()-44)/2,l=this.data().map(t=>t[0]);this._domainScale.domain(l).range([0,r]).padding(this.domainPadding());const h=this._domainScale.step()*this._domainScale.padding(),c=this._radialAxis.selectAll("circle").data(l);c.enter().append("circle").attr("fill","transparent").merge(c).attr("r",t=>this._domainScale(t)+this._domainScale.step()-h/2),c.exit().remove();const u=this._radialAxis.selectAll(".arc-text").data(l);u.enter().append("text").attr("class","arc-text").attr("x",-4).attr("alignment-baseline","middle").attr("text-anchor","end").merge(u).attr("y",t=>-this._domainScale(t)-this._domainScale.bandwidth()/2).text(t=>t),u.exit().remove();const p=this._axialAxis.selectAll("line").data(o);p.enter().append("line").merge(p).attr("x2",t=>r*Math.cos(this._valueScale(t)-this.radians(90))).attr("y2",t=>r*Math.sin(this._valueScale(t)-this.radians(90))),p.exit().remove();const d=this._axialAxis.selectAll("text").data(o);d.enter().append("text").style("dominant-baseline","central").merge(d).attr("x",t=>(r+10)*Math.cos(this._valueScale(t)-this.radians(90))).attr("y",t=>(r+10)*Math.sin(this._valueScale(t)-this.radians(90))).style("text-anchor",t=>{const e=this.degrees(this._valueScale(t));return e>=0&&e<=20||e>=160&&e<=200||e>=340&&e<=360?"middle":e>=180&&e<=360?"end":null}).text(t=>t),d.exit().remove();const f=this.columns().length>1?this.columns()[1]:"";this._d3Arc.innerRadius(t=>this._domainScale(t[0])).outerRadius(t=>this._domainScale(t[0])+this._domainScale.bandwidth());const y=this._arcs.selectAll("path").data(this.data(),t=>t[0]);y.enter().append("path").attr("class","arc").call(this._selection.enter.bind(this._selection)).on("mouseout.tooltip",this.tooltip.hide).on("mousemove.tooltip",this.tooltip.show).on("click",function(t,e){n.click(n.rowToObj(t),f,n._selection.selected(this))}).on("dblclick",function(t,e){n.dblclick(n.rowToObj(t),f,n._selection.selected(this))}).merge(y).style("fill",(t,e)=>this.fillColor(t,t[0],t[1])).transition().delay((t,e)=>e*this.transitionDelay()).duration(this.transitionDuration()).attrTween("d",(t,e)=>{const n=i.interpolate(t._current||0,t[1]);return t._current=t[1],i=>this._d3Arc([t[0],n(i)],e)}),y.exit().remove()}degrees(t){return 180*t/Math.PI}radians(t){return t*Math.PI/180}};o(Go,"RadialBar"),a(Go,"__inputs",[{id:"label",type:"any"},{id:"values",type:"number"}]);let Xo=Go;Xo.prototype._class+=" chart_RadialBar",Xo.prototype.implements(e.INDChart.prototype),Xo.prototype.implements(e.ITooltip.prototype),Xo.prototype.mixin(i.Utility.SimpleSelectionMixin),Xo.prototype.publish("paletteID","default","set","Color palette for this widget",Xo.prototype._palette.switch()),Xo.prototype.publish("tickCount",10,"number","Number of ticks to display"),Xo.prototype.publish("domainPadding",.25,"number","Padding between chart edge and container edge (0..1)"),Xo.prototype.publish("valueMaxAngle",270,"number","Maximum angular length of a bar (degrees)"),Xo.prototype.publish("valueDomainHigh",null,"number","Value domain high",void 0,{optional:!0}),Xo.prototype.publish("transitionDelay",100,"number","Delay between the start of each row animation (ms)"),Xo.prototype.publish("transitionDuration",750,"number","Duration of a row's animation (ms)");const Yo=i.Palette.rainbow("Blues"),Uo=i.Palette.ordinal("Quartile",[Yo(100,0,100),Yo(50,0,100),Yo(50,0,100),Yo(75,0,100)]);function Qo(t){const e=i.format(t);return function(t){const i=(Math.round(100*t)/100).toString();return i.length<=4?i:e(t)}}Uo("Std. Dev."),Uo("MinMax"),Uo("25%"),Uo("50%"),o(Qo,"myFormatter");const Zo=class _StatChart extends i.HTMLWidget{constructor(){super(),a(this,"_selectElement"),a(this,"_tickFormatter"),a(this,"_bellCurve",(new Ft).columns(["","Std. Dev."]).paletteID("Quartile").interpolate_default("basis").pointSize(0).xAxisType("linear").xAxisOverlapMode("none").xAxisTickFormat(",").yAxisHidden(!0).yAxisDomainLow(0).yAxisDomainHigh(110).yAxisGuideLines(!1)),a(this,"_candle",(new Vo).columns(["Min","25%","50%","75%","Max"]).edgePadding(0).roundedCorners(1).lineWidth(1).upperTextRotation(-90).lowerTextRotation(-90).labelFontSize(0).valueFontSize(0).lineColor(Yo(90,0,100)).innerRectColor(Yo(10,0,100))),this.columns(["Min","25%","50%","75%","Max","Mean","Std. Dev."])}stdDev(t){return this.mean()+t*this.standardDeviation()}formatStdDev(t){return this._tickFormatter(this.stdDev(t))}quartile(t){return this.quartiles()[t]}formatQ(t){return this._tickFormatter(this.quartile(t))}domain(t){switch(t){case"25_75":return[this.quartile(1),this.quartile(3)];case"normal":return[this.stdDev(-4),this.stdDev(4)];default:return[this.quartile(0),this.quartile(4)]}}min(){return this.quartile(0)}max(){return this.quartile(4)}data(t){if(!arguments.length)return[[...this.quartiles(),this.mean(),this.standardDeviation()]];const e=t[0];return this.quartiles([e[0],e[1],e[2],e[3],e[4]]),this.mean(e[5]),this.standardDeviation(e[6]),this}enter(t,e){super.enter(t,e),this._bellCurve.target(e.append("div").node()),this._candle.target(e.append("div").node()),this._selectElement=e.append("div").style("position","absolute").style("top","0px").style("right","0px").append("select").on("change",()=>{this.view(this._selectElement.node().value),this.lazyRender()}),this._selectElement.append("option").attr("value","min_max").text("Min / Max"),this._selectElement.append("option").attr("value","25_75").text("25% / 75%"),this._selectElement.append("option").attr("value","normal").text("Normal")}bellTicks(t){let e;switch(t){case"25_75":e=[{label:this.formatQ(1),value:this.quartile(1)},{label:this.formatQ(2),value:this.quartile(2)},{label:this.formatQ(3),value:this.quartile(3)}];break;case"normal":e=[{label:this.formatStdDev(-4),value:this.stdDev(-4)},{label:"-3σ",value:this.stdDev(-3)},{label:"-2σ",value:this.stdDev(-2)},{label:"-1σ",value:this.stdDev(-1)},{label:this.formatStdDev(0),value:this.stdDev(0)},{label:"+1σ",value:this.stdDev(1)},{label:"+2σ",value:this.stdDev(2)},{label:"+3σ",value:this.stdDev(3)},{label:this.formatStdDev(4),value:this.stdDev(4)}];break;default:e=[{label:this.formatQ(0),value:this.quartile(0)},{label:this.formatQ(1),value:this.quartile(1)},{label:this.formatQ(2),value:this.quartile(2)},{label:this.formatQ(3),value:this.quartile(3)},{label:this.formatQ(4),value:this.quartile(4)}]}const[i,n]=this.domain(this._selectElement.node().value);return e.filter(t=>t.value>=i&&t.value<=n).map(t=>({label:t.label,value:t.value.toString()}))}updateScatter(){const t=this._selectElement.node().value,[e,i]=this.domain(t),n=(i-e)*(this.domainPadding()/100);this._bellCurve.xAxisDomainLow(e-n).xAxisDomainHigh(i+n).xAxisTicks(this.bellTicks(t)).data([[this.stdDev(-4),0],[this.stdDev(-3),.3],[this.stdDev(-2),5],[this.stdDev(-1),68],[this.stdDev(0),100],[this.stdDev(1),68],[this.stdDev(2),5],[this.stdDev(3),.3],[this.stdDev(4),0]]).resize({width:this.width(),height:this.height()-this.candleHeight()}).render()}updateCandle(){const t=this._bellCurve.dataPos(this.quartile(0)),e=this._bellCurve.dataPos(this.quartile(4))-t;this._candle.resize({width:this.width(),height:this.candleHeight()}).pos({x:t+e/2+2,y:this.candleHeight()/2}).width(e).candleWidth(this.candleHeight()).data(this.quartiles()).render()}update(t,e){super.update(t,e),this._tickFormatter=Qo(this.tickFormat()),this._selectElement.node().value=this.view(),this.updateScatter(),this.updateCandle()}exit(t,e){this._bellCurve.target(null),this._candle.target(null),this._selectElement.remove(),super.exit(t,e)}};o(Zo,"StatChart");let Jo=Zo;Jo.prototype._class+=" chart_StatChart",Jo.prototype.publish("view","min_max","set","View",["min_max","25_75","normal"]),Jo.prototype.publish("tickFormat",".2e","string","X-Axis Tick Format"),Jo.prototype.publish("candleHeight",20,"number","Height of candle widget (pixels)"),Jo.prototype.publish("domainPadding",10,"number","Domain value padding"),Jo.prototype.publish("mean",.5,"number","Mean"),Jo.prototype.publish("standardDeviation",.125,"number","Standard Deviation (σ)"),Jo.prototype.publish("quartiles",[0,.25,.5,.75,1],"object","Quartiles (Min, 25%, 50%, 75%, Max)");const Ko=class _Step extends Ft{constructor(){super(),this.interpolate_default("step")}};o(Ko,"Step");let ta=Ko;ta.prototype._class+=" chart_Step";const ea="text",ia="html",na=class _Summary extends i.HTMLWidget{constructor(){super(),a(this,"_playIntervalIdx",0),a(this,"_mainDiv"),a(this,"_headerDiv"),a(this,"_textDiv"),this._tag="div",this._drawStartPos="center",this.playInterval(this.playInterval())}lookupFieldIdx(t,e){let i=e;if(!(this[t+"_exists"]()&&(i=this.columns().indexOf(this[t]()),i<0)))return i}lookupFieldText(t,e){return this[t+"_exists"]()?this[t]():void 0!==e&&this.columns()[e]||""}currentRow(){return this.data()[this._playIntervalIdx]}summaryData(){let t;this.hideLabel()||(t=this.lookupFieldIdx("labelColumn",0));const e=this.lookupFieldIdx("iconColumn"),i=this.lookupFieldIdx("valueColumn",1);let n,s;this.hideMore()||(n=this.lookupFieldIdx("moreIconColumn"),s=this.lookupFieldIdx("moreTextColumn"));const o=this.lookupFieldIdx("colorFillColumn"),a=this.lookupFieldIdx("colorStrokeColumn");return this.formattedData().map(function(r){return{icon:void 0===e?this.icon():r[e],label:void 0===t?"":r[t],value:r[i],moreIcon:void 0===n?this.hideMore()?"":this.moreIcon():r[n],moreText:void 0===s?this.hideMore()?"":this.moreText():r[s],fill:void 0===o?this.colorFill():r[o],stroke:void 0===a?this.colorStroke():r[a]}},this)}enter(t,e){super.enter(t,e),this._mainDiv=e.append("div");const i=this;this._headerDiv=this._mainDiv.append("h2").on("click",function(){i.click(i.rowToObj(i.currentRow()),i.lookupFieldText("valueColumn",1),!0)}).on("dblclick",function(){i.dblclick(i.rowToObj(i.currentRow()),i.lookupFieldText("valueColumn",1),!0)}),this._textDiv=this._mainDiv.append("div").attr("class","text").on("click",function(){i.click(i.rowToObj(i.currentRow()),i.lookupFieldText("labelColumn",0),!0)}).on("dblclick",function(){i.dblclick(i.rowToObj(i.currentRow()),i.lookupFieldText("labelColumn",0),!0)})}update(t,e){super.update(t,e),this.data().length;const n=this.summaryData();this._playIntervalIdx>=n.length&&(this._playIntervalIdx=0);const s=this._playIntervalIdx<n.length?n[this._playIntervalIdx]:["",""];e.style("width",this.fixedSize()?this.minWidth_exists()?this.minWidth()+"px":null:"100%").style("height",this.fixedSize()?this.minHeight_exists()?this.minHeight()+"px":null:"100%"),this._mainDiv.attr("class","content bgIcon "+s.icon).transition().style("background-color",s.fill).style("color",s.stroke).style("min-width",this.minWidth_exists()?this.minWidth()+"px":null).style("min-height",this.minHeight_exists()?this.minHeight()+"px":null).style("font-size",this.iconFontSize()+"px"),this._headerDiv.transition().style("color",s.stroke).style("font-size",this.headerFontSize()+"px")[this.valueHTML()?ia:ea](s.value),this._textDiv.style("font-size",this.textFontSize()+"px")[this.labelHTML()?ia:ea](s.label);const o=this,a=this._mainDiv.selectAll(".more").data([s]),r=a.enter().append("div").attr("class","more").on("click",function(t){o.click(o.rowToObj(o.currentRow()),o.lookupFieldText("moreTextColumn")||"more",!0)}).each(function(){const t=i.select(this);t.append("i"),t.append("span")}).merge(a).style("display",this.hideMoreWrapper()?"none":null).style("font-size",this.moreFontSize()+"px").style("height",this.moreWrapperHeight_exists()?this.moreWrapperHeight()+"px":null).transition().style("background-color",i.rgb(s.fill).darker(.75).toString());r.select("i").attr("class",function(t){return"fa "+t.moreIcon}),this.moreTextHTML()?r.select("span").each(function(t){this.innerHTML=t.moreText}):r.select("span").text(t=>t.moreText),a.exit().remove()}exit(t,e){super.exit(t,e)}};o(na,"Summary");let sa=na;sa.prototype._class+=" chart_Summary",sa.prototype.implements(e.I2DChart.prototype),sa.prototype.publish("iconColumn",null,"set","Select Icon Column",function(){return this.columns()},{optional:!0}),sa.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:o(t=>t.iconColumn(),"disable")}),sa.prototype.publish("headerFontSize",null,"number","headerFontSize"),sa.prototype.publish("textFontSize",null,"number","textFontSize"),sa.prototype.publish("moreFontSize",null,"number","moreFontSize"),sa.prototype.publish("iconFontSize",null,"number","iconFontSize"),sa.prototype.publish("hideLabel",!1,"boolean","Hide label column"),sa.prototype.publish("labelColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0,disable:o(t=>t.hideLabel(),"disable")}),sa.prototype.publish("labelHTML",!1,"boolean","Allow HTML",null,{disable:o(t=>t.hideLabel(),"disable")}),sa.prototype.publish("valueColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),sa.prototype.publish("valueHTML",!1,"boolean","Allow HTML"),sa.prototype.publish("hideMore",!1,"boolean","Hide More Information"),sa.prototype.publish("hideMoreWrapper",!1,"boolean","Hide More Information Wrapper"),sa.prototype.publish("moreWrapperHeight",null,"number","Height of the 'more' text wrapper (pixels)"),sa.prototype.publish("moreIconColumn",null,"set","Select More Icon Column",function(){return this.columns()},{optional:!0,disable:o(t=>t.hideMore(),"disable")}),sa.prototype.publish("moreIcon","fa-info-circle","string","FA Char icon class",null,{disable:o(t=>t.hideMore()||t.moreIconColumn(),"disable")}),sa.prototype.publish("moreTextColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0,disable:o(t=>t.hideMore(),"disable")}),sa.prototype.publish("moreText","More Info","string","More text",null,{disable:o(t=>t.hideMore()||t.moreTextColumn(),"disable")}),sa.prototype.publish("moreTextHTML",!1,"boolean","Allow HTML",null,{disable:o(t=>t.hideMore(),"disable")}),sa.prototype.publish("colorFillColumn",null,"set","Column for color",function(){return this.columns()},{optional:!0}),sa.prototype.publish("colorFill","#3498db","html-color","Fill Color",null,{disable:o(t=>t.colorFillColumn(),"disable")}),sa.prototype.publish("colorStrokeColumn",null,"set","Column for color",function(){return this.columns()},{optional:!0}),sa.prototype.publish("colorStroke","#ffffff","html-color","Fill Color",null,{disable:o(t=>t.colorStrokeColumn(),"disable")}),sa.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),sa.prototype.publish("minWidth",225,"number","Minimum Width"),sa.prototype.publish("minHeight",150,"number","Minimum Height"),sa.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0});const oa=sa.prototype.playInterval;sa.prototype.playInterval=function(t){const e=oa.apply(this,arguments);if(arguments.length){this._playIntervalHandle&&clearInterval(this._playIntervalHandle);const e=this;t&&(this._playIntervalHandle=setInterval(function(){e._playIntervalIdx++,e._renderCount&&e.data().length&&e.render()},t))}return e};const aa=class _SummaryC extends i.CanvasWidget{constructor(){super(),a(this,"_playIntervalIdx",0),e.I2DChart.call(this),this.playInterval(this.playInterval())}currentRow(){return this.data()[this._playIntervalIdx]}enter(t,e){super.enter.apply(this,arguments);const{width:i,height:n}=this.size();t.height=n,t.width=i}update(t,e){super.update.apply(this,arguments);const n=this;this._playIntervalIdx>=this.data().length&&(this._playIntervalIdx=0);const s=this.size(),a=Math.min(s.width,s.height),r=this.fontSizeRatio(),l=this.columns().indexOf(this.labelColumn()),h=this.columns().indexOf(this.valueColumn()),c=this.columns().indexOf(this.colorFillColumn()),u=this.columns().indexOf(this.colorStrokeColumn()),p=this.columns().indexOf(this.iconColumn()),d=-1!==p?this.currentRow()[p]:this.icon(),f=-1!==l?this.currentRow()[l]:"",y=-1!==h?this.currentRow()[h]:"",_=-1!==c?this.currentRow()[c]:this.colorFill(),x=-1!==u?this.currentRow()[u]:this.colorStroke();let m=s.height*(r-this.paddingSizeRatio());const g=s.height*(1-r-this.paddingSizeRatio()),b=s.height*(this.iconSizeRatio()-this.paddingSizeRatio()),v=a*this.paddingSizeRatio(),w=t.getContext("2d");w.clearRect(0,0,s.width,s.height);const S=n.fontFamily();function A(t,e,i,n){w.textBaseline="top",w.font=`${i}px ${S}`,w.fillStyle=x;let o=w.measureText(t);if(o.width>s.width-2*v){i*=(s.width-2*v)/o.width,w.font=`${i}px ${S}`,o=w.measureText(t)}const a=M(o.width,n);return w.fillText(t,a,e),i}function k(t,e,i){if(void 0===t)return;w.textBaseline=n.iconBaseline(),w.font=`${e}px FontAwesome`,w.fillStyle=x;let o=w.measureText(t);if(o.width>s.width-2*v){const i=(s.width-2*v)/o.width;w.font=e*i+"px FontAwesome",o=w.measureText(t)}const a=M(o.width,i),r=T(n.iconBaseline());w.fillText(t,a,r)}function M(t,e){switch(e){case"start":return v;case"middle":return s.width/2-t/2;case"end":return s.width-t-v}}function T(t){switch(t){case"top":return v;case"middle":return s.height/2;case"bottom":return s.height-v}}w.fillStyle=_,w.fillRect(0,0,s.width,s.height),w.globalAlpha=this.iconOpacity(),k(i.Utility.faChar(d),b,n.iconAnchor()),w.globalAlpha=this.valueOpacity(),m=A(y,v,m,n.valueAnchor()),w.globalAlpha=this.labelOpacity(),A(f,m+v,g,n.labelAnchor()),o(A,"drawText"),o(k,"drawIcon"),o(M,"getTextOffsetX"),o(T,"getTextOffsetY")}};o(aa,"SummaryC");let ra=aa;ra.prototype._class+=" chart_SummaryC",ra.prototype.implements(e.I2DChart.prototype),ra.prototype.publish("iconBaseline","bottom","string","Text baseline for the icon",["top","middle","bottom"]),ra.prototype.publish("iconAnchor","end","set","Anchors the icon either at the start, middle, or end of the summary",["start","middle","end"]),ra.prototype.publish("valueAnchor","start","set","Anchors the value either at the start, middle, or end of the summary",["start","middle","end"]),ra.prototype.publish("labelAnchor","start","set","Anchors the label either at the start, middle, or end of the summary",["start","middle","end"]),ra.prototype.publish("iconColumn",null,"set","Select Icon Column",function(){return this.columns()},{optional:!0}),ra.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:o(t=>t.iconColumn(),"disable")}),ra.prototype.publish("fontFamily","Arial","string","Font Family"),ra.prototype.publish("labelColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),ra.prototype.publish("valueColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),ra.prototype.publish("colorFillColumn",null,"set","Column for background color",function(){return this.columns()},{optional:!0}),ra.prototype.publish("colorFill","#0097e6","html-color","Background Color",null,{disable:o(t=>t.colorFillColumn(),"disable")}),ra.prototype.publish("colorStrokeColumn",null,"set","Column for font color",function(){return this.columns()},{optional:!0}),ra.prototype.publish("colorStroke","#2f3640","html-color","Font Color",null,{disable:o(t=>t.colorStrokeColumn(),"disable")}),ra.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),ra.prototype.publish("minWidth",225,"number","Minimum Width"),ra.prototype.publish("minHeight",150,"number","Minimum Height"),ra.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0}),ra.prototype.publish("fontSizeRatio",.618,"number","Ratio between widget height and value font size"),ra.prototype.publish("valueOpacity",1,"number","Opacity of value text (0..1)"),ra.prototype.publish("labelOpacity",.9,"number","Opacity of label text (0..1)"),ra.prototype.publish("iconOpacity",.3,"number","Opacity of icon text (0..1)"),ra.prototype.publish("paddingSizeRatio",.1,"number","Ratio of the smallest dimension for edge padding (0..1)"),ra.prototype.publish("iconSizeRatio",.9,"number","Ratio of the height for icon size (0..1)");const la=ra.prototype.playInterval;ra.prototype.playInterval=function(t){const e=la.apply(this,arguments);if(arguments.length){this._playIntervalHandle&&clearInterval(this._playIntervalHandle);const e=this;t&&(this._playIntervalHandle=setInterval(function(){e._playIntervalIdx++,e._renderCount&&e.data().length&&e.render()},t))}return e};const ha=Math.PI/180,ca=2048;function ua(){const t=i.dispatch("word","end"),e={};let n=[256,256],s=pa,a=da,r=ya,l=fa,h=fa,c=_a,u=xa,p=[],d=wa,f=1/0,y=null,_=Math.random,x=ka;function m(t){t.width=t.height=1;const e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/e,t.height=ca/e;const i=t.getContext("2d");return i.fillStyle=i.strokeStyle="red",i.textAlign="center",{context:i,ratio:e}}function g(t,e,i){const s=e.x,o=e.y,a=Math.sqrt(n[0]*n[0]+n[1]*n[1]),r=d(n),l=_()<.5?1:-1;let h,c,u,p=-l;for(;(h=r(p+=l))&&(c=~~h[0],u=~~h[1],!(Math.min(Math.abs(c),Math.abs(u))>=a));)if(e.x=s+c,e.y=o+u,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>n[0]||e.y+e.y1>n[1])&&(!i||!ga(e,t,n[0]))&&(!i||va(e,i))){const i=e.sprite,s=e.width>>5,o=n[0]>>5,a=e.x-(s<<4),r=127&a,l=32-r,h=e.y1-e.y0;let c,u=(e.y+e.y0)*o+(a>>5);for(let e=0;e<h;e++){c=0;for(let n=0;n<=s;n++)t[u+n]|=c<<l|(n<s?(c=i[e*s+n])>>>r:0);u+=o}return delete e.sprite,!0}return!1}return e.canvas=function(t){return arguments.length?(x=Ma(t),e):x},e.start=function(){const i=m(x()),o=Aa((n[0]>>5)*n[1]);let d=null;const b=p.length;let v=-1;const w=[],S=p.map(function(t,e){return t.text=s.call(this,t,e),t.font=a.call(this,t,e),t.style=l.call(this,t,e),t.weight=h.call(this,t,e),t.rotate=c.call(this,t,e),t.size=~~r.call(this,t,e),t.padding=u.call(this,t,e),t}).sort(function(t,e){return e.size-t.size});return y&&clearInterval(y),y=setInterval(A,0),A(),e;function A(){const s=Date.now();for(;Date.now()-s<f&&++v<b&&y;){const s=S[v];s.x=n[0]*(_()+.5)>>1,s.y=n[1]*(_()+.5)>>1,ma(i,s,S,v),s.hasText&&g(o,s,d)&&(w.push(s),t.call("word",e,s),d?ba(d,s):d=[{x:s.x+s.x0,y:s.y+s.y0},{x:s.x+s.x1,y:s.y+s.y1}],s.x-=n[0]>>1,s.y-=n[1]>>1)}v>=b&&(e.stop(),t.call("end",e,w,d))}},e.stop=function(){return y&&(clearInterval(y),y=null),e},o(m,"getContext"),o(g,"place"),e.timeInterval=function(t){return arguments.length?(f=null==t?1/0:t,e):f},e.words=function(t){return arguments.length?(p=t,e):p},e.size=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e.font=function(t){return arguments.length?(a=Ma(t),e):a},e.fontStyle=function(t){return arguments.length?(l=Ma(t),e):l},e.fontWeight=function(t){return arguments.length?(h=Ma(t),e):h},e.rotate=function(t){return arguments.length?(c=Ma(t),e):c},e.text=function(t){return arguments.length?(s=Ma(t),e):s},e.spiral=function(t){return arguments.length?(d=Ta[t]||t,e):d},e.fontSize=function(t){return arguments.length?(r=Ma(t),e):r},e.padding=function(t){return arguments.length?(u=Ma(t),e):u},e.random=function(t){return arguments.length?(_=t,e):_},e.on=function(){const i=t.on.apply(t,arguments);return i===t?e:i},e}function pa(t){return t.text}function da(){return"serif"}function fa(){return"normal"}function ya(t){return Math.sqrt(t.value)}function _a(){return 30*(~~(6*Math.random())-3)}function xa(){return 1}function ma(t,e,i,n){if(e.sprite)return;const s=t.context,o=t.ratio;s.clearRect(0,0,2048/o,ca/o);let a=0,r=0,l=0;const h=i.length;for(--n;++n<h;){e=i[n],s.save(),s.font=e.style+" "+e.weight+" "+~~((e.size+1)/o)+"px "+e.font;let t=s.measureText(e.text+"m").width*o,h=e.size<<1;if(e.rotate){const i=Math.sin(e.rotate*ha),n=Math.cos(e.rotate*ha),s=t*n,o=t*i,a=h*n,r=h*i;t=Math.max(Math.abs(s+r),Math.abs(s-r))+31>>5<<5,h=~~Math.max(Math.abs(o+a),Math.abs(o-a))}else t=t+31>>5<<5;if(h>l&&(l=h),a+t>=2048&&(a=0,r+=l,l=0),r+h>=ca)break;s.translate((a+(t>>1))/o,(r+(h>>1))/o),e.rotate&&s.rotate(e.rotate*ha),s.fillText(e.text,0,0),e.padding&&(s.lineWidth=2*e.padding,s.strokeText(e.text,0,0)),s.restore(),e.width=t,e.height=h,e.xoff=a,e.yoff=r,e.x1=t>>1,e.y1=h>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,a+=t}const c=s.getImageData(0,0,2048/o,ca/o).data,u=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;const t=e.width,s=t>>5;let o=e.y1-e.y0;for(let e=0;e<o*s;e++)u[e]=0;if(a=e.xoff,null==a)return;r=e.yoff;let l=0,h=-1;for(let i=0;i<o;i++){for(let e=0;e<t;e++){const t=s*i+(e>>5),n=c[2048*(r+i)+(a+e)<<2]?1<<31-e%32:0;u[t]|=n,l|=n}l?h=i:(e.y0++,o--,i--,r++)}e.y1=e.y0+h,e.sprite=u.slice(0,(e.y1-e.y0)*s)}}function ga(t,e,i){i>>=5;const n=t.sprite,s=t.width>>5,o=t.x-(s<<4),a=127&o,r=32-a,l=t.y1-t.y0;let h,c=(t.y+t.y0)*i+(o>>5);for(let u=0;u<l;u++){h=0;for(let t=0;t<=s;t++)if((h<<r|(t<s?(h=n[u*s+t])>>>a:0))&e[c+t])return!0;c+=i}return!1}function ba(t,e){const i=t[0],n=t[1];e.x+e.x0<i.x&&(i.x=e.x+e.x0),e.y+e.y0<i.y&&(i.y=e.y+e.y0),e.x+e.x1>n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.y=e.y+e.y1)}function va(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0<e[1].x&&t.y+t.y1>e[0].y&&t.y+t.y0<e[1].y}function wa(t){const e=t[0]/t[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function Sa(t){const e=4*t[0]/t[1];let i=0,n=0;return function(t){const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}function Aa(t){const e=[];let i=-1;for(;++i<t;)e[i]=0;return e}function ka(){return document.createElement("canvas")}function Ma(t){return"function"==typeof t?t:function(){return t}}o(ua,"d3Cloud"),o(pa,"cloudText"),o(da,"cloudFont"),o(fa,"cloudFontNormal"),o(ya,"cloudFontSize"),o(_a,"cloudRotate"),o(xa,"cloudPadding"),o(ma,"cloudSprite"),o(ga,"cloudCollide"),o(ba,"cloudBounds"),o(va,"collideRects"),o(wa,"archimedeanSpiral"),o(Sa,"rectangularSpiral"),o(Aa,"zeroArray"),o(ka,"cloudCanvas"),o(Ma,"functor");const Ta={archimedean:wa,rectangular:Sa},Pa=class _WordCloud extends i.SVGWidget{constructor(){super(),a(this,"_prevOffsetX"),a(this,"_prevOffsetY"),a(this,"_prevZoom"),a(this,"_root"),a(this,"_canvas"),a(this,"_d3Cloud"),a(this,"_d3Zoom"),e.I2DChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this),this._prevOffsetX=this.offsetX(),this._prevOffsetY=this.offsetY(),this._prevZoom=this.zoom()}calcData(){return this.data().map(t=>({__viz_label:t[0],__viz_weight:t[1],__viz_row:t}))}enter(t,e){super.enter(t,e),this._selection.widgetElement(e),this._root=e.append("g"),this._canvas=document.createElement("canvas");const n=this;this._d3Zoom=i.zoom().scaleExtent([.1,10]),this._d3Zoom.on("zoom",function(t){const e=i.d3Event();e&&e.transform&&n.zoomed(n._d3Zoom,[e.transform.x,e.transform.y],e.transform.k)}),e.call(this._d3Zoom),this.tooltipHTML(function(t){const e=n.columns(),i=e&&e.length?e[0]:"Word";return n.tooltipFormat({label:t.__viz_label,series:i,value:t.__viz_weight})})}update(t,e){super.update(t,e),this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._d3Cloud=ua().canvas(()=>this._canvas),this.zoomed(this,[this.offsetX(),this.offsetY()],this.zoom());const n=this.calcData(),s=this,a=i.extent(n,function(t){return t.__viz_weight});let r;switch(this.scaleMode()){case"log":r=i.scaleLog;break;case"sqrt":r=i.scaleSqrt;break;case"pow":r=i.scalePow;break;default:r=i.scaleLinear}const l=r().domain(a).range([this.fontSizeFrom(),this.fontSizeTo()]),h=i.scaleLinear().domain([0,s.angleCount()-1]).range([s.angleFrom(),s.angleTo()]);function c(t,e){const i=s._root.selectAll("text").data(t,function(t){return t.__viz_label?t.__viz_label.toLowerCase():""});i.enter().append("text").attr("text-anchor","middle").call(s._selection.enter.bind(s._selection)).text(function(t){return t.__viz_label}).on("click",function(t){s.click(s.rowToObj(t.__viz_row),s.columns()[1],s._selection.selected(this))}).on("dblclick",function(t){s.dblclick(s.rowToObj(t.__viz_row),s.columns()[1],s._selection.selected(this))}).on("mouseout.tooltip",s.tooltip.hide).on("mousemove.tooltip",s.tooltip.show).style("opacity",1e-6).merge(i).style("font-size",function(t){return l(t.__viz_weight)+"px"}).style("font-family",s.fontFamily()).transition().duration(1e3).attr("transform",function(t){return"translate("+[t.x,t.y]+")rotate("+t.rotate+")"}).style("fill",function(t){return s._palette(t.__viz_label?t.__viz_label.toLowerCase():"")}).style("opacity",1),i.exit().transition().duration(1e3).style("opacity",1e-4).remove()}this._d3Cloud.stop().size([this.width(),this.height()]).words(n).font(this.fontFamily()).padding(this.padding()).spiral(this.spiral()).text(function(t){return t.__viz_label.trim()}).fontSize(function(t){return l(t.__viz_weight)}).rotate((t,e)=>h(e%s.angleCount())).on("word",t=>{}).on("end",c).start(),o(c,"draw")}zoomed(t,e,i){if(e[0]!==this._prevOffsetX||e[1]!==this._prevOffsetY||i!==this._prevZoom){switch(this._root.attr("transform",e),t){case this:break;case this._d3Zoom:this.offsetX(e[0]),this.offsetY(e[1]),this.zoom(i)}this._prevOffsetX=e[0],this._prevOffsetY=e[1],this._prevZoom=i}}};o(Pa,"WordCloud"),a(Pa,"__inputs",[{id:"label",type:"string"},{id:"value",type:"number"}]);let Ca=Pa;Ca.prototype._class+=" chart_WordCloud",Ca.prototype.implements(e.I2DChart.prototype),Ca.prototype.implements(e.ITooltip.prototype),Ca.prototype.mixin(i.Utility.SimpleSelectionMixin),Ca.prototype.publish("paletteID","default","set","Color palette for this widget",Ca.prototype._palette.switch(),{tags:["Basic","Shared"]}),Ca.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Ca.prototype.publish("fontFamily","Impact","string","Font Name",null,{tags:["Basic"]}),Ca.prototype.publish("fontSizeFrom",6,"number","Minimum font size (pixels)",null,{tags:["Basic"]}),Ca.prototype.publish("fontSizeTo",48,"number","Maximum font size (pixels)",null,{tags:["Basic"]}),Ca.prototype.publish("angleFrom",-60,"number","Minimum angle (degrees)",null,{tags:["Basic"]}),Ca.prototype.publish("angleTo",60,"number","Maximum angle (degrees)",null,{tags:["Basic"]}),Ca.prototype.publish("angleCount",5,"number","Number of different angles",null,{tags:["Basic"]}),Ca.prototype.publish("padding",0,"number","Padding between words (pixels)",null,{tags:["Intermediate"]}),Ca.prototype.publish("scaleMode","linear","set","Text scaling mode",["linear","log","sqrt","pow"],{tags:["Intermediate"]}),Ca.prototype.publish("spiral","archimedean","set","Text scaling mode",["archimedean","rectangular"],{tags:["Intermediate"]}),Ca.prototype.publish("offsetX",0,"number","X offset",null,{tags:["Advanced"]}),Ca.prototype.publish("offsetY",0,"number","Y offset",null,{tags:["Advanced"]}),Ca.prototype.publish("zoom",1,"number","Zoom",null,{tags:["Advanced"]}),t.Area=Et,t.Axis=Pt,t.BUILD_VERSION="3.2.1",t.Bar=Nt,t.Bubble=Ie,t.BubbleXY=Fe,t.Bullet=ni,t.Column=Rt,t.Contour=Nn,t.Gantt=Bn,t.Gauge=vo,t.HalfPie=To,t.Heat=Co,t.HexBin=jo,t.Line=Lo,t.PKG_NAME="@hpcc-js/chart",t.PKG_VERSION="3.2.0",t.Pie=ko,t.QuarterPie=$o,t.QuartileCandlestick=Vo,t.Radar=Wo,t.RadialBar=Xo,t.Scatter=Ft,t.StatChart=Jo,t.Step=ta,t.Summary=sa,t.SummaryC=ra,t.WordCloud=Ca,t.XYAxis=It,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
3
2
|
//# sourceMappingURL=index.umd.cjs.map
|
|
4
|
-
|
|
3
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode(".chart_Axis{fill:#000;font:10px sans-serif}.chart_Axis .axis .tick>text{font:10px sans-serif}.chart_Axis .axis path.domain,.chart_Axis .axis .tick line{fill:none;stroke:#000}.chart_Axis .guide path.domain{fill:none;stroke:none}.chart_Axis .guide .tick line{fill:none;stroke:#d3d3d3;opacity:.7}.chart_Axis .guide .tick.guide-0 line{stroke:#000;stroke-width:1;stroke-dasharray:3 5}.chart_Axis line,.chart_Axis path{shape-rendering:crispEdges}.chart_XYAxis .axis{fill:#000;font:10px sans-serif}.chart_XYAxis .tick>text{font:10px sans-serif}.chart_XYAxis .focus .chart_Axis.value .tick{visibility:hidden}.chart_XYAxis .axis path,.chart_XYAxis .axis line{fill:none;stroke:#000;shape-rendering:crispEdges}.chart_XYAxis .region{opacity:.33}.chart_XYAxis .brush rect.background{z-index:-999}.chart_XYAxis .brush .selection{stroke:#4682b4;stroke-opacity:1;stroke-width:1px;fill:#4682b4;fill-opacity:.125;shape-rendering:crispEdges}.chart_XYAxis .brush path.handle--custom{fill:#eee;stroke:#666}.chart_Scatter .pointShape,.chart_Scatter .line,.chart_Scatter .area{pointer-events:none}.chart_Scatter .point .pointSelection{fill:none;stroke:none;pointer-events:all}.chart_Scatter .point .pointSelection.selected{fill:none;stroke:red}.chart_Column .columnRect{fill:#4682b4;cursor:pointer}.chart_Column .data.axis path{display:none}.chart_Column .columnRect{stroke:transparent;border-width:1.5px}.chart_Column .columnRect.selected{stroke:red}.chart_Bubble circle{cursor:pointer}.chart_Bubble .selected circle{stroke:red;stroke-width:1.5px}.chart_Bubble .common_FAChar{fill:#fff;pointer-events:none}.chart_Bubble .common_Text{pointer-events:none}.chart_Bullet .domain{opacity:0}.chart_Bullet .bullet{border:solid 1px;border-color:transparent;font:10px sans-serif}.chart_Bullet .bullet.selected{border-color:red}.chart_Bullet .bullet.over{border-color:orange}.chart_Bullet .bullet.selected.over{border-color:red}.chart_Bullet .bullet .marker{stroke:#000;stroke-width:2px}.chart_Bullet .bullet .tick line{stroke:#666;stroke-width:.5px}.chart_Bullet .bullet .range.s0{fill:#eee}.chart_Bullet .bullet .range.s1{fill:#ddd}.chart_Bullet .bullet .range.s2{fill:#ccc}.chart_Bullet .bullet .measure.s0{fill:#b0c4de}.chart_Bullet .bullet .measure.s1{fill:#4682b4}.chart_Bullet .bullet .title{font-size:14px;font-weight:700}.chart_Bullet .bullet .subtitle{fill:#999}.chart_Pie path{cursor:pointer}.chart_Pie>g>text{cursor:pointer}.chart_Pie .arc path{stroke:#fff;stroke-width:.75px}.chart_Pie .arc.selected path{stroke:red;stroke-width:1.5px}.chart_Pie polyline{opacity:.3;stroke:#000;stroke-width:2px;fill:none}.chart_HexBin .hexagon{fill:none;stroke:#000;stroke-width:.5px}.chart_HexBin .hexagon.selected{stroke:red}.chart_Line .dataLine{fill:none;stroke:#4682b4;stroke-width:1.5px}.chart_Radar .pointShape,.chart_Radar .area{pointer-events:none}.chart_Radar .point .pointSelection{fill:none;stroke:none;pointer-events:all}.chart_Radar .point .pointSelection.selected{fill:none;stroke:red}.chart_RadialBar path.arc{opacity:.9;transition:opacity .5s}.chart_RadialBar path.arc.selected{stroke:red}.chart_RadialBar path.arc:hover{opacity:.7}.chart_RadialBar .axis line,.chart_RadialBar .axis circle{stroke:#ccc;stroke-width:1px}.chart_RadialBar .axis circle{fill:none}.chart_RadialBar .r.axis text{text-anchor:end}.chart_Summary{width:225px;height:150px;font-size:14px}.chart_Summary .content h2{font-weight:700;font-size:3em;margin-left:10px;margin-top:10px;margin-bottom:10px}.chart_Summary .bgIcon:before{position:absolute;font-family:FontAwesome;font-size:5.5em;opacity:.4;top:.5em;right:15px}.chart_Summary .bgIcon{position:relative}.chart_Summary .content{float:left;width:100%;height:100%;background-color:#efd752}.chart_Summary .content div{margin-top:-1.1em;font-size:1.1em;opacity:.8}.chart_Summary .content .text{padding-left:10px}.chart_Summary .content .more{position:absolute;bottom:0;width:100%;height:3em;line-height:3em}.chart_Summary .content .more i{padding-left:10px;padding-right:.5em}.other_Wordcloud text{cursor:pointer}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}}();
|