@alter-eco/cartogram
Version:
A cartogram function used for building warped maps, made with D3
1 lines • 172 kB
JavaScript
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("perf_hooks")):"function"==typeof define&&define.amd?define(["perf_hooks"],n):t.Cartogram=n(t.perf_hooks)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var n="http://www.w3.org/1999/xhtml",e={svg:"http://www.w3.org/2000/svg",xhtml:n,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function r(t){var n=t+="",r=n.indexOf(":");return r>=0&&"xmlns"!==(n=t.slice(0,r))&&(t=t.slice(r+1)),e.hasOwnProperty(n)?{space:e[n],local:t}:t}function i(t){var e=r(t);return(e.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===n&&e.documentElement.namespaceURI===n?e.createElement(t):e.createElementNS(r,t)}})(e)}function o(){}function a(t){return null==t?o:function(){return this.querySelector(t)}}function u(){return[]}function c(t){return null==t?u:function(){return this.querySelectorAll(t)}}var f=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var s=document.documentElement;if(!s.matches){var l=s.webkitMatchesSelector||s.msMatchesSelector||s.mozMatchesSelector||s.oMatchesSelector;f=function(t){return function(){return l.call(this,t)}}}}var h=f;function p(t){return new Array(t.length)}function d(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}d.prototype={constructor:d,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 g="$";function v(t,n,e,r,i,o){for(var a,u=0,c=n.length,f=o.length;u<f;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new d(t,o[u]);for(;u<c;++u)(a=n[u])&&(i[u]=a)}function y(t,n,e,r,i,o,a){var u,c,f,s={},l=n.length,h=o.length,p=new Array(l);for(u=0;u<l;++u)(c=n[u])&&(p[u]=f=g+a.call(c,c.__data__,u,n),f in s?i[u]=c:s[f]=c);for(u=0;u<h;++u)(c=s[f=g+a.call(t,o[u],u,o)])?(r[u]=c,c.__data__=o[u],s[f]=null):e[u]=new d(t,o[u]);for(u=0;u<l;++u)(c=n[u])&&s[p[u]]===c&&(i[u]=c)}function m(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function b(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function w(t,n){return t.style.getPropertyValue(n)||b(t).getComputedStyle(t,null).getPropertyValue(n)}function _(t){return t.trim().split(/^|\s+/)}function x(t){return t.classList||new M(t)}function M(t){this._node=t,this._names=_(t.getAttribute("class")||"")}function E(t,n){for(var e=x(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function A(t,n){for(var e=x(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function S(){this.textContent=""}function T(){this.innerHTML=""}function C(){this.nextSibling&&this.parentNode.appendChild(this)}function k(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function N(){return null}function P(){var t=this.parentNode;t&&t.removeChild(this)}function O(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function U(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}M.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 j={},D=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(j={mouseenter:"mouseover",mouseleave:"mouseout"}));function L(t,n,e){return t=R(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function R(t,n,e){return function(r){var i=D;D=r;try{t.call(this,this.__data__,n,e)}finally{D=i}}}function I(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 B(t,n,e){var r=j.hasOwnProperty(t.type)?L:R;return function(i,o,a){var u,c=this.__on,f=r(n,o,a);if(c)for(var s=0,l=c.length;s<l;++s)if((u=c[s]).type===t.type&&u.name===t.name)return this.removeEventListener(u.type,u.listener,u.capture),this.addEventListener(u.type,u.listener=f,u.capture=e),void(u.value=n);this.addEventListener(t.type,f,e),u={type:t.type,name:t.name,value:n,listener:f,capture:e},c?c.push(u):this.__on=[u]}}function Y(t,n,e){var r=b(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)}var q=[null];function F(t,n){this._groups=t,this._parents=n}function z(){return new F([[document.documentElement]],q)}function H(t){return"string"==typeof t?new F([[document.querySelector(t)]],[document.documentElement]):new F([[t]],q)}function $(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}F.prototype=z.prototype={constructor:F,select:function(t){"function"!=typeof t&&(t=a(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u,c=n[i],f=c.length,s=r[i]=new Array(f),l=0;l<f;++l)(o=c[l])&&(u=t.call(o,o.__data__,l,c))&&("__data__"in o&&(u.__data__=o.__data__),s[l]=u);return new F(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=c(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],f=u.length,s=0;s<f;++s)(a=u[s])&&(r.push(t.call(a,a.__data__,s,u)),i.push(a));return new F(r,i)},filter:function(t){"function"!=typeof t&&(t=h(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,c=r[i]=[],f=0;f<u;++f)(o=a[f])&&t.call(o,o.__data__,f,a)&&c.push(o);return new F(r,this._parents)},data:function(t,n){if(!t)return d=new Array(this.size()),s=-1,this.each(function(t){d[++s]=t}),d;var e,r=n?y:v,i=this._parents,o=this._groups;"function"!=typeof t&&(e=t,t=function(){return e});for(var a=o.length,u=new Array(a),c=new Array(a),f=new Array(a),s=0;s<a;++s){var l=i[s],h=o[s],p=h.length,d=t.call(l,l&&l.__data__,s,i),g=d.length,m=c[s]=new Array(g),b=u[s]=new Array(g);r(l,h,m,b,f[s]=new Array(p),d,n);for(var w,_,x=0,M=0;x<g;++x)if(w=m[x]){for(x>=M&&(M=x+1);!(_=b[M])&&++M<g;);w._next=_||null}}return(u=new F(u,i))._enter=c,u._exit=f,u},enter:function(){return new F(this._enter||this._groups.map(p),this._parents)},exit:function(){return new F(this._exit||this._groups.map(p),this._parents)},merge:function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var c,f=n[u],s=e[u],l=f.length,h=a[u]=new Array(l),p=0;p<l;++p)(c=f[p]||s[p])&&(h[p]=c);for(;u<r;++u)a[u]=n[u];return new F(a,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,a=i[o];--o>=0;)(r=i[o])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=m);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],c=u.length,f=i[o]=new Array(c),s=0;s<c;++s)(a=u[s])&&(f[s]=a);f.sort(n)}return new F(i,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 a=r[i];if(a)return a}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],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=r(t);if(arguments.length<2){var i=this.node();return e.local?i.getAttributeNS(e.space,e.local):i.getAttribute(e)}return this.each((null==n?e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof n?e.local?function(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(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}:e.local?function(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}:function(t,n){return function(){this.setAttribute(t,n)}})(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof n?function(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}:function(t,n,e){return function(){this.style.setProperty(t,n,e)}})(t,n,null==e?"":e)):w(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?function(t){return function(){delete this[t]}}:"function"==typeof n?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(t,n){return function(){this[t]=n}})(t,n)):this.node()[t]},classed:function(t,n){var e=_(t+"");if(arguments.length<2){for(var r=x(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?function(t,n){return function(){(n.apply(this,arguments)?E:A)(this,t)}}:n?function(t){return function(){E(this,t)}}:function(t){return function(){A(this,t)}})(e,n))},text:function(t){return arguments.length?this.each(null==t?S:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?T:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(C)},lower:function(){return this.each(k)},append:function(t){var n="function"==typeof t?t:i(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},insert:function(t,n){var e="function"==typeof t?t:i(t),r=null==n?N:"function"==typeof n?n:a(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(P)},clone:function(t){return this.select(t?U:O)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(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}})}(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?B:I,null==e&&(e=!1),r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var c,f=0,s=u.length;f<s;++f)for(r=0,c=u[f];r<a;++r)if((i=o[r]).type===c.type&&i.name===c.name)return c.value},dispatch:function(t,n){return this.each(("function"==typeof n?function(t,n){return function(){return Y(this,t,n.apply(this,arguments))}}:function(t,n){return function(){return Y(this,t,n)}})(t,n))}};var X=function(t){var n;return 1===t.length&&(n=t,t=function(t,e){return $(n(t),e)}),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var o=r+i>>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var o=r+i>>>1;t(n[o],e)>0?i=o:r=o+1}return r}}}($).right,V=Math.sqrt(50),W=Math.sqrt(10),Z=Math.sqrt(2);function G(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=V?10:o>=W?5:o>=Z?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=V?10:o>=W?5:o>=Z?2:1)}function K(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o<i;)if(null!=(e=t[o])&&e>=e)for(r=e;++o<i;)null!=(e=t[o])&&e>r&&(r=e)}else for(;++o<i;)if(null!=(e=n(t[o],o,t))&&e>=e)for(r=e;++o<i;)null!=(e=n(t[o],o,t))&&e>r&&(r=e);return r}function J(t){for(var n,e,r,i=t.length,o=-1,a=0;++o<i;)a+=t[o].length;for(e=new Array(a);--i>=0;)for(n=(r=t[i]).length;--n>=0;)e[--a]=r[n];return e}function Q(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o<i;)if(null!=(e=t[o])&&e>=e)for(r=e;++o<i;)null!=(e=t[o])&&r>e&&(r=e)}else for(;++o<i;)if(null!=(e=n(t[o],o,t))&&e>=e)for(r=e;++o<i;)null!=(e=n(t[o],o,t))&&r>e&&(r=e);return r}function tt(t,n){var e,r=t.length,i=-1,o=0;if(null==n)for(;++i<r;)(e=+t[i])&&(o+=e);else for(;++i<r;)(e=+n(t[i],i,t))&&(o+=e);return o}function nt(){}function et(t,n){var e=new nt;if(t instanceof nt)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 a in t)e.set(a,t[a]);return e}function rt(){}nt.prototype=et.prototype={constructor:nt,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 it=et.prototype;rt.prototype=function(t,n){var e=new rt;if(t instanceof rt)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:rt,has:it.has,add:function(t){return this["$"+(t+="")]=t,this},remove:it.remove,clear:it.clear,values:it.keys,size:it.size,empty:it.empty,each:it.each};var ot=Array.prototype,at=ot.map,ut=ot.slice,ct={name:"implicit"};function ft(t){var n=et(),e=[],r=ct;function i(i){var o=i+"",a=n.get(o);if(!a){if(r!==ct)return r;n.set(o,a=e.push(i))}return t[(a-1)%t.length]}return t=null==t?[]:ut.call(t),i.domain=function(t){if(!arguments.length)return e.slice();e=[],n=et();for(var r,o,a=-1,u=t.length;++a<u;)n.has(o=(r=t[a])+"")||n.set(o,e.push(r));return i},i.range=function(n){return arguments.length?(t=ut.call(n),i):t.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return ft().domain(e).range(t).unknown(r)},i}function st(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function lt(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function ht(){}var pt="\\s*([+-]?\\d+)\\s*",dt="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",gt="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vt=/^#([0-9a-f]{3})$/,yt=/^#([0-9a-f]{6})$/,mt=new RegExp("^rgb\\("+[pt,pt,pt]+"\\)$"),bt=new RegExp("^rgb\\("+[gt,gt,gt]+"\\)$"),wt=new RegExp("^rgba\\("+[pt,pt,pt,dt]+"\\)$"),_t=new RegExp("^rgba\\("+[gt,gt,gt,dt]+"\\)$"),xt=new RegExp("^hsl\\("+[dt,gt,gt]+"\\)$"),Mt=new RegExp("^hsla\\("+[dt,gt,gt,dt]+"\\)$"),Et={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 At(t){var n;return t=(t+"").trim().toLowerCase(),(n=vt.exec(t))?new Nt((n=parseInt(n[1],16))>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):(n=yt.exec(t))?St(parseInt(n[1],16)):(n=mt.exec(t))?new Nt(n[1],n[2],n[3],1):(n=bt.exec(t))?new Nt(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=wt.exec(t))?Tt(n[1],n[2],n[3],n[4]):(n=_t.exec(t))?Tt(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=xt.exec(t))?Pt(n[1],n[2]/100,n[3]/100,1):(n=Mt.exec(t))?Pt(n[1],n[2]/100,n[3]/100,n[4]):Et.hasOwnProperty(t)?St(Et[t]):"transparent"===t?new Nt(NaN,NaN,NaN,0):null}function St(t){return new Nt(t>>16&255,t>>8&255,255&t,1)}function Tt(t,n,e,r){return r<=0&&(t=n=e=NaN),new Nt(t,n,e,r)}function Ct(t){return t instanceof ht||(t=At(t)),t?new Nt((t=t.rgb()).r,t.g,t.b,t.opacity):new Nt}function kt(t,n,e,r){return 1===arguments.length?Ct(t):new Nt(t,n,e,null==r?1:r)}function Nt(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Pt(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Ot(t,n,e,r)}function Ot(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Ut(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}st(ht,At,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),st(Nt,kt,lt(ht,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Nt(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Nt(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+")")}})),st(Ot,function(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Ot)return new Ot(t.h,t.s,t.l,t.opacity);if(t instanceof ht||(t=At(t)),!t)return new Ot;if(t instanceof Ot)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,c=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e<r):e===o?(r-n)/u+2:(n-e)/u+4,u/=c<.5?o+i:2-o-i,a*=60):u=c>0&&c<1?0:a,new Ot(a,u,c,t.opacity)}(t):new Ot(t,n,e,null==r?1:r)},lt(ht,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Ot(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Ot(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Nt(Ut(t>=240?t-240:t+120,i,r),Ut(t,i,r),Ut(t<120?t+240:t-120,i,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 jt=Math.PI/180,Dt=180/Math.PI,Lt=.95047,Rt=1,It=1.08883,Bt=4/29,Yt=6/29,qt=3*Yt*Yt,Ft=Yt*Yt*Yt;function zt(t){if(t instanceof Ht)return new Ht(t.l,t.a,t.b,t.opacity);if(t instanceof Zt){var n=t.h*jt;return new Ht(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof Nt||(t=Ct(t));var e=Wt(t.r),r=Wt(t.g),i=Wt(t.b),o=$t((.4124564*e+.3575761*r+.1804375*i)/Lt),a=$t((.2126729*e+.7151522*r+.072175*i)/Rt);return new Ht(116*a-16,500*(o-a),200*(a-$t((.0193339*e+.119192*r+.9503041*i)/It)),t.opacity)}function Ht(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function $t(t){return t>Ft?Math.pow(t,1/3):t/qt+Bt}function Xt(t){return t>Yt?t*t*t:qt*(t-Bt)}function Vt(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Wt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Zt(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}st(Ht,function(t,n,e,r){return 1===arguments.length?zt(t):new Ht(t,n,e,null==r?1:r)},lt(ht,{brighter:function(t){return new Ht(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new Ht(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return t=Rt*Xt(t),new Nt(Vt(3.2404542*(n=Lt*Xt(n))-1.5371385*t-.4985314*(e=It*Xt(e))),Vt(-.969266*n+1.8760108*t+.041556*e),Vt(.0556434*n-.2040259*t+1.0572252*e),this.opacity)}})),st(Zt,function(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Zt)return new Zt(t.h,t.c,t.l,t.opacity);t instanceof Ht||(t=zt(t));var n=Math.atan2(t.b,t.a)*Dt;return new Zt(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new Zt(t,n,e,null==r?1:r)},lt(ht,{brighter:function(t){return new Zt(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new Zt(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return zt(this).rgb()}}));var Gt=-.14861,Kt=1.78277,Jt=-.29227,Qt=-.90649,tn=1.97294,nn=tn*Qt,en=tn*Kt,rn=Kt*Jt-Qt*Gt;function on(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof an)return new an(t.h,t.s,t.l,t.opacity);t instanceof Nt||(t=Ct(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(rn*r+nn*n-en*e)/(rn+nn-en),o=r-i,a=(tn*(e-i)-Jt*o)/Qt,u=Math.sqrt(a*a+o*o)/(tn*i*(1-i)),c=u?Math.atan2(a,o)*Dt-120:NaN;return new an(c<0?c+360:c,u,i,t.opacity)}(t):new an(t,n,e,null==r?1:r)}function an(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function un(t){return function(){return t}}function cn(t,n){return function(e){return t+e*n}}function fn(t){return 1==(t=+t)?sn:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):un(isNaN(n)?e:n)}}function sn(t,n){var e=n-t;return e?cn(t,e):un(isNaN(t)?n:t)}st(an,on,lt(ht,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new an(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new an(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*jt,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new Nt(255*(n+e*(Gt*r+Kt*i)),255*(n+e*(Jt*r+Qt*i)),255*(n+e*(tn*r)),this.opacity)}}));var ln=function t(n){var e=fn(n);function r(t,n){var r=e((t=kt(t)).r,(n=kt(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=sn(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function hn(t,n){return n-=t=+t,function(e){return t+n*e}}var pn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,dn=new RegExp(pn.source,"g");function gn(t,n){var e,r,i,o=pn.lastIndex=dn.lastIndex=0,a=-1,u=[],c=[];for(t+="",n+="";(e=pn.exec(t))&&(r=dn.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:hn(e,r)})),o=dn.lastIndex;return o<n.length&&(i=n.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?c[0]?function(t){return function(n){return t(n)+""}}(c[0].x):function(t){return function(){return t}}(n):(n=c.length,function(t){for(var e,r=0;r<n;++r)u[(e=c[r]).i]=e.x(t);return u.join("")})}function vn(t,n){var e,r=typeof n;return null==n||"boolean"===r?un(n):("number"===r?hn:"string"===r?(e=At(n))?(n=e,ln):gn:n instanceof At?ln:n instanceof Date?function(t,n){var e=new Date;return n-=t=+t,function(r){return e.setTime(t+n*r),e}}:Array.isArray(n)?function(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(e=0;e<i;++e)o[e]=vn(t[e],n[e]);for(;e<r;++e)a[e]=n[e];return function(t){for(e=0;e<i;++e)a[e]=o[e](t);return a}}:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?function(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=vn(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}:hn)(t,n)}function yn(t,n){return n-=t=+t,function(e){return Math.round(t+n*e)}}var mn,bn,wn,_n,xn=180/Math.PI,Mn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function En(t,n,e,r,i,o){var a,u,c;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(c=t*e+n*r)&&(e-=t*c,r-=n*c),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,c/=u),t*r<n*e&&(t=-t,n=-n,c=-c,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*xn,skewX:Math.atan(c)*xn,scaleX:a,scaleY:u}}function An(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],c=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var c=a.push("translate(",null,n,null,e);u.push({i:c-4,x:hn(t,i)},{i:c-2,x:hn(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,u,c),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:hn(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,c),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:hn(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,c),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:hn(t,e)},{i:u-2,x:hn(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,c),o=a=null,function(t){for(var n,e=-1,r=c.length;++e<r;)u[(n=c[e]).i]=n.x(t);return u.join("")}}}var Sn=An(function(t){return"none"===t?Mn:(mn||(mn=document.createElement("DIV"),bn=document.documentElement,wn=document.defaultView),mn.style.transform=t,t=wn.getComputedStyle(bn.appendChild(mn),null).getPropertyValue("transform"),bn.removeChild(mn),En(+(t=t.slice(7,-1).split(","))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),Tn=An(function(t){return null==t?Mn:(_n||(_n=document.createElementNS("http://www.w3.org/2000/svg","g")),_n.setAttribute("transform",t),(t=_n.transform.baseVal.consolidate())?En((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Mn)},", ",")",")");Math.SQRT2;function Cn(t){return function n(e){function r(n,r){var i=t((n=on(n)).h,(r=on(r)).h),o=sn(n.s,r.s),a=sn(n.l,r.l),u=sn(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=u(t),n+""}}return e=+e,r.gamma=n,r}(1)}Cn(function(t,n){var e=n-t;return e?cn(t,e>180||e<-180?e-360*Math.round(e/360):e):un(isNaN(t)?n:t)});var kn=Cn(sn);function Nn(t){return+t}var Pn,On=[0,1];function Un(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:(e=n,function(){return e});var e}function jn(t,n,e,r){var i=t[0],o=t[1],a=n[0],u=n[1];return o<i?(i=e(o,i),a=r(u,a)):(i=e(i,o),a=r(a,u)),function(t){return a(i(t))}}function Dn(t,n,e,r){var i=Math.min(t.length,n.length)-1,o=new Array(i),a=new Array(i),u=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++u<i;)o[u]=e(t[u],t[u+1]),a[u]=r(n[u],n[u+1]);return function(n){var e=X(t,n,1,i)-1;return a[e](o[e](n))}}function Ln(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function Rn(t){return(t=Ln(Math.abs(t)))?t[1]:NaN}function In(t,n){var e=Ln(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}var Bn={"":function(t,n){t=t.toPrecision(n);t:for(var e,r=t.length,i=1,o=-1;i<r;++i)switch(t[i]){case".":o=e=i;break;case"0":0===o&&(o=i),e=i;break;case"e":break t;default:o>0&&(o=0)}return o>0?t.slice(0,o)+t.slice(e+1):t},"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return In(100*t,n)},r:In,s:function(t,n){var e=Ln(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(Pn=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Ln(t,Math.max(0,n+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},Yn=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;function qn(t){return new Fn(t)}function Fn(t){if(!(n=Yn.exec(t)))throw new Error("invalid format: "+t);var n,e=n[1]||" ",r=n[2]||">",i=n[3]||"-",o=n[4]||"",a=!!n[5],u=n[6]&&+n[6],c=!!n[7],f=n[8]&&+n[8].slice(1),s=n[9]||"";"n"===s?(c=!0,s="g"):Bn[s]||(s=""),(a||"0"===e&&"="===r)&&(a=!0,e="0",r="="),this.fill=e,this.align=r,this.sign=i,this.symbol=o,this.zero=a,this.width=u,this.comma=c,this.precision=f,this.type=s}function zn(t){return t}qn.prototype=Fn.prototype,Fn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var Hn,$n,Xn,Vn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Wn(t){var n,e,r=t.grouping&&t.thousands?(n=t.grouping,e=t.thousands,function(t,r){for(var i=t.length,o=[],a=0,u=n[0],c=0;i>0&&u>0&&(c+u+1>r&&(u=Math.max(1,r-c)),o.push(t.substring(i-=u,i+u)),!((c+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}):zn,i=t.currency,o=t.decimal,a=t.numerals?function(t){return function(n){return n.replace(/[0-9]/g,function(n){return t[+n]})}}(t.numerals):zn,u=t.percent||"%";function c(t){var n=(t=qn(t)).fill,e=t.align,c=t.sign,f=t.symbol,s=t.zero,l=t.width,h=t.comma,p=t.precision,d=t.type,g="$"===f?i[0]:"#"===f&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",v="$"===f?i[1]:/[%p]/.test(d)?u:"",y=Bn[d],m=!d||/[defgprs%]/.test(d);function b(t){var i,u,f,b=g,w=v;if("c"===d)w=y(t)+w,t="";else{var _=(t=+t)<0;if(t=y(Math.abs(t),p),_&&0==+t&&(_=!1),b=(_?"("===c?c:"-":"-"===c||"("===c?"":c)+b,w=("s"===d?Vn[8+Pn/3]:"")+w+(_&&"("===c?")":""),m)for(i=-1,u=t.length;++i<u;)if(48>(f=t.charCodeAt(i))||f>57){w=(46===f?o+t.slice(i+1):t.slice(i))+w,t=t.slice(0,i);break}}h&&!s&&(t=r(t,1/0));var x=b.length+t.length+w.length,M=x<l?new Array(l-x+1).join(n):"";switch(h&&s&&(t=r(M+t,M.length?l-w.length:1/0),M=""),e){case"<":t=b+t+w+M;break;case"=":t=b+M+t+w;break;case"^":t=M.slice(0,x=M.length>>1)+b+t+w+M.slice(x);break;default:t=M+b+t+w}return a(t)}return p=null==p?d?6:12:/[gprs]/.test(d)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p)),b.toString=function(){return t+""},b}return{format:c,formatPrefix:function(t,n){var e=c(((t=qn(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Rn(n)/3))),i=Math.pow(10,-r),o=Vn[8+r/3];return function(t){return e(i*t)+o}}}}function Zn(t,n,e){var r,i=t[0],o=t[t.length-1],a=function(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=V?i*=10:o>=W?i*=5:o>=Z&&(i*=2),n<t?-i:i}(i,o,null==n?10:n);switch((e=qn(null==e?",f":e)).type){case"s":var u=Math.max(Math.abs(i),Math.abs(o));return null!=e.precision||isNaN(r=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Rn(n)/3)))-Rn(Math.abs(t)))}(a,u))||(e.precision=r),Xn(e,u);case"":case"e":case"g":case"p":case"r":null!=e.precision||isNaN(r=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Rn(n)-Rn(t))+1}(a,Math.max(Math.abs(i),Math.abs(o))))||(e.precision=r-("e"===e.type));break;case"f":case"%":null!=e.precision||isNaN(r=function(t){return Math.max(0,-Rn(Math.abs(t)))}(a))||(e.precision=r-2*("%"===e.type))}return $n(e)}function Gn(t){var n=t.domain;return t.ticks=function(t){var e=n();return function(t,n,e){var r,i,o,a,u=-1;if(e=+e,(t=+t)==(n=+n)&&e>0)return[t];if((r=n<t)&&(i=t,t=n,n=i),0===(a=G(t,n,e))||!isFinite(a))return[];if(a>0)for(t=Math.ceil(t/a),n=Math.floor(n/a),o=new Array(i=Math.ceil(n-t+1));++u<i;)o[u]=(t+u)*a;else for(t=Math.floor(t*a),n=Math.ceil(n*a),o=new Array(i=Math.ceil(t-n+1));++u<i;)o[u]=(t-u)/a;return r&&o.reverse(),o}(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){return Zn(n(),t,e)},t.nice=function(e){null==e&&(e=10);var r,i=n(),o=0,a=i.length-1,u=i[o],c=i[a];return c<u&&(r=u,u=c,c=r,r=o,o=a,a=r),(r=G(u,c,e))>0?r=G(u=Math.floor(u/r)*r,c=Math.ceil(c/r)*r,e):r<0&&(r=G(u=Math.ceil(u*r)/r,c=Math.floor(c*r)/r,e)),r>0?(i[o]=Math.floor(u/r)*r,i[a]=Math.ceil(c/r)*r,n(i)):r<0&&(i[o]=Math.ceil(u*r)/r,i[a]=Math.floor(c*r)/r,n(i)),t},t}function Kn(){var t=function(t,n){var e,r,i,o=On,a=On,u=vn,c=!1;function f(){return e=Math.min(o.length,a.length)>2?Dn:jn,r=i=null,s}function s(n){return(r||(r=e(o,a,c?function(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=n?0:t>=e?1:r(t)}}}(t):t,u)))(+n)}return s.invert=function(t){return(i||(i=e(a,o,Un,c?function(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=0?n:t>=1?e:r(t)}}}(n):n)))(+t)},s.domain=function(t){return arguments.length?(o=at.call(t,Nn),f()):o.slice()},s.range=function(t){return arguments.length?(a=ut.call(t),f()):a.slice()},s.rangeRound=function(t){return a=ut.call(t),u=yn,f()},s.clamp=function(t){return arguments.length?(c=!!t,f()):c},s.interpolate=function(t){return arguments.length?(u=t,f()):u},f()}(Un,hn);return t.copy=function(){return n=t,Kn().domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp());var n},Gn(t)}Hn=Wn({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),$n=Hn.format,Xn=Hn.formatPrefix;var Jn=new Date,Qn=new Date;function te(t,n,e,r){function i(n){return t(n=new Date(+n)),n}return i.floor=i,i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,r,o){var a,u=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return u;do{u.push(a=new Date(+e)),n(e,o),t(e)}while(a<e&&e<r);return u},i.filter=function(e){return te(function(n){if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)},function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})},e&&(i.count=function(n,r){return Jn.setTime(+n),Qn.setTime(+r),t(Jn),t(Qn),Math.floor(e(Jn,Qn))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}var ne=te(function(){},function(t,n){t.setTime(+t+n)},function(t,n){return n-t});ne.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?te(function(n){n.setTime(Math.floor(n/t)*t)},function(n,e){n.setTime(+n+e*t)},function(n,e){return(e-n)/t}):ne:null};var ee=6e4,re=6048e5,ie=(te(function(t){t.setTime(1e3*Math.floor(t/1e3))},function(t,n){t.setTime(+t+1e3*n)},function(t,n){return(n-t)/1e3},function(t){return t.getUTCSeconds()}),te(function(t){t.setTime(Math.floor(t/ee)*ee)},function(t,n){t.setTime(+t+n*ee)},function(t,n){return(n-t)/ee},function(t){return t.getMinutes()}),te(function(t){var n=t.getTimezoneOffset()*ee%36e5;n<0&&(n+=36e5),t.setTime(36e5*Math.floor((+t-n)/36e5)+n)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getHours()}),te(function(t){t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*ee)/864e5},function(t){return t.getDate()-1}));function oe(t){return te(function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+7*n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*ee)/re})}var ae=oe(0),ue=oe(1),ce=(oe(2),oe(3),oe(4)),fe=(oe(5),oe(6),te(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,n){t.setMonth(t.getMonth()+n)},function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())},function(t){return t.getMonth()}),te(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t,n){return n.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()}));fe.every=function(t){return isFinite(t=Math.floor(t))&&t>0?te(function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)},function(n,e){n.setFullYear(n.getFullYear()+e*t)}):null};te(function(t){t.setUTCSeconds(0,0)},function(t,n){t.setTime(+t+n*ee)},function(t,n){return(n-t)/ee},function(t){return t.getUTCMinutes()}),te(function(t){t.setUTCMinutes(0,0,0)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getUTCHours()});var se=te(function(t){t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n)},function(t,n){return(n-t)/864e5},function(t){return t.getUTCDate()-1});function le(t){return te(function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+7*n)},function(t,n){return(n-t)/re})}var he=le(0),pe=le(1),de=(le(2),le(3),le(4)),ge=(le(5),le(6),te(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCMonth(t.getUTCMonth()+n)},function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()}),te(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)},function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()}));function ve(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function ye(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function me(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}ge.every=function(t){return isFinite(t=Math.floor(t))&&t>0?te(function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)}):null};var be,we,_e,xe={"-":"",_:" ",0:"0"},Me=/^\s*\d+/,Ee=/^%/,Ae=/[\\^$*+?|[\]().{}]/g;function Se(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function Te(t){return t.replace(Ae,"\\$&")}function Ce(t){return new RegExp("^(?:"+t.map(Te).join("|")+")","i")}function ke(t){for(var n={},e=-1,r=t.length;++e<r;)n[t[e].toLowerCase()]=e;return n}function Ne(t,n,e){var r=Me.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function Pe(t,n,e){var r=Me.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function Oe(t,n,e){var r=Me.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function Ue(t,n,e){var r=Me.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function je(t,n,e){var r=Me.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function De(t,n,e){var r=Me.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function Le(t,n,e){var r=Me.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function Re(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function Ie(t,n,e){var r=Me.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function Be(t,n,e){var r=Me.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function Ye(t,n,e){var r=Me.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function qe(t,n,e){var r=Me.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function Fe(t,n,e){var r=Me.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function ze(t,n,e){var r=Me.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function He(t,n,e){var r=Me.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function $e(t,n,e){var r=Me.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function Xe(t,n,e){var r=Ee.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function Ve(t,n,e){var r=Me.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function We(t,n,e){var r=Me.exec(n.slice(e));return r?(t.Q=1e3*+r[0],e+r[0].length):-1}function Ze(t,n){return Se(t.getDate(),n,2)}function Ge(t,n){return Se(t.getHours(),n,2)}function Ke(t,n){return Se(t.getHours()%12||12,n,2)}function Je(t,n){return Se(1+ie.count(fe(t),t),n,3)}function Qe(t,n){return Se(t.getMilliseconds(),n,3)}function tr(t,n){return Qe(t,n)+"000"}function nr(t,n){return Se(t.getMonth()+1,n,2)}function er(t,n){return Se(t.getMinutes(),n,2)}function rr(t,n){return Se(t.getSeconds(),n,2)}function ir(t){var n=t.getDay();return 0===n?7:n}function or(t,n){return Se(ae.count(fe(t),t),n,2)}function ar(t,n){var e=t.getDay();return t=e>=4||0===e?ce(t):ce.ceil(t),Se(ce.count(fe(t),t)+(4===fe(t).getDay()),n,2)}function ur(t){return t.getDay()}function cr(t,n){return Se(ue.count(fe(t),t),n,2)}function fr(t,n){return Se(t.getFullYear()%100,n,2)}function sr(t,n){return Se(t.getFullYear()%1e4,n,4)}function lr(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Se(n/60|0,"0",2)+Se(n%60,"0",2)}function hr(t,n){return Se(t.getUTCDate(),n,2)}function pr(t,n){return Se(t.getUTCHours(),n,2)}function dr(t,n){return Se(t.getUTCHours()%12||12,n,2)}function gr(t,n){return Se(1+se.count(ge(t),t),n,3)}function vr(t,n){return Se(t.getUTCMilliseconds(),n,3)}function yr(t,n){return vr(t,n)+"000"}function mr(t,n){return Se(t.getUTCMonth()+1,n,2)}function br(t,n){return Se(t.getUTCMinutes(),n,2)}function wr(t,n){return Se(t.getUTCSeconds(),n,2)}function _r(t){var n=t.getUTCDay();return 0===n?7:n}function xr(t,n){return Se(he.count(ge(t),t),n,2)}function Mr(t,n){var e=t.getUTCDay();return t=e>=4||0===e?de(t):de.ceil(t),Se(de.count(ge(t),t)+(4===ge(t).getUTCDay()),n,2)}function Er(t){return t.getUTCDay()}function Ar(t,n){return Se(pe.count(ge(t),t),n,2)}function Sr(t,n){return Se(t.getUTCFullYear()%100,n,2)}function Tr(t,n){return Se(t.getUTCFullYear()%1e4,n,4)}function Cr(){return"+0000"}function kr(){return"%"}function Nr(t){return+t}function Pr(t){return Math.floor(+t/1e3)}!function(t){be=function(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,c=t.shortMonths,f=Ce(i),s=ke(i),l=Ce(o),h=ke(o),p=Ce(a),d=ke(a),g=Ce(u),v=ke(u),y=Ce(c),m=ke(c),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:Ze,e:Ze,f:tr,H:Ge,I:Ke,j:Je,L:Qe,m:nr,M:er,p:function(t){return i[+(t.getHours()>=12)]},Q:Nr,s:Pr,S:rr,u:ir,U:or,V:ar,w:ur,W:cr,x:null,X:null,y:fr,Y:sr,Z:lr,"%":kr},w={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:hr,e:hr,f:yr,H:pr,I:dr,j:gr,L:vr,m:mr,M:br,p:function(t){return i[+(t.getUTCHours()>=12)]},Q:Nr,s:Pr,S:wr,u:_r,U:xr,V:Mr,w:Er,W:Ar,x:null,X:null,y:Sr,Y:Tr,Z:Cr,"%":kr},_={a:function(t,n,e){var r=p.exec(n.slice(e));return r?(t.w=d[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.w=h[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=y.exec(n.slice(e));return r?(t.m=m[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=g.exec(n.slice(e));return r?(t.m=v[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return E(t,n,e,r)},d:Be,e:Be,f:$e,H:qe,I:qe,j:Ye,L:He,m:Ie,M:Fe,p:function(t,n,e){var r=f.exec(n.slice(e));return r?(t.p=s[r[0].toLowerCase()],e+r[0].length):-1},Q:Ve,s:We,S:ze,u:Pe,U:Oe,V:Ue,w:Ne,W:je,x:function(t,n,r){return E(t,e,n,r)},X:function(t,n,e){return E(t,r,n,e)},y:Le,Y:De,Z:Re,"%":Xe};function x(t,n){return function(e){var r,i,o,a=[],u=-1,c=0,f=t.length;for(e instanceof Date||(e=new Date(+e));++u<f;)37===t.charCodeAt(u)&&(a.push(t.slice(c,u)),null!=(i=xe[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),a.push(r),c=u+1);return a.push(t.slice(c,u)),a.join("")}}function M(t,n){return function(e){var r,i,o=me(1900);if(E(o,t,e+="",0)!=e.length)return null;if("Q"in o)return new Date(o.Q);if("p"in o&&(o.H=o.H%12+12*o.p),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(r=(i=(r=ye(me(o.y))).getUTCDay())>4||0===i?pe.ceil(r):pe(r),r=se.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(r=(i=(r=n(me(o.y))).getDay())>4||0===i?ue.ceil(r):ue(r),r=ie.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?ye(me(o.y)).getUTCDay():n(me(o.y)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,ye(o)):n(o)}}function E(t,n,e,r){for(var i,o,a=0,u=n.length,c=e.length;a<u;){if(r>=c)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=_[i in xe?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return b.x=x(e,b),b.X=x(r,b),b.c=x(n,b),w.x=x(e,w),w.X=x(r,w),w.c=x(n,w),{format:function(t){var n=x(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=M(t+="",ve);return n.toString=function(){return t},n},utcFormat:function(t){var n=x(t+="",w);return n.toString=function(){return t},n},utcParse:function(t){var n=M(t,ye);return n.toString=function(){return t},n}}}(t),be.format,be.parse,we=be.utcFormat,_e=be.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});Date.prototype.toISOString||we("%Y-%m-%dT%H:%M:%S.%LZ");+new Date("2000-01-01T00:00:00.000Z")||_e("%Y-%m-%dT%H:%M:%S.%LZ");function Or(){return new Ur}function Ur(){this.reset()}Ur.prototype={constructor:Ur,reset:function(){this.s=this.t=0},add:function(t){Dr(jr,t,this.t),Dr(this,jr.s,this.s),this.s?this.t+=jr.t:this.s=jr.t},valueOf:function(){return this.s}};var jr=new Ur;function Dr(t,n,e){var r=t.s=n+e,i=r-n,o=r-i;t.t=n-o+(e-i)}var Lr=1e-6,Rr=Math.PI,Ir=Rr/2,Br=Rr/4,Yr=2*Rr,qr=180/Rr,Fr=Rr/180,zr=Math.abs,Hr=Math.atan,$r=Math.atan2,Xr=Math.cos,Vr=Math.exp,Wr=Math.log,Zr=Math.pow,Gr=Math.sin,Kr=Math.sign||function(t){return t>0?1:t<0?-1:0},Jr=Math.sqrt,Qr=Math.tan;function ti(t){return t>1?Ir:t<-1?-Ir:Math.asin(t)}function ni(){}function ei(t,n){t&&ii.hasOwnProperty(t.type)&&ii[t.type](t,n)}var ri={Feature:function(t,n){ei(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)ei(e[r].geometry,n)}},ii={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){oi(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)oi(e[r],n,0)},Polygon:function(t,n){ai(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)ai(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)ei(e[r],n)}};function oi(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function ai(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)oi(t[e],n,1);n.polygonEnd()}function ui(t,n){t&&ri.hasOwnProperty(t.type)?ri[t.type](t,n):ei(t,n)}Or(),Or();function ci(t){return[$r(t[1],t[0]),ti(t[2])]}function fi(t){var n=t[0],e=t[1],r=Xr(e);return[r*Xr(n),r*Gr(n),Gr(e)]}function si(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function li(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function hi(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function pi(t,n){return[t[