vsup
Version:
Value-Suppressing Uncertainty Palettes. A technique for creating bivariate scales for depicting uncertainty, using D3.
1 lines • 107 kB
JavaScript
(function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.vsup={})})(this,function(t){"use strict";function n(t,e){return t<e?-1:e<t?1:e<=t?0:NaN}var f,r,o=(1===(f=n).length&&(r=f,f=function(t,e){return n(r(t),e)}),{left:function(t,e,n,r){for(null==n&&(n=0),null==r&&(r=t.length);n<r;){var a=n+r>>>1;f(t[a],e)<0?n=a+1:r=a}return n},right:function(t,e,n,r){for(null==n&&(n=0),null==r&&(r=t.length);n<r;){var a=n+r>>>1;0<f(t[a],e)?r=a:n=a+1}return n}}).right;function C(t,e,n){t=+t,e=+e,n=(a=arguments.length)<2?(e=t,t=0,1):a<3?1:+n;for(var r=-1,a=0|Math.max(0,Math.ceil((e-t)/n)),f=new Array(a);++r<a;)f[r]=t+r*n;return f}var m=Math.sqrt(50),_=Math.sqrt(10),w=Math.sqrt(2);function u(t,e,n){var r=(e-t)/Math.max(0,n),a=Math.floor(Math.log(r)/Math.LN10),f=r/Math.pow(10,a);return 0<=a?(m<=f?10:_<=f?5:w<=f?2:1)*Math.pow(10,a):-Math.pow(10,-a)/(m<=f?10:_<=f?5:w<=f?2:1)}var a=Array.prototype.slice;function N(t){return t}var k=1,P=2,D=3,U=4,S=1e-6;function i(t){return"translate("+(t+.5)+",0)"}function c(t){return"translate(0,"+(t+.5)+")"}function z(){return!this.__axis}function x(p,g){var y=[],v=null,m=null,_=6,w=6,x=3,M=p===k||p===U?-1:1,A=p===U||p===P?"x":"y",T=p===k||p===D?i:c;function e(t){var e=null==v?g.ticks?g.ticks.apply(g,y):g.domain():v,n=null==m?g.tickFormat?g.tickFormat.apply(g,y):N:m,r=Math.max(_,0)+x,a=g.range(),f=+a[0]+.5,i=+a[a.length-1]+.5,c=(g.bandwidth?function(e){var n=Math.max(0,e.bandwidth()-1)/2;return e.round()&&(n=Math.round(n)),function(t){return+e(t)+n}}:function(e){return function(t){return+e(t)}})(g.copy()),o=t.selection?t.selection():t,u=o.selectAll(".domain").data([null]),s=o.selectAll(".tick").data(e,g).order(),d=s.exit(),l=s.enter().append("g").attr("class","tick"),h=s.select("line"),b=s.select("text");u=u.merge(u.enter().insert("path",".tick").attr("class","domain").attr("stroke","#000")),s=s.merge(l),h=h.merge(l.append("line").attr("stroke","#000").attr(A+"2",M*_)),b=b.merge(l.append("text").attr("fill","#000").attr(A,M*r).attr("dy",p===k?"0em":p===D?"0.71em":"0.32em")),t!==o&&(u=u.transition(t),s=s.transition(t),h=h.transition(t),b=b.transition(t),d=d.transition(t).attr("opacity",S).attr("transform",function(t){return isFinite(t=c(t))?T(t):this.getAttribute("transform")}),l.attr("opacity",S).attr("transform",function(t){var e=this.parentNode.__axis;return T(e&&isFinite(e=e(t))?e:c(t))})),d.remove(),u.attr("d",p===U||p==P?"M"+M*w+","+f+"H0.5V"+i+"H"+M*w:"M"+f+","+M*w+"V0.5H"+i+"V"+M*w),s.attr("opacity",1).attr("transform",function(t){return T(c(t))}),h.attr(A+"2",M*_),b.attr(A,M*r).text(n),o.filter(z).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",p===P?"start":p===U?"end":"middle"),o.each(function(){this.__axis=c})}return e.scale=function(t){return arguments.length?(g=t,e):g},e.ticks=function(){return y=a.call(arguments),e},e.tickArguments=function(t){return arguments.length?(y=null==t?[]:a.call(t),e):y.slice()},e.tickValues=function(t){return arguments.length?(v=null==t?null:a.call(t),e):v&&v.slice()},e.tickFormat=function(t){return arguments.length?(m=t,e):m},e.tickSize=function(t){return arguments.length?(_=w=+t,e):_},e.tickSizeInner=function(t){return arguments.length?(_=+t,e):_},e.tickSizeOuter=function(t){return arguments.length?(w=+t,e):w},e.tickPadding=function(t){return arguments.length?(x=+t,e):x},e}function E(t){return x(P,t)}var s={value:function(){}};function e(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new d(r)}function d(t){this._=t}function l(t,e){for(var n,r=0,a=t.length;r<a;++r)if((n=t[r]).name===e)return n.value}function h(t,e,n){for(var r=0,a=t.length;r<a;++r)if(t[r].name===e){t[r]=s,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}d.prototype=e.prototype={constructor:d,on:function(t,e){var n,r,a=this._,f=(r=a,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(0<=n&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),i=-1,c=f.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++i<c;)if(n=(t=f[i]).type)a[n]=h(a[n],t.name,e);else if(null==e)for(n in a)a[n]=h(a[n],t.name,null);return this}for(;++i<c;)if((n=(t=f[i]).type)&&(n=l(a[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new d(t)},call:function(t,e){if(0<(n=arguments.length-2))for(var n,r,a=new Array(n),f=0;f<n;++f)a[f]=arguments[f+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(f=0,n=(r=this._[t]).length;f<n;++f)r[f].value.apply(e,a)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],a=0,f=r.length;a<f;++a)r[a].value.apply(e,n)}};var b="http://www.w3.org/1999/xhtml",p={svg:"http://www.w3.org/2000/svg",xhtml:b,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function g(t){var e=t+="",n=e.indexOf(":");return 0<=n&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),p.hasOwnProperty(e)?{space:p[e],local:t}:t}function y(t){var e=g(t);return(e.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(n){return function(){var t=this.ownerDocument,e=this.namespaceURI;return e===b&&t.documentElement.namespaceURI===b?t.createElement(n):t.createElementNS(e,n)}})(e)}function v(){}function M(t){return null==t?v:function(){return this.querySelector(t)}}function A(){return[]}function T(t){return null==t?A:function(){return this.querySelectorAll(t)}}var F=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var q=document.documentElement;if(!q.matches){var Y=q.webkitMatchesSelector||q.msMatchesSelector||q.mozMatchesSelector||q.oMatchesSelector;F=function(t){return function(){return Y.call(this,t)}}}}var I=F;function L(t){return new Array(t.length)}function H(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}H.prototype={constructor:H,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var O="$";function j(t,e,n,r,a,f){for(var i,c=0,o=e.length,u=f.length;c<u;++c)(i=e[c])?(i.__data__=f[c],r[c]=i):n[c]=new H(t,f[c]);for(;c<o;++c)(i=e[c])&&(a[c]=i)}function R(t,e,n,r,a,f,i){var c,o,u,s={},d=e.length,l=f.length,h=new Array(d);for(c=0;c<d;++c)(o=e[c])&&(h[c]=u=O+i.call(o,o.__data__,c,e),u in s?a[c]=o:s[u]=o);for(c=0;c<l;++c)(o=s[u=O+i.call(t,f[c],c,f)])?((r[c]=o).__data__=f[c],s[u]=null):n[c]=new H(t,f[c]);for(c=0;c<d;++c)(o=e[c])&&s[h[c]]===o&&(a[c]=o)}function V(t,e){return t<e?-1:e<t?1:e<=t?0:NaN}function X(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function $(t,e){return t.style.getPropertyValue(e)||X(t).getComputedStyle(t,null).getPropertyValue(e)}function Z(t){return t.trim().split(/^|\s+/)}function G(t){return t.classList||new B(t)}function B(t){this._node=t,this._names=Z(t.getAttribute("class")||"")}function Q(t,e){for(var n=G(t),r=-1,a=e.length;++r<a;)n.add(e[r])}function W(t,e){for(var n=G(t),r=-1,a=e.length;++r<a;)n.remove(e[r])}function J(){this.textContent=""}function K(){this.innerHTML=""}function tt(){this.nextSibling&&this.parentNode.appendChild(this)}function et(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function nt(){return null}function rt(){var t=this.parentNode;t&&t.removeChild(this)}function at(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function ft(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}B.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);0<=e&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return 0<=this._names.indexOf(t)}};var it={};"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(it={mouseenter:"mouseover",mouseleave:"mouseout"}));function ct(n,t,e){return n=ot(n,t,e),function(t){var e=t.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||n.call(this,t)}}function ot(e,n,r){return function(t){try{e.call(this,this.__data__,n,r)}finally{}}}function ut(f){return function(){var t=this.__on;if(t){for(var e,n=0,r=-1,a=t.length;n<a;++n)e=t[n],f.type&&e.type!==f.type||e.name!==f.name?t[++r]=e:this.removeEventListener(e.type,e.listener,e.capture);++r?t.length=r:delete this.__on}}}function st(o,u,s){var d=it.hasOwnProperty(o.type)?ct:ot;return function(t,e,n){var r,a=this.__on,f=d(u,e,n);if(a)for(var i=0,c=a.length;i<c;++i)if((r=a[i]).type===o.type&&r.name===o.name)return this.removeEventListener(r.type,r.listener,r.capture),this.addEventListener(r.type,r.listener=f,r.capture=s),void(r.value=u);this.addEventListener(o.type,f,s),r={type:o.type,name:o.name,value:u,listener:f,capture:s},a?a.push(r):this.__on=[r]}}function dt(t,e,n){var r=X(t),a=r.CustomEvent;"function"==typeof a?a=new a(e,n):(a=r.document.createEvent("Event"),n?(a.initEvent(e,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(e,!1,!1)),t.dispatchEvent(a)}var lt=[null];function ht(t,e){this._groups=t,this._parents=e}function bt(){return new ht([[document.documentElement]],lt)}function pt(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function gt(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function yt(){}ht.prototype=bt.prototype={constructor:ht,select:function(t){"function"!=typeof t&&(t=M(t));for(var e=this._groups,n=e.length,r=new Array(n),a=0;a<n;++a)for(var f,i,c=e[a],o=c.length,u=r[a]=new Array(o),s=0;s<o;++s)(f=c[s])&&(i=t.call(f,f.__data__,s,c))&&("__data__"in f&&(i.__data__=f.__data__),u[s]=i);return new ht(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=T(t));for(var e=this._groups,n=e.length,r=[],a=[],f=0;f<n;++f)for(var i,c=e[f],o=c.length,u=0;u<o;++u)(i=c[u])&&(r.push(t.call(i,i.__data__,u,c)),a.push(i));return new ht(r,a)},filter:function(t){"function"!=typeof t&&(t=I(t));for(var e=this._groups,n=e.length,r=new Array(n),a=0;a<n;++a)for(var f,i=e[a],c=i.length,o=r[a]=[],u=0;u<c;++u)(f=i[u])&&t.call(f,f.__data__,u,i)&&o.push(f);return new ht(r,this._parents)},data:function(t,e){if(!t)return b=new Array(this.size()),s=-1,this.each(function(t){b[++s]=t}),b;var n,r=e?R:j,a=this._parents,f=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var i=f.length,c=new Array(i),o=new Array(i),u=new Array(i),s=0;s<i;++s){var d=a[s],l=f[s],h=l.length,b=t.call(d,d&&d.__data__,s,a),p=b.length,g=o[s]=new Array(p),y=c[s]=new Array(p);r(d,l,g,y,u[s]=new Array(h),b,e);for(var v,m,_=0,w=0;_<p;++_)if(v=g[_]){for(w<=_&&(w=_+1);!(m=y[w])&&++w<p;);v._next=m||null}}return(c=new ht(c,a))._enter=o,c._exit=u,c},enter:function(){return new ht(this._enter||this._groups.map(L),this._parents)},exit:function(){return new ht(this._exit||this._groups.map(L),this._parents)},merge:function(t){for(var e=this._groups,n=t._groups,r=e.length,a=n.length,f=Math.min(r,a),i=new Array(r),c=0;c<f;++c)for(var o,u=e[c],s=n[c],d=u.length,l=i[c]=new Array(d),h=0;h<d;++h)(o=u[h]||s[h])&&(l[h]=o);for(;c<r;++c)i[c]=e[c];return new ht(i,this._parents)},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,a=t[e],f=a.length-1,i=a[f];0<=--f;)(r=a[f])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},sort:function(n){function t(t,e){return t&&e?n(t.__data__,e.__data__):!t-!e}n||(n=V);for(var e=this._groups,r=e.length,a=new Array(r),f=0;f<r;++f){for(var i,c=e[f],o=c.length,u=a[f]=new Array(o),s=0;s<o;++s)(i=c[s])&&(u[s]=i);u.sort(t)}return new ht(a,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()),e=-1;return this.each(function(){t[++e]=this}),t},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],a=0,f=r.length;a<f;++a){var i=r[a];if(i)return i}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var a,f=e[n],i=0,c=f.length;i<c;++i)(a=f[i])&&t.call(a,a.__data__,i,f);return this},attr:function(t,e){var n=g(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof e?n.local?function(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,t)}}:function(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}:n.local?function(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}:function(t,e){return function(){this.setAttribute(t,e)}})(n,e))},style:function(t,e,n){return 1<arguments.length?this.each((null==e?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof e?function(e,n,r){return function(){var t=n.apply(this,arguments);null==t?this.style.removeProperty(e):this.style.setProperty(e,t,r)}}:function(t,e,n){return function(){this.style.setProperty(t,e,n)}})(t,e,null==n?"":n)):$(this.node(),t)},property:function(t,e){return 1<arguments.length?this.each((null==e?function(t){return function(){delete this[t]}}:"function"==typeof e?function(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}:function(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]},classed:function(t,e){var n=Z(t+"");if(arguments.length<2){for(var r=G(this.node()),a=-1,f=n.length;++a<f;)if(!r.contains(n[a]))return!1;return!0}return this.each(("function"==typeof e?function(t,e){return function(){(e.apply(this,arguments)?Q:W)(this,t)}}:e?function(t){return function(){Q(this,t)}}:function(t){return function(){W(this,t)}})(n,e))},text:function(t){return arguments.length?this.each(null==t?J:("function"==typeof t?function(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?K:("function"==typeof t?function(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(tt)},lower:function(){return this.each(et)},append:function(t){var e="function"==typeof t?t:y(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:y(t),r=null==e?nt:"function"==typeof e?e:M(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(rt)},clone:function(t){return this.select(t?ft:at)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,a,f=(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return 0<=n&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}),i=f.length;if(!(arguments.length<2)){for(c=e?st:ut,null==n&&(n=!1),r=0;r<i;++r)this.each(c(f[r],e,n));return this}var c=this.node().__on;if(c)for(var o,u=0,s=c.length;u<s;++u)for(r=0,o=c[u];r<i;++r)if((a=f[r]).type===o.type&&a.name===o.name)return o.value},dispatch:function(t,e){return this.each(("function"==typeof e?function(t,e){return function(){return dt(this,t,e.apply(this,arguments))}}:function(t,e){return function(){return dt(this,t,e)}})(t,e))}};var vt=1/.7,mt="\\s*([+-]?\\d+)\\s*",_t="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",wt="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xt=/^#([0-9a-f]{3})$/,Mt=/^#([0-9a-f]{6})$/,At=new RegExp("^rgb\\("+[mt,mt,mt]+"\\)$"),Tt=new RegExp("^rgb\\("+[wt,wt,wt]+"\\)$"),Nt=new RegExp("^rgba\\("+[mt,mt,mt,_t]+"\\)$"),kt=new RegExp("^rgba\\("+[wt,wt,wt,_t]+"\\)$"),Ct=new RegExp("^hsl\\("+[_t,wt,wt]+"\\)$"),Pt=new RegExp("^hsla\\("+[_t,wt,wt,_t]+"\\)$"),Dt={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ut(t){var e;return t=(t+"").trim().toLowerCase(),(e=xt.exec(t))?new qt((e=parseInt(e[1],16))>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):(e=Mt.exec(t))?St(parseInt(e[1],16)):(e=At.exec(t))?new qt(e[1],e[2],e[3],1):(e=Tt.exec(t))?new qt(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Nt.exec(t))?zt(e[1],e[2],e[3],e[4]):(e=kt.exec(t))?zt(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ct.exec(t))?Yt(e[1],e[2]/100,e[3]/100,1):(e=Pt.exec(t))?Yt(e[1],e[2]/100,e[3]/100,e[4]):Dt.hasOwnProperty(t)?St(Dt[t]):"transparent"===t?new qt(NaN,NaN,NaN,0):null}function St(t){return new qt(t>>16&255,t>>8&255,255&t,1)}function zt(t,e,n,r){return r<=0&&(t=e=n=NaN),new qt(t,e,n,r)}function Et(t){return t instanceof yt||(t=Ut(t)),t?new qt((t=t.rgb()).r,t.g,t.b,t.opacity):new qt}function Ft(t,e,n,r){return 1===arguments.length?Et(t):new qt(t,e,n,null==r?1:r)}function qt(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Yt(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||1<=n?t=e=NaN:e<=0&&(t=NaN),new Lt(t,e,n,r)}function It(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Lt)return new Lt(t.h,t.s,t.l,t.opacity);if(t instanceof yt||(t=Ut(t)),!t)return new Lt;if(t instanceof Lt)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,a=Math.min(e,n,r),f=Math.max(e,n,r),i=NaN,c=f-a,o=(f+a)/2;return c?(i=e===f?(n-r)/c+6*(n<r):n===f?(r-e)/c+2:(e-n)/c+4,c/=o<.5?f+a:2-f-a,i*=60):c=0<o&&o<1?0:i,new Lt(i,c,o,t.opacity)}(t):new Lt(t,e,n,null==r?1:r)}function Lt(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ht(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}pt(yt,Ut,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),pt(qt,Ft,gt(yt,{brighter:function(t){return t=null==t?vt:Math.pow(vt,t),new qt(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new qt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),pt(Lt,It,gt(yt,{brighter:function(t){return t=null==t?vt:Math.pow(vt,t),new Lt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Lt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,a=2*n-r;return new qt(Ht(240<=t?t-240:t+120,a,r),Ht(t,a,r),Ht(t<120?t+240:t-120,a,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var Ot=Math.PI/180,jt=180/Math.PI,Rt=.95047,Vt=1,Xt=1.08883,$t=4/29,Zt=6/29,Gt=3*Zt*Zt,Bt=Zt*Zt*Zt;function Qt(t){if(t instanceof Jt)return new Jt(t.l,t.a,t.b,t.opacity);if(t instanceof re){var e=t.h*Ot;return new Jt(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof qt||(t=Et(t));var n=ne(t.r),r=ne(t.g),a=ne(t.b),f=Kt((.4124564*n+.3575761*r+.1804375*a)/Rt),i=Kt((.2126729*n+.7151522*r+.072175*a)/Vt);return new Jt(116*i-16,500*(f-i),200*(i-Kt((.0193339*n+.119192*r+.9503041*a)/Xt)),t.opacity)}function Wt(t,e,n,r){return 1===arguments.length?Qt(t):new Jt(t,e,n,null==r?1:r)}function Jt(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function Kt(t){return Bt<t?Math.pow(t,1/3):t/Gt+$t}function te(t){return Zt<t?t*t*t:Gt*(t-$t)}function ee(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ne(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function re(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}pt(Jt,Wt,gt(yt,{brighter:function(t){return new Jt(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new Jt(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return t=Vt*te(t),new qt(ee(3.2404542*(e=Rt*te(e))-1.5371385*t-.4985314*(n=Xt*te(n))),ee(-.969266*e+1.8760108*t+.041556*n),ee(.0556434*e-.2040259*t+1.0572252*n),this.opacity)}})),pt(re,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof re)return new re(t.h,t.c,t.l,t.opacity);t instanceof Jt||(t=Qt(t));var e=Math.atan2(t.b,t.a)*jt;return new re(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new re(t,e,n,null==r?1:r)},gt(yt,{brighter:function(t){return new re(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new re(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return Qt(this).rgb()}}));var ae=1.78277,fe=-.29227,ie=-.90649,ce=1.97294,oe=ce*ie,ue=ce*ae,se=ae*fe- -.14861*ie;function de(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof le)return new le(t.h,t.s,t.l,t.opacity);t instanceof qt||(t=Et(t));var e=t.r/255,n=t.g/255,r=t.b/255,a=(se*r+oe*e-ue*n)/(se+oe-ue),f=r-a,i=(ce*(n-a)-fe*f)/ie,c=Math.sqrt(i*i+f*f)/(ce*a*(1-a)),o=c?Math.atan2(i,f)*jt-120:NaN;return new le(o<0?o+360:o,c,a,t.opacity)}(t):new le(t,e,n,null==r?1:r)}function le(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function he(t){return function(){return t}}function be(e,n){return function(t){return e+t*n}}function pe(f){return 1==(f=+f)?ge:function(t,e){return e-t?(n=t,r=e,a=f,n=Math.pow(n,a),r=Math.pow(r,a)-n,a=1/a,function(t){return Math.pow(n+t*r,a)}):he(isNaN(t)?e:t);var n,r,a}}function ge(t,e){var n=e-t;return n?be(t,n):he(isNaN(t)?e:t)}pt(le,de,gt(yt,{brighter:function(t){return t=null==t?vt:Math.pow(vt,t),new le(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new le(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Ot,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),a=Math.sin(t);return new qt(255*(e+n*(-.14861*r+ae*a)),255*(e+n*(fe*r+ie*a)),255*(e+n*(ce*r)),this.opacity)}}));var ye=function t(e){var i=pe(e);function n(e,t){var n=i((e=Ft(e)).r,(t=Ft(t)).r),r=i(e.g,t.g),a=i(e.b,t.b),f=ge(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=r(t),e.b=a(t),e.opacity=f(t),e+""}}return n.gamma=t,n}(1);var ve,me=(ve=function(u){var s=u.length-1;return function(t){var e,n,r,a=t<=0?t=0:1<=t?s-(t=1):Math.floor(t*s),f=u[a],i=u[a+1],c=0<a?u[a-1]:2*f-i,o=a<s-1?u[a+2]:2*i-f;return((1-3*(e=(t-a/s)*s)+3*(n=e*e)-(r=n*e))*c+(4-6*n+3*r)*f+(1+3*e+3*n-3*r)*i+r*o)/6}},function(t){var e,n,r=t.length,a=new Array(r),f=new Array(r),i=new Array(r);for(e=0;e<r;++e)n=Ft(t[e]),a[e]=n.r||0,f[e]=n.g||0,i[e]=n.b||0;return a=ve(a),f=ve(f),i=ve(i),n.opacity=1,function(t){return n.r=a(t),n.g=f(t),n.b=i(t),n+""}});function _e(e,n){return n-=e=+e,function(t){return e+n*t}}var we=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xe=new RegExp(we.source,"g");function Me(t,r){var e,n,a,f,i,c=we.lastIndex=xe.lastIndex=0,o=-1,u=[],s=[];for(t+="",r+="";(e=we.exec(t))&&(n=xe.exec(r));)(a=n.index)>c&&(a=r.slice(c,a),u[o]?u[o]+=a:u[++o]=a),(e=e[0])===(n=n[0])?u[o]?u[o]+=n:u[++o]=n:(u[++o]=null,s.push({i:o,x:_e(e,n)})),c=xe.lastIndex;return c<r.length&&(a=r.slice(c),u[o]?u[o]+=a:u[++o]=a),u.length<2?s[0]?(i=s[0].x,function(t){return i(t)+""}):(f=r,function(){return f}):(r=s.length,function(t){for(var e,n=0;n<r;++n)u[(e=s[n]).i]=e.x(t);return u.join("")})}function Ae(t,e){var n,r=typeof e;return null==e||"boolean"===r?he(e):("number"===r?_e:"string"===r?(n=Ut(e))?(e=n,ye):Me:e instanceof Ut?ye:e instanceof Date?function(e,n){var r=new Date;return n-=e=+e,function(t){return r.setTime(e+n*t),r}}:Array.isArray(e)?function(t,e){var n,r=e?e.length:0,a=t?Math.min(r,t.length):0,f=new Array(a),i=new Array(r);for(n=0;n<a;++n)f[n]=Ae(t[n],e[n]);for(;n<r;++n)i[n]=e[n];return function(t){for(n=0;n<a;++n)i[n]=f[n](t);return i}}:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?function(t,e){var n,r={},a={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Ae(t[n],e[n]):a[n]=e[n];return function(t){for(n in r)a[n]=r[n](t);return a}}:_e)(t,e)}function Te(e,n){return n-=e=+e,function(t){return Math.round(e+n*t)}}var Ne,ke,Ce,Pe,De=180/Math.PI,Ue={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Se(t,e,n,r,a,f){var i,c,o;return(i=Math.sqrt(t*t+e*e))&&(t/=i,e/=i),(o=t*n+e*r)&&(n-=t*o,r-=e*o),(c=Math.sqrt(n*n+r*r))&&(n/=c,r/=c,o/=c),t*r<e*n&&(t=-t,e=-e,o=-o,i=-i),{translateX:a,translateY:f,rotate:Math.atan2(e,t)*De,skewX:Math.atan(o)*De,scaleX:i,scaleY:c}}function ze(l,h,b,p){function g(t){return t.length?t.pop()+" ":""}return function(t,e){var n,r,a,f,i,c,o,u,s=[],d=[];return t=l(t),e=l(e),function(t,e,n,r,a,f){if(t!==n||e!==r){var i=a.push("translate(",null,h,null,b);f.push({i:i-4,x:_e(t,n)},{i:i-2,x:_e(e,r)})}else(n||r)&&a.push("translate("+n+h+r+b)}(t.translateX,t.translateY,e.translateX,e.translateY,s,d),n=t.rotate,r=e.rotate,a=s,f=d,n!==r?(180<n-r?r+=360:180<r-n&&(n+=360),f.push({i:a.push(g(a)+"rotate(",null,p)-2,x:_e(n,r)})):r&&a.push(g(a)+"rotate("+r+p),i=t.skewX,c=e.skewX,o=s,u=d,i!==c?u.push({i:o.push(g(o)+"skewX(",null,p)-2,x:_e(i,c)}):c&&o.push(g(o)+"skewX("+c+p),function(t,e,n,r,a,f){if(t!==n||e!==r){var i=a.push(g(a)+"scale(",null,",",null,")");f.push({i:i-4,x:_e(t,n)},{i:i-2,x:_e(e,r)})}else 1===n&&1===r||a.push(g(a)+"scale("+n+","+r+")")}(t.scaleX,t.scaleY,e.scaleX,e.scaleY,s,d),t=e=null,function(t){for(var e,n=-1,r=d.length;++n<r;)s[(e=d[n]).i]=e.x(t);return s.join("")}}}var Ee=ze(function(t){return"none"===t?Ue:(Ne||(Ne=document.createElement("DIV"),ke=document.documentElement,Ce=document.defaultView),Ne.style.transform=t,t=Ce.getComputedStyle(ke.appendChild(Ne),null).getPropertyValue("transform"),ke.removeChild(Ne),Se(+(t=t.slice(7,-1).split(","))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),Fe=ze(function(t){return null==t?Ue:(Pe||(Pe=document.createElementNS("http://www.w3.org/2000/svg","g")),Pe.setAttribute("transform",t),(t=Pe.transform.baseVal.consolidate())?Se((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Ue)},", ",")",")");Math.SQRT2;function qe(e,t){var n=ge((e=Wt(e)).l,(t=Wt(t)).l),r=ge(e.a,t.a),a=ge(e.b,t.b),f=ge(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=r(t),e.b=a(t),e.opacity=f(t),e+""}}function Ye(c){return function t(i){function e(e,t){var n=c((e=de(e)).h,(t=de(t)).h),r=ge(e.s,t.s),a=ge(e.l,t.l),f=ge(e.opacity,t.opacity);return function(t){return e.h=n(t),e.s=r(t),e.l=a(Math.pow(t,i)),e.opacity=f(t),e+""}}return i=+i,e.gamma=t,e}(1)}Ye(function(t,e){var n=e-t;return n?be(t,180<n||n<-180?n-360*Math.round(n/360):n):he(isNaN(t)?e:t)});var Ie=Ye(ge);var Le,He,Oe=0,je=0,Re=0,Ve=1e3,Xe=0,$e=0,Ze=0,Ge="object"==typeof performance&&performance.now?performance:Date,Be="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Qe(){return $e||(Be(We),$e=Ge.now()+Ze)}function We(){$e=0}function Je(){this._call=this._time=this._next=null}function Ke(t,e,n){var r=new Je;return r.restart(t,e,n),r}function tn(){$e=(Xe=Ge.now())+Ze,Oe=je=0;try{(function(){Qe(),++Oe;for(var t,e=Le;e;)0<=(t=$e-e._time)&&e._call.call(null,t),e=e._next;--Oe})()}finally{Oe=0,function(){var t,e,n=Le,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),n=(t=n)._next):(e=n._next,n._next=null,n=t?t._next=e:Le=e);He=t,nn(r)}(),$e=0}}function en(){var t=Ge.now(),e=t-Xe;Ve<e&&(Ze-=e,Xe=t)}function nn(t){Oe||(je&&(je=clearTimeout(je)),24<t-$e?(t<1/0&&(je=setTimeout(tn,t-Ge.now()-Ze)),Re&&(Re=clearInterval(Re))):(Re||(Xe=Ge.now(),Re=setInterval(en,Ve)),Oe=1,Be(tn)))}function rn(e,n,t){var r=new Je;return n=null==n?0:+n,r.restart(function(t){r.stop(),e(t+n)},n,t),r}Je.prototype=Ke.prototype={constructor:Je,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Qe():+n)+(null==e?0:+e),this._next||He===this||(He?He._next=this:Le=this,He=this),this._call=t,this._time=n,nn()},stop:function(){this._call&&(this._call=null,this._time=1/0,nn())}};var an=e("start","end","interrupt"),fn=[],cn=0,on=1,un=2,sn=3,dn=4,ln=5,hn=6;function bn(t,e,n,r,a,f){var i=t.__transition;if(i){if(n in i)return}else t.__transition={};(function(f,i,c){var o,u=f.__transition;function s(t){var e,n,r,a;if(c.state!==on)return l();for(e in u)if((a=u[e]).name===c.name){if(a.state===sn)return rn(s);a.state===dn?(a.state=hn,a.timer.stop(),a.on.call("interrupt",f,f.__data__,a.index,a.group),delete u[e]):+e<i&&(a.state=hn,a.timer.stop(),delete u[e])}if(rn(function(){c.state===sn&&(c.state=dn,c.timer.restart(d,c.delay,c.time),d(t))}),c.state=un,c.on.call("start",f,f.__data__,c.index,c.group),c.state===un){for(c.state=sn,o=new Array(r=c.tween.length),e=0,n=-1;e<r;++e)(a=c.tween[e].value.call(f,f.__data__,c.index,c.group))&&(o[++n]=a);o.length=n+1}}function d(t){for(var e=t<c.duration?c.ease.call(null,t/c.duration):(c.timer.restart(l),c.state=ln,1),n=-1,r=o.length;++n<r;)o[n].call(null,e);c.state===ln&&(c.on.call("end",f,f.__data__,c.index,c.group),l())}function l(){for(var t in c.state=hn,c.timer.stop(),delete u[i],u)return;delete f.__transition}(u[i]=c).timer=Ke(function(t){c.state=on,c.timer.restart(s,c.delay,c.time),c.delay<=t&&s(t-c.delay)},0,c.time)})(t,n,{name:e,index:r,group:a,on:an,tween:fn,time:f.time,delay:f.delay,duration:f.duration,ease:f.ease,timer:null,state:cn})}function pn(t,e){var n=yn(t,e);if(n.state>cn)throw new Error("too late; already scheduled");return n}function gn(t,e){var n=yn(t,e);if(n.state>un)throw new Error("too late; already started");return n}function yn(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function vn(t,e,n){var r=t._id;return t.each(function(){var t=gn(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return yn(t,r).value[e]}}function mn(t,e){var n;return("number"==typeof e?_e:e instanceof Ut?ye:(n=Ut(e))?(e=n,ye):Me)(t,e)}var _n=bt.prototype.constructor;var wn=0;function xn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Mn(){return++wn}var An=bt.prototype;xn.prototype=function(t){return bt().transition(t)}.prototype={constructor:xn,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=M(t));for(var r=this._groups,a=r.length,f=new Array(a),i=0;i<a;++i)for(var c,o,u=r[i],s=u.length,d=f[i]=new Array(s),l=0;l<s;++l)(c=u[l])&&(o=t.call(c,c.__data__,l,u))&&("__data__"in c&&(o.__data__=c.__data__),d[l]=o,bn(d[l],e,n,l,d,yn(c,n)));return new xn(f,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=T(t));for(var r=this._groups,a=r.length,f=[],i=[],c=0;c<a;++c)for(var o,u=r[c],s=u.length,d=0;d<s;++d)if(o=u[d]){for(var l,h=t.call(o,o.__data__,d,u),b=yn(o,n),p=0,g=h.length;p<g;++p)(l=h[p])&&bn(l,e,n,p,h,b);f.push(h),i.push(o)}return new xn(f,i,e,n)},filter:function(t){"function"!=typeof t&&(t=I(t));for(var e=this._groups,n=e.length,r=new Array(n),a=0;a<n;++a)for(var f,i=e[a],c=i.length,o=r[a]=[],u=0;u<c;++u)(f=i[u])&&t.call(f,f.__data__,u,i)&&o.push(f);return new xn(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,a=n.length,f=Math.min(r,a),i=new Array(r),c=0;c<f;++c)for(var o,u=e[c],s=n[c],d=u.length,l=i[c]=new Array(d),h=0;h<d;++h)(o=u[h]||s[h])&&(l[h]=o);for(;c<r;++c)i[c]=e[c];return new xn(i,this._parents,this._name,this._id)},selection:function(){return new _n(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Mn(),r=this._groups,a=r.length,f=0;f<a;++f)for(var i,c=r[f],o=c.length,u=0;u<o;++u)if(i=c[u]){var s=yn(i,e);bn(i,t,n,u,c,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new xn(r,this._parents,t,n)},call:An.call,nodes:An.nodes,node:An.node,size:An.size,empty:An.empty,each:An.each,on:function(t,e){var n,r,a,f,i,c,o=this._id;return arguments.length<2?yn(this.node(),o).on.on(t):this.each((n=o,a=e,c=((r=t)+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return 0<=e&&(t=t.slice(0,e)),!t||"start"===t})?pn:gn,function(){var t=c(this,n),e=t.on;e!==f&&(i=(f=e).copy()).on(r,a),t.on=i}))},attr:function(t,e){var n=g(t),r="transform"===n?Fe:mn;return this.attrTween(t,"function"==typeof e?(n.local?function(n,r,a){var f,i,c;return function(){var t,e=a(this);if(null!=e)return(t=this.getAttributeNS(n.space,n.local))===e?null:t===f&&e===i?c:c=r(f=t,i=e);this.removeAttributeNS(n.space,n.local)}}:function(n,r,a){var f,i,c;return function(){var t,e=a(this);if(null!=e)return(t=this.getAttribute(n))===e?null:t===f&&e===i?c:c=r(f=t,i=e);this.removeAttribute(n)}})(n,r,vn(this,"attr."+t,e)):null==e?(n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(n):(n.local?function(e,n,r){var a,f;return function(){var t=this.getAttributeNS(e.space,e.local);return t===r?null:t===a?f:f=n(a=t,r)}}:function(e,n,r){var a,f;return function(){var t=this.getAttribute(e);return t===r?null:t===a?f:f=n(a=t,r)}})(n,r,e+""))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=g(t);return this.tween(n,(r.local?function(r,t){function e(){var e=this,n=t.apply(e,arguments);return n&&function(t){e.setAttributeNS(r.space,r.local,n(t))}}return e._value=t,e}:function(r,t){function e(){var e=this,n=t.apply(e,arguments);return n&&function(t){e.setAttribute(r,n(t))}}return e._value=t,e})(r,e))},style:function(t,e,n){var r,a,f,i,c,o,u,s,d,l,h,b,p,g,y,v,m,_="transform"==(t+="")?Ee:mn;return null==e?this.styleTween(t,(p=t,g=_,function(){var t=$(this,p),e=(this.style.removeProperty(p),$(this,p));return t===e?null:t===y&&e===v?m:m=g(y=t,v=e)})).on("end.style."+t,(b=t,function(){this.style.removeProperty(b)})):this.styleTween(t,"function"==typeof e?(u=_,s=vn(this,"style."+(o=t),e),function(){var t=$(this,o),e=s(this);return null==e&&(this.style.removeProperty(o),e=$(this,o)),t===e?null:t===d&&e===l?h:h=u(d=t,l=e)}):(r=t,a=_,f=e+"",function(){var t=$(this,r);return t===f?null:t===i?c:c=a(i=t,f)}),n)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(r,t,a){function e(){var e=this,n=t.apply(e,arguments);return n&&function(t){e.style.setProperty(r,n(t),a)}}return e._value=t,e}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?(n=vn(this,"text",t),function(){var t=n(this);this.textContent=null==t?"":t}):(e=null==t?"":t+"",function(){this.textContent=e}));var e,n},remove:function(){return this.on("end.remove",(n=this._id,function(){var t=this.parentNode;for(var e in this.__transition)if(+e!==n)return;t&&t.removeChild(this)}));var n},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,a=yn(this.node(),n).tween,f=0,i=a.length;f<i;++f)if((r=a[f]).name===t)return r.value;return null}return this.each((null==e?function(a,f){var i,c;return function(){var t=gn(this,a),e=t.tween;if(e!==i)for(var n=0,r=(c=i=e).length;n<r;++n)if(c[n].name===f){(c=c.slice()).splice(n,1);break}t.tween=c}}:function(f,i,c){var o,u;if("function"!=typeof c)throw new Error;return function(){var t=gn(this,f),e=t.tween;if(e!==o){u=(o=e).slice();for(var n={name:i,value:c},r=0,a=u.length;r<a;++r)if(u[r].name===i){u[r]=n;break}r===a&&u.push(n)}t.tween=u}})(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?function(t,e){return function(){pn(this,t).delay=+e.apply(this,arguments)}}:function(t,e){return e=+e,function(){pn(this,t).delay=e}})(e,t)):yn(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?function(t,e){return function(){gn(this,t).duration=+e.apply(this,arguments)}}:function(t,e){return e=+e,function(){gn(this,t).duration=e}})(e,t)):yn(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){gn(this,t).ease=e}}(e,t)):yn(this.node(),e).ease}};Math.PI,Math.PI;var Tn={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Nn(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))return Tn.time=Qe(),Tn;return n}bt.prototype.interrupt=function(t){return this.each(function(){(function(t,e){var n,r,a,f=t.__transition,i=!0;if(f){for(a in e=null==e?null:e+"",f)(n=f[a]).name===e?(r=n.state>un&&n.state<ln,n.state=hn,n.timer.stop(),r&&n.on.call("interrupt",t,t.__data__,n.index,n.group),delete f[a]):i=!1;i&&delete t.__transition}})(this,t)})},bt.prototype.transition=function(t){var e,n;t instanceof xn?(e=t._id,t=t._name):(e=Mn(),(n=Tn).time=Qe(),t=null==t?null:t+"");for(var r=this._groups,a=r.length,f=0;f<a;++f)for(var i,c=r[f],o=c.length,u=0;u<o;++u)(i=c[u])&&bn(i,t,e,u,c,n||Nn(i,e));return new xn(r,this._parents,t,e)};Math.PI;var kn=Math.PI,Cn=2*kn,Pn=1e-6,Dn=Cn-Pn;function Un(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Sn(){return new Un}Un.prototype=Sn.prototype={constructor:Un,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,r){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(t,e,n,r,a,f){this._+="C"+ +t+","+ +e+","+ +n+","+ +r+","+(this._x1=+a)+","+(this._y1=+f)},arcTo:function(t,e,n,r,a){t=+t,e=+e,n=+n,r=+r,a=+a;var f=this._x1,i=this._y1,c=n-t,o=r-e,u=f-t,s=i-e,d=u*u+s*s;if(a<0)throw new Error("negative radius: "+a);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(Pn<d)if(Math.abs(s*c-o*u)>Pn&&a){var l=n-f,h=r-i,b=c*c+o*o,p=l*l+h*h,g=Math.sqrt(b),y=Math.sqrt(d),v=a*Math.tan((kn-Math.acos((b+d-p)/(2*g*y)))/2),m=v/y,_=v/g;Math.abs(m-1)>Pn&&(this._+="L"+(t+m*u)+","+(e+m*s)),this._+="A"+a+","+a+",0,0,"+ +(u*h<s*l)+","+(this._x1=t+_*c)+","+(this._y1=e+_*o)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,r,a,f){t=+t,e=+e;var i=(n=+n)*Math.cos(r),c=n*Math.sin(r),o=t+i,u=e+c,s=1^f,d=f?r-a:a-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+o+","+u:(Math.abs(this._x1-o)>Pn||Math.abs(this._y1-u)>Pn)&&(this._+="L"+o+","+u),n&&(d<0&&(d=d%Cn+Cn),Dn<d?this._+="A"+n+","+n+",0,1,"+s+","+(t-i)+","+(e-c)+"A"+n+","+n+",0,1,"+s+","+(this._x1=o)+","+(this._y1=u):Pn<d&&(this._+="A"+n+","+n+",0,"+ +(kn<=d)+","+s+","+(this._x1=t+n*Math.cos(a))+","+(this._y1=e+n*Math.sin(a))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var zn="$";function En(){}function Fn(t,e){var n=new En;if(t instanceof En)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var r,a=-1,f=t.length;if(null==e)for(;++a<f;)n.set(a,t[a]);else for(;++a<f;)n.set(e(r=t[a],a,t),r)}else if(t)for(var i in t)n.set(i,t[i]);return n}function qn(){}En.prototype=Fn.prototype={constructor:En,has:function(t){return zn+t in this},get:function(t){return this[zn+t]},set:function(t,e){return this[zn+t]=e,this},remove:function(t){var e=zn+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===zn&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===zn&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===zn&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===zn&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===zn&&++t;return t},empty:function(){for(var t in this)if(t[0]===zn)return!1;return!0},each:function(t){for(var e in this)e[0]===zn&&t(this[e],e.slice(1),this)}};var Yn=Fn.prototype;qn.prototype=function(t,e){var n=new qn;if(t instanceof qn)t.each(function(t){n.add(t)});else if(t){var r=-1,a=t.length;if(null==e)for(;++r<a;)n.add(t[r]);else for(;++r<a;)n.add(e(t[r],r,t))}return n}.prototype={constructor:qn,has:Yn.has,add:function(t){return this[zn+(t+="")]=t,this},remove:Yn.remove,clear:Yn.clear,values:Yn.keys,size:Yn.size,empty:Yn.empty,each:Yn.each};var In={},Ln={},Hn=34,On=10,jn=13;function Rn(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}")}function Vn(f){var e=new RegExp('["'+f+"\n\r]"),d=f.charCodeAt(0);function n(r,t){var e,n=[],a=r.length,f=0,i=0,c=a<=0,o=!1;function u(){if(c)return Ln;if(o)return o=!1,In;var t,e,n=f;if(r.charCodeAt(n)===Hn){for(;f++<a&&r.charCodeAt(f)!==Hn||r.charCodeAt(++f)===Hn;);return(t=f)>=a?c=!0:(e=r.charCodeAt(f++))===On?o=!0:e===jn&&(o=!0,r.charCodeAt(f)===On&&++f),r.slice(n+1,t-1).replace(/""/g,'"')}for(;f<a;){if((e=r.charCodeAt(t=f++))===On)o=!0;else if(e===jn)o=!0,r.charCodeAt(f)===On&&++f;else if(e!==d)continue;return r.slice(n,t)}return c=!0,r.slice(n,a)}for(r.charCodeAt(a-1)===On&&--a,r.charCodeAt(a-1)===jn&&--a;(e=u())!==Ln;){for(var s=[];e!==In&&e!==Ln;)s.push(e),e=u();t&&null==(s=t(s,i++))||n.push(s)}return n}function r(t){return t.map(i).join(f)}function i(t){return null==t?"":e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,f){var i,c,e=n(t,function(t,e){if(i)return i(t,e-1);var n,r,a;c=t,i=f?(r=f,a=Rn(n=t),function(t,e){return r(a(t),e,n)}):Rn(t)});return e.columns=c||[],e},parseRows:n,format:function(t,n){var e,r,a;return null==n&&(e=t,r=Object.create(null),a=[],e.forEach(function(t){for(var e in t)e in r||a.push(r[e]=e)}),n=a),[n.map(i).join(f)].concat(t.map(function(e){return n.map(function(t){return i(e[t])}).join(f)})).join("\n")},formatRows:function(t){return t.map(r).join("\n")}}}Vn(","),Vn("\t");function Xn(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var a,f,i,c,o,u,s,d,l,h=t._root,b={data:r},p=t._x0,g=t._y0,y=t._x1,v=t._y1;if(!h)return t._root=b,t;for(;h.length;)if((u=e>=(f=(p+y)/2))?p=f:y=f,(s=n>=(i=(g+v)/2))?g=i:v=i,!(h=(a=h)[d=s<<1|u]))return a[d]=b,t;if(c=+t._x.call(null,h.data),o=+t._y.call(null,h.data),e===c&&n===o)return b.next=h,a?a[d]=b:t._root=b,t;for(;a=a?a[d]=new Array(4):t._root=new Array(4),(u=e>=(f=(p+y)/2))?p=f:y=f,(s=n>=(i=(g+v)/2))?g=i:v=i,(d=s<<1|u)==(l=(i<=o)<<1|f<=c););return a[l]=h,a[d]=b,t}function $n(t,e,n,r,a){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=a}function Zn(t){return t[0]}function Gn(t){return t[1]}function Bn(t,e,n,r,a,f){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=a,this._y1=f,this._root=void 0}function Qn(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var Wn=function(t,e,n){var r=new Bn(null==e?Zn:e,null==n?Gn:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}.prototype=Bn.prototype;Wn.copy=function(){var t,e,n=new Bn(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=Qn(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var a=0;a<4;++a)(e=r.source[a])&&(e.length?t.push({source:e,target:r.target[a]=new Array(4)}):r.target[a]=Qn(e));return n},Wn.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t);return Xn(this.cover(e,n),e,n,t)},Wn.addAll=function(t){var e,n,r,a,f=t.length,i=new Array(f),c=new Array(f),o=1/0,u=1/0,s=-1/0,d=-1/0;for(n=0;n<f;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(a=+this._y.call(null,e))||((i[n]=r)<o&&(o=r),s<r&&(s=r),(c[n]=a)<u&&(u=a),d<a&&(d=a));for(s<o&&(o=this._x0,s=this._x1),d<u&&(u=this._y0,d=this._y1),this.cover(o,u).cover(s,d),n=0;n<f;++n)Xn(this,i[n],c[n],t[n]);return this},Wn.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,a=this._x1,f=this._y1;if(isNaN(n))a=(n=Math.floor(t))+1,f=(r=Math.floor(e))+1;else{if(!(t<n||a<t||e<r||f<e))return this;var i,c,o=a-n,u=this._root;switch(c=(e<(r+f)/2)<<1|t<(n+a)/2){case 0:for(;(i=new Array(4))[c]=u,u=i,f=r+(o*=2),(a=n+o)<t||f<e;);break;case 1:for(;(i=new Array(4))[c]=u,u=i,f=r+(o*=2),t<(n=a-o)||f<e;);break;case 2:for(;(i=new Array(4))[c]=u,u=i,r=f-(o*=2),(a=n+o)<t||e<r;);break;case 3:for(;(i=new Array(4))[c]=u,u=i,r=f-(o*=2),t<(n=a-o)||e<r;);}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._x1=a,this._y1=f,this},Wn.data=function(){var e=[];return this.visit(function(t){if(!t.length)for(;e.push(t.data),t=t.next;);}),e},Wn.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Wn.find=function(t,e,n){var r,a,f,i,c,o,u,s=this._x0,d=this._y0,l=this._x1,h=this._y1,b=[],p=this._root;for(p&&b.push(new $n(p,s,d,l,h)),null==n?n=1/0:(s=t-n,d=e-n,l=t+n,h=e+n,n*=n);o=b.pop();)if(!(!(p=o.node)||(a=o.x0)>l||(f=o.y0)>h||(i=o.x1)<s||(c=o.y1)<d))if(p.length){var g=(a+i)/2,y=(f+c)/2;b.push(new $n(p[3],g,y,i,c),new $n(p[2],a,y,g,c),new $n(p[1],g,f,i,y),new $n(p[0],a,f,g,y)),(u=(y<=e)<<1|g<=t)&&(o=b[b.length-1],b[b.length-1]=b[b.length-1-u],b[b.length-1-u]=o)}else{var v=t-+this._x.call(null,p.data),m=e-+this._y.call(null,p.data),_=v*v+m*m;if(_<n){var w=Math.sqrt(n=_);s=t-w,d=e-w,l=t+w,h=e+w,r=p.data}}return r},Wn.remove=function(t){if(isNaN(f=+this._x.call(null,t))||isNaN(i=+this._y.call(null,t)))return this;var e,n,r,a,f,i,c,o,u,s,d,l,h=this._root,b=this._x0,p=this._y0,g=this._x1,y=this._y1;if(!h)return this;if(h.length)for(;;){if((u=f>=(c=(b+g)/2))?b=c:g=c,(s=i>=(o=(p+y)/2))?p=o:y=o,!(h=(e=h)[d=s<<1|u]))return this;if(!h.length)break;(e[d+1&3]||e[d+2&3]||e[d+3&3])&&(n=e,l=d)}for(;h.data!==t;)if(!(h=(r=h).next))return this;return(a=h.next)&&delete h.next,r?a?r.next=a:delete r.next:e?(a?e[d]=a:delete e[d],(h=e[0]||e[1]||e[2]||e[3])&&h===(e[3]||e[2]||e[1]||e[0])&&!h.length&&(n?n[l]=h:this._root=h)):this._root=a,this},Wn.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},Wn.root=function(){return this._root},Wn.size=function(){var e=0;return this.visit(function(t){if(!t.length)for(;++e,t=t.next;);}),e},Wn.visit=function(t){var e,n,r,a,f,i,c=[],o=this._root;for(o&&c.push(new $n(o,this._x0,this._y0,this._x1,this._y1));e=c.pop();)if(!t(o=e.node,r=e.x0,a=e.y0,f=e.x1,i=e.y1)&&o.length){var u=(r+f)/2,s=(a+i)/2;(n=o[3])&&c.push(new $n(n,u,s,f,i)),(n=o[2])&&c.push(new $n(n,r,s,u,i)),(n=o[1])&&c.push(new $n(n,u,a,f,s)),(n=o[0])&&c.push(new