|
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3={})}(this,function(t){"use strict";function n(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Lt&&n.documentElement.namespaceURI===Lt?n.createElement(t):n.createElementNS(e,t)}}function e(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function r(t,n,e){return t=i(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function i(n,e,r){return function(i){var o=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=o}}}function o(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}function u(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function s(t,n,e){var o=Ut.hasOwnProperty(t.type)?r:i;return function(r,i,u){var s,a=this.__on,c=o(n,i,u);if(a)for(var h=0,l=a.length;h<l;++h)if((s=a[h]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.capture),this.addEventListener(s.type,s.listener=c,s.capture=e),void(s.value=n);this.addEventListener(t.type,c,e),s={type:t.type,name:t.name,value:n,listener:c,capture:e},a?a.push(s):this.__on=[s]}}function a(){}function c(){return[]}function h(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function l(t,n,e,r,i,o){for(var u,s=0,a=n.length,c=o.length;s<c;++s)(u=n[s])?(u.__data__=o[s],r[s]=u):e[s]=new h(t,o[s]);for(;s<a;++s)(u=n[s])&&(i[s]=u)}function f(t,n,e,r,i,o,u){var s,a,c,l={},f=n.length,p=o.length,_=new Array(f);for(s=0;s<f;++s)(a=n[s])&&(_[s]=c=Ft+u.call(a,a.__data__,s,n),c in l?i[s]=a:l[c]=a);for(s=0;s<p;++s)(a=l[c=Ft+u.call(t,o[s],s,o)])?(r[s]=a,a.__data__=o[s],l[c]=null):e[s]=new h(t,o[s]);for(s=0;s<f;++s)(a=n[s])&&l[_[s]]===a&&(i[s]=a)}function p(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function _(t){return function(){this.removeAttribute(t)}}function v(t){return function(){this.removeAttributeNS(t.space,t.local)}}function d(t,n){return function(){this.setAttribute(t,n)}}function y(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function m(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function g(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function w(t){return function(){this.style.removeProperty(t)}}function x(t,n,e){return function(){this.style.setProperty(t,n,e)}}function A(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function b(t,n){return t.style.getPropertyValue(n)||Gt(t).getComputedStyle(t,null).getPropertyValue(n)}function E(t){return function(){delete this[t]}}function M(t,n){return function(){this[t]=n}}function S(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function T(t){return t.trim().split(/^|\s+/)}function z(t){return t.classList||new C(t)}function C(t){this._node=t,this._names=T(t.getAttribute("class")||"")}function N(t,n){for(var e=z(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function k(t,n){for(var e=z(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function P(t){return function(){N(this,t)}}function O(t){return function(){k(this,t)}}function q(t,n){return function(){(n.apply(this,arguments)?N:k)(this,t)}}function L(){this.textContent=""}function j(t){return function(){this.textContent=t}}function B(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function $(){this.innerHTML=""}function R(t){return function(){this.innerHTML=t}}function D(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function H(){this.nextSibling&&this.parentNode.appendChild(this)}function I(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function U(){return null}function V(){var t=this.parentNode;t&&t.removeChild(this)}function X(t,n,e){var r=Gt(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function J(t,n){return function(){return X(this,t,n)}}function Z(t,n){return function(){return X(this,t,n.apply(this,arguments))}}function F(t,n){this._groups=t,this._parents=n}function G(){return new F([[document.documentElement]],Qt)}function Q(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function K(){return new Q}function W(t){this._context=t}function Y(t){return t[0]}function tt(t){return t[1]}function nt(t){return t<0?-1:1}function et(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),u=(e-t._y1)/(i||r<0&&-0),s=(o*i+u*r)/(r+i);return(nt(o)+nt(u))*Math.min(Math.abs(o),Math.abs(u),.5*Math.abs(s))||0}function rt(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function it(t,n,e){var r=t._x0,i=t._y0,o=t._x1,u=t._y1,s=(o-r)/3;t._context.bezierCurveTo(r+s,i+s*n,o-s,u-s*e,o,u)}function ot(t){this._context=t}function ut(t){this._context=t}function st(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function at(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;for(t=e.pop(),n=r.pop();t===n;)i=t,t=e.pop(),n=r.pop();return i}function ct(t,n){var e,r,i,o,u,s=new pt(t),a=+t.value&&(s.value=t.value),c=[s];for(null==n&&(n=ht);e=c.pop();)if(a&&(e.value=+e.data.value),(i=n(e.data))&&(u=i.length))for(e.children=new Array(u),o=u-1;o>=0;--o)c.push(r=e.children[o]=new pt(i[o])),r.parent=e,r.depth=e.depth+1;return s.eachBefore(ft)}function ht(t){return t.children}function lt(t){t.data=t.data.data}function ft(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function pt(t){this.data=t,this.depth=this.height=0,this.parent=null}function _t(t,n){return t.parent===n.parent?1:2}function vt(t){var n=t.children;return n?n[0]:t.t}function dt(t){var n=t.children;return n?n[n.length-1]:t.t}function yt(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function mt(t){for(var n,e=0,r=0,i=t.children,o=i.length;--o>=0;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}function gt(t,n,e){return t.a.parent===n.parent?t.a:e}function wt(t,n){this._=t,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=n}function xt(t){for(var n,e,r,i,o,u=new wt(t,0),s=[u];n=s.pop();)if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)s.push(e=n.children[i]=new wt(r[i],i)),e.parent=n;return(u.parent=new wt(null,0)).children=[u],u}function At(){}function bt(t,n){var e=new At;if(t instanceof At)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)for(;++i<o;)e.set(i,t[i]);else for(;++i<o;)e.set(n(r=t[i],i,t),r)}else if(t)for(var u in t)e.set(u,t[u]);return e}function Et(){}function Mt(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new St(r)}function St(t){this._=t}function Tt(t,n){return t.trim().split(/^|\s+/).map(function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})}function zt(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function Ct(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=rn,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}function Nt(t){return function(n,e){t(null==n?e:null)}}function kt(t){var n=t.responseType;return n&&"text"!==n?t.response:t.responseText}function Pt(t){return new Function("d","return {"+t.map(function(t,n){return JSON.stringify(t)+": d["+n+"]"}).join(",")+"}")}function Ot(t,n){var e=Pt(t);return function(r,i){return n(e(r),i,t)}}function qt(t){var n=Object.create(null),e=[];return t.forEach(function(t){for(var r in t)r in n||e.push(n[r]=r)}),e}var Lt="http://www.w3.org/1999/xhtml",jt={svg:"http://www.w3.org/2000/svg",xhtml:Lt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},Bt=function(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),jt.hasOwnProperty(n)?{space:jt[n],local:t}:t},$t=function(t){var r=Bt(t);return(r.local?e:n)(r)},Rt=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var Dt=document.documentElement;if(!Dt.matches){var Ht=Dt.webkitMatchesSelector||Dt.msMatchesSelector||Dt.mozMatchesSelector||Dt.oMatchesSelector;Rt=function(t){return function(){return Ht.call(this,t)}}}}var It=Rt,Ut={};t.event=null,"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(Ut={mouseenter:"mouseover",mouseleave:"mouseout"}));var Vt=function(t){return null==t?a:function(){return this.querySelector(t)}},Xt=function(t){return null==t?c:function(){return this.querySelectorAll(t)}},Jt=function(t){return new Array(t.length)};h.prototype={constructor:h,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var Zt=function(t){return function(){return t}},Ft="$",Gt=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};C.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Qt=[null];F.prototype=G.prototype={constructor:F,select:function(t){"function"!=typeof t&&(t=Vt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u,s=n[i],a=s.length,c=r[i]=new Array(a),h=0;h<a;++h)(o=s[h])&&(u=t.call(o,o.__data__,h,s))&&("__data__"in o&&(u.__data__=o.__data__),c[h]=u);return new F(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=Xt(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var u,s=n[o],a=s.length,c=0;c<a;++c)(u=s[c])&&(r.push(t.call(u,u.__data__,c,s)),i.push(u));return new F(r,i)},filter:function(t){"function"!=typeof t&&(t=It(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],s=u.length,a=r[i]=[],c=0;c<s;++c)(o=u[c])&&t.call(o,o.__data__,c,u)&&a.push(o);return new F(r,this._parents)},data:function(t,n){if(!t)return v=new Array(this.size()),c=-1,this.each(function(t){v[++c]=t}),v;var e=n?f:l,r=this._parents,i=this._groups;"function"!=typeof t&&(t=Zt(t));for(var o=i.length,u=new Array(o),s=new Array(o),a=new Array(o),c=0;c<o;++c){var h=r[c],p=i[c],_=p.length,v=t.call(h,h&&h.__data__,c,r),d=v.length,y=s[c]=new Array(d),m=u[c]=new Array(d);e(h,p,y,m,a[c]=new Array(_),v,n);for(var g,w,x=0,A=0;x<d;++x)if(g=y[x]){for(x>=A&&(A=x+1);!(w=m[A])&&++A<d;);g._next=w||null}}return u=new F(u,r),u._enter=s,u._exit=a,u},enter:function(){return new F(this._enter||this._groups.map(Jt),this._parents)},exit:function(){return new F(this._exit||this._groups.map(Jt),this._parents)},merge:function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),s=0;s<o;++s)for(var a,c=n[s],h=e[s],l=c.length,f=u[s]=new Array(l),p=0;p<l;++p)(a=c[p]||h[p])&&(f[p]=a);for(;s<r;++s)u[s]=n[s];return new F(u,this._parents)},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,u=i[o];--o>=0;)(r=i[o])&&(u&&u!==r.nextSibling&&u.parentNode.insertBefore(r,u),u=r);return this},sort:function(t){t||(t=p);for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i){for(var o,u=n[i],s=u.length,a=r[i]=new Array(s),c=0;c<s;++c)(o=u[c])&&(a[c]=o);a.sort(function(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e})}return new F(r,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var u=r[i];if(u)return u}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],u=0,s=o.length;u<s;++u)(i=o[u])&&t.call(i,i.__data__,u,o);return this},attr:function(t,n){var e=Bt(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?v:_:"function"==typeof n?e.local?g:m:e.local?y:d)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?w:"function"==typeof n?A:x)(t,n,null==e?"":e)):b(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?E:"function"==typeof n?S:M)(t,n)):this.node()[t]},classed:function(t,n){var e=T(t+"");if(arguments.length<2){for(var r=z(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?q:n?P:O)(e,n))},text:function(t){return arguments.length?this.each(null==t?L:("function"==typeof t?B:j)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?$:("function"==typeof t?D:R)(t)):this.node().innerHTML},raise:function(){return this.each(H)},lower:function(){return this.each(I)},append:function(t){var n="function"==typeof t?t:$t(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},insert:function(t,n){var e="function"==typeof t?t:$t(t),r=null==n?U:"function"==typeof n?n:Vt(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(V)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,a=o(t+""),c=a.length;if(!(arguments.length<2)){for(h=n?s:u,null==e&&(e=!1),r=0;r<c;++r)this.each(h(a[r],n,e));return this}var h=this.node().__on;if(h)for(var l,f=0,p=h.length;f<p;++f)for(r=0,l=h[f];r<c;++r)if((i=a[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,n){return this.each(("function"==typeof n?Z:J)(t,n))}};var Kt=Math.PI,Wt=2*Kt,Yt=Wt-1e-6;Q.prototype=K.prototype={constructor:Q,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,r){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+r)},bezierCurveTo:function(t,n,e,r,i,o){this._+="C"+ +t+","+ +n+","+ +e+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},arcTo:function(t,n,e,r,i){t=+t,n=+n,e=+e,r=+r,i=+i;var o=this._x1,u=this._y1,s=e-t,a=r-n,c=o-t,h=u-n,l=c*c+h*h;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(l>1e-6)if(Math.abs(h*s-a*c)>1e-6&&i){var f=e-o,p=r-u,_=s*s+a*a,v=f*f+p*p,d=Math.sqrt(_),y=Math.sqrt(l),m=i*Math.tan((Kt-Math.acos((_+l-v)/(2*d*y)))/2),g=m/y,w=m/d;Math.abs(g-1)>1e-6&&(this._+="L"+(t+g*c)+","+(n+g*h)),this._+="A"+i+","+i+",0,0,"+ +(h*f>c*p)+","+(this._x1=t+w*s)+","+(this._y1=n+w*a)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,o){t=+t,n=+n;var u=(e=+e)*Math.cos(r),s=e*Math.sin(r),a=t+u,c=n+s,h=1^o,l=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+a+","+c:(Math.abs(this._x1-a)>1e-6||Math.abs(this._y1-c)>1e-6)&&(this._+="L"+a+","+c),e&&(l<0&&(l=l%Wt+Wt),l>Yt?this._+="A"+e+","+e+",0,1,"+h+","+(t-u)+","+(n-s)+"A"+e+","+e+",0,1,"+h+","+(this._x1=a)+","+(this._y1=c):l>1e-6&&(this._+="A"+e+","+e+",0,"+ +(l>=Kt)+","+h+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};var tn=function(t){return function(){return t}};W.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var nn=function(t){return new W(t)};ot.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:it(this,this._t0,rt(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(t=+t,n=+n,t!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,it(this,rt(this,e=et(this,t,n)),e);break;default:it(this,this._t0,e=et(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(function(t){this._context=new ut(t)}.prototype=Object.create(ot.prototype)).point=function(t,n){ot.prototype.point.call(this,n,t)},ut.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,o){this._context.bezierCurveTo(n,t,r,e,o,i)}};pt.prototype=ct.prototype={constructor:pt,count:function(){return this.eachAfter(st)},each:function(t){var n,e,r,i,o=this,u=[o];do{for(n=u.reverse(),u=[];o=n.pop();)if(t(o),e=o.children)for(r=0,i=e.length;r<i;++r)u.push(e[r])}while(u.length);return this},eachAfter:function(t){for(var n,e,r,i=this,o=[i],u=[];i=o.pop();)if(u.push(i),n=i.children)for(e=0,r=n.length;e<r;++e)o.push(n[e]);for(;i=u.pop();)t(i);return this},eachBefore:function(t){for(var n,e,r=this,i=[r];r=i.pop();)if(t(r),n=r.children)for(e=n.length-1;e>=0;--e)i.push(n[e]);return this},sum:function(t){return this.eachAfter(function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e})},sort:function(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})},path:function(t){for(var n=this,e=at(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){var t=[];return this.each(function(n){t.push(n)}),t},leaves:function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},links:function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n},copy:function(){return ct(this).eachBefore(lt)}};wt.prototype=Object.create(pt.prototype);At.prototype=bt.prototype={constructor:At,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,n){return this["$"+t]=n,this},remove:function(t){var n="$"+t;return n in this&&delete this[n]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)"$"===n[0]&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)"$"===n[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var n in this)"$"===n[0]&&t(this[n],n.slice(1),this)}};var en=bt.prototype;Et.prototype=function(t,n){var e=new Et;if(t instanceof Et)t.each(function(t){e.add(t)});else if(t){var r=-1,i=t.length;if(null==n)for(;++r<i;)e.add(t[r]);else for(;++r<i;)e.add(n(t[r],r,t))}return e}.prototype={constructor:Et,has:en.has,add:function(t){return t+="",this["$"+t]=t,this},remove:en.remove,clear:en.clear,values:en.keys,size:en.size,empty:en.empty,each:en.each};var rn={value:function(){}};St.prototype=Mt.prototype={constructor:St,on:function(t,n){var e,r=this._,i=Tt(t+"",r),o=-1,u=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++o<u;)if(e=(t=i[o]).type)r[e]=Ct(r[e],t.name,n);else if(null==n)for(e in r)r[e]=Ct(r[e],t.name,null);return this}for(;++o<u;)if((e=(t=i[o]).type)&&(e=zt(r[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new St(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var on=function(t,n){function e(t){var n,e=c.status;if(!e&&kt(c)||e>=200&&e<300||304===e){if(o)try{n=o.call(r,c)}catch(t){return void s.call("error",r,t)}else n=c;s.call("load",r,n)}else s.call("error",r,t)}var r,i,o,u,s=Mt("beforesend","progress","load","error"),a=bt(),c=new XMLHttpRequest,h=null,l=null,f=0;if("undefined"==typeof XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(t)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=c.ontimeout=e:c.onreadystatechange=function(t){c.readyState>3&&e(t)},c.onprogress=function(t){s.call("progress",r,t)},r={header:function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?a.get(t):(null==n?a.remove(t):a.set(t,n+""),r)},mimeType:function(t){return arguments.length?(i=null==t?null:t+"",r):i},responseType:function(t){return arguments.length?(u=t,r):u},timeout:function(t){return arguments.length?(f=+t,r):f},user:function(t){return arguments.length<1?h:(h=null==t?null:t+"",r)},password:function(t){return arguments.length<1?l:(l=null==t?null:t+"",r)},response:function(t){return o=t,r},get:function(t,n){return r.send("GET",t,n)},post:function(t,n){return r.send("POST",t,n)},send:function(n,e,o){return c.open(n,t,!0,h,l),null==i||a.has("accept")||a.set("accept",i+",*/*"),c.setRequestHeader&&a.each(function(t,n){c.setRequestHeader(n,t)}),null!=i&&c.overrideMimeType&&c.overrideMimeType(i),null!=u&&(c.responseType=u),f>0&&(c.timeout=f),null==o&&"function"==typeof e&&(o=e,e=null),null!=o&&1===o.length&&(o=Nt(o)),null!=o&&r.on("error",o).on("load",function(t){o(null,t)}),s.call("beforesend",r,c),c.send(null==e?null:e),r},abort:function(){return c.abort(),r},on:function(){var t=s.on.apply(s,arguments);return t===s?r:t}},null!=n){if("function"!=typeof n)throw new Error("invalid callback: "+n);return r.get(n)}return r},un=function(t,n){return function(e,r){var i=on(e).mimeType(t).response(n);if(null!=r){if("function"!=typeof r)throw new Error("invalid callback: "+r);return i.get(r)}return i}}("application/json",function(t){return JSON.parse(t.responseText)}),sn=function(t){function n(t,n){function e(){if(h>=c)return s;if(i)return i=!1,u;var n,e=h;if(34===t.charCodeAt(e)){for(var r=e;r++<c;)if(34===t.charCodeAt(r)){if(34!==t.charCodeAt(r+1))break;++r}return h=r+2,13===(n=t.charCodeAt(r+1))?(i=!0,10===t.charCodeAt(r+2)&&++h):10===n&&(i=!0),t.slice(e+1,r).replace(/""/g,'"')}for(;h<c;){var a=1;if(10===(n=t.charCodeAt(h++)))i=!0;else if(13===n)i=!0,10===t.charCodeAt(h)&&(++h,++a);else if(n!==o)continue;return t.slice(e,h-a)}return t.slice(e)}for(var r,i,u={},s={},a=[],c=t.length,h=0,l=0;(r=e())!==s;){for(var f=[];r!==u&&r!==s;)f.push(r),r=e();n&&null==(f=n(f,l++))||a.push(f)}return a}function e(n){return n.map(r).join(t)}function r(t){return null==t?"":i.test(t+="")?'"'+t.replace(/\"/g,'""')+'"':t}var i=new RegExp('["'+t+"\n\r]"),o=t.charCodeAt(0);return{parse:function(t,e){var r,i,o=n(t,function(t,n){if(r)return r(t,n-1);i=t,r=e?Ot(t,e):Pt(t)});return o.columns=i,o},parseRows:n,format:function(n,e){return null==e&&(e=qt(n)),[e.map(r).join(t)].concat(n.map(function(n){return e.map(function(t){return r(n[t])}).join(t)})).join("\n")},formatRows:function(t){return t.map(e).join("\n")}}};sn(","),sn("\t");t.style=b,t.selection=G,t.select=function(t){return"string"==typeof t?new F([[document.querySelector(t)]],[document.documentElement]):new F([[t]],Qt)},t.selectAll=function(t){return"string"==typeof t?new F([document.querySelectorAll(t)],[document.documentElement]):new F([null==t?[]:t],Qt)},t.line=function(){function t(t){var s,a,c,h=t.length,l=!1;for(null==i&&(u=o(c=K())),s=0;s<=h;++s)!(s<h&&r(a=t[s],s,t))===l&&((l=!l)?u.lineStart():u.lineEnd()),l&&u.point(+n(a,s,t),+e(a,s,t));if(c)return u=null,c+""||null}var n=Y,e=tt,r=tn(!0),i=null,o=nn,u=null;return t.x=function(e){return arguments.length?(n="function"==typeof e?e:tn(+e),t):n},t.y=function(n){return arguments.length?(e="function"==typeof n?n:tn(+n),t):e},t.defined=function(n){return arguments.length?(r="function"==typeof n?n:tn(!!n),t):r},t.curve=function(n){return arguments.length?(o=n,null!=i&&(u=o(i)),t):o},t.context=function(n){return arguments.length?(null==n?i=u=null:u=o(i=n),t):i},t},t.tree=function(){function t(t){var r=xt(t);if(r.eachAfter(n),r.parent.m=-r.z,r.eachBefore(e),a)t.eachBefore(i);else{var c=t,h=t,l=t;t.eachBefore(function(t){t.x<c.x&&(c=t),t.x>h.x&&(h=t),t.depth>l.depth&&(l=t)});var f=c===h?1:o(c,h)/2,p=f-c.x,_=u/(h.x+f+p),v=s/(l.depth||1);t.eachBefore(function(t){t.x=(t.x+p)*_,t.y=t.depth*v})}return t}function n(t){var n=t.children,e=t.parent.children,i=t.i?e[t.i-1]:null;if(n){mt(t);var u=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+o(t._,i._),t.m=t.z-u):t.z=u}else i&&(t.z=i.z+o(t._,i._));t.parent.A=r(t,i,t.parent.A||e[0])}function e(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function r(t,n,e){if(n){for(var r,i=t,u=t,s=n,a=i.parent.children[0],c=i.m,h=u.m,l=s.m,f=a.m;s=dt(s),i=vt(i),s&&i;)a=vt(a),(u=dt(u)).a=t,(r=s.z+l-i.z-c+o(s._,i._))>0&&(yt(gt(s,t,e),t,r),c+=r,h+=r),l+=s.m,c+=i.m,f+=a.m,h+=u.m;s&&!dt(u)&&(u.t=s,u.m+=l-h),i&&!vt(a)&&(a.t=i,a.m+=c-f,e=t)}return e}function i(t){t.x*=u,t.y=t.depth*s}var o=_t,u=1,s=1,a=null;return t.separation=function(n){return arguments.length?(o=n,t):o},t.size=function(n){return arguments.length?(a=!1,u=+n[0],s=+n[1],t):a?null:[u,s]},t.nodeSize=function(n){return arguments.length?(a=!0,u=+n[0],s=+n[1],t):a?[u,s]:null},t},t.json=un,t.map=bt,t.dispatch=Mt,Object.defineProperty(t,"__esModule",{value:!0})}); |