// https://d3js.org/d3-hierarchy/ Version 1.1.0. Copyright 2017 Mike Bostock. !function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.d3=n.d3||{})}(this,function(n){"use strict";function r(n,r){return n.parent===r.parent?1:2}function e(n){return n.reduce(t,0)/n.length}function t(n,r){return n+r.x}function i(n){return 1+n.reduce(u,0)}function u(n,r){return Math.max(n,r.y)}function o(n){for(var r;r=n.children;)n=r[0];return n}function a(n){for(var r;r=n.children;)n=r[r.length-1];return n}function f(n){var r=0,e=n.children,t=e&&e.length;if(t)for(;--t>=0;)r+=e[t].value;else r=1;n.value=r}function c(n,r){if(n===r)return n;var e=n.ancestors(),t=r.ancestors(),i=null;for(n=e.pop(),r=t.pop();n===r;)i=n,n=e.pop(),r=t.pop();return i}function h(n,r){var e,t,i,u,o,a=new v(n),f=+n.value&&(a.value=n.value),c=[a];for(null==r&&(r=p);e=c.pop();)if(f&&(e.value=+e.data.value),(i=r(e.data))&&(o=i.length))for(e.children=new Array(o),u=o-1;u>=0;--u)c.push(t=e.children[u]=new v(i[u])),t.parent=e,t.depth=e.depth+1;return a.eachBefore(s)}function l(){return h(this).eachBefore(d)}function p(n){return n.children}function d(n){n.data=n.data.data}function s(n){var r=0;do n.height=r;while((n=n.parent)&&n.height<++r)}function v(n){this.data=n,this.depth=this.height=0,this.parent=null}function x(n){this._=n,this.next=null}function y(n,r){var e=r.x-n.x,t=r.y-n.y,i=n.r-r.r;return i*i+1e-6>e*e+t*t}function g(n,r){var e,t,i,u=null,o=n.head;switch(r.length){case 1:e=_(r[0]);break;case 2:e=m(r[0],r[1]);break;case 3:e=w(r[0],r[1],r[2])}for(;o;)i=o._,t=o.next,e&&y(e,i)?u=o:(u?(n.tail=u,u.next=null):n.head=n.tail=null,r.push(i),e=g(n,r),r.pop(),n.head?(o.next=n.head,n.head=o):(o.next=null,n.head=n.tail=o),u=n.tail,u.next=t),o=t;return n.tail=u,e}function _(n){return{x:n.x,y:n.y,r:n.r}}function m(n,r){var e=n.x,t=n.y,i=n.r,u=r.x,o=r.y,a=r.r,f=u-e,c=o-t,h=a-i,l=Math.sqrt(f*f+c*c);return{x:(e+u+f/l*h)/2,y:(t+o+c/l*h)/2,r:(l+i+a)/2}}function w(n,r,e){var t=n.x,i=n.y,u=n.r,o=r.x,a=r.y,f=r.r,c=e.x,h=e.y,l=e.r,p=2*(t-o),d=2*(i-a),s=2*(f-u),v=t*t+i*i-u*u-o*o-a*a+f*f,x=2*(t-c),y=2*(i-h),g=2*(l-u),_=t*t+i*i-u*u-c*c-h*h+l*l,m=x*d-p*y,w=(d*_-y*v)/m-t,z=(y*s-d*g)/m,B=(x*v-p*_)/m-i,M=(p*g-x*s)/m,A=z*z+M*M-1,q=2*(w*z+B*M+u),b=w*w+B*B-u*u,k=(-q-Math.sqrt(q*q-4*A*b))/(2*A);return{x:w+z*k+t,y:B+M*k+i,r:k}}function z(n,r,e){var t=n.x,i=n.y,u=r.r+e.r,o=n.r+e.r,a=r.x-t,f=r.y-i,c=a*a+f*f;if(c){var h=.5+((o*=o)-(u*=u))/(2*c),l=Math.sqrt(Math.max(0,2*u*(o+c)-(o-=c)*o-u*u))/(2*c);e.x=t+h*a+l*f,e.y=i+h*f-l*a}else e.x=t+o,e.y=i}function B(n,r){var e=r.x-n.x,t=r.y-n.y,i=n.r+r.r;return i*i-1e-6>e*e+t*t}function M(n,r){for(var e=n._.r;n!==r;)e+=2*(n=n.next)._.r;return e-r._.r}function A(n,r,e){var t=n.x-r,i=n.y-e;return t*t+i*i}function q(n){this._=n,this.next=null,this.previous=null}function b(n){if(!(i=n.length))return 0;var r,e,t,i;if(r=n[0],r.x=0,r.y=0,!(i>1))return r.r;if(e=n[1],r.x=-e.r,e.x=r.r,e.y=0,!(i>2))return r.r+e.r;z(e,r,t=n[2]);var u,o,a,f,c,h,l,p=r.r*r.r,d=e.r*e.r,s=t.r*t.r,v=p+d+s,x=p*r.x+d*e.x+s*t.x,y=p*r.y+d*e.y+s*t.y;r=new q(r),e=new q(e),t=new q(t),r.next=t.previous=e,e.next=r.previous=t,t.next=e.previous=r;n:for(a=3;aM(f,e)?r=f:e=f,r.next=e,e.previous=r,--a;continue n}h+=f._.r+(f=f.next)._.r}else{if(B(c._,t._)){M(r,c)>l+r._.r+e._.r?r=c:e=c,r.next=e,e.previous=r,--a;continue n}l+=c._.r+(c=c.previous)._.r}while(f!==c.next);for(t.previous=r,t.next=e,r.next=e.previous=e=t,v+=s=t._.r*t._.r,x+=s*t._.x,y+=s*t._.y,p=A(r._,u=x/v,o=y/v);(t=t.next)!==e;)(s=A(t._,u,o))
=0;)r=i[u],r.z+=e,r.m+=e,e+=r.s+(t+=r.c)}function G(n,r,e){return n.a.parent===r.parent?n.a:e}function H(n,r){this._=n,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=r}function J(n){for(var r,e,t,i,u,o=new H(n,0),a=[o];r=a.pop();)if(t=r._.children)for(r.children=new Array(u=t.length),i=u-1;i>=0;--i)a.push(e=r.children[i]=new H(t[i],i)),e.parent=r;return(o.parent=new H(null,0)).children=[o],o}function K(n,r,e,t,i,u){for(var o,a,f,c,h,l,p,d,s,v,x,y=[],g=r.children,_=0,m=0,w=g.length,z=r.value;_ o-t){var g=(i*y+a*x)/e;u(n,d,x,t,i,o,g),u(d,r,y,t,g,o,a)}else{var _=(t*y+o*x)/e;u(n,d,x,t,i,_,a),u(d,r,y,_,i,o,a)}}var o,a,f=n.children,c=f.length,h=new Array(c+1);for(h[0]=a=o=0;o>>1;h[v]