Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support for Sizzle.

D3 now supports Sizzle, preferring Sizzle to the native Selectors API if Sizzle
is available. Sizzle internally uses the native Selectors API and thus this
should have minimal performance implications; also, it allows you to use Sizzle
proprietary extensions such as ":first".

This commit also restricts the definition of the enter selection so that only
append and insert operations are defined. The other operations were generally
unsupported anyway, and it cleans up the code to have separate implementations
for insert and append. (I might enable additional operations in the future, such
as `filter`, `sort` and `each`, but this seems like a reasonable first pass.)
  • Loading branch information...
commit 8da80dcc994ef660198b5cf2b88343c429296847 1 parent c31590e
@mbostock mbostock authored
View
121 d3.js
@@ -1,4 +1,4 @@
-(function(){d3 = {version: "0.30.8"}; // semver
+(function(){d3 = {version: "1.0.0"}; // semver
if (!Date.now) Date.now = function() {
return +new Date();
};
@@ -923,20 +923,29 @@ function d3_hsl_rgb(h, s, l) {
return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
}
+var d3_select = function(s, n) { return n.querySelector(s); },
+ d3_selectAll = function(s, n) { return d3_array(n.querySelectorAll(s)); };
+
+// Use Sizzle, if available.
+if (typeof Sizzle == "function") {
+ d3_select = function(s, n) { return Sizzle(s, n)[0]; };
+ d3_selectAll = Sizzle;
+}
+
var d3_root = d3_selection([[document]]);
d3_root[0].parentNode = document.documentElement;
// TODO fast singleton implementation!
-d3.select = function(query) {
- return typeof query == "string"
- ? d3_root.select(query)
- : d3_selection([[query]]); // assume node
+d3.select = function(selector) {
+ return typeof selector == "string"
+ ? d3_root.select(selector)
+ : d3_selection([[selector]]); // assume node
};
-d3.selectAll = function(query) {
- return typeof query == "string"
- ? d3_root.selectAll(query)
- : d3_selection([d3_array(query)]); // assume node[]
+d3.selectAll = function(selector) {
+ return typeof selector == "string"
+ ? d3_root.selectAll(selector)
+ : d3_selection([d3_array(selector)]); // assume node[]
};
function d3_selection(groups) {
@@ -983,16 +992,16 @@ function d3_selection(groups) {
}
// TODO select(function)?
- groups.select = function(query) {
+ groups.select = function(selector) {
return select(function(node) {
- return node.querySelector(query);
+ return d3_select(selector, node);
});
};
// TODO selectAll(function)?
- groups.selectAll = function(query) {
+ groups.selectAll = function(selector) {
return selectAll(function(node) {
- return d3_array(node.querySelectorAll(query));
+ return d3_selectAll(selector, node);
});
};
@@ -1035,18 +1044,7 @@ function d3_selection(groups) {
nodeData;
function enterNode(data) {
- return {
- __data__: data,
- appendChild: function(a) {
- return group.parentNode.appendChild(a);
- },
- insertBefore: function(a, b) {
- return group.parentNode.insertBefore(a, b);
- },
- querySelector: function(a) {
- return group.parentNode.querySelector(a);
- }
- };
+ return {__data__: data};
}
if (join) {
@@ -1137,7 +1135,7 @@ function d3_selection(groups) {
var selection = d3_selection(update);
selection.enter = function() {
- return d3_selection(enter);
+ return d3_selectionEnter(enter);
};
selection.exit = function() {
return d3_selection(exit);
@@ -1409,19 +1407,19 @@ function d3_selection(groups) {
function insert(node) {
return node.insertBefore(
document.createElement(name),
- node.querySelector(before));
+ d3_select(before, node));
}
function insertNS(node) {
return node.insertBefore(
document.createElementNS(name.space, name.local),
- node.querySelector(before));
+ d3_select(before, node));
}
return select(name.local ? insertNS : insert);
};
- // TODO remove(query)?
+ // TODO remove(selector)?
// TODO remove(node)?
// TODO remove(function)?
groups.remove = function() {
@@ -1486,6 +1484,71 @@ function d3_selection(groups) {
return groups;
}
+function d3_selectionEnter(groups) {
+
+ function select(select) {
+ var subgroups = [],
+ subgroup,
+ subnode,
+ group,
+ node;
+ for (var j = 0, m = groups.length; j < m; j++) {
+ group = groups[j];
+ subgroups.push(subgroup = []);
+ subgroup.parentNode = group.parentNode;
+ subgroup.parentData = group.parentData;
+ for (var i = 0, n = group.length; i < n; i++) {
+ if (node = group[i]) {
+ subgroup.push(subnode = select(group.parentNode));
+ subnode.__data__ = node.__data__;
+ } else {
+ subgroup.push(null);
+ }
+ }
+ }
+ return d3_selection(subgroups);
+ }
+
+ // TODO append(node)?
+ // TODO append(function)?
+ groups.append = function(name) {
+ name = d3.ns.qualify(name);
+
+ function append(node) {
+ return node.appendChild(document.createElement(name));
+ }
+
+ function appendNS(node) {
+ return node.appendChild(document.createElementNS(name.space, name.local));
+ }
+
+ return select(name.local ? appendNS : append);
+ };
+
+ // TODO insert(node, function)?
+ // TODO insert(function, string)?
+ // TODO insert(function, function)?
+ groups.insert = function(name, before) {
+ name = d3.ns.qualify(name);
+
+ function insert(node) {
+ return node.insertBefore(
+ document.createElement(name),
+ d3_select(before, node));
+ }
+
+ function insertNS(node) {
+ return node.insertBefore(
+ document.createElementNS(name.space, name.local),
+ d3_select(before, node));
+ }
+
+ return select(name.local ? insertNS : insert);
+ };
+
+ return groups;
+}
+
function d3_selection_comparator(comparator) {
if (!arguments.length) comparator = d3.ascending;
return function(a, b) {
View
133 d3.min.js
@@ -1,66 +1,67 @@
-(function(){function R(a){return Array.prototype.slice.call(a)}function v(a){return typeof a=="function"?a:function(){return a}}function D(a,b){return function(){var d=b.apply(a,arguments);return arguments.length?a:d}}function ua(a){return a==null}function da(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function ea(a,b){b=R(arguments);b[0]=this;a.apply(this,b);return this}function va(){var a={},b=[];a.add=function(d){for(var f=0;f<b.length;f++)if(b[f].listener==d)return a;b.push({listener:d,
-on:true});return a};a.remove=function(d){for(var f=0;f<b.length;f++){var e=b[f];if(e.listener==d){e.on=false;b=b.slice(0,f).concat(b.slice(f+1));break}}return a};a.dispatch=function(){for(var d=b,f=0,e=d.length;f<e;f++){var c=d[f];c.on&&c.listener.apply(this,arguments)}};return a}function fa(a){return function(b){return 1-a(1-b)}}function ga(a){return function(b){return 0.5*(b<0.5?a(2*b):2-a(2-2*b))}}function wa(a){return a}function S(a){return function(b){return Math.pow(b,a)}}function xa(a){return 1-
-Math.cos(a*Math.PI/2)}function ya(a){return a?Math.pow(2,10*(a-1))-0.0010:0}function za(a){return 1-Math.sqrt(1-a*a)}function Aa(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375}function J(a,b,d){return{r:a,g:b,b:d,toString:Ba}}function Ba(){return"#"+T(this.r)+T(this.g)+T(this.b)}function T(a){return a<16?"0"+a.toString(16):a.toString(16)}function U(a,b,d){var f=0,e=0,c=0,i,h;if(i=/([a-z]+)\((.*)\)/i.exec(a)){h=
-i[2].split(",");switch(i[1]){case "hsl":return d(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case "rgb":return b(V(h[0]),V(h[1]),V(h[2]))}}if(d=G[a])return b(d.r,d.g,d.b);if(a!=null&&a.charAt(0)=="#"){if(a.length==4){f=a.charAt(1);f+=f;e=a.charAt(2);e+=e;c=a.charAt(3);c+=c}else if(a.length==7){f=a.substring(1,3);e=a.substring(3,5);c=a.substring(5,7)}f=parseInt(f,16);e=parseInt(e,16);c=parseInt(c,16)}return b(f,e,c)}function Ca(a,b,d){var f=Math.min(a/=255,b/=255,d/=255),e=Math.max(a,
-b,d),c=e-f,i=(e+f)/2;if(c){f=i<0.5?c/(e+f):c/(2-e-f);a=a==e?(b-d)/c+(b<d?6:0):b==e?(d-a)/c+2:(a-b)/c+4;a*=60}else f=a=0;return W(a,f,i)}function V(a){var b=parseFloat(a);return a.charAt(a.length-1)=="%"?Math.round(b*2.55):b}function W(a,b,d){return{h:a,s:b,l:d,toString:Da}}function Da(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"}function ha(a,b,d){function f(i){if(i>360)i-=360;else if(i<0)i+=360;if(i<60)return e+(c-e)*i/60;if(i<180)return c;if(i<240)return e+(c-e)*(240-i)/60;return e}
-var e,c;a%=360;if(a<0)a+=360;b=b<0?0:b>1?1:b;d=d<0?0:d>1?1:d;c=d<=0.5?d*(1+b):d+b-d*b;e=2*d-c;return J(Math.round(f(a+120)*255),Math.round(f(a)*255),Math.round(f(a-120)*255))}function y(a){function b(e){for(var c=[],i,h,g,k,j=0,o=a.length;j<o;j++){g=a[j];c.push(i=[]);i.parentNode=g.parentNode;i.parentData=g.parentData;for(var p=0,l=g.length;p<l;p++)if(k=g[p]){i.push(h=e(k));if(h&&"__data__"in k)h.__data__=k.__data__}else i.push(null)}return y(c)}function d(e){for(var c=[],i,h,g,k=0,j=a.length;k<j;k++){h=
-a[k];for(var o=0,p=h.length;o<p;o++)if(g=h[o]){c.push(i=e(g));i.parentNode=g;i.parentData=g.__data__}}return y(c)}function f(e){for(var c=0,i=a.length;c<i;c++)for(var h=a[c],g=0,k=h.length;g<k;g++){var j=h[g];if(j)return e.call(j,j.__data__,g)}return null}a.select=function(e){return b(function(c){return c.querySelector(e)})};a.selectAll=function(e){return d(function(c){return R(c.querySelectorAll(e))})};a.filter=function(e){for(var c=[],i,h,g,k=0,j=a.length;k<j;k++){h=a[k];c.push(i=[]);i.parentNode=
-h.parentNode;i.parentData=h.parentData;for(var o=0,p=h.length;o<p;o++)if((g=h[o])&&e.call(g,g.__data__,o))i.push(g)}return y(c)};a.data=function(e,c){function i(l,n){function q(Ea){return{__data__:Ea,appendChild:function(H){return l.parentNode.appendChild(H)},insertBefore:function(H,Fa){return l.parentNode.insertBefore(H,Fa)},querySelector:function(H){return l.parentNode.querySelector(H)}}}var m=0,r=l.length,t=n.length,s=Math.min(r,t),u=Math.max(r,t),z=[],A=[],w=[],x,B;if(c){s={};u=[];var E;B=n.length;
-for(m=0;m<r;m++){E=c.call(x=l[m],x.__data__,m);if(E in s)w[B++]=l[m];else{s[E]=x;u.push(E)}}for(m=0;m<t;m++){if(x=s[E=c.call(n,B=n[m],m)]){x.__data__=B;z[m]=x;A[m]=w[m]=null}else{A[m]=q(B);z[m]=w[m]=null}delete s[E]}for(m=0;m<r;m++)if(u[m]in s)w[m]=l[m]}else{for(;m<s;m++){x=l[m];B=n[m];if(x){x.__data__=B;z[m]=x;A[m]=w[m]=null}else{A[m]=q(B);z[m]=w[m]=null}}for(;m<t;m++){A[m]=q(n[m]);z[m]=w[m]=null}for(;m<u;m++){w[m]=l[m];A[m]=z[m]=null}}A.parentNode=z.parentNode=w.parentNode=l.parentNode;A.parentData=
-z.parentData=w.parentData=l.parentData;h.push(A);g.push(z);k.push(w)}var h=[],g=[],k=[],j=-1,o=a.length,p;if(typeof e=="function")for(;++j<o;)i(p=a[j],e.call(p,p.parentData,j));else for(;++j<o;)i(p=a[j],e);j=y(g);j.enter=function(){return y(h)};j.exit=function(){return y(k)};return j};a.each=function(e){for(var c=0,i=a.length;c<i;c++)for(var h=a[c],g=0,k=h.length;g<k;g++){var j=h[g];j&&e.call(j,j.__data__,g)}return a};a.empty=function(){return!f(function(){return true})};a.node=function(){return f(function(){return this})};
-a.attr=function(e,c){function i(){this.removeAttribute(e)}function h(){this.removeAttributeNS(e.space,e.local)}function g(){this.setAttribute(e,c)}function k(){this.setAttributeNS(e.space,e.local,c)}function j(){var p=c.apply(this,arguments);p==null?this.removeAttribute(e):this.setAttribute(e,p)}function o(){var p=c.apply(this,arguments);p==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,p)}e=d3.ns.qualify(e);if(arguments.length<2)return f(e.local?function(){return this.getAttributeNS(e.space,
-e.local)}:function(){return this.getAttribute(e)});return a.each(c==null?e.local?h:i:typeof c=="function"?e.local?o:j:e.local?k:g)};a.classed=function(e,c){function i(){var j=this.className;k.lastIndex=0;if(!k.test(j))this.className=da(j+" "+e)}function h(){var j=da(this.className.replace(k," "));this.className=j.length?j:null}function g(){(c.apply(this,arguments)?i:h).call(this)}var k=RegExp("(^|\\s+)"+d3.requote(e)+"(\\s+|$)","g");if(arguments.length<2)return f(function(){k.lastIndex=0;return k.test(this.className)});
-return a.each(typeof c=="function"?g:c?i:h)};a.style=function(e,c,i){function h(){this.style.removeProperty(e)}function g(){this.style.setProperty(e,c,i)}function k(){var j=c.apply(this,arguments);j==null?this.style.removeProperty(e):this.style.setProperty(e,j,i)}if(arguments.length<3)i=null;if(arguments.length<2)return f(function(){return window.getComputedStyle(this,null).getPropertyValue(e)});return a.each(c==null?h:typeof c=="function"?k:g)};a.property=function(e,c){function i(){delete this[e]}
-function h(){this[e]=c}function g(){var k=c.apply(this,arguments);if(k==null)delete this[e];else this[e]=k}e=d3.ns.qualify(e);if(arguments.length<2)return f(function(){return this[e]});return a.each(c==null?i:typeof c=="function"?g:h)};a.text=function(e){function c(){this.appendChild(document.createTextNode(e))}function i(){var h=e.apply(this,arguments);h!=null&&this.appendChild(document.createTextNode(h))}if(arguments.length<1)return f(function(){return this.textContent});a.each(function(){for(;this.lastChild;)this.removeChild(this.lastChild)});
-return e==null?a:a.each(typeof e=="function"?i:c)};a.html=function(e){function c(){this.innerHTML=e}function i(){this.innerHTML=e.apply(this,arguments)}if(arguments.length<1)return f(function(){return this.innerHTML});return a.each(typeof e=="function"?i:c)};a.append=function(e){function c(h){return h.appendChild(document.createElement(e))}function i(h){return h.appendChild(document.createElementNS(e.space,e.local))}e=d3.ns.qualify(e);return b(e.local?i:c)};a.insert=function(e,c){function i(g){return g.insertBefore(document.createElement(e),
-g.querySelector(c))}function h(g){return g.insertBefore(document.createElementNS(e.space,e.local),g.querySelector(c))}e=d3.ns.qualify(e);return b(e.local?h:i)};a.remove=function(){return b(function(e){var c=e.parentNode;c.removeChild(e);return c})};a.sort=function(e){e=Ga.apply(this,arguments);for(var c=0,i=a.length;c<i;c++){var h=a[c];h.sort(e);for(var g=1,k=h.length,j=h[0];g<k;g++){var o=h[g];if(o){j&&j.parentNode.insertBefore(o,j.nextSibling);j=o}}}return a};a.on=function(e,c){var i=e.indexOf("."),
-h=i==-1?e:e.substring(0,i),g="__on"+e;return a.each(function(k,j){function o(p){var l=d3.event;d3.event=p;try{c.call(this,k,j)}finally{d3.event=l}}this[g]&&this.removeEventListener(h,this[g],false);if(c)this.addEventListener(h,this[g]=o,false)})};a.transition=function(){return X(a)};a.call=ea;return a}function Ga(a){if(!arguments.length)a=d3.ascending;return function(b,d){return a(b&&b.__data__,d&&d.__data__)}}function X(a){function b(l){var n=true,q=-1;a.each(function(){if(g[++q]!=2){var m=(l-k[q])/
-j[q],r=this.__transition__,t,s,u=c[q];if(m<1){n=false;if(m<0)return}else m=1;if(g[q]){if(!r||r.active!=f){g[q]=2;return}}else if(!r||r.active>f){g[q]=2;return}else{g[q]=1;h.start.dispatch.apply(this,arguments);u=c[q]={};r.active=f;for(s in e)u[s]=e[s].apply(this,arguments)}t=p(m);for(s in e)u[s].call(this,t);if(m==1){g[q]=2;if(r.active==f){m=r.owner;if(m==f){delete this.__transition__;i&&this.parentNode.removeChild(this)}Y=f;h.end.dispatch.apply(this,arguments);Y=0;r.owner=m}}}});return n}var d={},
-f=Y||++Ha,e={},c=[],i=false,h=d3.dispatch("start","end"),g=[],k=[],j=[],o,p=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=f});d.delay=function(l){var n=Infinity,q=-1;if(typeof l=="function")a.each(function(){var m=k[++q]=+l.apply(this,arguments);if(m<n)n=m});else{n=+l;a.each(function(){k[++q]=n})}Ia(b,n);return d};d.duration=function(l){var n=-1;if(typeof l=="function"){o=0;a.each(function(){var q=j[++n]=+l.apply(this,arguments);if(q>o)o=q})}else{o=
-+l;a.each(function(){j[++n]=o})}return d};d.ease=function(l){p=typeof l=="string"?d3.ease(l):l;return d};d.attrTween=function(l,n){function q(r,t){var s=n.call(this,r,t,this.getAttribute(l));return function(u){this.setAttribute(l,s(u))}}function m(r,t){var s=n.call(this,r,t,this.getAttributeNS(l.space,l.local));return function(u){this.setAttributeNS(l.space,l.local,s(u))}}e["attr."+l]=l.local?m:q;return d};d.attr=function(l,n){return d.attrTween(l,ia(n))};d.styleTween=function(l,n,q){if(arguments.length<
-3)q=null;e["style."+l]=function(m,r){var t=n.call(this,m,r,window.getComputedStyle(this,null).getPropertyValue(l));return function(s){this.style.setProperty(l,t(s),q)}};return d};d.style=function(l,n,q){if(arguments.length<3)q=null;return d.styleTween(l,ia(n),q)};d.select=function(l){var n;l=X(a.select(l)).ease(p);n=-1;l.delay(function(){return k[++n]});n=-1;l.duration(function(){return j[++n]});return l};d.selectAll=function(l){var n;l=X(a.selectAll(l)).ease(p);n=-1;l.delay(function(q,m){return k[m?
-n:++n]});n=-1;l.duration(function(q,m){return j[m?n:++n]});return l};d.remove=function(){i=true;return d};d.each=function(l,n){h[l].add(n);return d};d.call=ea;return d.delay(0).duration(250)}function ia(a){return typeof a=="function"?function(b,d,f){return d3.interpolate(f,String(a.call(this,b,d)))}:(a=String(a),function(b,d,f){return d3.interpolate(f,a)})}function Ia(a,b){var d=Date.now(),f=false,e=d+b,c=F;if(isFinite(b)){for(;c;){if(c.callback==a){c.then=d;c.delay=b;f=true}else{var i=c.then+c.delay;
-if(i<e)e=i}c=c.next}f||(F={callback:a,then:d,delay:b,next:F});if(!K){clearTimeout(Z);Z=setTimeout(Ja,Math.max(24,e-d))}}}function Ja(){K=setInterval(Ka,24);Z=0}function Ka(){for(var a,b=Date.now(),d=F;d;){a=b-d.then;if(a>d.delay)d.flush=d.callback(a);d=d.next}a=null;for(b=F;b;)b=b.flush?a?a.next=b.next:F=b.next:(a=b).next;a||(K=clearInterval(K))}function La(a){return a.innerRadius}function Ma(a){return a.outerRadius}function ja(a){return a.startAngle}function ka(a){return a.endAngle}function $(a,
-b,d,f){var e=[],c=-1,i=b.length,h=typeof d=="function",g=typeof f=="function",k;if(h&&g)for(;++c<i;)e.push([d.call(a,k=b[c],c),f.call(a,k,c)]);else if(h)for(;++c<i;)e.push([d.call(a,b[c],c),f]);else if(g)for(;++c<i;)e.push([d,f.call(a,b[c],c)]);else for(;++c<i;)e.push([d,f]);return e}function la(a){return a[0]}function ma(a){return a[1]}function I(a){var b=[],d=0,f=a.length,e=a[0];for(b.push(e[0],",",e[1]);++d<f;)b.push("L",(e=a[d])[0],",",e[1]);return b.join("")}function na(a,b){if(b.length<1||a.length!=
-b.length&&a.length!=b.length+2)return I(a);var d=a.length!=b.length,f="",e=a[0],c=a[1],i=b[0],h=i,g=1;if(d){f+="Q"+(c[0]-i[0]*2/3)+","+(c[1]-i[1]*2/3)+","+c[0]+","+c[1];e=a[1];g=2}if(b.length>1){h=b[1];c=a[g];g++;f+="C"+(e[0]+i[0])+","+(e[1]+i[1])+","+(c[0]-h[0])+","+(c[1]-h[1])+","+c[0]+","+c[1];for(e=2;e<b.length;e++,g++){c=a[g];h=b[e];f+="S"+(c[0]-h[0])+","+(c[1]-h[1])+","+c[0]+","+c[1]}}if(d){d=a[g];f+="Q"+(c[0]+h[0]*2/3)+","+(c[1]+h[1]*2/3)+","+d[0]+","+d[1]}return f}function oa(a,b){for(var d=
-[],f=(1-b)/2,e=a[0],c=a[1],i=a[2],h=2,g=a.length;++h<g;){d.push([f*(i[0]-e[0]),f*(i[1]-e[1])]);e=c;c=i;i=a[h]}d.push([f*(i[0]-e[0]),f*(i[1]-e[1])]);return d}function C(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function L(a,b,d){a.push("C",C(pa,b),",",C(pa,d),",",C(qa,b),",",C(qa,d),",",C(M,b),",",C(M,d))}function Na(){return 0}function Oa(a){return a.source}function Pa(a){return a.target}function Qa(a){return a.radius}function Ra(){return 64}function Sa(){return"circle"}d3={version:"0.30.8"};
-if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=function(a){function b(){}b.prototype=a;return new b};d3.ascending=function(a,b){return a<b?-1:a>b?1:0};d3.descending=function(a,b){return b<a?-1:b>a?1:0};d3.min=function(a,b){var d=0,f=a.length,e=a[0],c;if(arguments.length==1)for(;++d<f;){if(e>(c=a[d]))e=c}else for(e=b(a[0]);++d<f;)if(e>(c=b(a[d])))e=c;return e};d3.max=function(a,b){var d=0,f=a.length,e=a[0],c;if(arguments.length==1)for(;++d<f;){if(e<(c=a[d]))e=c}else for(e=
-b(e);++d<f;)if(e<(c=b(a[d])))e=c;return e};d3.nest=function(){function a(c,i){if(c>=d.length)return e?e.call(b,i):f?i.sort(f):i;for(var h=-1,g=i.length,k=d[c],j,o=[],p,l={};++h<g;)if((j=k(p=i[h]))in l)l[j].push(p);else{l[j]=[p];o.push(j)}c++;h=-1;for(g=o.length;++h<g;){p=l[j=o[h]];l[j]=a(c,p)}return l}var b={},d=[],f,e;b.map=function(c){return a(0,c)};b.key=function(c){d.push(c);return b};b.sortKeys=function(){return b};b.sortValues=function(c){f=c;return b};b.rollup=function(c){e=c;return b};return b};
-d3.keys=function(a){var b=[],d;for(d in a)b.push(d);return b};d3.values=function(a){var b=[],d;for(d in a)b.push(a[d]);return b};d3.entries=function(a){var b=[],d;for(d in a)b.push({key:d,value:a[d]});return b};d3.merge=function(a){return Array.prototype.concat.apply([],a)};d3.split=function(a,b){var d=[],f=[],e,c=-1,i=a.length;if(arguments.length<2)b=ua;for(;++c<i;)if(b.call(f,e=a[c],c))f=[];else{f.length||d.push(f);f.push(e)}return d};d3.range=function(a,b,d){if(arguments.length==1){b=a;a=0}if(d==
-null)d=1;if((b-a)/d==Infinity)throw Error("infinite range");var f=[],e=-1,c;if(d<0)for(;(c=a+d*++e)>b;)f.push(c);else for(;(c=a+d*++e)<b;)f.push(c);return f};d3.requote=function(a){return a.replace(Ta,"\\$&")};var Ta=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.xhr=function(a,b,d){var f=new XMLHttpRequest;if(arguments.length<3)d=b;else b&&f.overrideMimeType(b);f.open("GET",a,true);f.onreadystatechange=function(){if(f.readyState==4)d(f.status<300?f:null)};f.send(null)};d3.text=function(a,b,d){if(arguments.length<
-3){d=b;b=null}d3.xhr(a,b,function(f){d(f&&f.responseText)})};d3.json=function(a,b){d3.text(a,"application/json",function(d){b(d?JSON.parse(d):null)})};d3.html=function(a,b){d3.text(a,"text/html",function(d){if(d!=null){var f=document.createRange();f.selectNode(document.body);d=f.createContextualFragment(d)}b(d)})};d3.xml=function(a,b,d){if(arguments.length<3){d=b;b=null}d3.xhr(a,b,function(f){d(f&&f.responseXML)})};d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",
-xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}};d3.dispatch=function(){for(var a={},b,d=0,f=arguments.length;d<f;d++){b=arguments[d];a[b]=va(b)}return a};d3.format=function(a){a=Ua.exec(a);var b=a[1]||" ",d=ra[a[3]]||ra["-"],f=a[5],e=+a[6],c=a[7],i=a[8],h=a[9];if(i)i=i.substring(1);if(f)b="0";if(h=="d")i="0";return function(g){g=
-+g;var k=g<0&&(g=-g);if(h=="d"&&g%1)return"";g=i?g.toFixed(i):""+g;if(c){for(var j=g.lastIndexOf("."),o=j>=0?g.substring(j):(j=g.length,""),p=[];j>0;)p.push(g.substring(j-=3,j+3));g=p.reverse().join(",")+o}k=(g=d(k,g)).length;if(k<e)g=Array(e-k+1).join(b)+g;return g}};var Ua=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,ra={"+":function(a,b){return(a?"−":"+")+b}," ":function(a,b){return(a?"−":" ")+b},"-":function(a,b){return a?""+b:b}},Va=S(2),Wa=S(3),Xa={linear:function(){return wa},
-poly:S,quad:function(){return Va},cubic:function(){return Wa},sin:function(){return xa},exp:function(){return ya},circle:function(){return za},elastic:function(a,b){var d;if(arguments.length<2)b=0.45;if(arguments.length<1){a=1;d=b/4}else d=b/(2*Math.PI)*Math.asin(1/a);return function(f){return 1+a*Math.pow(2,10*-f)*Math.sin((f-d)*2*Math.PI/b)}},back:function(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}},bounce:function(){return Aa}},Ya={"in":function(a){return a},out:fa,"in-out":ga,
-"out-in":function(a){return ga(fa(a))}};d3.ease=function(a){var b=a.indexOf("-"),d=b>=0?a.substring(0,b):a;b=b>=0?a.substring(b+1):"in";return Ya[b](Xa[d].apply(null,Array.prototype.slice.call(arguments,1)))};d3.event=null;d3.interpolate=function(a,b){if(typeof b=="number")return d3.interpolateNumber(+a,b);if(typeof b=="string")return b in G||/^(#|rgb\(|hsl\()/.test(b)?d3.interpolateRgb(String(a),b):d3.interpolateString(String(a),b);if(b instanceof Array)return d3.interpolateArray(a,b);return d3.interpolateObject(a,
-b)};d3.interpolateNumber=function(a,b){b-=a;return function(d){return a+b*d}};d3.interpolateRound=function(a,b){b-=a;return function(d){return Math.round(a+b*d)}};d3.interpolateString=function(a,b){var d,f,e=0,c=[],i=[],h,g;for(f=0;d=aa.exec(b);++f){d.index&&c.push(b.substring(e,d.index));i.push({i:c.length,x:d[0]});c.push(null);e=aa.lastIndex}e<b.length&&c.push(b.substring(e));f=0;for(h=i.length;(d=aa.exec(a))&&f<h;++f){g=i[f];if(g.x==d[0]){if(g.i)if(c[g.i+1]==null){c[g.i-1]+=g.x;c.splice(g.i,1);
-for(d=f+1;d<h;++d)i[d].i--}else{c[g.i-1]+=g.x+c[g.i+1];c.splice(g.i,2);for(d=f+1;d<h;++d)i[d].i-=2}else if(c[g.i+1]==null)c[g.i]=g.x;else{c[g.i]=g.x+c[g.i+1];c.splice(g.i+1,1);for(d=f+1;d<h;++d)i[d].i--}i.splice(f,1);h--;f--}else g.x=d3.interpolateNumber(parseFloat(d[0]),parseFloat(g.x))}for(;f<h;){g=i.pop();if(c[g.i+1]==null)c[g.i]=g.x;else{c[g.i]=g.x+c[g.i+1];c.splice(g.i+1,1)}h--}if(c.length==1)return c[0]==null?i[0].x:function(){return b};return function(k){for(f=0;f<h;++f)c[(g=i[f]).i]=g.x(k);
-return c.join("")}};d3.interpolateRgb=function(a,b){a=d3.rgb(a);b=d3.rgb(b);var d=a.r,f=a.g,e=a.b,c=b.r-d,i=b.g-f,h=b.b-e;return function(g){return"rgb("+Math.round(d+c*g)+","+Math.round(f+i*g)+","+Math.round(e+h*g)+")"}};d3.interpolateArray=function(a,b){var d=[],f=[],e=a.length,c=b.length,i=Math.min(a.length,b.length),h;for(h=0;h<i;++h)d.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)f[h]=a[h];for(;h<c;++h)f[h]=b[h];return function(g){for(h=0;h<i;++h)f[h]=d[h](g);return f}};d3.interpolateObject=function(a,
-b){var d={},f={},e;for(e in a)if(e in b)d[e]=(e in Za||/\bcolor\b/.test(e)?d3.interpolateRgb:d3.interpolate)(a[e],b[e]);else f[e]=a[e];for(e in b)e in a||(f[e]=b[e]);return function(c){for(e in d)f[e]=d[e](c);return f}};var aa=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,Za={background:1,fill:1,stroke:1};d3.rgb=function(a,b,d){return arguments.length==1?U(""+a,J,ha):J(~~a,~~b,~~d)};var G={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",
-bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",
-darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",
-honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",
-lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",
-orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",
-slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},ba;for(ba in G)G[ba]=U(G[ba],J,ha);d3.hsl=function(a,b,d){return arguments.length==1?U(""+a,Ca,W):W(+a,+b,+d)};var N=y([[document]]);N[0].parentNode=document.documentElement;d3.select=function(a){return typeof a=="string"?N.select(a):
-y([[a]])};d3.selectAll=function(a){return typeof a=="string"?N.selectAll(a):y([R(a)])};d3.transition=N.transition;var Ha=0,Y=0,F=null,Z=0,K;d3.scale={};d3.scale.linear=function(){function a(j){return k((j-d)*i)}function b(j){var o=Math.min(d,f),p=Math.max(d,f),l=p-o,n=Math.pow(10,Math.floor(Math.log(l/j)/Math.LN10));j=j/(l/n);if(j<=0.15)n*=10;else if(j<=0.35)n*=5;else if(j<=0.75)n*=2;return{start:Math.ceil(o/n)*n,stop:Math.floor(p/n)*n+n*0.5,step:n}}var d=0,f=1,e=0,c=1,i=1/(f-d),h=(f-d)/(c-e),g=d3.interpolate,
-k=g(e,c);a.invert=function(j){return(j-e)*h+d};a.domain=function(j){if(!arguments.length)return[d,f];d=j[0];f=j[1];i=1/(f-d);h=(f-d)/(c-e);return a};a.range=function(j){if(!arguments.length)return[e,c];e=j[0];c=j[1];h=(f-d)/(c-e);k=g(e,c);return a};a.rangeRound=function(j){return a.range(j).interpolate(d3.interpolateRound)};a.interpolate=function(j){if(!arguments.length)return g;k=(g=j)(e,c);return a};a.ticks=function(j){j=b(j);return d3.range(j.start,j.stop,j.step)};a.tickFormat=function(j){j=Math.max(0,
--Math.floor(Math.log(b(j).step)/Math.LN10+0.01));return d3.format(",."+j+"f")};return a};d3.scale.log=function(){function a(c){return(e?-Math.log(-c):Math.log(c))/Math.LN10}function b(c){return e?-Math.pow(10,-c):Math.pow(10,c)}function d(c){return f(a(c))}var f=d3.scale.linear(),e=false;d.invert=function(c){return b(f.invert(c))};d.domain=function(c){if(!arguments.length)return f.domain().map(b);e=(c[0]||c[1])<0;f.domain(c.map(a));return d};d.range=D(d,f.range);d.rangeRound=D(d,f.rangeRound);d.interpolate=
-D(d,f.interpolate);d.ticks=function(){var c=f.domain(),i=[];if(c.every(isFinite)){var h=Math.floor(c[0]),g=Math.ceil(c[1]),k=b(c[0]);c=b(c[1]);if(e)for(i.push(b(h));h++<g;)for(var j=9;j>0;j--)i.push(b(h)*j);else{for(;h<g;h++)for(j=1;j<10;j++)i.push(b(h)*j);i.push(b(h))}for(h=0;i[h]<k;h++);for(g=i.length;i[g-1]>c;g--);i=i.slice(h,g)}return i};d.tickFormat=function(){return function(c){return c.toPrecision(1)}};return d};d3.scale.pow=function(){function a(g){return h?-Math.pow(-g,c):Math.pow(g,c)}function b(g){return h?
--Math.pow(-g,i):Math.pow(g,i)}function d(g){return f(a(g))}var f=d3.scale.linear(),e=d3.scale.linear(),c=1,i=1/c,h=false;d.invert=function(g){return b(f.invert(g))};d.domain=function(g){if(!arguments.length)return f.domain().map(b);h=(g[0]||g[1])<0;f.domain(g.map(a));e.domain(g);return d};d.range=D(d,f.range);d.rangeRound=D(d,f.rangeRound);d.inteprolate=D(d,f.interpolate);d.ticks=e.ticks;d.tickFormat=e.tickFormat;d.exponent=function(g){if(!arguments.length)return c;var k=d.domain();c=g;i=1/g;return d.domain(k)};
-return d};d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){function a(c){c=c in d?d[c]:d[c]=b.push(c)-1;return f[c%f.length]}var b=[],d={},f=[],e=0;a.domain=function(c){if(!arguments.length)return b;b=c;d={};for(var i=-1,h=-1,g=b.length;++i<g;){c=b[i];c in d||(d[c]=++h)}return a};a.range=function(c){if(!arguments.length)return f;f=c;return a};a.rangePoints=function(c,i){if(arguments.length<2)i=0;var h=c[0],g=c[1],k=(g-h)/(b.length-1+i);f=b.length==1?[(h+g)/
-2]:d3.range(h+k*i/2,g+k/2,k);e=0;return a};a.rangeBands=function(c,i){if(arguments.length<2)i=0;var h=c[0],g=c[1],k=(g-h)/(b.length+i);f=d3.range(h+k*i,g,k);e=k*(1-i);return a};a.rangeRoundBands=function(c,i){if(arguments.length<2)i=0;var h=c[0],g=c[1],k=g-h,j=Math.floor(k/(b.length+i));f=d3.range(h+Math.round((k-(b.length-i)*j)/2),g,j);e=Math.round(j*(1-i));return a};a.rangeBand=function(){return e};return a};d3.scale.category10=function(){return d3.scale.ordinal().range($a)};d3.scale.category20=
-function(){return d3.scale.ordinal().range(ab)};d3.scale.category20b=function(){return d3.scale.ordinal().range(bb)};d3.scale.category20c=function(){return d3.scale.ordinal().range(cb)};var $a=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ab=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bb=
-["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],cb=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function a(){for(var i=-1,h=c.length=e.length,g=f.length/h;++i<h;)c[i]=
-f[~~(i*g)]}function b(i){if(isNaN(i=+i))return NaN;for(var h=0,g=c.length-1;h<=g;){var k=h+g>>1,j=c[k];if(j<i)h=k+1;else if(j>i)g=k-1;else return k}return g<0?0:g}function d(i){return e[b(i)]}var f=[],e=[],c=[];d.domain=function(i){if(!arguments.length)return f;f=i.filter(function(h){return!isNaN(h)}).sort(d3.ascending);a();return d};d.range=function(i){if(!arguments.length)return e;e=i;a();return d};d.quantiles=function(){return c};return d};d3.scale.quantize=function(){function a(i){return c[Math.max(0,
-Math.min(e,Math.floor(f*(i-b))))]}var b=0,d=1,f=2,e=1,c=[0,1];a.domain=function(i){if(!arguments.length)return[b,d];b=i[0];d=i[1];f=c.length/(d-b);return a};a.range=function(i){if(!arguments.length)return c;c=i;f=c.length/(d-b);e=c.length-1;return a};return a};d3.svg={};d3.svg.arc=function(){function a(c,i){var h=b.call(this,c,i),g=d.call(this,c,i),k=f.call(this,c,i)+O,j=e.call(this,c,i)+O,o=j-k,p=o<Math.PI?"0":"1",l=Math.cos(k);k=Math.sin(k);var n=Math.cos(j);j=Math.sin(j);return o>=db?h?"M0,"+g+
-"A"+g+","+g+" 0 1,1 0,"+-g+"A"+g+","+g+" 0 1,1 0,"+g+"M0,"+h+"A"+h+","+h+" 0 1,1 0,"+-h+"A"+h+","+h+" 0 1,1 0,"+h+"Z":"M0,"+g+"A"+g+","+g+" 0 1,1 0,"+-g+"A"+g+","+g+" 0 1,1 0,"+g+"Z":h?"M"+g*l+","+g*k+"A"+g+","+g+" 0 "+p+",1 "+g*n+","+g*j+"L"+h*n+","+h*j+"A"+h+","+h+" 0 "+p+",0 "+h*l+","+h*k+"Z":"M"+g*l+","+g*k+"A"+g+","+g+" 0 "+p+",1 "+g*n+","+g*j+"L0,0Z"}var b=La,d=Ma,f=ja,e=ka;a.innerRadius=function(c){if(!arguments.length)return b;b=v(c);return a};a.outerRadius=function(c){if(!arguments.length)return d;
-d=v(c);return a};a.startAngle=function(c){if(!arguments.length)return f;f=v(c);return a};a.endAngle=function(c){if(!arguments.length)return e;e=v(c);return a};return a};var O=-Math.PI/2,db=2*Math.PI-1.0E-6;d3.svg.line=function(){function a(i){return i.length<1?null:"M"+e($(this,i,b,d),c)}var b=la,d=ma,f="linear",e=P[f],c=0.7;a.x=function(i){if(!arguments.length)return b;b=i;return a};a.y=function(i){if(!arguments.length)return d;d=i;return a};a.interpolate=function(i){if(!arguments.length)return f;
-e=P[f=i];return a};a.tension=function(i){if(!arguments.length)return c;c=i;return a};return a};var P={linear:I,basis:function(a){if(a.length<3)return I(a);var b=[],d=1,f=a.length,e=a[0],c=e[0],i=e[1],h=[c,c,c,(e=a[1])[0]],g=[i,i,i,e[1]];b.push(c,",",i);for(L(b,h,g);++d<f;){e=a[d];h.shift();h.push(e[0]);g.shift();g.push(e[1]);L(b,h,g)}for(d=-1;++d<2;){h.shift();h.push(e[0]);g.shift();g.push(e[1]);L(b,h,g)}return b.join("")},"basis-closed":function(a){for(var b,d=-1,f=a.length,e=f+4,c,i=[],h=[];++d<
-4;){c=a[d%f];i.push(c[0]);h.push(c[1])}b=[C(M,i),",",C(M,h)];for(--d;++d<e;){c=a[d%f];i.shift();i.push(c[0]);h.shift();h.push(c[1]);L(b,i,h)}return b.join("")},cardinal:function(a,b){if(a.length<3)return I(a);return a[0]+na(a,oa(a,b))},"cardinal-closed":function(a,b){if(a.length<3)return I(a);return a[0]+na(a,oa([a[a.length-2]].concat(a,[a[1]]),b))}},pa=[0,2/3,1/3,0],qa=[0,1/3,2/3,0],M=[0,1/6,2/3,1/6];d3.svg.area=function(){function a(h){return h.length<1?null:"M"+c($(this,h,b,f),i)+"L"+c($(this,
-h,b,d).reverse(),i)+"Z"}var b=la,d=Na,f=ma,e="linear",c=P[e],i=0.7;a.x=function(h){if(!arguments.length)return b;b=h;return a};a.y0=function(h){if(!arguments.length)return d;d=h;return a};a.y1=function(h){if(!arguments.length)return f;f=h;return a};a.interpolate=function(h){if(!arguments.length)return e;c=P[e=h];return a};a.tension=function(h){if(!arguments.length)return i;i=h;return a};return a};d3.svg.chord=function(){function a(h,g){var k=b(this,d,h,g),j=b(this,f,h,g);return"M"+k.p0+("A"+k.r+","+
-k.r+" 0 0,1 "+k.p1)+(k.a0==j.a0&&k.a1==j.a1?"Q 0,0 "+k.p0:"Q 0,0 "+j.p0+("A"+j.r+","+j.r+" 0 0,1 "+j.p1)+("Q 0,0 "+k.p0))+"Z"}function b(h,g,k,j){var o=g.call(h,k,j);g=e.call(h,o,j);k=c.call(h,o,j)+O;h=i.call(h,o,j)+O;return{r:g,a0:k,a1:h,p0:[g*Math.cos(k),g*Math.sin(k)],p1:[g*Math.cos(h),g*Math.sin(h)]}}var d=Oa,f=Pa,e=Qa,c=ja,i=ka;a.radius=function(h){if(!arguments.length)return e;e=v(h);return a};a.source=function(h){if(!arguments.length)return d;d=v(h);return a};a.target=function(h){if(!arguments.length)return f;
-f=v(h);return a};a.startAngle=function(h){if(!arguments.length)return c;c=v(h);return a};a.endAngle=function(h){if(!arguments.length)return i;i=v(h);return a};return a};d3.svg.mouse=function(a){var b=(a.ownerSVGElement||a).createSVGPoint();if(ca<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),f=d[0][0].getScreenCTM();ca=!(f.f||f.e);d.remove()}if(ca){b.x=d3.event.pageX;b.y=d3.event.pageY}else{b.x=d3.event.clientX;
-b.y=d3.event.clientY}b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var ca=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.symbol=function(){function a(f,e){return(sa[b.call(this,f,e)]||sa.circle)(d.call(this,f,e))}var b=Sa,d=Ra;a.type=function(f){if(!arguments.length)return b;b=v(f);return a};a.size=function(f){if(!arguments.length)return d;d=v(f);return a};return a};d3.svg.symbolTypes=["circle","cross","diamond","square","triangle-down","triangle-up"];var sa={circle:function(a){a=
-Math.sqrt(a/Math.PI);return"M0,"+a+"A"+a+","+a+" 0 1,1 0,"+-a+"A"+a+","+a+" 0 1,1 0,"+a+"Z"},cross:function(a){a=Math.sqrt(a/5)/2;return"M"+-3*a+","+-a+"H"+-a+"V"+-3*a+"H"+a+"V"+-a+"H"+3*a+"V"+a+"H"+a+"V"+3*a+"H"+-a+"V"+a+"H"+-3*a+"Z"},diamond:function(a){a=Math.sqrt(a/(2*ta));var b=a*ta;return"M0,"+-a+"L"+b+",0 0,"+a+" "+-b+",0Z"},square:function(a){a=Math.sqrt(a)/2;return"M"+-a+","+-a+"L"+a+","+-a+" "+a+","+a+" "+-a+","+a+"Z"},"triangle-down":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+
-b+"L"+a+","+-b+" "+-a+","+-b+"Z"},"triangle-up":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+-b+"L"+a+","+b+" "+-a+","+b+"Z"}},Q=Math.sqrt(3),ta=Math.tan(30*Math.PI/180)})();
+(function(){function Q(a){return Array.prototype.slice.call(a)}function v(a){return typeof a=="function"?a:function(){return a}}function C(a,b){return function(){var d=b.apply(a,arguments);return arguments.length?a:d}}function ua(a){return a==null}function ca(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function da(a,b){b=Q(arguments);b[0]=this;a.apply(this,b);return this}function va(){var a={},b=[];a.add=function(d){for(var f=0;f<b.length;f++)if(b[f].listener==d)return a;b.push({listener:d,
+on:true});return a};a.remove=function(d){for(var f=0;f<b.length;f++){var e=b[f];if(e.listener==d){e.on=false;b=b.slice(0,f).concat(b.slice(f+1));break}}return a};a.dispatch=function(){for(var d=b,f=0,e=d.length;f<e;f++){var c=d[f];c.on&&c.listener.apply(this,arguments)}};return a}function ea(a){return function(b){return 1-a(1-b)}}function fa(a){return function(b){return 0.5*(b<0.5?a(2*b):2-a(2-2*b))}}function wa(a){return a}function R(a){return function(b){return Math.pow(b,a)}}function xa(a){return 1-
+Math.cos(a*Math.PI/2)}function ya(a){return a?Math.pow(2,10*(a-1))-0.0010:0}function za(a){return 1-Math.sqrt(1-a*a)}function Aa(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375}function I(a,b,d){return{r:a,g:b,b:d,toString:Ba}}function Ba(){return"#"+S(this.r)+S(this.g)+S(this.b)}function S(a){return a<16?"0"+a.toString(16):a.toString(16)}function T(a,b,d){var f=0,e=0,c=0,i,h;if(i=/([a-z]+)\((.*)\)/i.exec(a)){h=
+i[2].split(",");switch(i[1]){case "hsl":return d(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case "rgb":return b(U(h[0]),U(h[1]),U(h[2]))}}if(d=G[a])return b(d.r,d.g,d.b);if(a!=null&&a.charAt(0)=="#"){if(a.length==4){f=a.charAt(1);f+=f;e=a.charAt(2);e+=e;c=a.charAt(3);c+=c}else if(a.length==7){f=a.substring(1,3);e=a.substring(3,5);c=a.substring(5,7)}f=parseInt(f,16);e=parseInt(e,16);c=parseInt(c,16)}return b(f,e,c)}function Ca(a,b,d){var f=Math.min(a/=255,b/=255,d/=255),e=Math.max(a,
+b,d),c=e-f,i=(e+f)/2;if(c){f=i<0.5?c/(e+f):c/(2-e-f);a=a==e?(b-d)/c+(b<d?6:0):b==e?(d-a)/c+2:(a-b)/c+4;a*=60}else f=a=0;return V(a,f,i)}function U(a){var b=parseFloat(a);return a.charAt(a.length-1)=="%"?Math.round(b*2.55):b}function V(a,b,d){return{h:a,s:b,l:d,toString:Da}}function Da(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"}function ga(a,b,d){function f(i){if(i>360)i-=360;else if(i<0)i+=360;if(i<60)return e+(c-e)*i/60;if(i<180)return c;if(i<240)return e+(c-e)*(240-i)/60;return e}
+var e,c;a%=360;if(a<0)a+=360;b=b<0?0:b>1?1:b;d=d<0?0:d>1?1:d;c=d<=0.5?d*(1+b):d+b-d*b;e=2*d-c;return I(Math.round(f(a+120)*255),Math.round(f(a)*255),Math.round(f(a-120)*255))}function y(a){function b(e){for(var c=[],i,h,g,k,j=0,o=a.length;j<o;j++){g=a[j];c.push(i=[]);i.parentNode=g.parentNode;i.parentData=g.parentData;for(var p=0,m=g.length;p<m;p++)if(k=g[p]){i.push(h=e(k));if(h&&"__data__"in k)h.__data__=k.__data__}else i.push(null)}return y(c)}function d(e){for(var c=[],i,h,g,k=0,j=a.length;k<j;k++){h=
+a[k];for(var o=0,p=h.length;o<p;o++)if(g=h[o]){c.push(i=e(g));i.parentNode=g;i.parentData=g.__data__}}return y(c)}function f(e){for(var c=0,i=a.length;c<i;c++)for(var h=a[c],g=0,k=h.length;g<k;g++){var j=h[g];if(j)return e.call(j,j.__data__,g)}return null}a.select=function(e){return b(function(c){return D(e,c)})};a.selectAll=function(e){return d(function(c){return ha(e,c)})};a.filter=function(e){for(var c=[],i,h,g,k=0,j=a.length;k<j;k++){h=a[k];c.push(i=[]);i.parentNode=h.parentNode;i.parentData=
+h.parentData;for(var o=0,p=h.length;o<p;o++)if((g=h[o])&&e.call(g,g.__data__,o))i.push(g)}return y(c)};a.data=function(e,c){function i(m,n){var l=0,q=m.length,r=n.length,t=Math.min(q,r),u=Math.max(q,r),s=[],z=[],w=[],x,A;if(c){t={};u=[];var E;A=n.length;for(l=0;l<q;l++){E=c.call(x=m[l],x.__data__,l);if(E in t)w[A++]=m[l];else{t[E]=x;u.push(E)}}for(l=0;l<r;l++){if(x=t[E=c.call(n,A=n[l],l)]){x.__data__=A;s[l]=x;z[l]=w[l]=null}else{z[l]={__data__:A};s[l]=w[l]=null}delete t[E]}for(l=0;l<q;l++)if(u[l]in
+t)w[l]=m[l]}else{for(;l<t;l++){x=m[l];A=n[l];if(x){x.__data__=A;s[l]=x;z[l]=w[l]=null}else{z[l]={__data__:A};s[l]=w[l]=null}}for(;l<r;l++){z[l]={__data__:n[l]};s[l]=w[l]=null}for(;l<u;l++){w[l]=m[l];z[l]=s[l]=null}}z.parentNode=s.parentNode=w.parentNode=m.parentNode;z.parentData=s.parentData=w.parentData=m.parentData;h.push(z);g.push(s);k.push(w)}var h=[],g=[],k=[],j=-1,o=a.length,p;if(typeof e=="function")for(;++j<o;)i(p=a[j],e.call(p,p.parentData,j));else for(;++j<o;)i(p=a[j],e);j=y(g);j.enter=
+function(){return Ea(h)};j.exit=function(){return y(k)};return j};a.each=function(e){for(var c=0,i=a.length;c<i;c++)for(var h=a[c],g=0,k=h.length;g<k;g++){var j=h[g];j&&e.call(j,j.__data__,g)}return a};a.empty=function(){return!f(function(){return true})};a.node=function(){return f(function(){return this})};a.attr=function(e,c){function i(){this.removeAttribute(e)}function h(){this.removeAttributeNS(e.space,e.local)}function g(){this.setAttribute(e,c)}function k(){this.setAttributeNS(e.space,e.local,
+c)}function j(){var p=c.apply(this,arguments);p==null?this.removeAttribute(e):this.setAttribute(e,p)}function o(){var p=c.apply(this,arguments);p==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,p)}e=d3.ns.qualify(e);if(arguments.length<2)return f(e.local?function(){return this.getAttributeNS(e.space,e.local)}:function(){return this.getAttribute(e)});return a.each(c==null?e.local?h:i:typeof c=="function"?e.local?o:j:e.local?k:g)};a.classed=function(e,c){function i(){var j=
+this.className;k.lastIndex=0;if(!k.test(j))this.className=ca(j+" "+e)}function h(){var j=ca(this.className.replace(k," "));this.className=j.length?j:null}function g(){(c.apply(this,arguments)?i:h).call(this)}var k=RegExp("(^|\\s+)"+d3.requote(e)+"(\\s+|$)","g");if(arguments.length<2)return f(function(){k.lastIndex=0;return k.test(this.className)});return a.each(typeof c=="function"?g:c?i:h)};a.style=function(e,c,i){function h(){this.style.removeProperty(e)}function g(){this.style.setProperty(e,c,
+i)}function k(){var j=c.apply(this,arguments);j==null?this.style.removeProperty(e):this.style.setProperty(e,j,i)}if(arguments.length<3)i=null;if(arguments.length<2)return f(function(){return window.getComputedStyle(this,null).getPropertyValue(e)});return a.each(c==null?h:typeof c=="function"?k:g)};a.property=function(e,c){function i(){delete this[e]}function h(){this[e]=c}function g(){var k=c.apply(this,arguments);if(k==null)delete this[e];else this[e]=k}e=d3.ns.qualify(e);if(arguments.length<2)return f(function(){return this[e]});
+return a.each(c==null?i:typeof c=="function"?g:h)};a.text=function(e){function c(){this.appendChild(document.createTextNode(e))}function i(){var h=e.apply(this,arguments);h!=null&&this.appendChild(document.createTextNode(h))}if(arguments.length<1)return f(function(){return this.textContent});a.each(function(){for(;this.lastChild;)this.removeChild(this.lastChild)});return e==null?a:a.each(typeof e=="function"?i:c)};a.html=function(e){function c(){this.innerHTML=e}function i(){this.innerHTML=e.apply(this,
+arguments)}if(arguments.length<1)return f(function(){return this.innerHTML});return a.each(typeof e=="function"?i:c)};a.append=function(e){function c(h){return h.appendChild(document.createElement(e))}function i(h){return h.appendChild(document.createElementNS(e.space,e.local))}e=d3.ns.qualify(e);return b(e.local?i:c)};a.insert=function(e,c){function i(g){return g.insertBefore(document.createElement(e),D(c,g))}function h(g){return g.insertBefore(document.createElementNS(e.space,e.local),D(c,g))}e=
+d3.ns.qualify(e);return b(e.local?h:i)};a.remove=function(){return b(function(e){var c=e.parentNode;c.removeChild(e);return c})};a.sort=function(e){e=Fa.apply(this,arguments);for(var c=0,i=a.length;c<i;c++){var h=a[c];h.sort(e);for(var g=1,k=h.length,j=h[0];g<k;g++){var o=h[g];if(o){j&&j.parentNode.insertBefore(o,j.nextSibling);j=o}}}return a};a.on=function(e,c){var i=e.indexOf("."),h=i==-1?e:e.substring(0,i),g="__on"+e;return a.each(function(k,j){function o(p){var m=d3.event;d3.event=p;try{c.call(this,
+k,j)}finally{d3.event=m}}this[g]&&this.removeEventListener(h,this[g],false);if(c)this.addEventListener(h,this[g]=o,false)})};a.transition=function(){return W(a)};a.call=da;return a}function Ea(a){function b(d){for(var f=[],e,c,i,h,g=0,k=a.length;g<k;g++){i=a[g];f.push(e=[]);e.parentNode=i.parentNode;e.parentData=i.parentData;for(var j=0,o=i.length;j<o;j++)if(h=i[j]){e.push(c=d(i.parentNode));c.__data__=h.__data__}else e.push(null)}return y(f)}a.append=function(d){function f(c){return c.appendChild(document.createElement(d))}
+function e(c){return c.appendChild(document.createElementNS(d.space,d.local))}d=d3.ns.qualify(d);return b(d.local?e:f)};a.insert=function(d,f){function e(i){return i.insertBefore(document.createElement(d),D(f,i))}function c(i){return i.insertBefore(document.createElementNS(d.space,d.local),D(f,i))}d=d3.ns.qualify(d);return b(d.local?c:e)};return a}function Fa(a){if(!arguments.length)a=d3.ascending;return function(b,d){return a(b&&b.__data__,d&&d.__data__)}}function W(a){function b(m){var n=true,l=
+-1;a.each(function(){if(g[++l]!=2){var q=(m-k[l])/j[l],r=this.__transition__,t,u,s=c[l];if(q<1){n=false;if(q<0)return}else q=1;if(g[l]){if(!r||r.active!=f){g[l]=2;return}}else if(!r||r.active>f){g[l]=2;return}else{g[l]=1;h.start.dispatch.apply(this,arguments);s=c[l]={};r.active=f;for(u in e)s[u]=e[u].apply(this,arguments)}t=p(q);for(u in e)s[u].call(this,t);if(q==1){g[l]=2;if(r.active==f){q=r.owner;if(q==f){delete this.__transition__;i&&this.parentNode.removeChild(this)}X=f;h.end.dispatch.apply(this,
+arguments);X=0;r.owner=q}}}});return n}var d={},f=X||++Ga,e={},c=[],i=false,h=d3.dispatch("start","end"),g=[],k=[],j=[],o,p=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=f});d.delay=function(m){var n=Infinity,l=-1;if(typeof m=="function")a.each(function(){var q=k[++l]=+m.apply(this,arguments);if(q<n)n=q});else{n=+m;a.each(function(){k[++l]=n})}Ha(b,n);return d};d.duration=function(m){var n=-1;if(typeof m=="function"){o=0;a.each(function(){var l=j[++n]=
++m.apply(this,arguments);if(l>o)o=l})}else{o=+m;a.each(function(){j[++n]=o})}return d};d.ease=function(m){p=typeof m=="string"?d3.ease(m):m;return d};d.attrTween=function(m,n){function l(r,t){var u=n.call(this,r,t,this.getAttribute(m));return function(s){this.setAttribute(m,u(s))}}function q(r,t){var u=n.call(this,r,t,this.getAttributeNS(m.space,m.local));return function(s){this.setAttributeNS(m.space,m.local,u(s))}}e["attr."+m]=m.local?q:l;return d};d.attr=function(m,n){return d.attrTween(m,ia(n))};
+d.styleTween=function(m,n,l){if(arguments.length<3)l=null;e["style."+m]=function(q,r){var t=n.call(this,q,r,window.getComputedStyle(this,null).getPropertyValue(m));return function(u){this.style.setProperty(m,t(u),l)}};return d};d.style=function(m,n,l){if(arguments.length<3)l=null;return d.styleTween(m,ia(n),l)};d.select=function(m){var n;m=W(a.select(m)).ease(p);n=-1;m.delay(function(){return k[++n]});n=-1;m.duration(function(){return j[++n]});return m};d.selectAll=function(m){var n;m=W(a.selectAll(m)).ease(p);
+n=-1;m.delay(function(l,q){return k[q?n:++n]});n=-1;m.duration(function(l,q){return j[q?n:++n]});return m};d.remove=function(){i=true;return d};d.each=function(m,n){h[m].add(n);return d};d.call=da;return d.delay(0).duration(250)}function ia(a){return typeof a=="function"?function(b,d,f){return d3.interpolate(f,String(a.call(this,b,d)))}:(a=String(a),function(b,d,f){return d3.interpolate(f,a)})}function Ha(a,b){var d=Date.now(),f=false,e=d+b,c=F;if(isFinite(b)){for(;c;){if(c.callback==a){c.then=d;
+c.delay=b;f=true}else{var i=c.then+c.delay;if(i<e)e=i}c=c.next}f||(F={callback:a,then:d,delay:b,next:F});if(!J){clearTimeout(Y);Y=setTimeout(Ia,Math.max(24,e-d))}}}function Ia(){J=setInterval(Ja,24);Y=0}function Ja(){for(var a,b=Date.now(),d=F;d;){a=b-d.then;if(a>d.delay)d.flush=d.callback(a);d=d.next}a=null;for(b=F;b;)b=b.flush?a?a.next=b.next:F=b.next:(a=b).next;a||(J=clearInterval(J))}function Ka(a){return a.innerRadius}function La(a){return a.outerRadius}function ja(a){return a.startAngle}function ka(a){return a.endAngle}
+function Z(a,b,d,f){var e=[],c=-1,i=b.length,h=typeof d=="function",g=typeof f=="function",k;if(h&&g)for(;++c<i;)e.push([d.call(a,k=b[c],c),f.call(a,k,c)]);else if(h)for(;++c<i;)e.push([d.call(a,b[c],c),f]);else if(g)for(;++c<i;)e.push([d,f.call(a,b[c],c)]);else for(;++c<i;)e.push([d,f]);return e}function la(a){return a[0]}function ma(a){return a[1]}function H(a){var b=[],d=0,f=a.length,e=a[0];for(b.push(e[0],",",e[1]);++d<f;)b.push("L",(e=a[d])[0],",",e[1]);return b.join("")}function na(a,b){if(b.length<
+1||a.length!=b.length&&a.length!=b.length+2)return H(a);var d=a.length!=b.length,f="",e=a[0],c=a[1],i=b[0],h=i,g=1;if(d){f+="Q"+(c[0]-i[0]*2/3)+","+(c[1]-i[1]*2/3)+","+c[0]+","+c[1];e=a[1];g=2}if(b.length>1){h=b[1];c=a[g];g++;f+="C"+(e[0]+i[0])+","+(e[1]+i[1])+","+(c[0]-h[0])+","+(c[1]-h[1])+","+c[0]+","+c[1];for(e=2;e<b.length;e++,g++){c=a[g];h=b[e];f+="S"+(c[0]-h[0])+","+(c[1]-h[1])+","+c[0]+","+c[1]}}if(d){d=a[g];f+="Q"+(c[0]+h[0]*2/3)+","+(c[1]+h[1]*2/3)+","+d[0]+","+d[1]}return f}function oa(a,
+b){for(var d=[],f=(1-b)/2,e=a[0],c=a[1],i=a[2],h=2,g=a.length;++h<g;){d.push([f*(i[0]-e[0]),f*(i[1]-e[1])]);e=c;c=i;i=a[h]}d.push([f*(i[0]-e[0]),f*(i[1]-e[1])]);return d}function B(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function K(a,b,d){a.push("C",B(pa,b),",",B(pa,d),",",B(qa,b),",",B(qa,d),",",B(L,b),",",B(L,d))}function Ma(){return 0}function Na(a){return a.source}function Oa(a){return a.target}function Pa(a){return a.radius}function Qa(){return 64}function Ra(){return"circle"}d3=
+{version:"1.0.0"};if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=function(a){function b(){}b.prototype=a;return new b};d3.ascending=function(a,b){return a<b?-1:a>b?1:0};d3.descending=function(a,b){return b<a?-1:b>a?1:0};d3.min=function(a,b){var d=0,f=a.length,e=a[0],c;if(arguments.length==1)for(;++d<f;){if(e>(c=a[d]))e=c}else for(e=b(a[0]);++d<f;)if(e>(c=b(a[d])))e=c;return e};d3.max=function(a,b){var d=0,f=a.length,e=a[0],c;if(arguments.length==1)for(;++d<f;){if(e<
+(c=a[d]))e=c}else for(e=b(e);++d<f;)if(e<(c=b(a[d])))e=c;return e};d3.nest=function(){function a(c,i){if(c>=d.length)return e?e.call(b,i):f?i.sort(f):i;for(var h=-1,g=i.length,k=d[c],j,o=[],p,m={};++h<g;)if((j=k(p=i[h]))in m)m[j].push(p);else{m[j]=[p];o.push(j)}c++;h=-1;for(g=o.length;++h<g;){p=m[j=o[h]];m[j]=a(c,p)}return m}var b={},d=[],f,e;b.map=function(c){return a(0,c)};b.key=function(c){d.push(c);return b};b.sortKeys=function(){return b};b.sortValues=function(c){f=c;return b};b.rollup=function(c){e=
+c;return b};return b};d3.keys=function(a){var b=[],d;for(d in a)b.push(d);return b};d3.values=function(a){var b=[],d;for(d in a)b.push(a[d]);return b};d3.entries=function(a){var b=[],d;for(d in a)b.push({key:d,value:a[d]});return b};d3.merge=function(a){return Array.prototype.concat.apply([],a)};d3.split=function(a,b){var d=[],f=[],e,c=-1,i=a.length;if(arguments.length<2)b=ua;for(;++c<i;)if(b.call(f,e=a[c],c))f=[];else{f.length||d.push(f);f.push(e)}return d};d3.range=function(a,b,d){if(arguments.length==
+1){b=a;a=0}if(d==null)d=1;if((b-a)/d==Infinity)throw Error("infinite range");var f=[],e=-1,c;if(d<0)for(;(c=a+d*++e)>b;)f.push(c);else for(;(c=a+d*++e)<b;)f.push(c);return f};d3.requote=function(a){return a.replace(Sa,"\\$&")};var Sa=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.xhr=function(a,b,d){var f=new XMLHttpRequest;if(arguments.length<3)d=b;else b&&f.overrideMimeType(b);f.open("GET",a,true);f.onreadystatechange=function(){if(f.readyState==4)d(f.status<300?f:null)};f.send(null)};d3.text=function(a,b,
+d){if(arguments.length<3){d=b;b=null}d3.xhr(a,b,function(f){d(f&&f.responseText)})};d3.json=function(a,b){d3.text(a,"application/json",function(d){b(d?JSON.parse(d):null)})};d3.html=function(a,b){d3.text(a,"text/html",function(d){if(d!=null){var f=document.createRange();f.selectNode(document.body);d=f.createContextualFragment(d)}b(d)})};d3.xml=function(a,b,d){if(arguments.length<3){d=b;b=null}d3.xhr(a,b,function(f){d(f&&f.responseXML)})};d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",
+xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}};d3.dispatch=function(){for(var a={},b,d=0,f=arguments.length;d<f;d++){b=arguments[d];a[b]=va(b)}return a};d3.format=function(a){a=Ta.exec(a);var b=a[1]||" ",d=ra[a[3]]||ra["-"],f=a[5],e=+a[6],c=a[7],i=a[8],h=a[9];if(i)i=i.substring(1);if(f)b="0";if(h=="d")i="0";return function(g){g=
++g;var k=g<0&&(g=-g);if(h=="d"&&g%1)return"";g=i?g.toFixed(i):""+g;if(c){for(var j=g.lastIndexOf("."),o=j>=0?g.substring(j):(j=g.length,""),p=[];j>0;)p.push(g.substring(j-=3,j+3));g=p.reverse().join(",")+o}k=(g=d(k,g)).length;if(k<e)g=Array(e-k+1).join(b)+g;return g}};var Ta=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,ra={"+":function(a,b){return(a?"−":"+")+b}," ":function(a,b){return(a?"−":" ")+b},"-":function(a,b){return a?""+b:b}},Ua=R(2),Va=R(3),Wa={linear:function(){return wa},
+poly:R,quad:function(){return Ua},cubic:function(){return Va},sin:function(){return xa},exp:function(){return ya},circle:function(){return za},elastic:function(a,b){var d;if(arguments.length<2)b=0.45;if(arguments.length<1){a=1;d=b/4}else d=b/(2*Math.PI)*Math.asin(1/a);return function(f){return 1+a*Math.pow(2,10*-f)*Math.sin((f-d)*2*Math.PI/b)}},back:function(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}},bounce:function(){return Aa}},Xa={"in":function(a){return a},out:ea,"in-out":fa,
+"out-in":function(a){return fa(ea(a))}};d3.ease=function(a){var b=a.indexOf("-"),d=b>=0?a.substring(0,b):a;b=b>=0?a.substring(b+1):"in";return Xa[b](Wa[d].apply(null,Array.prototype.slice.call(arguments,1)))};d3.event=null;d3.interpolate=function(a,b){if(typeof b=="number")return d3.interpolateNumber(+a,b);if(typeof b=="string")return b in G||/^(#|rgb\(|hsl\()/.test(b)?d3.interpolateRgb(String(a),b):d3.interpolateString(String(a),b);if(b instanceof Array)return d3.interpolateArray(a,b);return d3.interpolateObject(a,
+b)};d3.interpolateNumber=function(a,b){b-=a;return function(d){return a+b*d}};d3.interpolateRound=function(a,b){b-=a;return function(d){return Math.round(a+b*d)}};d3.interpolateString=function(a,b){var d,f,e=0,c=[],i=[],h,g;for(f=0;d=$.exec(b);++f){d.index&&c.push(b.substring(e,d.index));i.push({i:c.length,x:d[0]});c.push(null);e=$.lastIndex}e<b.length&&c.push(b.substring(e));f=0;for(h=i.length;(d=$.exec(a))&&f<h;++f){g=i[f];if(g.x==d[0]){if(g.i)if(c[g.i+1]==null){c[g.i-1]+=g.x;c.splice(g.i,1);for(d=
+f+1;d<h;++d)i[d].i--}else{c[g.i-1]+=g.x+c[g.i+1];c.splice(g.i,2);for(d=f+1;d<h;++d)i[d].i-=2}else if(c[g.i+1]==null)c[g.i]=g.x;else{c[g.i]=g.x+c[g.i+1];c.splice(g.i+1,1);for(d=f+1;d<h;++d)i[d].i--}i.splice(f,1);h--;f--}else g.x=d3.interpolateNumber(parseFloat(d[0]),parseFloat(g.x))}for(;f<h;){g=i.pop();if(c[g.i+1]==null)c[g.i]=g.x;else{c[g.i]=g.x+c[g.i+1];c.splice(g.i+1,1)}h--}if(c.length==1)return c[0]==null?i[0].x:function(){return b};return function(k){for(f=0;f<h;++f)c[(g=i[f]).i]=g.x(k);return c.join("")}};
+d3.interpolateRgb=function(a,b){a=d3.rgb(a);b=d3.rgb(b);var d=a.r,f=a.g,e=a.b,c=b.r-d,i=b.g-f,h=b.b-e;return function(g){return"rgb("+Math.round(d+c*g)+","+Math.round(f+i*g)+","+Math.round(e+h*g)+")"}};d3.interpolateArray=function(a,b){var d=[],f=[],e=a.length,c=b.length,i=Math.min(a.length,b.length),h;for(h=0;h<i;++h)d.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)f[h]=a[h];for(;h<c;++h)f[h]=b[h];return function(g){for(h=0;h<i;++h)f[h]=d[h](g);return f}};d3.interpolateObject=function(a,b){var d={},
+f={},e;for(e in a)if(e in b)d[e]=(e in Ya||/\bcolor\b/.test(e)?d3.interpolateRgb:d3.interpolate)(a[e],b[e]);else f[e]=a[e];for(e in b)e in a||(f[e]=b[e]);return function(c){for(e in d)f[e]=d[e](c);return f}};var $=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,Ya={background:1,fill:1,stroke:1};d3.rgb=function(a,b,d){return arguments.length==1?T(""+a,I,ga):I(~~a,~~b,~~d)};var G={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",
+black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",
+darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",
+hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",
+lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",
+orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",
+snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},aa;for(aa in G)G[aa]=T(G[aa],I,ga);d3.hsl=function(a,b,d){return arguments.length==1?T(""+a,Ca,V):V(+a,+b,+d)};var D=function(a,b){return b.querySelector(a)},ha=function(a,b){return Q(b.querySelectorAll(a))};if(typeof Sizzle=="function"){D=function(a,
+b){return Sizzle(a,b)[0]};ha=Sizzle}var M=y([[document]]);M[0].parentNode=document.documentElement;d3.select=function(a){return typeof a=="string"?M.select(a):y([[a]])};d3.selectAll=function(a){return typeof a=="string"?M.selectAll(a):y([Q(a)])};d3.transition=M.transition;var Ga=0,X=0,F=null,Y=0,J;d3.scale={};d3.scale.linear=function(){function a(j){return k((j-d)*i)}function b(j){var o=Math.min(d,f),p=Math.max(d,f),m=p-o,n=Math.pow(10,Math.floor(Math.log(m/j)/Math.LN10));j=j/(m/n);if(j<=0.15)n*=
+10;else if(j<=0.35)n*=5;else if(j<=0.75)n*=2;return{start:Math.ceil(o/n)*n,stop:Math.floor(p/n)*n+n*0.5,step:n}}var d=0,f=1,e=0,c=1,i=1/(f-d),h=(f-d)/(c-e),g=d3.interpolate,k=g(e,c);a.invert=function(j){return(j-e)*h+d};a.domain=function(j){if(!arguments.length)return[d,f];d=j[0];f=j[1];i=1/(f-d);h=(f-d)/(c-e);return a};a.range=function(j){if(!arguments.length)return[e,c];e=j[0];c=j[1];h=(f-d)/(c-e);k=g(e,c);return a};a.rangeRound=function(j){return a.range(j).interpolate(d3.interpolateRound)};a.interpolate=
+function(j){if(!arguments.length)return g;k=(g=j)(e,c);return a};a.ticks=function(j){j=b(j);return d3.range(j.start,j.stop,j.step)};a.tickFormat=function(j){j=Math.max(0,-Math.floor(Math.log(b(j).step)/Math.LN10+0.01));return d3.format(",."+j+"f")};return a};d3.scale.log=function(){function a(c){return(e?-Math.log(-c):Math.log(c))/Math.LN10}function b(c){return e?-Math.pow(10,-c):Math.pow(10,c)}function d(c){return f(a(c))}var f=d3.scale.linear(),e=false;d.invert=function(c){return b(f.invert(c))};
+d.domain=function(c){if(!arguments.length)return f.domain().map(b);e=(c[0]||c[1])<0;f.domain(c.map(a));return d};d.range=C(d,f.range);d.rangeRound=C(d,f.rangeRound);d.interpolate=C(d,f.interpolate);d.ticks=function(){var c=f.domain(),i=[];if(c.every(isFinite)){var h=Math.floor(c[0]),g=Math.ceil(c[1]),k=b(c[0]);c=b(c[1]);if(e)for(i.push(b(h));h++<g;)for(var j=9;j>0;j--)i.push(b(h)*j);else{for(;h<g;h++)for(j=1;j<10;j++)i.push(b(h)*j);i.push(b(h))}for(h=0;i[h]<k;h++);for(g=i.length;i[g-1]>c;g--);i=i.slice(h,
+g)}return i};d.tickFormat=function(){return function(c){return c.toPrecision(1)}};return d};d3.scale.pow=function(){function a(g){return h?-Math.pow(-g,c):Math.pow(g,c)}function b(g){return h?-Math.pow(-g,i):Math.pow(g,i)}function d(g){return f(a(g))}var f=d3.scale.linear(),e=d3.scale.linear(),c=1,i=1/c,h=false;d.invert=function(g){return b(f.invert(g))};d.domain=function(g){if(!arguments.length)return f.domain().map(b);h=(g[0]||g[1])<0;f.domain(g.map(a));e.domain(g);return d};d.range=C(d,f.range);
+d.rangeRound=C(d,f.rangeRound);d.inteprolate=C(d,f.interpolate);d.ticks=e.ticks;d.tickFormat=e.tickFormat;d.exponent=function(g){if(!arguments.length)return c;var k=d.domain();c=g;i=1/g;return d.domain(k)};return d};d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){function a(c){c=c in d?d[c]:d[c]=b.push(c)-1;return f[c%f.length]}var b=[],d={},f=[],e=0;a.domain=function(c){if(!arguments.length)return b;b=c;d={};for(var i=-1,h=-1,g=b.length;++i<g;){c=b[i];c in
+d||(d[c]=++h)}return a};a.range=function(c){if(!arguments.length)return f;f=c;return a};a.rangePoints=function(c,i){if(arguments.length<2)i=0;var h=c[0],g=c[1],k=(g-h)/(b.length-1+i);f=b.length==1?[(h+g)/2]:d3.range(h+k*i/2,g+k/2,k);e=0;return a};a.rangeBands=function(c,i){if(arguments.length<2)i=0;var h=c[0],g=c[1],k=(g-h)/(b.length+i);f=d3.range(h+k*i,g,k);e=k*(1-i);return a};a.rangeRoundBands=function(c,i){if(arguments.length<2)i=0;var h=c[0],g=c[1],k=g-h,j=Math.floor(k/(b.length+i));f=d3.range(h+
+Math.round((k-(b.length-i)*j)/2),g,j);e=Math.round(j*(1-i));return a};a.rangeBand=function(){return e};return a};d3.scale.category10=function(){return d3.scale.ordinal().range(Za)};d3.scale.category20=function(){return d3.scale.ordinal().range($a)};d3.scale.category20b=function(){return d3.scale.ordinal().range(ab)};d3.scale.category20c=function(){return d3.scale.ordinal().range(bb)};var Za=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],$a=["#1f77b4",
+"#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],ab=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bb=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b",
+"#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function a(){for(var i=-1,h=c.length=e.length,g=f.length/h;++i<h;)c[i]=f[~~(i*g)]}function b(i){if(isNaN(i=+i))return NaN;for(var h=0,g=c.length-1;h<=g;){var k=h+g>>1,j=c[k];if(j<i)h=k+1;else if(j>i)g=k-1;else return k}return g<0?0:g}function d(i){return e[b(i)]}var f=[],e=[],c=[];d.domain=function(i){if(!arguments.length)return f;f=i.filter(function(h){return!isNaN(h)}).sort(d3.ascending);
+a();return d};d.range=function(i){if(!arguments.length)return e;e=i;a();return d};d.quantiles=function(){return c};return d};d3.scale.quantize=function(){function a(i){return c[Math.max(0,Math.min(e,Math.floor(f*(i-b))))]}var b=0,d=1,f=2,e=1,c=[0,1];a.domain=function(i){if(!arguments.length)return[b,d];b=i[0];d=i[1];f=c.length/(d-b);return a};a.range=function(i){if(!arguments.length)return c;c=i;f=c.length/(d-b);e=c.length-1;return a};return a};d3.svg={};d3.svg.arc=function(){function a(c,i){var h=
+b.call(this,c,i),g=d.call(this,c,i),k=f.call(this,c,i)+N,j=e.call(this,c,i)+N,o=j-k,p=o<Math.PI?"0":"1",m=Math.cos(k);k=Math.sin(k);var n=Math.cos(j);j=Math.sin(j);return o>=cb?h?"M0,"+g+"A"+g+","+g+" 0 1,1 0,"+-g+"A"+g+","+g+" 0 1,1 0,"+g+"M0,"+h+"A"+h+","+h+" 0 1,1 0,"+-h+"A"+h+","+h+" 0 1,1 0,"+h+"Z":"M0,"+g+"A"+g+","+g+" 0 1,1 0,"+-g+"A"+g+","+g+" 0 1,1 0,"+g+"Z":h?"M"+g*m+","+g*k+"A"+g+","+g+" 0 "+p+",1 "+g*n+","+g*j+"L"+h*n+","+h*j+"A"+h+","+h+" 0 "+p+",0 "+h*m+","+h*k+"Z":"M"+g*m+","+g*k+"A"+
+g+","+g+" 0 "+p+",1 "+g*n+","+g*j+"L0,0Z"}var b=Ka,d=La,f=ja,e=ka;a.innerRadius=function(c){if(!arguments.length)return b;b=v(c);return a};a.outerRadius=function(c){if(!arguments.length)return d;d=v(c);return a};a.startAngle=function(c){if(!arguments.length)return f;f=v(c);return a};a.endAngle=function(c){if(!arguments.length)return e;e=v(c);return a};return a};var N=-Math.PI/2,cb=2*Math.PI-1.0E-6;d3.svg.line=function(){function a(i){return i.length<1?null:"M"+e(Z(this,i,b,d),c)}var b=la,d=ma,f="linear",
+e=O[f],c=0.7;a.x=function(i){if(!arguments.length)return b;b=i;return a};a.y=function(i){if(!arguments.length)return d;d=i;return a};a.interpolate=function(i){if(!arguments.length)return f;e=O[f=i];return a};a.tension=function(i){if(!arguments.length)return c;c=i;return a};return a};var O={linear:H,basis:function(a){if(a.length<3)return H(a);var b=[],d=1,f=a.length,e=a[0],c=e[0],i=e[1],h=[c,c,c,(e=a[1])[0]],g=[i,i,i,e[1]];b.push(c,",",i);for(K(b,h,g);++d<f;){e=a[d];h.shift();h.push(e[0]);g.shift();
+g.push(e[1]);K(b,h,g)}for(d=-1;++d<2;){h.shift();h.push(e[0]);g.shift();g.push(e[1]);K(b,h,g)}return b.join("")},"basis-closed":function(a){for(var b,d=-1,f=a.length,e=f+4,c,i=[],h=[];++d<4;){c=a[d%f];i.push(c[0]);h.push(c[1])}b=[B(L,i),",",B(L,h)];for(--d;++d<e;){c=a[d%f];i.shift();i.push(c[0]);h.shift();h.push(c[1]);K(b,i,h)}return b.join("")},cardinal:function(a,b){if(a.length<3)return H(a);return a[0]+na(a,oa(a,b))},"cardinal-closed":function(a,b){if(a.length<3)return H(a);return a[0]+na(a,oa([a[a.length-
+2]].concat(a,[a[1]]),b))}},pa=[0,2/3,1/3,0],qa=[0,1/3,2/3,0],L=[0,1/6,2/3,1/6];d3.svg.area=function(){function a(h){return h.length<1?null:"M"+c(Z(this,h,b,f),i)+"L"+c(Z(this,h,b,d).reverse(),i)+"Z"}var b=la,d=Ma,f=ma,e="linear",c=O[e],i=0.7;a.x=function(h){if(!arguments.length)return b;b=h;return a};a.y0=function(h){if(!arguments.length)return d;d=h;return a};a.y1=function(h){if(!arguments.length)return f;f=h;return a};a.interpolate=function(h){if(!arguments.length)return e;c=O[e=h];return a};a.tension=
+function(h){if(!arguments.length)return i;i=h;return a};return a};d3.svg.chord=function(){function a(h,g){var k=b(this,d,h,g),j=b(this,f,h,g);return"M"+k.p0+("A"+k.r+","+k.r+" 0 0,1 "+k.p1)+(k.a0==j.a0&&k.a1==j.a1?"Q 0,0 "+k.p0:"Q 0,0 "+j.p0+("A"+j.r+","+j.r+" 0 0,1 "+j.p1)+("Q 0,0 "+k.p0))+"Z"}function b(h,g,k,j){var o=g.call(h,k,j);g=e.call(h,o,j);k=c.call(h,o,j)+N;h=i.call(h,o,j)+N;return{r:g,a0:k,a1:h,p0:[g*Math.cos(k),g*Math.sin(k)],p1:[g*Math.cos(h),g*Math.sin(h)]}}var d=Na,f=Oa,e=Pa,c=ja,i=
+ka;a.radius=function(h){if(!arguments.length)return e;e=v(h);return a};a.source=function(h){if(!arguments.length)return d;d=v(h);return a};a.target=function(h){if(!arguments.length)return f;f=v(h);return a};a.startAngle=function(h){if(!arguments.length)return c;c=v(h);return a};a.endAngle=function(h){if(!arguments.length)return i;i=v(h);return a};return a};d3.svg.mouse=function(a){var b=(a.ownerSVGElement||a).createSVGPoint();if(ba<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position",
+"absolute").style("top",0).style("left",0),f=d[0][0].getScreenCTM();ba=!(f.f||f.e);d.remove()}if(ba){b.x=d3.event.pageX;b.y=d3.event.pageY}else{b.x=d3.event.clientX;b.y=d3.event.clientY}b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var ba=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.symbol=function(){function a(f,e){return(sa[b.call(this,f,e)]||sa.circle)(d.call(this,f,e))}var b=Ra,d=Qa;a.type=function(f){if(!arguments.length)return b;b=v(f);return a};a.size=function(f){if(!arguments.length)return d;
+d=v(f);return a};return a};d3.svg.symbolTypes=["circle","cross","diamond","square","triangle-down","triangle-up"];var sa={circle:function(a){a=Math.sqrt(a/Math.PI);return"M0,"+a+"A"+a+","+a+" 0 1,1 0,"+-a+"A"+a+","+a+" 0 1,1 0,"+a+"Z"},cross:function(a){a=Math.sqrt(a/5)/2;return"M"+-3*a+","+-a+"H"+-a+"V"+-3*a+"H"+a+"V"+-a+"H"+3*a+"V"+a+"H"+a+"V"+3*a+"H"+-a+"V"+a+"H"+-3*a+"Z"},diamond:function(a){a=Math.sqrt(a/(2*ta));var b=a*ta;return"M0,"+-a+"L"+b+",0 0,"+a+" "+-b+",0Z"},square:function(a){a=Math.sqrt(a)/
+2;return"M"+-a+","+-a+"L"+a+","+-a+" "+a+","+a+" "+-a+","+a+"Z"},"triangle-down":function(a){a=Math.sqrt(a/P);var b=a*P/2;return"M0,"+b+"L"+a+","+-b+" "+-a+","+-b+"Z"},"triangle-up":function(a){a=Math.sqrt(a/P);var b=a*P/2;return"M0,"+-b+"L"+a+","+b+" "+-a+","+b+"Z"}},P=Math.sqrt(3),ta=Math.tan(30*Math.PI/180)})();
View
27 examples/sizzle/sizzle.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Sizzle</title>
+ <script type="text/javascript" src="../../lib/sizzle/sizzle.js"></script>
+ <script type="text/javascript" src="../../d3.js"></script>
+ <style type="text/css">
+
+body {
+ margin: 2em;
+ text-align: center;
+ font: 300 36px helvetica neue;
+}
+
+ </style>
+ </head>
+ <body>
+ Sizzle.js disabled.
+ <script type="text/javascript">
+
+// The :first psuedo-class is a custom Sizzle extension.
+d3.select("body:first")
+ .html("Sizzle.js enabled!");
+
+ </script>
+ </body>
+</html>
View
1  examples/stream/stack.html
@@ -2,6 +2,7 @@
<html>
<head>
<title>Stacked Bar Chart</title>
+ <script type="text/javascript" src="../../lib/sizzle/sizzle.js"></script>
<script type="text/javascript" src="../../d3.js"></script>
<script type="text/javascript" src="../../d3.layout.js"></script>
<script type="text/javascript" src="stream.js"></script>
View
6,883 lib/jquery/jquery.js
6,883 additions, 0 deletions not shown
View
24 lib/sizzle/LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2009, John Resig
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the <organization> nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY John Resig ''AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
1,376 lib/sizzle/sizzle.js
@@ -0,0 +1,1376 @@
+/*!
+ * Sizzle CSS Selector Engine
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){
+
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+ done = 0,
+ toString = Object.prototype.toString,
+ hasDuplicate = false,
+ baseHasDuplicate = true;
+
+// Here we check if the JavaScript engine is using some sort of
+// optimization where it does not always call our comparision
+// function. If that is the case, discard the hasDuplicate value.
+// Thus far that includes Google Chrome.
+[0, 0].sort(function() {
+ baseHasDuplicate = false;
+ return 0;
+});
+
+var Sizzle = function( selector, context, results, seed ) {
+ results = results || [];
+ context = context || document;
+
+ var origContext = context;
+
+ if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
+ return [];
+ }
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ var m, set, checkSet, extra, ret, cur, pop, i,
+ prune = true,
+ contextXML = Sizzle.isXML( context ),
+ parts = [],
+ soFar = selector;
+
+ // Reset the position of the chunker regexp (start from head)
+ do {
+ chunker.exec( "" );
+ m = chunker.exec( soFar );
+
+ if ( m ) {
+ soFar = m[3];
+
+ parts.push( m[1] );
+
+ if ( m[2] ) {
+ extra = m[3];
+ break;
+ }
+ }
+ } while ( m );
+
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {
+
+ if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
+ set = posProcess( parts[0] + parts[1], context );
+
+ } else {
+ set = Expr.relative[ parts[0] ] ?
+ [ context ] :
+ Sizzle( parts.shift(), context );
+
+ while ( parts.length ) {
+ selector = parts.shift();
+
+ if ( Expr.relative[ selector ] ) {
+ selector += parts.shift();
+ }
+
+ set = posProcess( selector, set );
+ }
+ }
+
+ } else {
+ // Take a shortcut and set the context if the root selector is an ID
+ // (but not if it'll be faster if the inner selector is an ID)
+ if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
+ Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
+
+ ret = Sizzle.find( parts.shift(), context, contextXML );
+ context = ret.expr ?
+ Sizzle.filter( ret.expr, ret.set )[0] :
+ ret.set[0];
+ }
+
+ if ( context ) {
+ ret = seed ?
+ { expr: parts.pop(), set: makeArray(seed) } :
+ Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
+
+ set = ret.expr ?
+ Sizzle.filter( ret.expr, ret.set ) :
+ ret.set;
+
+ if ( parts.length > 0 ) {
+ checkSet = makeArray( set );
+
+ } else {
+ prune = false;
+ }
+
+ while ( parts.length ) {
+ cur = parts.pop();
+ pop = cur;
+
+ if ( !Expr.relative[ cur ] ) {
+ cur = "";
+ } else {
+ pop = parts.pop();
+ }
+
+ if ( pop == null ) {
+ pop = context;
+ }
+
+ Expr.relative[ cur ]( checkSet, pop, contextXML );
+ }
+
+ } else {
+ checkSet = parts = [];
+ }
+ }
+
+ if ( !checkSet ) {
+ checkSet = set;
+ }
+
+ if ( !checkSet ) {
+ Sizzle.error( cur || selector );
+ }
+
+ if ( toString.call(checkSet) === "[object Array]" ) {
+ if ( !prune ) {
+ results.push.apply( results, checkSet );
+
+ } else if ( context && context.nodeType === 1 ) {
+ for ( i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
+ results.push( set[i] );
+ }
+ }
+
+ } else {
+ for ( i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
+ results.push( set[i] );
+ }
+ }
+ }
+
+ } else {
+ makeArray( checkSet, results );
+ }
+
+ if ( extra ) {
+ Sizzle( extra, origContext, results, seed );
+ Sizzle.uniqueSort( results );
+ }
+
+ return results;
+};
+
+Sizzle.uniqueSort = function( results ) {
+ if ( sortOrder ) {
+ hasDuplicate = baseHasDuplicate;
+ results.sort( sortOrder );
+
+ if ( hasDuplicate ) {
+ for ( var i = 1; i < results.length; i++ ) {
+ if ( results[i] === results[ i - 1 ] ) {
+ results.splice( i--, 1 );
+ }
+ }
+ }
+ }
+
+ return results;
+};
+
+Sizzle.matches = function( expr, set ) {
+ return Sizzle( expr, null, null, set );
+};
+
+Sizzle.matchesSelector = function( node, expr ) {
+ return Sizzle( expr, null, null, [node] ).length > 0;
+};
+
+Sizzle.find = function( expr, context, isXML ) {
+ var set;
+
+ if ( !expr ) {
+ return [];
+ }
+
+ for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
+ var match,
+ type = Expr.order[i];
+
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
+ var left = match[1];
+ match.splice( 1, 1 );
+
+ if ( left.substr( left.length - 1 ) !== "\\" ) {
+ match[1] = (match[1] || "").replace(/\\/g, "");
+ set = Expr.find[ type ]( match, context, isXML );
+
+ if ( set != null ) {
+ expr = expr.replace( Expr.match[ type ], "" );
+ break;
+ }
+ }
+ }
+ }
+
+ if ( !set ) {
+ set = typeof context.getElementsByTagName !== "undefined" ?
+ context.getElementsByTagName( "*" ) :
+ [];
+ }
+
+ return { set: set, expr: expr };
+};
+
+Sizzle.filter = function( expr, set, inplace, not ) {
+ var match, anyFound,
+ old = expr,
+ result = [],
+ curLoop = set,
+ isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
+
+ while ( expr && set.length ) {
+ for ( var type in Expr.filter ) {
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
+ var found, item,
+ filter = Expr.filter[ type ],
+ left = match[1];
+
+ anyFound = false;
+
+ match.splice(1,1);
+
+ if ( left.substr( left.length - 1 ) === "\\" ) {
+ continue;
+ }
+
+ if ( curLoop === result ) {
+ result = [];
+ }
+
+ if ( Expr.preFilter[ type ] ) {
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
+
+ if ( !match ) {
+ anyFound = found = true;
+
+ } else if ( match === true ) {
+ continue;
+ }
+ }
+
+ if ( match ) {
+ for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
+ if ( item ) {
+ found = filter( item, match, i, curLoop );
+ var pass = not ^ !!found;
+
+ if ( inplace && found != null ) {
+ if ( pass ) {
+ anyFound = true;
+
+ } else {
+ curLoop[i] = false;
+ }
+
+ } else if ( pass ) {
+ result.push( item );
+ anyFound = true;
+ }
+ }
+ }
+ }
+
+ if ( found !== undefined ) {
+ if ( !inplace ) {
+ curLoop = result;
+ }
+
+ expr = expr.replace( Expr.match[ type ], "" );
+
+ if ( !anyFound ) {
+ return [];
+ }
+
+ break;
+ }
+ }
+ }
+
+ // Improper expression
+ if ( expr === old ) {
+ if ( anyFound == null ) {
+ Sizzle.error( expr );
+
+ } else {
+ break;
+ }
+ }
+
+ old = expr;
+ }
+
+ return curLoop;
+};
+
+Sizzle.error = function( msg ) {
+ throw "Syntax error, unrecognized expression: " + msg;
+};
+
+var Expr = Sizzle.selectors = {
+ order: [ "ID", "NAME", "TAG" ],
+
+ match: {
+ ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+ CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
+ TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
+ CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
+ },
+
+ leftMatch: {},
+
+ attrMap: {
+ "class": "className",
+ "for": "htmlFor"
+ },
+
+ attrHandle: {
+ href: function( elem ) {
+ return elem.getAttribute( "href" );
+ }
+ },
+
+ relative: {
+ "+": function(checkSet, part){
+ var isPartStr = typeof part === "string",
+ isTag = isPartStr && !/\W/.test( part ),
+ isPartStrNotTag = isPartStr && !isTag;
+
+ if ( isTag ) {
+ part = part.toLowerCase();
+ }
+
+ for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
+ if ( (elem = checkSet[i]) ) {
+ while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
+
+ checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
+ elem || false :
+ elem === part;
+ }
+ }
+
+ if ( isPartStrNotTag ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ },
+
+ ">": function( checkSet, part ) {
+ var elem,
+ isPartStr = typeof part === "string",
+ i = 0,
+ l = checkSet.length;
+
+ if ( isPartStr && !/\W/.test( part ) ) {
+ part = part.toLowerCase();
+
+ for ( ; i < l; i++ ) {
+ elem = checkSet[i];
+
+ if ( elem ) {
+ var parent = elem.parentNode;
+ checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
+ }
+ }
+
+ } else {
+ for ( ; i < l; i++ ) {
+ elem = checkSet[i];
+
+ if ( elem ) {
+ checkSet[i] = isPartStr ?
+ elem.parentNode :
+ elem.parentNode === part;
+ }
+ }
+
+ if ( isPartStr ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ }
+ },
+
+ "": function(checkSet, part, isXML){
+ var nodeCheck,
+ doneName = done++,
+ checkFn = dirCheck;
+
+ if ( typeof part === "string" && !/\W/.test(part) ) {
+ part = part.toLowerCase();
+ nodeCheck = part;
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
+ },
+
+ "~": function( checkSet, part, isXML ) {
+ var nodeCheck,
+ doneName = done++,
+ checkFn = dirCheck;
+
+ if ( typeof part === "string" && !/\W/.test( part ) ) {
+ part = part.toLowerCase();
+ nodeCheck = part;
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
+ }
+ },
+
+ find: {
+ ID: function( match, context, isXML ) {
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ return m && m.parentNode ? [m] : [];
+ }
+ },
+
+ NAME: function( match, context ) {
+ if ( typeof context.getElementsByName !== "undefined" ) {
+ var ret = [],
+ results = context.getElementsByName( match[1] );
+
+ for ( var i = 0, l = results.length; i < l; i++ ) {
+ if ( results[i].getAttribute("name") === match[1] ) {
+ ret.push( results[i] );
+ }
+ }
+
+ return ret.length === 0 ? null : ret;
+ }
+ },
+
+ TAG: function( match, context ) {
+ if ( typeof context.getElementsByTagName !== "undefined" ) {
+ return context.getElementsByTagName( match[1] );
+ }
+ }
+ },
+ preFilter: {
+ CLASS: function( match, curLoop, inplace, result, not, isXML ) {
+ match = " " + match[1].replace(/\\/g, "") + " ";
+
+ if ( isXML ) {
+ return match;
+ }
+
+ for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
+ if ( elem ) {
+ if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
+ if ( !inplace ) {
+ result.push( elem );
+ }
+
+ } else if ( inplace ) {
+ curLoop[i] = false;
+ }
+ }
+ }
+
+ return false;
+ },
+
+ ID: function( match ) {
+ return match[1].replace(/\\/g, "");
+ },
+
+ TAG: function( match, curLoop ) {
+ return match[1].toLowerCase();
+ },
+
+ CHILD: function( match ) {
+ if ( match[1] === "nth" ) {
+ if ( !match[2] ) {
+ Sizzle.error( match[0] );
+ }
+
+ match[2] = match[2].replace(/^\+|\s*/g, '');
+
+ // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+ var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
+ match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
+ !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
+
+ // calculate the numbers (first)n+(last) including if they are negative
+ match[2] = (test[1] + (test[2] || 1)) - 0;
+ match[3] = test[3] - 0;
+ }
+ else if ( match[2] ) {
+ Sizzle.error( match[0] );
+ }
+
+ // TODO: Move to normal caching system
+ match[0] = done++;
+
+ return match;
+ },
+
+ ATTR: function( match, curLoop, inplace, result, not, isXML ) {
+ var name = match[1] = match[1].replace(/\\/g, "");
+
+ if ( !isXML && Expr.attrMap[name] ) {
+ match[1] = Expr.attrMap[name];
+ }
+
+ // Handle if an un-quoted value was used
+ match[4] = ( match[4] || match[5] || "" ).replace(/\\/g, "");
+
+ if ( match[2] === "~=" ) {
+ match[4] = " " + match[4] + " ";
+ }
+
+ return match;
+ },
+
+ PSEUDO: function( match, curLoop, inplace, result, not ) {
+ if ( match[1] === "not" ) {
+ // If we're dealing with a complex expression, or a simple one
+ if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
+ match[3] = Sizzle(match[3], null, null, curLoop);
+
+ } else {
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+
+ if ( !inplace ) {
+ result.push.apply( result, ret );
+ }
+
+ return false;
+ }
+
+ } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
+ return true;
+ }
+
+ return match;
+ },
+
+ POS: function( match ) {
+ match.unshift( true );
+
+ return match;
+ }
+ },
+
+ filters: {
+ enabled: function( elem ) {
+ return elem.disabled === false && elem.type !== "hidden";
+ },
+
+ disabled: function( elem ) {
+ return elem.disabled === true;
+ },
+
+ checked: function( elem ) {
+ return elem.checked === true;
+ },
+
+ selected: function( elem ) {
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ elem.parentNode.selectedIndex;
+
+ return elem.selected === true;
+ },
+
+ parent: function( elem ) {
+ return !!elem.firstChild;
+ },
+
+ empty: function( elem ) {
+ return !elem.firstChild;
+ },
+
+ has: function( elem, i, match ) {
+ return !!Sizzle( match[3], elem ).length;
+ },
+
+ header: function( elem ) {
+ return (/h\d/i).test( elem.nodeName );
+ },
+
+ text: function( elem ) {
+ return "text" === elem.type;
+ },
+ radio: function( elem ) {
+ return "radio" === elem.type;
+ },
+
+ checkbox: function( elem ) {
+ return "checkbox" === elem.type;
+ },
+
+ file: function( elem ) {
+ return "file" === elem.type;
+ },
+ password: function( elem ) {
+ return "password" === elem.type;
+ },
+
+ submit: function( elem ) {
+ return "submit" === elem.type;
+ },
+
+ image: function( elem ) {
+ return "image" === elem.type;
+ },
+
+ reset: function( elem ) {
+ return "reset" === elem.type;
+ },
+
+ button: function( elem ) {
+ return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
+ },
+
+ input: function( elem ) {
+ return (/input|select|textarea|button/i).test( elem.nodeName );
+ }
+ },
+ setFilters: {
+ first: function( elem, i ) {
+ return i === 0;
+ },
+
+ last: function( elem, i, match, array ) {
+ return i === array.length - 1;
+ },
+
+ even: function( elem, i ) {
+ return i % 2 === 0;
+ },
+
+ odd: function( elem, i ) {
+ return i % 2 === 1;
+ },
+
+ lt: function( elem, i, match ) {
+ return i < match[3] - 0;
+ },
+
+ gt: function( elem, i, match ) {
+ return i > match[3] - 0;
+ },
+
+ nth: function( elem, i, match ) {
+ return match[3] - 0 === i;
+ },
+
+ eq: function( elem, i, match ) {
+ return match[3] - 0 === i;
+ }
+ },
+ filter: {
+ PSEUDO: function( elem, match, i, array ) {
+ var name = match[1],
+ filter = Expr.filters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+
+ } else if ( name === "contains" ) {
+ return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
+
+ } else if ( name === "not" ) {
+ var not = match[3];
+
+ for ( var j = 0, l = not.length; j < l; j++ ) {
+ if ( not[j] === elem ) {
+ return false;
+ }
+ }
+
+ return true;
+
+ } else {
+ Sizzle.error( name );
+ }
+ },
+
+ CHILD: function( elem, match ) {
+ var type = match[1],
+ node = elem;
+
+ switch ( type ) {
+ case "only":
+ case "first":
+ while ( (node = node.previousSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+
+ if ( type === "first" ) {
+ return true;
+ }
+
+ node = elem;
+
+ case "last":
+ while ( (node = node.nextSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+
+ return true;
+
+ case "nth":
+ var first = match[2],
+ last = match[3];
+
+ if ( first === 1 && last === 0 ) {
+ return true;
+ }
+
+ var doneName = match[0],
+ parent = elem.parentNode;
+
+ if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
+ var count = 0;
+
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {
+ if ( node.nodeType === 1 ) {
+ node.nodeIndex = ++count;
+ }
+ }
+
+ parent.sizcache = doneName;
+ }
+
+ var diff = elem.nodeIndex - last;
+
+ if ( first === 0 ) {
+ return diff === 0;
+
+ } else {
+ return ( diff % first === 0 && diff / first >= 0 );
+ }
+ }
+ },
+
+ ID: function( elem, match ) {
+ return elem.nodeType === 1 && elem.getAttribute("id") === match;
+ },
+
+ TAG: function( elem, match ) {
+ return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
+ },
+
+ CLASS: function( elem, match ) {
+ return (" " + (elem.className || elem.getAttribute("class")) + " ")
+ .indexOf( match ) > -1;
+ },
+
+ ATTR: function( elem, match ) {
+ var name = match[1],
+ result = Expr.attrHandle[ name ] ?
+ Expr.attrHandle[ name ]( elem ) :
+ elem[ name ] != null ?
+ elem[ name ] :
+ elem.getAttribute( name ),
+ value = result + "",
+ type = match[2],
+ check = match[4];
+
+ return result == null ?
+ type === "!=" :
+ type === "=" ?
+ value === check :
+ type === "*=" ?
+ value.indexOf(check) >= 0 :
+ type === "~=" ?
+ (" " + value + " ").indexOf(check) >= 0 :
+ !check ?
+ value && result !== false :
+ type === "!=" ?
+ value !== check :
+ type === "^=" ?
+ value.indexOf(check) === 0 :
+ type === "$=" ?
+ value.substr(value.length - check.length) === check :
+ type === "|=" ?
+ value === check || value.substr(0, check.length + 1) === check + "-" :
+ false;
+ },
+
+ POS: function( elem, match, i, array ) {
+ var name = match[2],
+ filter = Expr.setFilters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+ }
+ }
+ }
+};
+
+var origPOS = Expr.match.POS,
+ fescape = function(all, num){
+ return "\\" + (num - 0 + 1);
+ };
+
+for ( var type in Expr.match ) {
+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
+}
+
+var makeArray = function( array, results ) {
+ array = Array.prototype.slice.call( array, 0 );
+
+ if ( results ) {
+ results.push.apply( results, array );
+ return results;
+ }
+
+ return array;
+};
+
+// Perform a simple check to determine if the browser is capable of
+// converting a NodeList to an array using builtin methods.
+// Also verifies that the returned array holds DOM nodes
+// (which is not the case in the Blackberry browser)
+try {
+ Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
+
+// Provide a fallback method if it does not work
+} catch( e ) {
+ makeArray = function( array, results ) {
+ var i = 0,
+ ret = results || [];
+
+ if ( toString.call(array) === "[object Array]" ) {
+ Array.prototype.push.apply( ret, array );
+
+ } else {
+ if ( typeof array.length === "number" ) {
+ for ( var l = array.length; i < l; i++ ) {
+ ret.push( array[i] );
+ }
+
+ } else {
+ for ( ; array[i]; i++ ) {
+ ret.push( array[i] );
+ }
+ }
+ }
+
+ return ret;
+ };
+}
+
+var sortOrder, siblingCheck;
+
+if ( document.documentElement.compareDocumentPosition ) {
+ sortOrder = function( a, b ) {
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
+ return a.compareDocumentPosition ? -1 : 1;
+ }
+
+ return a.compareDocumentPosition(b) & 4 ? -1 : 1;
+ };
+
+} else {
+ sortOrder = function( a, b ) {
+ var al, bl,
+ ap = [],
+ bp = [],
+ aup = a.parentNode,
+ bup = b.parentNode,
+ cur = aup;
+
+ // The nodes are identical, we can exit early
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+
+ // If the nodes are siblings (or identical) we can do a quick check
+ } else if ( aup === bup ) {
+ return siblingCheck( a, b );
+
+ // If no parents were found then the nodes are disconnected
+ } else if ( !aup ) {
+ return -1;
+
+ } else if ( !bup ) {
+ return 1;
+ }
+
+ // Otherwise they're somewhere else in the tree so we need
+ // to build up a full list of the parentNodes for comparison
+ while ( cur ) {
+ ap.unshift( cur );
+ cur = cur.parentNode;
+ }
+
+ cur = bup;
+
+ while ( cur ) {
+ bp.unshift( cur );
+ cur = cur.parentNode;
+ }
+
+ al = ap.length;
+ bl = bp.length;
+
+ // Start walking down the tree looking for a discrepancy
+ for ( var i = 0; i < al && i < bl; i++ ) {
+ if ( ap[i] !== bp[i] ) {
+ return siblingCheck( ap[i], bp[i] );
+ }
+ }
+
+ // We ended someplace up the tree so do a sibling check
+ return i === al ?
+ siblingCheck( a, bp[i], -1 ) :
+ siblingCheck( ap[i], b, 1 );
+ };
+
+ siblingCheck = function( a, b, ret ) {
+ if ( a === b ) {
+ return ret;
+ }
+
+ var cur = a.nextSibling;
+
+ while ( cur ) {
+ if ( cur === b ) {
+ return -1;
+ }
+
+ cur = cur.nextSibling;
+ }
+
+ return 1;
+ };
+}
+
+// Utility function for retreiving the text value of an array of DOM nodes
+Sizzle.getText = function( elems ) {
+ var ret = "", elem;
+
+ for ( var i = 0; elems[i]; i++ ) {
+ elem = elems[i];
+
+ // Get the text from text nodes and CDATA nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
+ ret += elem.nodeValue;
+
+ // Traverse everything else, except comment nodes
+ } else if ( elem.nodeType !== 8 ) {
+ ret += Sizzle.getText( elem.childNodes );
+ }
+ }
+
+ return ret;
+};
+
+// Check to see if the browser returns elements by name when
+// querying by getElementById (and provide a workaround)
+(function(){
+ // We're going to inject a fake input element with a specified name
+ var form = document.createElement("div"),
+ id = "script" + (new Date()).getTime(),
+ root = document.documentElement;
+
+ form.innerHTML = "<a name='" + id + "'/>";
+
+ // Inject it into the root element, check its status, and remove it quickly
+ root.insertBefore( form, root.firstChild );
+
+ // The workaround has to do additional checks after a getElementById
+ // Which slows things down for other browsers (hence the branching)
+ if ( document.getElementById( id ) ) {
+ Expr.find.ID = function( match, context, isXML ) {
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+
+ return m ?
+ m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
+ [m] :
+ undefined :
+ [];
+ }
+ };
+
+ Expr.filter.ID = function( elem, match ) {
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
+
+ return elem.nodeType === 1 && node && node.nodeValue === match;
+ };
+ }
+
+ root.removeChild( form );