@hpcc-js/chart 3.3.1 → 3.3.2

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.
@@ -1,4 +1,4 @@
1
- (function(){"use strict";try{if(typeof document<"u"){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)}})();
2
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,`
3
- `)}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},{width:n,height:m,data:values1},r>>k),blurY({width:n,height:m,data:values1},{width:n,height:m,data:values0},r>>k),blurX({width:n,height:m,data:values0},{width:n,height:m,data:values1},r>>k),blurY({width:n,height:m,data:values1},{width:n,height:m,data:values0},r>>k),blurX({width:n,height:m,data:values0},{width:n,height:m,data:values1},r>>k),blurY({width:n,height:m,data:values1},{width:n,height:m,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,y: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"})});
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"})});
4
3
  //# sourceMappingURL=index.umd.cjs.map
4
+ (function(){"use strict";try{if(typeof document<"u"){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)}})();