/*
 Highcharts JS v7.0.1 (2018-12-19)

 (c) 2017-2018 Highsoft AS
 Authors: Jon Arild Nygard

 License: www.highcharts.com/license
*/
(function(n){"object"===typeof module&&module.exports?module.exports=n:"function"===typeof define&&define.amd?define(function(){return n}):n("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(n){var A=function(){return function(f){var h=this,e=h.graphic,t=f.animatableAttribs,m=f.onComplete,w=f.css,u=f.renderer;h.shouldDraw()?(e||(h.graphic=e=u[f.shapeType](f.shapeArgs).add(f.group)),e.css(w).attr(f.attribs).animate(t,f.isNew?!1:void 0,m)):e&&e.animate(t,void 0,function(){h.graphic=e=e.destroy();
"function"===typeof m&&m()});e&&e.addClass(h.getClassName(),!0)}}(),x=function(){return{getAngleBetweenPoints:function(f,h){return Math.atan2(h.x-f.x,h.y-f.y)},getCenterOfPoints:function(f){var h=f.reduce(function(e,f){e.x+=f.x;e.y+=f.y;return e},{x:0,y:0});return{x:h.x/f.length,y:h.y/f.length}},getDistanceBetweenPoints:function(f,h){return Math.sqrt(Math.pow(h.x-f.x,2)+Math.pow(h.y-f.y,2))}}}(),B=function(f){var h=f.getAngleBetweenPoints,e=f.getCenterOfPoints,t=f.getDistanceBetweenPoints,m=function(l,
a){a=Math.pow(10,a);return Math.round(l*a)/a},w=function(l,a){var p=t(l,a),k=l.r,f=a.r,e=[];if(p<k+f&&p>Math.abs(k-f)){var k=k*k,h=(k-f*f+p*p)/(2*p),f=Math.sqrt(k-h*h),k=l.x,e=a.x;l=l.y;var y=a.y;a=k+h*(e-k)/p;h=l+h*(y-l)/p;l=f/p*-(y-l);p=f/p*-(e-k);e=[{x:m(a+l,14),y:m(h-p,14)},{x:m(a-l,14),y:m(h+p,14)}]}return e},u=function(f){return f.reduce(function(a,f,k,l){l=l.slice(k+1).reduce(function(a,l,p){var e=[k,p+k+1];return a.concat(w(f,l).map(function(a){a.indexes=e;return a}))},[]);return a.concat(l)},
[])},n=function(f,a){return t(f,a)<=a.r+1e-10},z=function(f,a){return!a.some(function(a){return!n(f,a)})};return{getAreaOfIntersectionBetweenCircles:function(f){var a=u(f).filter(function(a){return z(a,f)}),p;if(1<a.length){var k=e(a),a=a.map(function(a){a.angle=h(k,a);return a}).sort(function(a,f){return f.angle-a.angle}),l=a[a.length-1],a=a.reduce(function(a,k){var p=a.startPoint,l=e([p,k]),m=k.indexes.filter(function(a){return-1<p.indexes.indexOf(a)}).reduce(function(a,e){e=f[e];var m=h(e,k),n=
h(e,p),m=n-(n-m+(n<m?2*Math.PI:0))/2,m=t(l,{x:e.x+e.r*Math.sin(m),y:e.y+e.r*Math.cos(m)});e=e.r;m>2*e&&(m=2*e);if(!a||a.width>m)a={r:e,largeArc:m>e?1:0,width:m,x:k.x,y:k.y};return a},null);if(m){var n=m.r;a.arcs.push(["A",n,n,0,m.largeArc,1,m.x,m.y]);a.startPoint=k}return a},{startPoint:l,arcs:[]}).arcs;0!==a.length&&1!==a.length&&(a.unshift(["M",l.x,l.y]),p={center:k,d:a})}return p},getCircleCircleIntersection:w,getCirclesIntersectionPoints:u,getOverlapBetweenCircles:function(f,a,e){var k=0;if(e<
f+a){var k=f*f,l=a*a;if(e<=Math.abs(a-f))k=Math.PI*Math.min(k,l);else{e=(k-l+e*e)/(2*e);var h=Math.sqrt(k-e*e),k=k*Math.asin(h/f)+l*Math.asin(h/a)-h*(e+Math.sqrt(e*e+l-k))}k=m(k,14)}return k},isPointInsideCircle:n,isPointInsideAllCircles:z,isPointOutsideAllCircles:function(e,a){return!a.some(function(a){return n(e,a)})},round:m}}(x);(function(f,h,e,n){var m=n.Color,t=n.extend,u=e.getAreaOfIntersectionBetweenCircles,x=e.getCircleCircleIntersection,z=h.getCenterOfPoints,l=h.getDistanceBetweenPoints,
a=e.getOverlapBetweenCircles,p=n.isArray,k=n.isNumber,D=n.isObject,A=e.isPointInsideAllCircles,B=e.isPointOutsideAllCircles,y=n.isString,L=n.merge,M=e.round,P=n.seriesType,N=function(d){return Object.keys(d).map(function(b){return d[b]})},O=function(d){var b=0;2===d.length&&(b=d[0],d=d[1],b=a(b.r,d.r,l(b,d)));return b},E=function(d,b){return b.reduce(function(b,g){var c=0;1<g.sets.length&&(c=g.value,g=O(g.sets.map(function(c){return d[c]})),g=c-g,c=Math.round(g*g*1E11)/1E11);return b+c},0)},F=function(d,
b,q){for(var g=0,c=d.length-1,a=Math.floor((g+c)/2),e;(e=q(d[a],b))!==b&&g<c;)b<e?c=a-1:g=a+1,a=Math.floor((g+c)/2);return e===b?a:-1},Q=function(d,b,q){var g=q||1;return Array.apply(0,Array(Math.round((d+b)/g))).map(function(d,b){return b*g})},C=function(d,b,q){var g=Q(0,d+b,.001),c=F(g,0,function(c){c=a(d,b,c);c=q-c;return.01>Math.abs(c)?0:c});return M(g[c],14)},v=function(d){return p(d.sets)&&1===d.sets.length},R=function(d,b){var q=function(c,d){return c.fx-d.fx},g=function(c,d,b,g){return d.map(function(d,
a){return c*d+b*g[a]})},c=function(c,b){b.fx=d(b);c[c.length-1]=b;return c},a=function(c){var b=c[0];return c.map(function(c){c=g(.5,b,.5,c);c.fx=d(c);return c})},e=function(c){for(var d=c.slice(0,-1).length,b=[],g=function(c,d){c.sum+=d[c.i];return c},a=0;a<d;a++)b[a]=c.reduce(g,{sum:0,i:a}).sum/d;return b},f=function(c,b,a,q){c=g(a,c,q,b);c.fx=d(c);return c};b=function(c){var b=c.length,a=Array(b+1);a[0]=c;a[0].fx=d(c);for(var g=0;g<b;++g){var q=c.slice();q[g]=q[g]?1.05*q[g]:.001;q.fx=d(q);a[g+
1]=q}return a}(b);for(var k=0;100>k;k++){b.sort(q);var r=b[b.length-1],h=e(b),l=f(h,r,2,-1);l.fx<b[0].fx?(r=f(h,r,3,-2),b=c(b,r.fx<l.fx?r:l)):l.fx>=b[b.length-2].fx?l.fx>r.fx?(h=f(h,r,.5,.5),b=h.fx<r.fx?c(b,h):a(b)):(h=f(h,r,1.5,-.5),b=h.fx<l.fx?c(b,h):a(b)):b=c(b,l)}return b[0]},G=function(d,b,a){b=b.reduce(function(b,c){c=c.r-l(d,c);return c<=b?c:b},Number.MAX_VALUE);return b=a.reduce(function(b,c){c=l(d,c)-c.r;return c<=b?c:b},b)},S=function(d,b){var a=d.reduce(function(a,c){var g=c.r/2;return[{x:c.x,
y:c.y},{x:c.x+g,y:c.y},{x:c.x-g,y:c.y},{x:c.x,y:c.y+g},{x:c.x,y:c.y-g}].reduce(function(c,a){var g=G(a,d,b);c.margin<g&&(c.point=a,c.margin=g);return c},a)},{point:void 0,margin:-Number.MAX_VALUE}).point,a=R(function(a){return-G({x:a[0],y:a[1]},d,b)},[a.x,a.y]),a={x:a[0],y:a[1]};A(a,d)&&B(a,b)||(a=z(d));return a},T=function(a){var b=a.filter(v);return a.reduce(function(a,d){if(d.value){var c=d.sets;d=c.join();var g=b.reduce(function(a,b){var d=-1<c.indexOf(b.sets[0]);a[d?"internal":"external"].push(b.circle);
return a},{internal:[],external:[]});a[d]=S(g.internal,g.external)}return a},{})},H=function(a){var b=a.filter(function(a){return 2===a.sets.length}).reduce(function(a,b){b.sets.forEach(function(c,d,g){D(a[c])||(a[c]={overlapping:{},totalOverlap:0});a[c].totalOverlap+=b.value;a[c].overlapping[g[1-d]]=b.value});return a},{});a.filter(v).forEach(function(a){t(a,b[a.sets[0]])});return a},I=function(a,b){return b.totalOverlap-a.totalOverlap},U=function(a){var b=[],d={};a.filter(function(a){return 1===
a.sets.length}).forEach(function(a){d[a.sets[0]]=a.circle={x:Number.MAX_VALUE,y:Number.MAX_VALUE,r:Math.sqrt(a.value/Math.PI)}});var g=function(a,c){var d=a.circle;d.x=c.x;d.y=c.y;b.push(a)};H(a);var c=a.filter(v).sort(I);g(c.pop(),{x:0,y:0});var e=a.filter(function(a){return 2===a.sets.length});c.forEach(function(a){var c=a.circle,f=c.r,q=a.overlapping,k=b.reduce(function(a,g,k){var h=g.circle;g=C(f,h.r,q[g.sets[0]]);var l=[{x:h.x+g,y:h.y},{x:h.x-g,y:h.y},{x:h.x,y:h.y+g},{x:h.x,y:h.y-g}];b.slice(k+
1).forEach(function(a){var c=a.circle;a=C(f,c.r,q[a.sets[0]]);l=l.concat(x({x:h.x,y:h.y,r:a},{x:c.x,y:c.y,r:a}))});l.forEach(function(b){c.x=b.x;c.y=b.y;var g=E(d,e);g<a.loss&&(a.loss=g,a.coordinates=b)});return a},{loss:Number.MAX_VALUE,coordinates:void 0});g(a,k.coordinates)});return d},V=function(a){var b={};0<a.length&&(b=U(a),a.filter(function(a){return!v(a)}).forEach(function(a){var d=a.sets;a=d.join();d=d.map(function(a){return b[a]});b[a]=u(d)}));return b},J=function(a){var b={};return D(a)&&
k(a.value)&&-1<a.value&&p(a.sets)&&0<a.sets.length&&!a.sets.some(function(a){var d=!1;!b[a]&&y(a)?b[a]=!0:d=!0;return d})},K=function(a){a=p(a)?a:[];var b=a.reduce(function(a,c){J(c)&&v(c)&&0<c.value&&-1===a.indexOf(c.sets[0])&&a.push(c.sets[0]);return a},[]).sort(),d=a.reduce(function(a,c){J(c)&&!c.sets.some(function(a){return-1===b.indexOf(a)})&&(a[c.sets.sort().join()]=c);return a},{});b.reduce(function(a,c,b,d){d.slice(b+1).forEach(function(b){a.push(c+","+b)});return a},[]).forEach(function(a){if(!d[a]){var c=
{sets:a.split(","),value:0};d[a]=c}});return N(d)},W=function(a,b,e){var d=e.bottom-e.top,c=e.right-e.left,d=Math.min(0<c?1/c*a:1,0<d?1/d*b:1);return{scale:d,centerX:a/2-(e.right+e.left)/2*d,centerY:b/2-(e.top+e.bottom)/2*d}};P("venn","scatter",{borderColor:"#cccccc",borderDashStyle:"solid",borderWidth:1,brighten:0,clip:!1,colorByPoint:!0,dataLabels:{enabled:!0,formatter:function(){return this.point.name}},marker:!1,opacity:.75,showInLegend:!1,states:{hover:{opacity:1,halo:!1,borderColor:"#333333"},
select:{color:"#cccccc",borderColor:"#000000",animation:!1}},tooltip:{pointFormat:"{point.name}: {point.value}"}},{isCartesian:!1,axisTypes:[],directTouch:!0,translate:function(){var a=this.chart;this.processedXData=this.xData;this.generatePoints();var b=K(this.options.data),e=V(b),g=T(b),b=Object.keys(e).filter(function(a){return(a=e[a])&&k(a.r)}).reduce(function(a,c){var b=e[c];c=b.x-b.r;var d=b.x+b.r,f=b.y+b.r,b=b.y-b.r;if(!k(a.left)||a.left>c)a.left=c;if(!k(a.right)||a.right<d)a.right=d;if(!k(a.top)||
a.top>b)a.top=b;if(!k(a.bottom)||a.bottom<f)a.bottom=f;return a},{top:0,bottom:0,left:0,right:0}),a=W(a.plotWidth,a.plotHeight,b),c=a.scale,f=a.centerX,h=a.centerY;this.points.forEach(function(a){var b=p(a.sets)?a.sets:[],d=b.join(),k=e[d],l,d=g[d];k&&(k.r?l={x:f+k.x*c,y:h+k.y*c,r:k.r*c}:k.d&&(l={d:k.d.reduce(function(a,b){"M"===b[0]?(b[1]=f+b[1]*c,b[2]=h+b[2]*c):"A"===b[0]&&(b[1]*=c,b[2]*=c,b[6]=f+b[6]*c,b[7]=h+b[7]*c);return a.concat(b)},[]).join(" ")}),d?(d.x=f+d.x*c,d.y=h+d.y*c):d={});a.shapeArgs=
l;d&&l&&(a.plotX=d.x,a.plotY=d.y);a.name=a.options.name||b.join("\u2229")})},drawPoints:function(){var a=this,b=a.chart,e=a.group,f=b.renderer;(a.points||[]).forEach(function(c){var d,g=c.shapeArgs;b.styledMode||(d=a.pointAttribs(c,c.state));c.draw({isNew:!c.graphic,animatableAttribs:g,attribs:d,group:e,renderer:f,shapeType:g&&g.d?"path":"circle"})})},pointAttribs:function(a,b){var d=this.options||{};a=L(d,{color:a&&a.color},a&&a.options||{},b&&d.states[b]||{});return{fill:m(a.color).setOpacity(a.opacity).brighten(a.brightness).get(),
stroke:a.borderColor,"stroke-width":a.borderWidth,dashstyle:a.borderDashStyle}},animate:function(a){if(!a){var b=n.animObject(this.options.animation);this.points.forEach(function(a){var d=a.shapeArgs;if(a.graphic&&d){var c={},e={};d.d?c.opacity=.001:(c.r=0,e.r=d.r);a.graphic.attr(c).animate(e,b);d.d&&setTimeout(function(){a&&a.graphic&&a.graphic.animate({opacity:1})},b.duration)}},this);this.animate=null}},utils:{addOverlapToSets:H,binarySearch:F,geometry:h,geometryCircles:e,getDistanceBetweenCirclesByOverlap:C,
loss:E,processVennData:K,sortByTotalOverlap:I}},{draw:f,shouldDraw:function(){return!!this.shapeArgs},isValid:function(){return k(this.value)}})})(A,x,B,n)});
//# sourceMappingURL=venn.js.map
