/*
 Highcharts JS v7.0.3 (2019-02-06)

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

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