Initial OpenECOMP policy/engine commit
[policy/engine.git] / ecomp-sdk-app / src / main / webapp / app / fusion / external / d3 / js / d3.v2.js
1 (function() {
2   function d3_class(ctor, properties) {
3     try {
4       for (var key in properties) {
5         Object.defineProperty(ctor.prototype, key, {
6           value: properties[key],
7           enumerable: false
8         });
9       }
10     } catch (e) {
11       ctor.prototype = properties;
12     }
13   }
14   function d3_arrayCopy(pseudoarray) {
15     var i = -1, n = pseudoarray.length, array = [];
16     while (++i < n) array.push(pseudoarray[i]);
17     return array;
18   }
19   function d3_arraySlice(pseudoarray) {
20     return Array.prototype.slice.call(pseudoarray);
21   }
22   function d3_Map() {}
23   function d3_identity(d) {
24     return d;
25   }
26   function d3_this() {
27     return this;
28   }
29   function d3_true() {
30     return true;
31   }
32   function d3_functor(v) {
33     return typeof v === "function" ? v : function() {
34       return v;
35     };
36   }
37   function d3_rebind(target, source, method) {
38     return function() {
39       var value = method.apply(source, arguments);
40       return arguments.length ? target : value;
41     };
42   }
43   function d3_number(x) {
44     return x != null && !isNaN(x);
45   }
46   function d3_zipLength(d) {
47     return d.length;
48   }
49   function d3_splitter(d) {
50     return d == null;
51   }
52   function d3_collapse(s) {
53     return s.trim().replace(/\s+/g, " ");
54   }
55   function d3_range_integerScale(x) {
56     var k = 1;
57     while (x * k % 1) k *= 10;
58     return k;
59   }
60   function d3_dispatch() {}
61   function d3_dispatch_event(dispatch) {
62     function event() {
63       var z = listeners, i = -1, n = z.length, l;
64       while (++i < n) if (l = z[i].on) l.apply(this, arguments);
65       return dispatch;
66     }
67     var listeners = [], listenerByName = new d3_Map;
68     event.on = function(name, listener) {
69       var l = listenerByName.get(name), i;
70       if (arguments.length < 2) return l && l.on;
71       if (l) {
72         l.on = null;
73         listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
74         listenerByName.remove(name);
75       }
76       if (listener) listeners.push(listenerByName.set(name, {
77         on: listener
78       }));
79       return dispatch;
80     };
81     return event;
82   }
83   function d3_format_precision(x, p) {
84     return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1);
85   }
86   function d3_format_typeDefault(x) {
87     return x + "";
88   }
89   function d3_format_group(value) {
90     var i = value.lastIndexOf("."), f = i >= 0 ? value.substring(i) : (i = value.length, ""), t = [];
91     while (i > 0) t.push(value.substring(i -= 3, i + 3));
92     return t.reverse().join(",") + f;
93   }
94   function d3_formatPrefix(d, i) {
95     var k = Math.pow(10, Math.abs(8 - i) * 3);
96     return {
97       scale: i > 8 ? function(d) {
98         return d / k;
99       } : function(d) {
100         return d * k;
101       },
102       symbol: d
103     };
104   }
105   function d3_ease_clamp(f) {
106     return function(t) {
107       return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
108     };
109   }
110   function d3_ease_reverse(f) {
111     return function(t) {
112       return 1 - f(1 - t);
113     };
114   }
115   function d3_ease_reflect(f) {
116     return function(t) {
117       return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t));
118     };
119   }
120   function d3_ease_identity(t) {
121     return t;
122   }
123   function d3_ease_poly(e) {
124     return function(t) {
125       return Math.pow(t, e);
126     };
127   }
128   function d3_ease_sin(t) {
129     return 1 - Math.cos(t * Math.PI / 2);
130   }
131   function d3_ease_exp(t) {
132     return Math.pow(2, 10 * (t - 1));
133   }
134   function d3_ease_circle(t) {
135     return 1 - Math.sqrt(1 - t * t);
136   }
137   function d3_ease_elastic(a, p) {
138     var s;
139     if (arguments.length < 2) p = .45;
140     if (arguments.length < 1) {
141       a = 1;
142       s = p / 4;
143     } else s = p / (2 * Math.PI) * Math.asin(1 / a);
144     return function(t) {
145       return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p);
146     };
147   }
148   function d3_ease_back(s) {
149     if (!s) s = 1.70158;
150     return function(t) {
151       return t * t * ((s + 1) * t - s);
152     };
153   }
154   function d3_ease_bounce(t) {
155     return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
156   }
157   function d3_eventCancel() {
158     d3.event.stopPropagation();
159     d3.event.preventDefault();
160   }
161   function d3_eventSource() {
162     var e = d3.event, s;
163     while (s = e.sourceEvent) e = s;
164     return e;
165   }
166   function d3_eventDispatch(target) {
167     var dispatch = new d3_dispatch, i = 0, n = arguments.length;
168     while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
169     dispatch.of = function(thiz, argumentz) {
170       return function(e1) {
171         try {
172           var e0 = e1.sourceEvent = d3.event;
173           e1.target = target;
174           d3.event = e1;
175           dispatch[e1.type].apply(thiz, argumentz);
176         } finally {
177           d3.event = e0;
178         }
179       };
180     };
181     return dispatch;
182   }
183   function d3_transform(m) {
184     var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
185     if (r0[0] * r1[1] < r1[0] * r0[1]) {
186       r0[0] *= -1;
187       r0[1] *= -1;
188       kx *= -1;
189       kz *= -1;
190     }
191     this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees;
192     this.translate = [ m.e, m.f ];
193     this.scale = [ kx, ky ];
194     this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0;
195   }
196   function d3_transformDot(a, b) {
197     return a[0] * b[0] + a[1] * b[1];
198   }
199   function d3_transformNormalize(a) {
200     var k = Math.sqrt(d3_transformDot(a, a));
201     if (k) {
202       a[0] /= k;
203       a[1] /= k;
204     }
205     return k;
206   }
207   function d3_transformCombine(a, b, k) {
208     a[0] += k * b[0];
209     a[1] += k * b[1];
210     return a;
211   }
212   function d3_interpolateByName(name) {
213     return name == "transform" ? d3.interpolateTransform : d3.interpolate;
214   }
215   function d3_uninterpolateNumber(a, b) {
216     b = b - (a = +a) ? 1 / (b - a) : 0;
217     return function(x) {
218       return (x - a) * b;
219     };
220   }
221   function d3_uninterpolateClamp(a, b) {
222     b = b - (a = +a) ? 1 / (b - a) : 0;
223     return function(x) {
224       return Math.max(0, Math.min(1, (x - a) * b));
225     };
226   }
227   function d3_rgb(r, g, b) {
228     return new d3_Rgb(r, g, b);
229   }
230   function d3_Rgb(r, g, b) {
231     this.r = r;
232     this.g = g;
233     this.b = b;
234   }
235   function d3_rgb_hex(v) {
236     return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);
237   }
238   function d3_rgb_parse(format, rgb, hsl) {
239     var r = 0, g = 0, b = 0, m1, m2, name;
240     m1 = /([a-z]+)\((.*)\)/i.exec(format);
241     if (m1) {
242       m2 = m1[2].split(",");
243       switch (m1[1]) {
244        case "hsl":
245         {
246           return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);
247         }
248        case "rgb":
249         {
250           return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));
251         }
252       }
253     }
254     if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);
255     if (format != null && format.charAt(0) === "#") {
256       if (format.length === 4) {
257         r = format.charAt(1);
258         r += r;
259         g = format.charAt(2);
260         g += g;
261         b = format.charAt(3);
262         b += b;
263       } else if (format.length === 7) {
264         r = format.substring(1, 3);
265         g = format.substring(3, 5);
266         b = format.substring(5, 7);
267       }
268       r = parseInt(r, 16);
269       g = parseInt(g, 16);
270       b = parseInt(b, 16);
271     }
272     return rgb(r, g, b);
273   }
274   function d3_rgb_hsl(r, g, b) {
275     var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2;
276     if (d) {
277       s = l < .5 ? d / (max + min) : d / (2 - max - min);
278       if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4;
279       h *= 60;
280     } else {
281       s = h = 0;
282     }
283     return d3_hsl(h, s, l);
284   }
285   function d3_rgb_lab(r, g, b) {
286     r = d3_rgb_xyz(r);
287     g = d3_rgb_xyz(g);
288     b = d3_rgb_xyz(b);
289     var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z);
290     return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
291   }
292   function d3_rgb_xyz(r) {
293     return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4);
294   }
295   function d3_rgb_parseNumber(c) {
296     var f = parseFloat(c);
297     return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
298   }
299   function d3_hsl(h, s, l) {
300     return new d3_Hsl(h, s, l);
301   }
302   function d3_Hsl(h, s, l) {
303     this.h = h;
304     this.s = s;
305     this.l = l;
306   }
307   function d3_hsl_rgb(h, s, l) {
308     function v(h) {
309       if (h > 360) h -= 360; else if (h < 0) h += 360;
310       if (h < 60) return m1 + (m2 - m1) * h / 60;
311       if (h < 180) return m2;
312       if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
313       return m1;
314     }
315     function vv(h) {
316       return Math.round(v(h) * 255);
317     }
318     var m1, m2;
319     h = h % 360;
320     if (h < 0) h += 360;
321     s = s < 0 ? 0 : s > 1 ? 1 : s;
322     l = l < 0 ? 0 : l > 1 ? 1 : l;
323     m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
324     m1 = 2 * l - m2;
325     return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
326   }
327   function d3_hcl(h, c, l) {
328     return new d3_Hcl(h, c, l);
329   }
330   function d3_Hcl(h, c, l) {
331     this.h = h;
332     this.c = c;
333     this.l = l;
334   }
335   function d3_hcl_lab(h, c, l) {
336     return d3_lab(l, Math.cos(h *= Math.PI / 180) * c, Math.sin(h) * c);
337   }
338   function d3_lab(l, a, b) {
339     return new d3_Lab(l, a, b);
340   }
341   function d3_Lab(l, a, b) {
342     this.l = l;
343     this.a = a;
344     this.b = b;
345   }
346   function d3_lab_rgb(l, a, b) {
347     var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
348     x = d3_lab_xyz(x) * d3_lab_X;
349     y = d3_lab_xyz(y) * d3_lab_Y;
350     z = d3_lab_xyz(z) * d3_lab_Z;
351     return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z));
352   }
353   function d3_lab_hcl(l, a, b) {
354     return d3_hcl(Math.atan2(b, a) / Math.PI * 180, Math.sqrt(a * a + b * b), l);
355   }
356   function d3_lab_xyz(x) {
357     return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
358   }
359   function d3_xyz_lab(x) {
360     return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
361   }
362   function d3_xyz_rgb(r) {
363     return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055));
364   }
365   function d3_selection(groups) {
366     d3_arraySubclass(groups, d3_selectionPrototype);
367     return groups;
368   }
369   function d3_selection_selector(selector) {
370     return function() {
371       return d3_select(selector, this);
372     };
373   }
374   function d3_selection_selectorAll(selector) {
375     return function() {
376       return d3_selectAll(selector, this);
377     };
378   }
379   function d3_selection_attr(name, value) {
380     function attrNull() {
381       this.removeAttribute(name);
382     }
383     function attrNullNS() {
384       this.removeAttributeNS(name.space, name.local);
385     }
386     function attrConstant() {
387       this.setAttribute(name, value);
388     }
389     function attrConstantNS() {
390       this.setAttributeNS(name.space, name.local, value);
391     }
392     function attrFunction() {
393       var x = value.apply(this, arguments);
394       if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);
395     }
396     function attrFunctionNS() {
397       var x = value.apply(this, arguments);
398       if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);
399     }
400     name = d3.ns.qualify(name);
401     return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;
402   }
403   function d3_selection_classedRe(name) {
404     return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g");
405   }
406   function d3_selection_classed(name, value) {
407     function classedConstant() {
408       var i = -1;
409       while (++i < n) name[i](this, value);
410     }
411     function classedFunction() {
412       var i = -1, x = value.apply(this, arguments);
413       while (++i < n) name[i](this, x);
414     }
415     name = name.trim().split(/\s+/).map(d3_selection_classedName);
416     var n = name.length;
417     return typeof value === "function" ? classedFunction : classedConstant;
418   }
419   function d3_selection_classedName(name) {
420     var re = d3_selection_classedRe(name);
421     return function(node, value) {
422       if (c = node.classList) return value ? c.add(name) : c.remove(name);
423       var c = node.className, cb = c.baseVal != null, cv = cb ? c.baseVal : c;
424       if (value) {
425         re.lastIndex = 0;
426         if (!re.test(cv)) {
427           cv = d3_collapse(cv + " " + name);
428           if (cb) c.baseVal = cv; else node.className = cv;
429         }
430       } else if (cv) {
431         cv = d3_collapse(cv.replace(re, " "));
432         if (cb) c.baseVal = cv; else node.className = cv;
433       }
434     };
435   }
436   function d3_selection_style(name, value, priority) {
437     function styleNull() {
438       this.style.removeProperty(name);
439     }
440     function styleConstant() {
441       this.style.setProperty(name, value, priority);
442     }
443     function styleFunction() {
444       var x = value.apply(this, arguments);
445       if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority);
446     }
447     return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant;
448   }
449   function d3_selection_property(name, value) {
450     function propertyNull() {
451       delete this[name];
452     }
453     function propertyConstant() {
454       this[name] = value;
455     }
456     function propertyFunction() {
457       var x = value.apply(this, arguments);
458       if (x == null) delete this[name]; else this[name] = x;
459     }
460     return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant;
461   }
462   function d3_selection_dataNode(data) {
463     return {
464       __data__: data
465     };
466   }
467   function d3_selection_filter(selector) {
468     return function() {
469       return d3_selectMatches(this, selector);
470     };
471   }
472   function d3_selection_sortComparator(comparator) {
473     if (!arguments.length) comparator = d3.ascending;
474     return function(a, b) {
475       return comparator(a && a.__data__, b && b.__data__);
476     };
477   }
478   function d3_selection_on(type, listener, capture) {
479     function onRemove() {
480       var wrapper = this[name];
481       if (wrapper) {
482         this.removeEventListener(type, wrapper, wrapper.$);
483         delete this[name];
484       }
485     }
486     function onAdd() {
487       function wrapper(e) {
488         var o = d3.event;
489         d3.event = e;
490         args[0] = node.__data__;
491         try {
492           listener.apply(node, args);
493         } finally {
494           d3.event = o;
495         }
496       }
497       var node = this, args = arguments;
498       onRemove.call(this);
499       this.addEventListener(type, this[name] = wrapper, wrapper.$ = capture);
500       wrapper._ = listener;
501     }
502     var name = "__on" + type, i = type.indexOf(".");
503     if (i > 0) type = type.substring(0, i);
504     return listener ? onAdd : onRemove;
505   }
506   function d3_selection_each(groups, callback) {
507     for (var j = 0, m = groups.length; j < m; j++) {
508       for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {
509         if (node = group[i]) callback(node, i, j);
510       }
511     }
512     return groups;
513   }
514   function d3_selection_enter(selection) {
515     d3_arraySubclass(selection, d3_selection_enterPrototype);
516     return selection;
517   }
518   function d3_transition(groups, id, time) {
519     d3_arraySubclass(groups, d3_transitionPrototype);
520     var tweens = new d3_Map, event = d3.dispatch("start", "end"), ease = d3_transitionEase;
521     groups.id = id;
522     groups.time = time;
523     groups.tween = function(name, tween) {
524       if (arguments.length < 2) return tweens.get(name);
525       if (tween == null) tweens.remove(name); else tweens.set(name, tween);
526       return groups;
527     };
528     groups.ease = function(value) {
529       if (!arguments.length) return ease;
530       ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments);
531       return groups;
532     };
533     groups.each = function(type, listener) {
534       if (arguments.length < 2) return d3_transition_each.call(groups, type);
535       event.on(type, listener);
536       return groups;
537     };
538     d3.timer(function(elapsed) {
539       return d3_selection_each(groups, function(node, i, j) {
540         function start(elapsed) {
541           if (lock.active > id) return stop();
542           lock.active = id;
543           tweens.forEach(function(key, value) {
544             if (value = value.call(node, d, i)) {
545               tweened.push(value);
546             }
547           });
548           event.start.call(node, d, i);
549           if (!tick(elapsed)) d3.timer(tick, 0, time);
550           return 1;
551         }
552         function tick(elapsed) {
553           if (lock.active !== id) return stop();
554           var t = (elapsed - delay) / duration, e = ease(t), n = tweened.length;
555           while (n > 0) {
556             tweened[--n].call(node, e);
557           }
558           if (t >= 1) {
559             stop();
560             d3_transitionId = id;
561             event.end.call(node, d, i);
562             d3_transitionId = 0;
563             return 1;
564           }
565         }
566         function stop() {
567           if (!--lock.count) delete node.__transition__;
568           return 1;
569         }
570         var tweened = [], delay = node.delay, duration = node.duration, lock = (node = node.node).__transition__ || (node.__transition__ = {
571           active: 0,
572           count: 0
573         }), d = node.__data__;
574         ++lock.count;
575         delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time);
576       });
577     }, 0, time);
578     return groups;
579   }
580   function d3_transition_each(callback) {
581     var id = d3_transitionId, ease = d3_transitionEase, delay = d3_transitionDelay, duration = d3_transitionDuration;
582     d3_transitionId = this.id;
583     d3_transitionEase = this.ease();
584     d3_selection_each(this, function(node, i, j) {
585       d3_transitionDelay = node.delay;
586       d3_transitionDuration = node.duration;
587       callback.call(node = node.node, node.__data__, i, j);
588     });
589     d3_transitionId = id;
590     d3_transitionEase = ease;
591     d3_transitionDelay = delay;
592     d3_transitionDuration = duration;
593     return this;
594   }
595   function d3_tweenNull(d, i, a) {
596     return a != "" && d3_tweenRemove;
597   }
598   function d3_tweenByName(b, name) {
599     return d3.tween(b, d3_interpolateByName(name));
600   }
601   function d3_timer_step() {
602     var elapsed, now = Date.now(), t1 = d3_timer_queue;
603     while (t1) {
604       elapsed = now - t1.then;
605       if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);
606       t1 = t1.next;
607     }
608     var delay = d3_timer_flush() - now;
609     if (delay > 24) {
610       if (isFinite(delay)) {
611         clearTimeout(d3_timer_timeout);
612         d3_timer_timeout = setTimeout(d3_timer_step, delay);
613       }
614       d3_timer_interval = 0;
615     } else {
616       d3_timer_interval = 1;
617       d3_timer_frame(d3_timer_step);
618     }
619   }
620   function d3_timer_flush() {
621     var t0 = null, t1 = d3_timer_queue, then = Infinity;
622     while (t1) {
623       if (t1.flush) {
624         t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;
625       } else {
626         then = Math.min(then, t1.then + t1.delay);
627         t1 = (t0 = t1).next;
628       }
629     }
630     return then;
631   }
632   function d3_mousePoint(container, e) {
633     var svg = container.ownerSVGElement || container;
634     if (svg.createSVGPoint) {
635       var point = svg.createSVGPoint();
636       if (d3_mouse_bug44083 < 0 && (window.scrollX || window.scrollY)) {
637         svg = d3.select(document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0);
638         var ctm = svg[0][0].getScreenCTM();
639         d3_mouse_bug44083 = !(ctm.f || ctm.e);
640         svg.remove();
641       }
642       if (d3_mouse_bug44083) {
643         point.x = e.pageX;
644         point.y = e.pageY;
645       } else {
646         point.x = e.clientX;
647         point.y = e.clientY;
648       }
649       point = point.matrixTransform(container.getScreenCTM().inverse());
650       return [ point.x, point.y ];
651     }
652     var rect = container.getBoundingClientRect();
653     return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
654   }
655   function d3_noop() {}
656   function d3_scaleExtent(domain) {
657     var start = domain[0], stop = domain[domain.length - 1];
658     return start < stop ? [ start, stop ] : [ stop, start ];
659   }
660   function d3_scaleRange(scale) {
661     return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
662   }
663   function d3_scale_nice(domain, nice) {
664     var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;
665     if (x1 < x0) {
666       dx = i0, i0 = i1, i1 = dx;
667       dx = x0, x0 = x1, x1 = dx;
668     }
669     if (nice = nice(x1 - x0)) {
670       domain[i0] = nice.floor(x0);
671       domain[i1] = nice.ceil(x1);
672     }
673     return domain;
674   }
675   function d3_scale_niceDefault() {
676     return Math;
677   }
678   function d3_scale_linear(domain, range, interpolate, clamp) {
679     function rescale() {
680       var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
681       output = linear(domain, range, uninterpolate, interpolate);
682       input = linear(range, domain, uninterpolate, d3.interpolate);
683       return scale;
684     }
685     function scale(x) {
686       return output(x);
687     }
688     var output, input;
689     scale.invert = function(y) {
690       return input(y);
691     };
692     scale.domain = function(x) {
693       if (!arguments.length) return domain;
694       domain = x.map(Number);
695       return rescale();
696     };
697     scale.range = function(x) {
698       if (!arguments.length) return range;
699       range = x;
700       return rescale();
701     };
702     scale.rangeRound = function(x) {
703       return scale.range(x).interpolate(d3.interpolateRound);
704     };
705     scale.clamp = function(x) {
706       if (!arguments.length) return clamp;
707       clamp = x;
708       return rescale();
709     };
710     scale.interpolate = function(x) {
711       if (!arguments.length) return interpolate;
712       interpolate = x;
713       return rescale();
714     };
715     scale.ticks = function(m) {
716       return d3_scale_linearTicks(domain, m);
717     };
718     scale.tickFormat = function(m) {
719       return d3_scale_linearTickFormat(domain, m);
720     };
721     scale.nice = function() {
722       d3_scale_nice(domain, d3_scale_linearNice);
723       return rescale();
724     };
725     scale.copy = function() {
726       return d3_scale_linear(domain, range, interpolate, clamp);
727     };
728     return rescale();
729   }
730   function d3_scale_linearRebind(scale, linear) {
731     return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
732   }
733   function d3_scale_linearNice(dx) {
734     dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
735     return dx && {
736       floor: function(x) {
737         return Math.floor(x / dx) * dx;
738       },
739       ceil: function(x) {
740         return Math.ceil(x / dx) * dx;
741       }
742     };
743   }
744   function d3_scale_linearTickRange(domain, m) {
745     var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step;
746     if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
747     extent[0] = Math.ceil(extent[0] / step) * step;
748     extent[1] = Math.floor(extent[1] / step) * step + step * .5;
749     extent[2] = step;
750     return extent;
751   }
752   function d3_scale_linearTicks(domain, m) {
753     return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
754   }
755   function d3_scale_linearTickFormat(domain, m) {
756     return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f");
757   }
758   function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
759     var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);
760     return function(x) {
761       return i(u(x));
762     };
763   }
764   function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
765     var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;
766     if (domain[k] < domain[0]) {
767       domain = domain.slice().reverse();
768       range = range.slice().reverse();
769     }
770     while (++j <= k) {
771       u.push(uninterpolate(domain[j - 1], domain[j]));
772       i.push(interpolate(range[j - 1], range[j]));
773     }
774     return function(x) {
775       var j = d3.bisect(domain, x, 1, k) - 1;
776       return i[j](u[j](x));
777     };
778   }
779   function d3_scale_log(linear, log) {
780     function scale(x) {
781       return linear(log(x));
782     }
783     var pow = log.pow;
784     scale.invert = function(x) {
785       return pow(linear.invert(x));
786     };
787     scale.domain = function(x) {
788       if (!arguments.length) return linear.domain().map(pow);
789       log = x[0] < 0 ? d3_scale_logn : d3_scale_logp;
790       pow = log.pow;
791       linear.domain(x.map(log));
792       return scale;
793     };
794     scale.nice = function() {
795       linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault));
796       return scale;
797     };
798     scale.ticks = function() {
799       var extent = d3_scaleExtent(linear.domain()), ticks = [];
800       if (extent.every(isFinite)) {
801         var i = Math.floor(extent[0]), j = Math.ceil(extent[1]), u = pow(extent[0]), v = pow(extent[1]);
802         if (log === d3_scale_logn) {
803           ticks.push(pow(i));
804           for (; i++ < j; ) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
805         } else {
806           for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);
807           ticks.push(pow(i));
808         }
809         for (i = 0; ticks[i] < u; i++) {}
810         for (j = ticks.length; ticks[j - 1] > v; j--) {}
811         ticks = ticks.slice(i, j);
812       }
813       return ticks;
814     };
815     scale.tickFormat = function(n, format) {
816       if (arguments.length < 2) format = d3_scale_logFormat;
817       if (arguments.length < 1) return format;
818       var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), e;
819       return function(d) {
820         return d / pow(f(log(d) + e)) <= k ? format(d) : "";
821       };
822     };
823     scale.copy = function() {
824       return d3_scale_log(linear.copy(), log);
825     };
826     return d3_scale_linearRebind(scale, linear);
827   }
828   function d3_scale_logp(x) {
829     return Math.log(x < 0 ? 0 : x) / Math.LN10;
830   }
831   function d3_scale_logn(x) {
832     return -Math.log(x > 0 ? 0 : -x) / Math.LN10;
833   }
834   function d3_scale_pow(linear, exponent) {
835     function scale(x) {
836       return linear(powp(x));
837     }
838     var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);
839     scale.invert = function(x) {
840       return powb(linear.invert(x));
841     };
842     scale.domain = function(x) {
843       if (!arguments.length) return linear.domain().map(powb);
844       linear.domain(x.map(powp));
845       return scale;
846     };
847     scale.ticks = function(m) {
848       return d3_scale_linearTicks(scale.domain(), m);
849     };
850     scale.tickFormat = function(m) {
851       return d3_scale_linearTickFormat(scale.domain(), m);
852     };
853     scale.nice = function() {
854       return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
855     };
856     scale.exponent = function(x) {
857       if (!arguments.length) return exponent;
858       var domain = scale.domain();
859       powp = d3_scale_powPow(exponent = x);
860       powb = d3_scale_powPow(1 / exponent);
861       return scale.domain(domain);
862     };
863     scale.copy = function() {
864       return d3_scale_pow(linear.copy(), exponent);
865     };
866     return d3_scale_linearRebind(scale, linear);
867   }
868   function d3_scale_powPow(e) {
869     return function(x) {
870       return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
871     };
872   }
873   function d3_scale_ordinal(domain, ranger) {
874     function scale(x) {
875       return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length];
876     }
877     function steps(start, step) {
878       return d3.range(domain.length).map(function(i) {
879         return start + step * i;
880       });
881     }
882     var index, range, rangeBand;
883     scale.domain = function(x) {
884       if (!arguments.length) return domain;
885       domain = [];
886       index = new d3_Map;
887       var i = -1, n = x.length, xi;
888       while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
889       return scale[ranger.t].apply(scale, ranger.a);
890     };
891     scale.range = function(x) {
892       if (!arguments.length) return range;
893       range = x;
894       rangeBand = 0;
895       ranger = {
896         t: "range",
897         a: arguments
898       };
899       return scale;
900     };
901     scale.rangePoints = function(x, padding) {
902       if (arguments.length < 2) padding = 0;
903       var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding);
904       range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
905       rangeBand = 0;
906       ranger = {
907         t: "rangePoints",
908         a: arguments
909       };
910       return scale;
911     };
912     scale.rangeBands = function(x, padding, outerPadding) {
913       if (arguments.length < 2) padding = 0;
914       if (arguments.length < 3) outerPadding = padding;
915       var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);
916       range = steps(start + step * outerPadding, step);
917       if (reverse) range.reverse();
918       rangeBand = step * (1 - padding);
919       ranger = {
920         t: "rangeBands",
921         a: arguments
922       };
923       return scale;
924     };
925     scale.rangeRoundBands = function(x, padding, outerPadding) {
926       if (arguments.length < 2) padding = 0;
927       if (arguments.length < 3) outerPadding = padding;
928       var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step;
929       range = steps(start + Math.round(error / 2), step);
930       if (reverse) range.reverse();
931       rangeBand = Math.round(step * (1 - padding));
932       ranger = {
933         t: "rangeRoundBands",
934         a: arguments
935       };
936       return scale;
937     };
938     scale.rangeBand = function() {
939       return rangeBand;
940     };
941     scale.rangeExtent = function() {
942       return d3_scaleExtent(ranger.a[0]);
943     };
944     scale.copy = function() {
945       return d3_scale_ordinal(domain, ranger);
946     };
947     return scale.domain(domain);
948   }
949   function d3_scale_quantile(domain, range) {
950     function rescale() {
951       var k = 0, n = domain.length, q = range.length;
952       thresholds = [];
953       while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
954       return scale;
955     }
956     function scale(x) {
957       if (isNaN(x = +x)) return NaN;
958       return range[d3.bisect(thresholds, x)];
959     }
960     var thresholds;
961     scale.domain = function(x) {
962       if (!arguments.length) return domain;
963       domain = x.filter(function(d) {
964         return !isNaN(d);
965       }).sort(d3.ascending);
966       return rescale();
967     };
968     scale.range = function(x) {
969       if (!arguments.length) return range;
970       range = x;
971       return rescale();
972     };
973     scale.quantiles = function() {
974       return thresholds;
975     };
976     scale.copy = function() {
977       return d3_scale_quantile(domain, range);
978     };
979     return rescale();
980   }
981   function d3_scale_quantize(x0, x1, range) {
982     function scale(x) {
983       return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
984     }
985     function rescale() {
986       kx = range.length / (x1 - x0);
987       i = range.length - 1;
988       return scale;
989     }
990     var kx, i;
991     scale.domain = function(x) {
992       if (!arguments.length) return [ x0, x1 ];
993       x0 = +x[0];
994       x1 = +x[x.length - 1];
995       return rescale();
996     };
997     scale.range = function(x) {
998       if (!arguments.length) return range;
999       range = x;
1000       return rescale();
1001     };
1002     scale.copy = function() {
1003       return d3_scale_quantize(x0, x1, range);
1004     };
1005     return rescale();
1006   }
1007   function d3_scale_threshold(domain, range) {
1008     function scale(x) {
1009       return range[d3.bisect(domain, x)];
1010     }
1011     scale.domain = function(_) {
1012       if (!arguments.length) return domain;
1013       domain = _;
1014       return scale;
1015     };
1016     scale.range = function(_) {
1017       if (!arguments.length) return range;
1018       range = _;
1019       return scale;
1020     };
1021     scale.copy = function() {
1022       return d3_scale_threshold(domain, range);
1023     };
1024     return scale;
1025   }
1026   function d3_scale_identity(domain) {
1027     function identity(x) {
1028       return +x;
1029     }
1030     identity.invert = identity;
1031     identity.domain = identity.range = function(x) {
1032       if (!arguments.length) return domain;
1033       domain = x.map(identity);
1034       return identity;
1035     };
1036     identity.ticks = function(m) {
1037       return d3_scale_linearTicks(domain, m);
1038     };
1039     identity.tickFormat = function(m) {
1040       return d3_scale_linearTickFormat(domain, m);
1041     };
1042     identity.copy = function() {
1043       return d3_scale_identity(domain);
1044     };
1045     return identity;
1046   }
1047   function d3_svg_arcInnerRadius(d) {
1048     return d.innerRadius;
1049   }
1050   function d3_svg_arcOuterRadius(d) {
1051     return d.outerRadius;
1052   }
1053   function d3_svg_arcStartAngle(d) {
1054     return d.startAngle;
1055   }
1056   function d3_svg_arcEndAngle(d) {
1057     return d.endAngle;
1058   }
1059   function d3_svg_line(projection) {
1060     function line(data) {
1061       function segment() {
1062         segments.push("M", interpolate(projection(points), tension));
1063       }
1064       var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);
1065       while (++i < n) {
1066         if (defined.call(this, d = data[i], i)) {
1067           points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);
1068         } else if (points.length) {
1069           segment();
1070           points = [];
1071         }
1072       }
1073       if (points.length) segment();
1074       return segments.length ? segments.join("") : null;
1075     }
1076     var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;
1077     line.x = function(_) {
1078       if (!arguments.length) return x;
1079       x = _;
1080       return line;
1081     };
1082     line.y = function(_) {
1083       if (!arguments.length) return y;
1084       y = _;
1085       return line;
1086     };
1087     line.defined = function(_) {
1088       if (!arguments.length) return defined;
1089       defined = _;
1090       return line;
1091     };
1092     line.interpolate = function(_) {
1093       if (!arguments.length) return interpolateKey;
1094       if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
1095       return line;
1096     };
1097     line.tension = function(_) {
1098       if (!arguments.length) return tension;
1099       tension = _;
1100       return line;
1101     };
1102     return line;
1103   }
1104   function d3_svg_lineX(d) {
1105     return d[0];
1106   }
1107   function d3_svg_lineY(d) {
1108     return d[1];
1109   }
1110   function d3_svg_lineLinear(points) {
1111     return points.join("L");
1112   }
1113   function d3_svg_lineLinearClosed(points) {
1114     return d3_svg_lineLinear(points) + "Z";
1115   }
1116   function d3_svg_lineStepBefore(points) {
1117     var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
1118     while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
1119     return path.join("");
1120   }
1121   function d3_svg_lineStepAfter(points) {
1122     var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
1123     while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
1124     return path.join("");
1125   }
1126   function d3_svg_lineCardinalOpen(points, tension) {
1127     return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension));
1128   }
1129   function d3_svg_lineCardinalClosed(points, tension) {
1130     return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
1131   }
1132   function d3_svg_lineCardinal(points, tension, closed) {
1133     return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));
1134   }
1135   function d3_svg_lineHermite(points, tangents) {
1136     if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {
1137       return d3_svg_lineLinear(points);
1138     }
1139     var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;
1140     if (quad) {
1141       path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];
1142       p0 = points[1];
1143       pi = 2;
1144     }
1145     if (tangents.length > 1) {
1146       t = tangents[1];
1147       p = points[pi];
1148       pi++;
1149       path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
1150       for (var i = 2; i < tangents.length; i++, pi++) {
1151         p = points[pi];
1152         t = tangents[i];
1153         path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
1154       }
1155     }
1156     if (quad) {
1157       var lp = points[pi];
1158       path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];
1159     }
1160     return path;
1161   }
1162   function d3_svg_lineCardinalTangents(points, tension) {
1163     var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;
1164     while (++i < n) {
1165       p0 = p1;
1166       p1 = p2;
1167       p2 = points[i];
1168       tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);
1169     }
1170     return tangents;
1171   }
1172   function d3_svg_lineBasis(points) {
1173     if (points.length < 3) return d3_svg_lineLinear(points);
1174     var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0 ];
1175     d3_svg_lineBasisBezier(path, px, py);
1176     while (++i < n) {
1177       pi = points[i];
1178       px.shift();
1179       px.push(pi[0]);
1180       py.shift();
1181       py.push(pi[1]);
1182       d3_svg_lineBasisBezier(path, px, py);
1183     }
1184     i = -1;
1185     while (++i < 2) {
1186       px.shift();
1187       px.push(pi[0]);
1188       py.shift();
1189       py.push(pi[1]);
1190       d3_svg_lineBasisBezier(path, px, py);
1191     }
1192     return path.join("");
1193   }
1194   function d3_svg_lineBasisOpen(points) {
1195     if (points.length < 4) return d3_svg_lineLinear(points);
1196     var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];
1197     while (++i < 3) {
1198       pi = points[i];
1199       px.push(pi[0]);
1200       py.push(pi[1]);
1201     }
1202     path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
1203     --i;
1204     while (++i < n) {
1205       pi = points[i];
1206       px.shift();
1207       px.push(pi[0]);
1208       py.shift();
1209       py.push(pi[1]);
1210       d3_svg_lineBasisBezier(path, px, py);
1211     }
1212     return path.join("");
1213   }
1214   function d3_svg_lineBasisClosed(points) {
1215     var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];
1216     while (++i < 4) {
1217       pi = points[i % n];
1218       px.push(pi[0]);
1219       py.push(pi[1]);
1220     }
1221     path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
1222     --i;
1223     while (++i < m) {
1224       pi = points[i % n];
1225       px.shift();
1226       px.push(pi[0]);
1227       py.shift();
1228       py.push(pi[1]);
1229       d3_svg_lineBasisBezier(path, px, py);
1230     }
1231     return path.join("");
1232   }
1233   function d3_svg_lineBundle(points, tension) {
1234     var n = points.length - 1;
1235     if (n) {
1236       var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;
1237       while (++i <= n) {
1238         p = points[i];
1239         t = i / n;
1240         p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
1241         p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
1242       }
1243     }
1244     return d3_svg_lineBasis(points);
1245   }
1246   function d3_svg_lineDot4(a, b) {
1247     return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
1248   }
1249   function d3_svg_lineBasisBezier(path, x, y) {
1250     path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
1251   }
1252   function d3_svg_lineSlope(p0, p1) {
1253     return (p1[1] - p0[1]) / (p1[0] - p0[0]);
1254   }
1255   function d3_svg_lineFiniteDifferences(points) {
1256     var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);
1257     while (++i < j) {
1258       m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;
1259     }
1260     m[i] = d;
1261     return m;
1262   }
1263   function d3_svg_lineMonotoneTangents(points) {
1264     var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;
1265     while (++i < j) {
1266       d = d3_svg_lineSlope(points[i], points[i + 1]);
1267       if (Math.abs(d) < 1e-6) {
1268         m[i] = m[i + 1] = 0;
1269       } else {
1270         a = m[i] / d;
1271         b = m[i + 1] / d;
1272         s = a * a + b * b;
1273         if (s > 9) {
1274           s = d * 3 / Math.sqrt(s);
1275           m[i] = s * a;
1276           m[i + 1] = s * b;
1277         }
1278       }
1279     }
1280     i = -1;
1281     while (++i <= j) {
1282       s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
1283       tangents.push([ s || 0, m[i] * s || 0 ]);
1284     }
1285     return tangents;
1286   }
1287   function d3_svg_lineMonotone(points) {
1288     return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
1289   }
1290   function d3_svg_lineRadial(points) {
1291     var point, i = -1, n = points.length, r, a;
1292     while (++i < n) {
1293       point = points[i];
1294       r = point[0];
1295       a = point[1] + d3_svg_arcOffset;
1296       point[0] = r * Math.cos(a);
1297       point[1] = r * Math.sin(a);
1298     }
1299     return points;
1300   }
1301   function d3_svg_area(projection) {
1302     function area(data) {
1303       function segment() {
1304         segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");
1305       }
1306       var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
1307         return x;
1308       } : d3_functor(x1), fy1 = y0 === y1 ? function() {
1309         return y;
1310       } : d3_functor(y1), x, y;
1311       while (++i < n) {
1312         if (defined.call(this, d = data[i], i)) {
1313           points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);
1314           points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);
1315         } else if (points0.length) {
1316           segment();
1317           points0 = [];
1318           points1 = [];
1319         }
1320       }
1321       if (points0.length) segment();
1322       return segments.length ? segments.join("") : null;
1323     }
1324     var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
1325     area.x = function(_) {
1326       if (!arguments.length) return x1;
1327       x0 = x1 = _;
1328       return area;
1329     };
1330     area.x0 = function(_) {
1331       if (!arguments.length) return x0;
1332       x0 = _;
1333       return area;
1334     };
1335     area.x1 = function(_) {
1336       if (!arguments.length) return x1;
1337       x1 = _;
1338       return area;
1339     };
1340     area.y = function(_) {
1341       if (!arguments.length) return y1;
1342       y0 = y1 = _;
1343       return area;
1344     };
1345     area.y0 = function(_) {
1346       if (!arguments.length) return y0;
1347       y0 = _;
1348       return area;
1349     };
1350     area.y1 = function(_) {
1351       if (!arguments.length) return y1;
1352       y1 = _;
1353       return area;
1354     };
1355     area.defined = function(_) {
1356       if (!arguments.length) return defined;
1357       defined = _;
1358       return area;
1359     };
1360     area.interpolate = function(_) {
1361       if (!arguments.length) return interpolateKey;
1362       if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
1363       interpolateReverse = interpolate.reverse || interpolate;
1364       L = interpolate.closed ? "M" : "L";
1365       return area;
1366     };
1367     area.tension = function(_) {
1368       if (!arguments.length) return tension;
1369       tension = _;
1370       return area;
1371     };
1372     return area;
1373   }
1374   function d3_svg_chordSource(d) {
1375     return d.source;
1376   }
1377   function d3_svg_chordTarget(d) {
1378     return d.target;
1379   }
1380   function d3_svg_chordRadius(d) {
1381     return d.radius;
1382   }
1383   function d3_svg_chordStartAngle(d) {
1384     return d.startAngle;
1385   }
1386   function d3_svg_chordEndAngle(d) {
1387     return d.endAngle;
1388   }
1389   function d3_svg_diagonalProjection(d) {
1390     return [ d.x, d.y ];
1391   }
1392   function d3_svg_diagonalRadialProjection(projection) {
1393     return function() {
1394       var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset;
1395       return [ r * Math.cos(a), r * Math.sin(a) ];
1396     };
1397   }
1398   function d3_svg_symbolSize() {
1399     return 64;
1400   }
1401   function d3_svg_symbolType() {
1402     return "circle";
1403   }
1404   function d3_svg_symbolCircle(size) {
1405     var r = Math.sqrt(size / Math.PI);
1406     return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
1407   }
1408   function d3_svg_axisX(selection, x) {
1409     selection.attr("transform", function(d) {
1410       return "translate(" + x(d) + ",0)";
1411     });
1412   }
1413   function d3_svg_axisY(selection, y) {
1414     selection.attr("transform", function(d) {
1415       return "translate(0," + y(d) + ")";
1416     });
1417   }
1418   function d3_svg_axisSubdivide(scale, ticks, m) {
1419     subticks = [];
1420     if (m && ticks.length > 1) {
1421       var extent = d3_scaleExtent(scale.domain()), subticks, i = -1, n = ticks.length, d = (ticks[1] - ticks[0]) / ++m, j, v;
1422       while (++i < n) {
1423         for (j = m; --j > 0; ) {
1424           if ((v = +ticks[i] - j * d) >= extent[0]) {
1425             subticks.push(v);
1426           }
1427         }
1428       }
1429       for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1]; ) {
1430         subticks.push(v);
1431       }
1432     }
1433     return subticks;
1434   }
1435   function d3_behavior_zoomDelta() {
1436     if (!d3_behavior_zoomDiv) {
1437       d3_behavior_zoomDiv = d3.select("body").append("div").style("visibility", "hidden").style("top", 0).style("height", 0).style("width", 0).style("overflow-y", "scroll").append("div").style("height", "2000px").node().parentNode;
1438     }
1439     var e = d3.event, delta;
1440     try {
1441       d3_behavior_zoomDiv.scrollTop = 1e3;
1442       d3_behavior_zoomDiv.dispatchEvent(e);
1443       delta = 1e3 - d3_behavior_zoomDiv.scrollTop;
1444     } catch (error) {
1445       delta = e.wheelDelta || -e.detail * 5;
1446     }
1447     return delta;
1448   }
1449   function d3_layout_bundlePath(link) {
1450     var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ];
1451     while (start !== lca) {
1452       start = start.parent;
1453       points.push(start);
1454     }
1455     var k = points.length;
1456     while (end !== lca) {
1457       points.splice(k, 0, end);
1458       end = end.parent;
1459     }
1460     return points;
1461   }
1462   function d3_layout_bundleAncestors(node) {
1463     var ancestors = [], parent = node.parent;
1464     while (parent != null) {
1465       ancestors.push(node);
1466       node = parent;
1467       parent = parent.parent;
1468     }
1469     ancestors.push(node);
1470     return ancestors;
1471   }
1472   function d3_layout_bundleLeastCommonAncestor(a, b) {
1473     if (a === b) return a;
1474     var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;
1475     while (aNode === bNode) {
1476       sharedNode = aNode;
1477       aNode = aNodes.pop();
1478       bNode = bNodes.pop();
1479     }
1480     return sharedNode;
1481   }
1482   function d3_layout_forceDragstart(d) {
1483     d.fixed |= 2;
1484   }
1485   function d3_layout_forceDragend(d) {
1486     d.fixed &= 1;
1487   }
1488   function d3_layout_forceMouseover(d) {
1489     d.fixed |= 4;
1490   }
1491   function d3_layout_forceMouseout(d) {
1492     d.fixed &= 3;
1493   }
1494   function d3_layout_forceAccumulate(quad, alpha, charges) {
1495     var cx = 0, cy = 0;
1496     quad.charge = 0;
1497     if (!quad.leaf) {
1498       var nodes = quad.nodes, n = nodes.length, i = -1, c;
1499       while (++i < n) {
1500         c = nodes[i];
1501         if (c == null) continue;
1502         d3_layout_forceAccumulate(c, alpha, charges);
1503         quad.charge += c.charge;
1504         cx += c.charge * c.cx;
1505         cy += c.charge * c.cy;
1506       }
1507     }
1508     if (quad.point) {
1509       if (!quad.leaf) {
1510         quad.point.x += Math.random() - .5;
1511         quad.point.y += Math.random() - .5;
1512       }
1513       var k = alpha * charges[quad.point.index];
1514       quad.charge += quad.pointCharge = k;
1515       cx += k * quad.point.x;
1516       cy += k * quad.point.y;
1517     }
1518     quad.cx = cx / quad.charge;
1519     quad.cy = cy / quad.charge;
1520   }
1521   function d3_layout_forceLinkDistance(link) {
1522     return 20;
1523   }
1524   function d3_layout_forceLinkStrength(link) {
1525     return 1;
1526   }
1527   function d3_layout_stackX(d) {
1528     return d.x;
1529   }
1530   function d3_layout_stackY(d) {
1531     return d.y;
1532   }
1533   function d3_layout_stackOut(d, y0, y) {
1534     d.y0 = y0;
1535     d.y = y;
1536   }
1537   function d3_layout_stackOrderDefault(data) {
1538     return d3.range(data.length);
1539   }
1540   function d3_layout_stackOffsetZero(data) {
1541     var j = -1, m = data[0].length, y0 = [];
1542     while (++j < m) y0[j] = 0;
1543     return y0;
1544   }
1545   function d3_layout_stackMaxIndex(array) {
1546     var i = 1, j = 0, v = array[0][1], k, n = array.length;
1547     for (; i < n; ++i) {
1548       if ((k = array[i][1]) > v) {
1549         j = i;
1550         v = k;
1551       }
1552     }
1553     return j;
1554   }
1555   function d3_layout_stackReduceSum(d) {
1556     return d.reduce(d3_layout_stackSum, 0);
1557   }
1558   function d3_layout_stackSum(p, d) {
1559     return p + d[1];
1560   }
1561   function d3_layout_histogramBinSturges(range, values) {
1562     return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
1563   }
1564   function d3_layout_histogramBinFixed(range, n) {
1565     var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];
1566     while (++x <= n) f[x] = m * x + b;
1567     return f;
1568   }
1569   function d3_layout_histogramRange(values) {
1570     return [ d3.min(values), d3.max(values) ];
1571   }
1572   function d3_layout_hierarchyRebind(object, hierarchy) {
1573     d3.rebind(object, hierarchy, "sort", "children", "value");
1574     object.links = d3_layout_hierarchyLinks;
1575     object.nodes = function(d) {
1576       d3_layout_hierarchyInline = true;
1577       return (object.nodes = object)(d);
1578     };
1579     return object;
1580   }
1581   function d3_layout_hierarchyChildren(d) {
1582     return d.children;
1583   }
1584   function d3_layout_hierarchyValue(d) {
1585     return d.value;
1586   }
1587   function d3_layout_hierarchySort(a, b) {
1588     return b.value - a.value;
1589   }
1590   function d3_layout_hierarchyLinks(nodes) {
1591     return d3.merge(nodes.map(function(parent) {
1592       return (parent.children || []).map(function(child) {
1593         return {
1594           source: parent,
1595           target: child
1596         };
1597       });
1598     }));
1599   }
1600   function d3_layout_packSort(a, b) {
1601     return a.value - b.value;
1602   }
1603   function d3_layout_packInsert(a, b) {
1604     var c = a._pack_next;
1605     a._pack_next = b;
1606     b._pack_prev = a;
1607     b._pack_next = c;
1608     c._pack_prev = b;
1609   }
1610   function d3_layout_packSplice(a, b) {
1611     a._pack_next = b;
1612     b._pack_prev = a;
1613   }
1614   function d3_layout_packIntersects(a, b) {
1615     var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;
1616     return dr * dr - dx * dx - dy * dy > .001;
1617   }
1618   function d3_layout_packSiblings(node) {
1619     function bound(node) {
1620       xMin = Math.min(node.x - node.r, xMin);
1621       xMax = Math.max(node.x + node.r, xMax);
1622       yMin = Math.min(node.y - node.r, yMin);
1623       yMax = Math.max(node.y + node.r, yMax);
1624     }
1625     if (!(nodes = node.children) || !(n = nodes.length)) return;
1626     var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;
1627     nodes.forEach(d3_layout_packLink);
1628     a = nodes[0];
1629     a.x = -a.r;
1630     a.y = 0;
1631     bound(a);
1632     if (n > 1) {
1633       b = nodes[1];
1634       b.x = b.r;
1635       b.y = 0;
1636       bound(b);
1637       if (n > 2) {
1638         c = nodes[2];
1639         d3_layout_packPlace(a, b, c);
1640         bound(c);
1641         d3_layout_packInsert(a, c);
1642         a._pack_prev = c;
1643         d3_layout_packInsert(c, b);
1644         b = a._pack_next;
1645         for (i = 3; i < n; i++) {
1646           d3_layout_packPlace(a, b, c = nodes[i]);
1647           var isect = 0, s1 = 1, s2 = 1;
1648           for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
1649             if (d3_layout_packIntersects(j, c)) {
1650               isect = 1;
1651               break;
1652             }
1653           }
1654           if (isect == 1) {
1655             for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
1656               if (d3_layout_packIntersects(k, c)) {
1657                 break;
1658               }
1659             }
1660           }
1661           if (isect) {
1662             if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b);
1663             i--;
1664           } else {
1665             d3_layout_packInsert(a, c);
1666             b = c;
1667             bound(c);
1668           }
1669         }
1670       }
1671     }
1672     var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;
1673     for (i = 0; i < n; i++) {
1674       c = nodes[i];
1675       c.x -= cx;
1676       c.y -= cy;
1677       cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));
1678     }
1679     node.r = cr;
1680     nodes.forEach(d3_layout_packUnlink);
1681   }
1682   function d3_layout_packLink(node) {
1683     node._pack_next = node._pack_prev = node;
1684   }
1685   function d3_layout_packUnlink(node) {
1686     delete node._pack_next;
1687     delete node._pack_prev;
1688   }
1689   function d3_layout_packTransform(node, x, y, k) {
1690     var children = node.children;
1691     node.x = x += k * node.x;
1692     node.y = y += k * node.y;
1693     node.r *= k;
1694     if (children) {
1695       var i = -1, n = children.length;
1696       while (++i < n) d3_layout_packTransform(children[i], x, y, k);
1697     }
1698   }
1699   function d3_layout_packPlace(a, b, c) {
1700     var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;
1701     if (db && (dx || dy)) {
1702       var da = b.r + c.r, dc = dx * dx + dy * dy;
1703       da *= da;
1704       db *= db;
1705       var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
1706       c.x = a.x + x * dx + y * dy;
1707       c.y = a.y + x * dy - y * dx;
1708     } else {
1709       c.x = a.x + db;
1710       c.y = a.y;
1711     }
1712   }
1713   function d3_layout_clusterY(children) {
1714     return 1 + d3.max(children, function(child) {
1715       return child.y;
1716     });
1717   }
1718   function d3_layout_clusterX(children) {
1719     return children.reduce(function(x, child) {
1720       return x + child.x;
1721     }, 0) / children.length;
1722   }
1723   function d3_layout_clusterLeft(node) {
1724     var children = node.children;
1725     return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
1726   }
1727   function d3_layout_clusterRight(node) {
1728     var children = node.children, n;
1729     return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
1730   }
1731   function d3_layout_treeSeparation(a, b) {
1732     return a.parent == b.parent ? 1 : 2;
1733   }
1734   function d3_layout_treeLeft(node) {
1735     var children = node.children;
1736     return children && children.length ? children[0] : node._tree.thread;
1737   }
1738   function d3_layout_treeRight(node) {
1739     var children = node.children, n;
1740     return children && (n = children.length) ? children[n - 1] : node._tree.thread;
1741   }
1742   function d3_layout_treeSearch(node, compare) {
1743     var children = node.children;
1744     if (children && (n = children.length)) {
1745       var child, n, i = -1;
1746       while (++i < n) {
1747         if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
1748           node = child;
1749         }
1750       }
1751     }
1752     return node;
1753   }
1754   function d3_layout_treeRightmost(a, b) {
1755     return a.x - b.x;
1756   }
1757   function d3_layout_treeLeftmost(a, b) {
1758     return b.x - a.x;
1759   }
1760   function d3_layout_treeDeepest(a, b) {
1761     return a.depth - b.depth;
1762   }
1763   function d3_layout_treeVisitAfter(node, callback) {
1764     function visit(node, previousSibling) {
1765       var children = node.children;
1766       if (children && (n = children.length)) {
1767         var child, previousChild = null, i = -1, n;
1768         while (++i < n) {
1769           child = children[i];
1770           visit(child, previousChild);
1771           previousChild = child;
1772         }
1773       }
1774       callback(node, previousSibling);
1775     }
1776     visit(node, null);
1777   }
1778   function d3_layout_treeShift(node) {
1779     var shift = 0, change = 0, children = node.children, i = children.length, child;
1780     while (--i >= 0) {
1781       child = children[i]._tree;
1782       child.prelim += shift;
1783       child.mod += shift;
1784       shift += child.shift + (change += child.change);
1785     }
1786   }
1787   function d3_layout_treeMove(ancestor, node, shift) {
1788     ancestor = ancestor._tree;
1789     node = node._tree;
1790     var change = shift / (node.number - ancestor.number);
1791     ancestor.change += change;
1792     node.change -= change;
1793     node.shift += shift;
1794     node.prelim += shift;
1795     node.mod += shift;
1796   }
1797   function d3_layout_treeAncestor(vim, node, ancestor) {
1798     return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor;
1799   }
1800   function d3_layout_treemapPadNull(node) {
1801     return {
1802       x: node.x,
1803       y: node.y,
1804       dx: node.dx,
1805       dy: node.dy
1806     };
1807   }
1808   function d3_layout_treemapPad(node, padding) {
1809     var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2];
1810     if (dx < 0) {
1811       x += dx / 2;
1812       dx = 0;
1813     }
1814     if (dy < 0) {
1815       y += dy / 2;
1816       dy = 0;
1817     }
1818     return {
1819       x: x,
1820       y: y,
1821       dx: dx,
1822       dy: dy
1823     };
1824   }
1825   function d3_dsv(delimiter, mimeType) {
1826     function dsv(url, callback) {
1827       d3.text(url, mimeType, function(text) {
1828         callback(text && dsv.parse(text));
1829       });
1830     }
1831     function formatRow(row) {
1832       return row.map(formatValue).join(delimiter);
1833     }
1834     function formatValue(text) {
1835       return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text;
1836     }
1837     var reParse = new RegExp("\r\n|[" + delimiter + "\r\n]", "g"), reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);
1838     dsv.parse = function(text) {
1839       var header;
1840       return dsv.parseRows(text, function(row, i) {
1841         if (i) {
1842           var o = {}, j = -1, m = header.length;
1843           while (++j < m) o[header[j]] = row[j];
1844           return o;
1845         } else {
1846           header = row;
1847           return null;
1848         }
1849       });
1850     };
1851     dsv.parseRows = function(text, f) {
1852       function token() {
1853         if (reParse.lastIndex >= text.length) return EOF;
1854         if (eol) {
1855           eol = false;
1856           return EOL;
1857         }
1858         var j = reParse.lastIndex;
1859         if (text.charCodeAt(j) === 34) {
1860           var i = j;
1861           while (i++ < text.length) {
1862             if (text.charCodeAt(i) === 34) {
1863               if (text.charCodeAt(i + 1) !== 34) break;
1864               i++;
1865             }
1866           }
1867           reParse.lastIndex = i + 2;
1868           var c = text.charCodeAt(i + 1);
1869           if (c === 13) {
1870             eol = true;
1871             if (text.charCodeAt(i + 2) === 10) reParse.lastIndex++;
1872           } else if (c === 10) {
1873             eol = true;
1874           }
1875           return text.substring(j + 1, i).replace(/""/g, '"');
1876         }
1877         var m = reParse.exec(text);
1878         if (m) {
1879           eol = m[0].charCodeAt(0) !== delimiterCode;
1880           return text.substring(j, m.index);
1881         }
1882         reParse.lastIndex = text.length;
1883         return text.substring(j);
1884       }
1885       var EOL = {}, EOF = {}, rows = [], n = 0, t, eol;
1886       reParse.lastIndex = 0;
1887       while ((t = token()) !== EOF) {
1888         var a = [];
1889         while (t !== EOL && t !== EOF) {
1890           a.push(t);
1891           t = token();
1892         }
1893         if (f && !(a = f(a, n++))) continue;
1894         rows.push(a);
1895       }
1896       return rows;
1897     };
1898     dsv.format = function(rows) {
1899       return rows.map(formatRow).join("\n");
1900     };
1901     return dsv;
1902   }
1903   function d3_geo_type(types, defaultValue) {
1904     return function(object) {
1905       return object && types.hasOwnProperty(object.type) ? types[object.type](object) : defaultValue;
1906     };
1907   }
1908   function d3_path_circle(radius) {
1909     return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + +2 * radius + "z";
1910   }
1911   function d3_geo_bounds(o, f) {
1912     if (d3_geo_boundsTypes.hasOwnProperty(o.type)) d3_geo_boundsTypes[o.type](o, f);
1913   }
1914   function d3_geo_boundsFeature(o, f) {
1915     d3_geo_bounds(o.geometry, f);
1916   }
1917   function d3_geo_boundsFeatureCollection(o, f) {
1918     for (var a = o.features, i = 0, n = a.length; i < n; i++) {
1919       d3_geo_bounds(a[i].geometry, f);
1920     }
1921   }
1922   function d3_geo_boundsGeometryCollection(o, f) {
1923     for (var a = o.geometries, i = 0, n = a.length; i < n; i++) {
1924       d3_geo_bounds(a[i], f);
1925     }
1926   }
1927   function d3_geo_boundsLineString(o, f) {
1928     for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
1929       f.apply(null, a[i]);
1930     }
1931   }
1932   function d3_geo_boundsMultiLineString(o, f) {
1933     for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
1934       for (var b = a[i], j = 0, m = b.length; j < m; j++) {
1935         f.apply(null, b[j]);
1936       }
1937     }
1938   }
1939   function d3_geo_boundsMultiPolygon(o, f) {
1940     for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
1941       for (var b = a[i][0], j = 0, m = b.length; j < m; j++) {
1942         f.apply(null, b[j]);
1943       }
1944     }
1945   }
1946   function d3_geo_boundsPoint(o, f) {
1947     f.apply(null, o.coordinates);
1948   }
1949   function d3_geo_boundsPolygon(o, f) {
1950     for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) {
1951       f.apply(null, a[i]);
1952     }
1953   }
1954   function d3_geo_greatArcSource(d) {
1955     return d.source;
1956   }
1957   function d3_geo_greatArcTarget(d) {
1958     return d.target;
1959   }
1960   function d3_geo_greatArcInterpolator() {
1961     function interpolate(t) {
1962       var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;
1963       return [ Math.atan2(y, x) / d3_geo_radians, Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians ];
1964     }
1965     var x0, y0, cy0, sy0, kx0, ky0, x1, y1, cy1, sy1, kx1, ky1, d, k;
1966     interpolate.distance = function() {
1967       if (d == null) k = 1 / Math.sin(d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))));
1968       return d;
1969     };
1970     interpolate.source = function(_) {
1971       var cx0 = Math.cos(x0 = _[0] * d3_geo_radians), sx0 = Math.sin(x0);
1972       cy0 = Math.cos(y0 = _[1] * d3_geo_radians);
1973       sy0 = Math.sin(y0);
1974       kx0 = cy0 * cx0;
1975       ky0 = cy0 * sx0;
1976       d = null;
1977       return interpolate;
1978     };
1979     interpolate.target = function(_) {
1980       var cx1 = Math.cos(x1 = _[0] * d3_geo_radians), sx1 = Math.sin(x1);
1981       cy1 = Math.cos(y1 = _[1] * d3_geo_radians);
1982       sy1 = Math.sin(y1);
1983       kx1 = cy1 * cx1;
1984       ky1 = cy1 * sx1;
1985       d = null;
1986       return interpolate;
1987     };
1988     return interpolate;
1989   }
1990   function d3_geo_greatArcInterpolate(a, b) {
1991     var i = d3_geo_greatArcInterpolator().source(a).target(b);
1992     i.distance();
1993     return i;
1994   }
1995   function d3_geom_contourStart(grid) {
1996     var x = 0, y = 0;
1997     while (true) {
1998       if (grid(x, y)) {
1999         return [ x, y ];
2000       }
2001       if (x === 0) {
2002         x = y + 1;
2003         y = 0;
2004       } else {
2005         x = x - 1;
2006         y = y + 1;
2007       }
2008     }
2009   }
2010   function d3_geom_hullCCW(i1, i2, i3, v) {
2011     var t, a, b, c, d, e, f;
2012     t = v[i1];
2013     a = t[0];
2014     b = t[1];
2015     t = v[i2];
2016     c = t[0];
2017     d = t[1];
2018     t = v[i3];
2019     e = t[0];
2020     f = t[1];
2021     return (f - b) * (c - a) - (d - b) * (e - a) > 0;
2022   }
2023   function d3_geom_polygonInside(p, a, b) {
2024     return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
2025   }
2026   function d3_geom_polygonIntersect(c, d, a, b) {
2027     var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], x13 = x1 - x3, x21 = x2 - x1, x43 = x4 - x3, y13 = y1 - y3, y21 = y2 - y1, y43 = y4 - y3, ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21);
2028     return [ x1 + ua * x21, y1 + ua * y21 ];
2029   }
2030   function d3_voronoi_tessellate(vertices, callback) {
2031     var Sites = {
2032       list: vertices.map(function(v, i) {
2033         return {
2034           index: i,
2035           x: v[0],
2036           y: v[1]
2037         };
2038       }).sort(function(a, b) {
2039         return a.y < b.y ? -1 : a.y > b.y ? 1 : a.x < b.x ? -1 : a.x > b.x ? 1 : 0;
2040       }),
2041       bottomSite: null
2042     };
2043     var EdgeList = {
2044       list: [],
2045       leftEnd: null,
2046       rightEnd: null,
2047       init: function() {
2048         EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
2049         EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
2050         EdgeList.leftEnd.r = EdgeList.rightEnd;
2051         EdgeList.rightEnd.l = EdgeList.leftEnd;
2052         EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
2053       },
2054       createHalfEdge: function(edge, side) {
2055         return {
2056           edge: edge,
2057           side: side,
2058           vertex: null,
2059           l: null,
2060           r: null
2061         };
2062       },
2063       insert: function(lb, he) {
2064         he.l = lb;
2065         he.r = lb.r;
2066         lb.r.l = he;
2067         lb.r = he;
2068       },
2069       leftBound: function(p) {
2070         var he = EdgeList.leftEnd;
2071         do {
2072           he = he.r;
2073         } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
2074         he = he.l;
2075         return he;
2076       },
2077       del: function(he) {
2078         he.l.r = he.r;
2079         he.r.l = he.l;
2080         he.edge = null;
2081       },
2082       right: function(he) {
2083         return he.r;
2084       },
2085       left: function(he) {
2086         return he.l;
2087       },
2088       leftRegion: function(he) {
2089         return he.edge == null ? Sites.bottomSite : he.edge.region[he.side];
2090       },
2091       rightRegion: function(he) {
2092         return he.edge == null ? Sites.bottomSite : he.edge.region[d3_voronoi_opposite[he.side]];
2093       }
2094     };
2095     var Geom = {
2096       bisect: function(s1, s2) {
2097         var newEdge = {
2098           region: {
2099             l: s1,
2100             r: s2
2101           },
2102           ep: {
2103             l: null,
2104             r: null
2105           }
2106         };
2107         var dx = s2.x - s1.x, dy = s2.y - s1.y, adx = dx > 0 ? dx : -dx, ady = dy > 0 ? dy : -dy;
2108         newEdge.c = s1.x * dx + s1.y * dy + (dx * dx + dy * dy) * .5;
2109         if (adx > ady) {
2110           newEdge.a = 1;
2111           newEdge.b = dy / dx;
2112           newEdge.c /= dx;
2113         } else {
2114           newEdge.b = 1;
2115           newEdge.a = dx / dy;
2116           newEdge.c /= dy;
2117         }
2118         return newEdge;
2119       },
2120       intersect: function(el1, el2) {
2121         var e1 = el1.edge, e2 = el2.edge;
2122         if (!e1 || !e2 || e1.region.r == e2.region.r) {
2123           return null;
2124         }
2125         var d = e1.a * e2.b - e1.b * e2.a;
2126         if (Math.abs(d) < 1e-10) {
2127           return null;
2128         }
2129         var xint = (e1.c * e2.b - e2.c * e1.b) / d, yint = (e2.c * e1.a - e1.c * e2.a) / d, e1r = e1.region.r, e2r = e2.region.r, el, e;
2130         if (e1r.y < e2r.y || e1r.y == e2r.y && e1r.x < e2r.x) {
2131           el = el1;
2132           e = e1;
2133         } else {
2134           el = el2;
2135           e = e2;
2136         }
2137         var rightOfSite = xint >= e.region.r.x;
2138         if (rightOfSite && el.side === "l" || !rightOfSite && el.side === "r") {
2139           return null;
2140         }
2141         return {
2142           x: xint,
2143           y: yint
2144         };
2145       },
2146       rightOf: function(he, p) {
2147         var e = he.edge, topsite = e.region.r, rightOfSite = p.x > topsite.x;
2148         if (rightOfSite && he.side === "l") {
2149           return 1;
2150         }
2151         if (!rightOfSite && he.side === "r") {
2152           return 0;
2153         }
2154         if (e.a === 1) {
2155           var dyp = p.y - topsite.y, dxp = p.x - topsite.x, fast = 0, above = 0;
2156           if (!rightOfSite && e.b < 0 || rightOfSite && e.b >= 0) {
2157             above = fast = dyp >= e.b * dxp;
2158           } else {
2159             above = p.x + p.y * e.b > e.c;
2160             if (e.b < 0) {
2161               above = !above;
2162             }
2163             if (!above) {
2164               fast = 1;
2165             }
2166           }
2167           if (!fast) {
2168             var dxs = topsite.x - e.region.l.x;
2169             above = e.b * (dxp * dxp - dyp * dyp) < dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b);
2170             if (e.b < 0) {
2171               above = !above;
2172             }
2173           }
2174         } else {
2175           var yl = e.c - e.a * p.x, t1 = p.y - yl, t2 = p.x - topsite.x, t3 = yl - topsite.y;
2176           above = t1 * t1 > t2 * t2 + t3 * t3;
2177         }
2178         return he.side === "l" ? above : !above;
2179       },
2180       endPoint: function(edge, side, site) {
2181         edge.ep[side] = site;
2182         if (!edge.ep[d3_voronoi_opposite[side]]) return;
2183         callback(edge);
2184       },
2185       distance: function(s, t) {
2186         var dx = s.x - t.x, dy = s.y - t.y;
2187         return Math.sqrt(dx * dx + dy * dy);
2188       }
2189     };
2190     var EventQueue = {
2191       list: [],
2192       insert: function(he, site, offset) {
2193         he.vertex = site;
2194         he.ystar = site.y + offset;
2195         for (var i = 0, list = EventQueue.list, l = list.length; i < l; i++) {
2196           var next = list[i];
2197           if (he.ystar > next.ystar || he.ystar == next.ystar && site.x > next.vertex.x) {
2198             continue;
2199           } else {
2200             break;
2201           }
2202         }
2203         list.splice(i, 0, he);
2204       },
2205       del: function(he) {
2206         for (var i = 0, ls = EventQueue.list, l = ls.length; i < l && ls[i] != he; ++i) {}
2207         ls.splice(i, 1);
2208       },
2209       empty: function() {
2210         return EventQueue.list.length === 0;
2211       },
2212       nextEvent: function(he) {
2213         for (var i = 0, ls = EventQueue.list, l = ls.length; i < l; ++i) {
2214           if (ls[i] == he) return ls[i + 1];
2215         }
2216         return null;
2217       },
2218       min: function() {
2219         var elem = EventQueue.list[0];
2220         return {
2221           x: elem.vertex.x,
2222           y: elem.ystar
2223         };
2224       },
2225       extractMin: function() {
2226         return EventQueue.list.shift();
2227       }
2228     };
2229     EdgeList.init();
2230     Sites.bottomSite = Sites.list.shift();
2231     var newSite = Sites.list.shift(), newIntStar;
2232     var lbnd, rbnd, llbnd, rrbnd, bisector;
2233     var bot, top, temp, p, v;
2234     var e, pm;
2235     while (true) {
2236       if (!EventQueue.empty()) {
2237         newIntStar = EventQueue.min();
2238       }
2239       if (newSite && (EventQueue.empty() || newSite.y < newIntStar.y || newSite.y == newIntStar.y && newSite.x < newIntStar.x)) {
2240         lbnd = EdgeList.leftBound(newSite);
2241         rbnd = EdgeList.right(lbnd);
2242         bot = EdgeList.rightRegion(lbnd);
2243         e = Geom.bisect(bot, newSite);
2244         bisector = EdgeList.createHalfEdge(e, "l");
2245         EdgeList.insert(lbnd, bisector);
2246         p = Geom.intersect(lbnd, bisector);
2247         if (p) {
2248           EventQueue.del(lbnd);
2249           EventQueue.insert(lbnd, p, Geom.distance(p, newSite));
2250         }
2251         lbnd = bisector;
2252         bisector = EdgeList.createHalfEdge(e, "r");
2253         EdgeList.insert(lbnd, bisector);
2254         p = Geom.intersect(bisector, rbnd);
2255         if (p) {
2256           EventQueue.insert(bisector, p, Geom.distance(p, newSite));
2257         }
2258         newSite = Sites.list.shift();
2259       } else if (!EventQueue.empty()) {
2260         lbnd = EventQueue.extractMin();
2261         llbnd = EdgeList.left(lbnd);
2262         rbnd = EdgeList.right(lbnd);
2263         rrbnd = EdgeList.right(rbnd);
2264         bot = EdgeList.leftRegion(lbnd);
2265         top = EdgeList.rightRegion(rbnd);
2266         v = lbnd.vertex;
2267         Geom.endPoint(lbnd.edge, lbnd.side, v);
2268         Geom.endPoint(rbnd.edge, rbnd.side, v);
2269         EdgeList.del(lbnd);
2270         EventQueue.del(rbnd);
2271         EdgeList.del(rbnd);
2272         pm = "l";
2273         if (bot.y > top.y) {
2274           temp = bot;
2275           bot = top;
2276           top = temp;
2277           pm = "r";
2278         }
2279         e = Geom.bisect(bot, top);
2280         bisector = EdgeList.createHalfEdge(e, pm);
2281         EdgeList.insert(llbnd, bisector);
2282         Geom.endPoint(e, d3_voronoi_opposite[pm], v);
2283         p = Geom.intersect(llbnd, bisector);
2284         if (p) {
2285           EventQueue.del(llbnd);
2286           EventQueue.insert(llbnd, p, Geom.distance(p, bot));
2287         }
2288         p = Geom.intersect(bisector, rrbnd);
2289         if (p) {
2290           EventQueue.insert(bisector, p, Geom.distance(p, bot));
2291         }
2292       } else {
2293         break;
2294       }
2295     }
2296     for (lbnd = EdgeList.right(EdgeList.leftEnd); lbnd != EdgeList.rightEnd; lbnd = EdgeList.right(lbnd)) {
2297       callback(lbnd.edge);
2298     }
2299   }
2300   function d3_geom_quadtreeNode() {
2301     return {
2302       leaf: true,
2303       nodes: [],
2304       point: null
2305     };
2306   }
2307   function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
2308     if (!f(node, x1, y1, x2, y2)) {
2309       var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes;
2310       if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
2311       if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
2312       if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
2313       if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
2314     }
2315   }
2316   function d3_geom_quadtreePoint(p) {
2317     return {
2318       x: p[0],
2319       y: p[1]
2320     };
2321   }
2322   function d3_time_utc() {
2323     this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]);
2324   }
2325   function d3_time_formatAbbreviate(name) {
2326     return name.substring(0, 3);
2327   }
2328   function d3_time_parse(date, template, string, j) {
2329     var c, p, i = 0, n = template.length, m = string.length;
2330     while (i < n) {
2331       if (j >= m) return -1;
2332       c = template.charCodeAt(i++);
2333       if (c == 37) {
2334         p = d3_time_parsers[template.charAt(i++)];
2335         if (!p || (j = p(date, string, j)) < 0) return -1;
2336       } else if (c != string.charCodeAt(j++)) {
2337         return -1;
2338       }
2339     }
2340     return j;
2341   }
2342   function d3_time_formatRe(names) {
2343     return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i");
2344   }
2345   function d3_time_formatLookup(names) {
2346     var map = new d3_Map, i = -1, n = names.length;
2347     while (++i < n) map.set(names[i].toLowerCase(), i);
2348     return map;
2349   }
2350   function d3_time_parseWeekdayAbbrev(date, string, i) {
2351     d3_time_dayAbbrevRe.lastIndex = 0;
2352     var n = d3_time_dayAbbrevRe.exec(string.substring(i));
2353     return n ? i += n[0].length : -1;
2354   }
2355   function d3_time_parseWeekday(date, string, i) {
2356     d3_time_dayRe.lastIndex = 0;
2357     var n = d3_time_dayRe.exec(string.substring(i));
2358     return n ? i += n[0].length : -1;
2359   }
2360   function d3_time_parseMonthAbbrev(date, string, i) {
2361     d3_time_monthAbbrevRe.lastIndex = 0;
2362     var n = d3_time_monthAbbrevRe.exec(string.substring(i));
2363     return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
2364   }
2365   function d3_time_parseMonth(date, string, i) {
2366     d3_time_monthRe.lastIndex = 0;
2367     var n = d3_time_monthRe.exec(string.substring(i));
2368     return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
2369   }
2370   function d3_time_parseLocaleFull(date, string, i) {
2371     return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
2372   }
2373   function d3_time_parseLocaleDate(date, string, i) {
2374     return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
2375   }
2376   function d3_time_parseLocaleTime(date, string, i) {
2377     return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
2378   }
2379   function d3_time_parseFullYear(date, string, i) {
2380     d3_time_numberRe.lastIndex = 0;
2381     var n = d3_time_numberRe.exec(string.substring(i, i + 4));
2382     return n ? (date.y = +n[0], i += n[0].length) : -1;
2383   }
2384   function d3_time_parseYear(date, string, i) {
2385     d3_time_numberRe.lastIndex = 0;
2386     var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2387     return n ? (date.y = d3_time_expandYear(+n[0]), i += n[0].length) : -1;
2388   }
2389   function d3_time_expandYear(d) {
2390     return d + (d > 68 ? 1900 : 2e3);
2391   }
2392   function d3_time_parseMonthNumber(date, string, i) {
2393     d3_time_numberRe.lastIndex = 0;
2394     var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2395     return n ? (date.m = n[0] - 1, i += n[0].length) : -1;
2396   }
2397   function d3_time_parseDay(date, string, i) {
2398     d3_time_numberRe.lastIndex = 0;
2399     var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2400     return n ? (date.d = +n[0], i += n[0].length) : -1;
2401   }
2402   function d3_time_parseHour24(date, string, i) {
2403     d3_time_numberRe.lastIndex = 0;
2404     var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2405     return n ? (date.H = +n[0], i += n[0].length) : -1;
2406   }
2407   function d3_time_parseMinutes(date, string, i) {
2408     d3_time_numberRe.lastIndex = 0;
2409     var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2410     return n ? (date.M = +n[0], i += n[0].length) : -1;
2411   }
2412   function d3_time_parseSeconds(date, string, i) {
2413     d3_time_numberRe.lastIndex = 0;
2414     var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2415     return n ? (date.S = +n[0], i += n[0].length) : -1;
2416   }
2417   function d3_time_parseMilliseconds(date, string, i) {
2418     d3_time_numberRe.lastIndex = 0;
2419     var n = d3_time_numberRe.exec(string.substring(i, i + 3));
2420     return n ? (date.L = +n[0], i += n[0].length) : -1;
2421   }
2422   function d3_time_parseAmPm(date, string, i) {
2423     var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());
2424     return n == null ? -1 : (date.p = n, i);
2425   }
2426   function d3_time_zone(d) {
2427     var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(Math.abs(z) / 60), zm = Math.abs(z) % 60;
2428     return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm);
2429   }
2430   function d3_time_formatIsoNative(date) {
2431     return date.toISOString();
2432   }
2433   function d3_time_interval(local, step, number) {
2434     function round(date) {
2435       var d0 = local(date), d1 = offset(d0, 1);
2436       return date - d0 < d1 - date ? d0 : d1;
2437     }
2438     function ceil(date) {
2439       step(date = local(new d3_time(date - 1)), 1);
2440       return date;
2441     }
2442     function offset(date, k) {
2443       step(date = new d3_time(+date), k);
2444       return date;
2445     }
2446     function range(t0, t1, dt) {
2447       var time = ceil(t0), times = [];
2448       if (dt > 1) {
2449         while (time < t1) {
2450           if (!(number(time) % dt)) times.push(new Date(+time));
2451           step(time, 1);
2452         }
2453       } else {
2454         while (time < t1) times.push(new Date(+time)), step(time, 1);
2455       }
2456       return times;
2457     }
2458     function range_utc(t0, t1, dt) {
2459       try {
2460         d3_time = d3_time_utc;
2461         var utc = new d3_time_utc;
2462         utc._ = t0;
2463         return range(utc, t1, dt);
2464       } finally {
2465         d3_time = Date;
2466       }
2467     }
2468     local.floor = local;
2469     local.round = round;
2470     local.ceil = ceil;
2471     local.offset = offset;
2472     local.range = range;
2473     var utc = local.utc = d3_time_interval_utc(local);
2474     utc.floor = utc;
2475     utc.round = d3_time_interval_utc(round);
2476     utc.ceil = d3_time_interval_utc(ceil);
2477     utc.offset = d3_time_interval_utc(offset);
2478     utc.range = range_utc;
2479     return local;
2480   }
2481   function d3_time_interval_utc(method) {
2482     return function(date, k) {
2483       try {
2484         d3_time = d3_time_utc;
2485         var utc = new d3_time_utc;
2486         utc._ = date;
2487         return method(utc, k)._;
2488       } finally {
2489         d3_time = Date;
2490       }
2491     };
2492   }
2493   function d3_time_scale(linear, methods, format) {
2494     function scale(x) {
2495       return linear(x);
2496     }
2497     scale.invert = function(x) {
2498       return d3_time_scaleDate(linear.invert(x));
2499     };
2500     scale.domain = function(x) {
2501       if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
2502       linear.domain(x);
2503       return scale;
2504     };
2505     scale.nice = function(m) {
2506       return scale.domain(d3_scale_nice(scale.domain(), function() {
2507         return m;
2508       }));
2509     };
2510     scale.ticks = function(m, k) {
2511       var extent = d3_time_scaleExtent(scale.domain());
2512       if (typeof m !== "function") {
2513         var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target);
2514         if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
2515         if (!i) return linear.ticks(m).map(d3_time_scaleDate);
2516         if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
2517         m = methods[i];
2518         k = m[1];
2519         m = m[0].range;
2520       }
2521       return m(extent[0], new Date(+extent[1] + 1), k);
2522     };
2523     scale.tickFormat = function() {
2524       return format;
2525     };
2526     scale.copy = function() {
2527       return d3_time_scale(linear.copy(), methods, format);
2528     };
2529     return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
2530   }
2531   function d3_time_scaleExtent(domain) {
2532     var start = domain[0], stop = domain[domain.length - 1];
2533     return start < stop ? [ start, stop ] : [ stop, start ];
2534   }
2535   function d3_time_scaleDate(t) {
2536     return new Date(t);
2537   }
2538   function d3_time_scaleFormat(formats) {
2539     return function(date) {
2540       var i = formats.length - 1, f = formats[i];
2541       while (!f[1](date)) f = formats[--i];
2542       return f[0](date);
2543     };
2544   }
2545   function d3_time_scaleSetYear(y) {
2546     var d = new Date(y, 0, 1);
2547     d.setFullYear(y);
2548     return d;
2549   }
2550   function d3_time_scaleGetYear(d) {
2551     var y = d.getFullYear(), d0 = d3_time_scaleSetYear(y), d1 = d3_time_scaleSetYear(y + 1);
2552     return y + (d - d0) / (d1 - d0);
2553   }
2554   function d3_time_scaleUTCSetYear(y) {
2555     var d = new Date(Date.UTC(y, 0, 1));
2556     d.setUTCFullYear(y);
2557     return d;
2558   }
2559   function d3_time_scaleUTCGetYear(d) {
2560     var y = d.getUTCFullYear(), d0 = d3_time_scaleUTCSetYear(y), d1 = d3_time_scaleUTCSetYear(y + 1);
2561     return y + (d - d0) / (d1 - d0);
2562   }
2563   if (!Date.now) Date.now = function() {
2564     return +(new Date);
2565   };
2566   try {
2567     document.createElement("div").style.setProperty("opacity", 0, "");
2568   } catch (error) {
2569     var d3_style_prototype = CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;
2570     d3_style_prototype.setProperty = function(name, value, priority) {
2571       d3_style_setProperty.call(this, name, value + "", priority);
2572     };
2573   }
2574   d3 = {
2575     version: "2.10.2"
2576   };
2577   var d3_array = d3_arraySlice;
2578   try {
2579     d3_array(document.documentElement.childNodes)[0].nodeType;
2580   } catch (e) {
2581     d3_array = d3_arrayCopy;
2582   }
2583   var d3_arraySubclass = [].__proto__ ? function(array, prototype) {
2584     array.__proto__ = prototype;
2585   } : function(array, prototype) {
2586     for (var property in prototype) array[property] = prototype[property];
2587   };
2588   d3.map = function(object) {
2589     var map = new d3_Map;
2590     for (var key in object) map.set(key, object[key]);
2591     return map;
2592   };
2593   d3_class(d3_Map, {
2594     has: function(key) {
2595       return d3_map_prefix + key in this;
2596     },
2597     get: function(key) {
2598       return this[d3_map_prefix + key];
2599     },
2600     set: function(key, value) {
2601       return this[d3_map_prefix + key] = value;
2602     },
2603     remove: function(key) {
2604       key = d3_map_prefix + key;
2605       return key in this && delete this[key];
2606     },
2607     keys: function() {
2608       var keys = [];
2609       this.forEach(function(key) {
2610         keys.push(key);
2611       });
2612       return keys;
2613     },
2614     values: function() {
2615       var values = [];
2616       this.forEach(function(key, value) {
2617         values.push(value);
2618       });
2619       return values;
2620     },
2621     entries: function() {
2622       var entries = [];
2623       this.forEach(function(key, value) {
2624         entries.push({
2625           key: key,
2626           value: value
2627         });
2628       });
2629       return entries;
2630     },
2631     forEach: function(f) {
2632       for (var key in this) {
2633         if (key.charCodeAt(0) === d3_map_prefixCode) {
2634           f.call(this, key.substring(1), this[key]);
2635         }
2636       }
2637     }
2638   });
2639   var d3_map_prefix = "\0", d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
2640   d3.functor = d3_functor;
2641   d3.rebind = function(target, source) {
2642     var i = 1, n = arguments.length, method;
2643     while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
2644     return target;
2645   };
2646   d3.ascending = function(a, b) {
2647     return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
2648   };
2649   d3.descending = function(a, b) {
2650     return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
2651   };
2652   d3.mean = function(array, f) {
2653     var n = array.length, a, m = 0, i = -1, j = 0;
2654     if (arguments.length === 1) {
2655       while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
2656     } else {
2657       while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
2658     }
2659     return j ? m : undefined;
2660   };
2661   d3.median = function(array, f) {
2662     if (arguments.length > 1) array = array.map(f);
2663     array = array.filter(d3_number);
2664     return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
2665   };
2666   d3.min = function(array, f) {
2667     var i = -1, n = array.length, a, b;
2668     if (arguments.length === 1) {
2669       while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
2670       while (++i < n) if ((b = array[i]) != null && a > b) a = b;
2671     } else {
2672       while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
2673       while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
2674     }
2675     return a;
2676   };
2677   d3.max = function(array, f) {
2678     var i = -1, n = array.length, a, b;
2679     if (arguments.length === 1) {
2680       while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
2681       while (++i < n) if ((b = array[i]) != null && b > a) a = b;
2682     } else {
2683       while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
2684       while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
2685     }
2686     return a;
2687   };
2688   d3.extent = function(array, f) {
2689     var i = -1, n = array.length, a, b, c;
2690     if (arguments.length === 1) {
2691       while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
2692       while (++i < n) if ((b = array[i]) != null) {
2693         if (a > b) a = b;
2694         if (c < b) c = b;
2695       }
2696     } else {
2697       while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
2698       while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
2699         if (a > b) a = b;
2700         if (c < b) c = b;
2701       }
2702     }
2703     return [ a, c ];
2704   };
2705   d3.random = {
2706     normal: function(µ, Ïƒ) {
2707       var n = arguments.length;
2708       if (n < 2) Ïƒ = 1;
2709       if (n < 1) Âµ = 0;
2710       return function() {
2711         var x, y, r;
2712         do {
2713           x = Math.random() * 2 - 1;
2714           y = Math.random() * 2 - 1;
2715           r = x * x + y * y;
2716         } while (!r || r > 1);
2717         return Âµ + Ïƒ * x * Math.sqrt(-2 * Math.log(r) / r);
2718       };
2719     },
2720     logNormal: function(µ, Ïƒ) {
2721       var n = arguments.length;
2722       if (n < 2) Ïƒ = 1;
2723       if (n < 1) Âµ = 0;
2724       var random = d3.random.normal();
2725       return function() {
2726         return Math.exp(µ + Ïƒ * random());
2727       };
2728     },
2729     irwinHall: function(m) {
2730       return function() {
2731         for (var s = 0, j = 0; j < m; j++) s += Math.random();
2732         return s / m;
2733       };
2734     }
2735   };
2736   d3.sum = function(array, f) {
2737     var s = 0, n = array.length, a, i = -1;
2738     if (arguments.length === 1) {
2739       while (++i < n) if (!isNaN(a = +array[i])) s += a;
2740     } else {
2741       while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
2742     }
2743     return s;
2744   };
2745   d3.quantile = function(values, p) {
2746     var H = (values.length - 1) * p + 1, h = Math.floor(H), v = values[h - 1], e = H - h;
2747     return e ? v + e * (values[h] - v) : v;
2748   };
2749   d3.transpose = function(matrix) {
2750     return d3.zip.apply(d3, matrix);
2751   };
2752   d3.zip = function() {
2753     if (!(n = arguments.length)) return [];
2754     for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) {
2755       for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) {
2756         zip[j] = arguments[j][i];
2757       }
2758     }
2759     return zips;
2760   };
2761   d3.bisector = function(f) {
2762     return {
2763       left: function(a, x, lo, hi) {
2764         if (arguments.length < 3) lo = 0;
2765         if (arguments.length < 4) hi = a.length;
2766         while (lo < hi) {
2767           var mid = lo + hi >>> 1;
2768           if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid;
2769         }
2770         return lo;
2771       },
2772       right: function(a, x, lo, hi) {
2773         if (arguments.length < 3) lo = 0;
2774         if (arguments.length < 4) hi = a.length;
2775         while (lo < hi) {
2776           var mid = lo + hi >>> 1;
2777           if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1;
2778         }
2779         return lo;
2780       }
2781     };
2782   };
2783   var d3_bisector = d3.bisector(function(d) {
2784     return d;
2785   });
2786   d3.bisectLeft = d3_bisector.left;
2787   d3.bisect = d3.bisectRight = d3_bisector.right;
2788   d3.first = function(array, f) {
2789     var i = 0, n = array.length, a = array[0], b;
2790     if (arguments.length === 1) f = d3.ascending;
2791     while (++i < n) {
2792       if (f.call(array, a, b = array[i]) > 0) {
2793         a = b;
2794       }
2795     }
2796     return a;
2797   };
2798   d3.last = function(array, f) {
2799     var i = 0, n = array.length, a = array[0], b;
2800     if (arguments.length === 1) f = d3.ascending;
2801     while (++i < n) {
2802       if (f.call(array, a, b = array[i]) <= 0) {
2803         a = b;
2804       }
2805     }
2806     return a;
2807   };
2808   d3.nest = function() {
2809     function map(array, depth) {
2810       if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
2811       var i = -1, n = array.length, key = keys[depth++], keyValue, object, valuesByKey = new d3_Map, values, o = {};
2812       while (++i < n) {
2813         if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
2814           values.push(object);
2815         } else {
2816           valuesByKey.set(keyValue, [ object ]);
2817         }
2818       }
2819       valuesByKey.forEach(function(keyValue, values) {
2820         o[keyValue] = map(values, depth);
2821       });
2822       return o;
2823     }
2824     function entries(map, depth) {
2825       if (depth >= keys.length) return map;
2826       var a = [], sortKey = sortKeys[depth++], key;
2827       for (key in map) {
2828         a.push({
2829           key: key,
2830           values: entries(map[key], depth)
2831         });
2832       }
2833       if (sortKey) a.sort(function(a, b) {
2834         return sortKey(a.key, b.key);
2835       });
2836       return a;
2837     }
2838     var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
2839     nest.map = function(array) {
2840       return map(array, 0);
2841     };
2842     nest.entries = function(array) {
2843       return entries(map(array, 0), 0);
2844     };
2845     nest.key = function(d) {
2846       keys.push(d);
2847       return nest;
2848     };
2849     nest.sortKeys = function(order) {
2850       sortKeys[keys.length - 1] = order;
2851       return nest;
2852     };
2853     nest.sortValues = function(order) {
2854       sortValues = order;
2855       return nest;
2856     };
2857     nest.rollup = function(f) {
2858       rollup = f;
2859       return nest;
2860     };
2861     return nest;
2862   };
2863   d3.keys = function(map) {
2864     var keys = [];
2865     for (var key in map) keys.push(key);
2866     return keys;
2867   };
2868   d3.values = function(map) {
2869     var values = [];
2870     for (var key in map) values.push(map[key]);
2871     return values;
2872   };
2873   d3.entries = function(map) {
2874     var entries = [];
2875     for (var key in map) entries.push({
2876       key: key,
2877       value: map[key]
2878     });
2879     return entries;
2880   };
2881   d3.permute = function(array, indexes) {
2882     var permutes = [], i = -1, n = indexes.length;
2883     while (++i < n) permutes[i] = array[indexes[i]];
2884     return permutes;
2885   };
2886   d3.merge = function(arrays) {
2887     return Array.prototype.concat.apply([], arrays);
2888   };
2889   d3.split = function(array, f) {
2890     var arrays = [], values = [], value, i = -1, n = array.length;
2891     if (arguments.length < 2) f = d3_splitter;
2892     while (++i < n) {
2893       if (f.call(values, value = array[i], i)) {
2894         values = [];
2895       } else {
2896         if (!values.length) arrays.push(values);
2897         values.push(value);
2898       }
2899     }
2900     return arrays;
2901   };
2902   d3.range = function(start, stop, step) {
2903     if (arguments.length < 3) {
2904       step = 1;
2905       if (arguments.length < 2) {
2906         stop = start;
2907         start = 0;
2908       }
2909     }
2910     if ((stop - start) / step === Infinity) throw new Error("infinite range");
2911     var range = [], k = d3_range_integerScale(Math.abs(step)), i = -1, j;
2912     start *= k, stop *= k, step *= k;
2913     if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k);
2914     return range;
2915   };
2916   d3.requote = function(s) {
2917     return s.replace(d3_requote_re, "\\$&");
2918   };
2919   var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
2920   d3.round = function(x, n) {
2921     return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);
2922   };
2923   d3.xhr = function(url, mime, callback) {
2924     var req = new XMLHttpRequest;
2925     if (arguments.length < 3) callback = mime, mime = null; else if (mime && req.overrideMimeType) req.overrideMimeType(mime);
2926     req.open("GET", url, true);
2927     if (mime) req.setRequestHeader("Accept", mime);
2928     req.onreadystatechange = function() {
2929       if (req.readyState === 4) {
2930         var s = req.status;
2931         callback(!s && req.response || s >= 200 && s < 300 || s === 304 ? req : null);
2932       }
2933     };
2934     req.send(null);
2935   };
2936   d3.text = function(url, mime, callback) {
2937     function ready(req) {
2938       callback(req && req.responseText);
2939     }
2940     if (arguments.length < 3) {
2941       callback = mime;
2942       mime = null;
2943     }
2944     d3.xhr(url, mime, ready);
2945   };
2946   d3.json = function(url, callback) {
2947     d3.text(url, "application/json", function(text) {
2948       callback(text ? JSON.parse(text) : null);
2949     });
2950   };
2951   d3.html = function(url, callback) {
2952     d3.text(url, "text/html", function(text) {
2953       if (text != null) {
2954         var range = document.createRange();
2955         range.selectNode(document.body);
2956         text = range.createContextualFragment(text);
2957       }
2958       callback(text);
2959     });
2960   };
2961   d3.xml = function(url, mime, callback) {
2962     function ready(req) {
2963       callback(req && req.responseXML);
2964     }
2965     if (arguments.length < 3) {
2966       callback = mime;
2967       mime = null;
2968     }
2969     d3.xhr(url, mime, ready);
2970   };
2971   var d3_nsPrefix = {
2972     svg: "http://www.w3.org/2000/svg",
2973     xhtml: "http://www.w3.org/1999/xhtml",
2974     xlink: "http://www.w3.org/1999/xlink",
2975     xml: "http://www.w3.org/XML/1998/namespace",
2976     xmlns: "http://www.w3.org/2000/xmlns/"
2977   };
2978   d3.ns = {
2979     prefix: d3_nsPrefix,
2980     qualify: function(name) {
2981       var i = name.indexOf(":"), prefix = name;
2982       if (i >= 0) {
2983         prefix = name.substring(0, i);
2984         name = name.substring(i + 1);
2985       }
2986       return d3_nsPrefix.hasOwnProperty(prefix) ? {
2987         space: d3_nsPrefix[prefix],
2988         local: name
2989       } : name;
2990     }
2991   };
2992   d3.dispatch = function() {
2993     var dispatch = new d3_dispatch, i = -1, n = arguments.length;
2994     while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
2995     return dispatch;
2996   };
2997   d3_dispatch.prototype.on = function(type, listener) {
2998     var i = type.indexOf("."), name = "";
2999     if (i > 0) {
3000       name = type.substring(i + 1);
3001       type = type.substring(0, i);
3002     }
3003     return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);
3004   };
3005   d3.format = function(specifier) {
3006     var match = d3_format_re.exec(specifier), fill = match[1] || " ", sign = match[3] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false;
3007     if (precision) precision = +precision.substring(1);
3008     if (zfill) {
3009       fill = "0";
3010       if (comma) width -= Math.floor((width - 1) / 4);
3011     }
3012     switch (type) {
3013      case "n":
3014       comma = true;
3015       type = "g";
3016       break;
3017      case "%":
3018       scale = 100;
3019       suffix = "%";
3020       type = "f";
3021       break;
3022      case "p":
3023       scale = 100;
3024       suffix = "%";
3025       type = "r";
3026       break;
3027      case "d":
3028       integer = true;
3029       precision = 0;
3030       break;
3031      case "s":
3032       scale = -1;
3033       type = "r";
3034       break;
3035     }
3036     if (type == "r" && !precision) type = "g";
3037     type = d3_format_types.get(type) || d3_format_typeDefault;
3038     return function(value) {
3039       if (integer && value % 1) return "";
3040       var negative = value < 0 && (value = -value) ? "-" : sign;
3041       if (scale < 0) {
3042         var prefix = d3.formatPrefix(value, precision);
3043         value = prefix.scale(value);
3044         suffix = prefix.symbol;
3045       } else {
3046         value *= scale;
3047       }
3048       value = type(value, precision);
3049       if (zfill) {
3050         var length = value.length + negative.length;
3051         if (length < width) value = (new Array(width - length + 1)).join(fill) + value;
3052         if (comma) value = d3_format_group(value);
3053         value = negative + value;
3054       } else {
3055         if (comma) value = d3_format_group(value);
3056         value = negative + value;
3057         var length = value.length;
3058         if (length < width) value = (new Array(width - length + 1)).join(fill) + value;
3059       }
3060       return value + suffix;
3061     };
3062   };
3063   var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;
3064   var d3_format_types = d3.map({
3065     g: function(x, p) {
3066       return x.toPrecision(p);
3067     },
3068     e: function(x, p) {
3069       return x.toExponential(p);
3070     },
3071     f: function(x, p) {
3072       return x.toFixed(p);
3073     },
3074     r: function(x, p) {
3075       return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p)));
3076     }
3077   });
3078   var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "μ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
3079   d3.formatPrefix = function(value, precision) {
3080     var i = 0;
3081     if (value) {
3082       if (value < 0) value *= -1;
3083       if (precision) value = d3.round(value, d3_format_precision(value, precision));
3084       i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
3085       i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
3086     }
3087     return d3_formatPrefixes[8 + i / 3];
3088   };
3089   var d3_ease_quad = d3_ease_poly(2), d3_ease_cubic = d3_ease_poly(3), d3_ease_default = function() {
3090     return d3_ease_identity;
3091   };
3092   var d3_ease = d3.map({
3093     linear: d3_ease_default,
3094     poly: d3_ease_poly,
3095     quad: function() {
3096       return d3_ease_quad;
3097     },
3098     cubic: function() {
3099       return d3_ease_cubic;
3100     },
3101     sin: function() {
3102       return d3_ease_sin;
3103     },
3104     exp: function() {
3105       return d3_ease_exp;
3106     },
3107     circle: function() {
3108       return d3_ease_circle;
3109     },
3110     elastic: d3_ease_elastic,
3111     back: d3_ease_back,
3112     bounce: function() {
3113       return d3_ease_bounce;
3114     }
3115   });
3116   var d3_ease_mode = d3.map({
3117     "in": d3_ease_identity,
3118     out: d3_ease_reverse,
3119     "in-out": d3_ease_reflect,
3120     "out-in": function(f) {
3121       return d3_ease_reflect(d3_ease_reverse(f));
3122     }
3123   });
3124   d3.ease = function(name) {
3125     var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in";
3126     t = d3_ease.get(t) || d3_ease_default;
3127     m = d3_ease_mode.get(m) || d3_ease_identity;
3128     return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1))));
3129   };
3130   d3.event = null;
3131   d3.transform = function(string) {
3132     var g = document.createElementNS(d3.ns.prefix.svg, "g");
3133     return (d3.transform = function(string) {
3134       g.setAttribute("transform", string);
3135       var t = g.transform.baseVal.consolidate();
3136       return new d3_transform(t ? t.matrix : d3_transformIdentity);
3137     })(string);
3138   };
3139   d3_transform.prototype.toString = function() {
3140     return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
3141   };
3142   var d3_transformDegrees = 180 / Math.PI, d3_transformIdentity = {
3143     a: 1,
3144     b: 0,
3145     c: 0,
3146     d: 1,
3147     e: 0,
3148     f: 0
3149   };
3150   d3.interpolate = function(a, b) {
3151     var i = d3.interpolators.length, f;
3152     while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;
3153     return f;
3154   };
3155   d3.interpolateNumber = function(a, b) {
3156     b -= a;
3157     return function(t) {
3158       return a + b * t;
3159     };
3160   };
3161   d3.interpolateRound = function(a, b) {
3162     b -= a;
3163     return function(t) {
3164       return Math.round(a + b * t);
3165     };
3166   };
3167   d3.interpolateString = function(a, b) {
3168     var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o;
3169     d3_interpolate_number.lastIndex = 0;
3170     for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
3171       if (m.index) s.push(b.substring(s0, s1 = m.index));
3172       q.push({
3173         i: s.length,
3174         x: m[0]
3175       });
3176       s.push(null);
3177       s0 = d3_interpolate_number.lastIndex;
3178     }
3179     if (s0 < b.length) s.push(b.substring(s0));
3180     for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
3181       o = q[i];
3182       if (o.x == m[0]) {
3183         if (o.i) {
3184           if (s[o.i + 1] == null) {
3185             s[o.i - 1] += o.x;
3186             s.splice(o.i, 1);
3187             for (j = i + 1; j < n; ++j) q[j].i--;
3188           } else {
3189             s[o.i - 1] += o.x + s[o.i + 1];
3190             s.splice(o.i, 2);
3191             for (j = i + 1; j < n; ++j) q[j].i -= 2;
3192           }
3193         } else {
3194           if (s[o.i + 1] == null) {
3195             s[o.i] = o.x;
3196           } else {
3197             s[o.i] = o.x + s[o.i + 1];
3198             s.splice(o.i + 1, 1);
3199             for (j = i + 1; j < n; ++j) q[j].i--;
3200           }
3201         }
3202         q.splice(i, 1);
3203         n--;
3204         i--;
3205       } else {
3206         o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
3207       }
3208     }
3209     while (i < n) {
3210       o = q.pop();
3211       if (s[o.i + 1] == null) {
3212         s[o.i] = o.x;
3213       } else {
3214         s[o.i] = o.x + s[o.i + 1];
3215         s.splice(o.i + 1, 1);
3216       }
3217       n--;
3218     }
3219     if (s.length === 1) {
3220       return s[0] == null ? q[0].x : function() {
3221         return b;
3222       };
3223     }
3224     return function(t) {
3225       for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
3226       return s.join("");
3227     };
3228   };
3229   d3.interpolateTransform = function(a, b) {
3230     var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale;
3231     if (ta[0] != tb[0] || ta[1] != tb[1]) {
3232       s.push("translate(", null, ",", null, ")");
3233       q.push({
3234         i: 1,
3235         x: d3.interpolateNumber(ta[0], tb[0])
3236       }, {
3237         i: 3,
3238         x: d3.interpolateNumber(ta[1], tb[1])
3239       });
3240     } else if (tb[0] || tb[1]) {
3241       s.push("translate(" + tb + ")");
3242     } else {
3243       s.push("");
3244     }
3245     if (ra != rb) {
3246       if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
3247       q.push({
3248         i: s.push(s.pop() + "rotate(", null, ")") - 2,
3249         x: d3.interpolateNumber(ra, rb)
3250       });
3251     } else if (rb) {
3252       s.push(s.pop() + "rotate(" + rb + ")");
3253     }
3254     if (wa != wb) {
3255       q.push({
3256         i: s.push(s.pop() + "skewX(", null, ")") - 2,
3257         x: d3.interpolateNumber(wa, wb)
3258       });
3259     } else if (wb) {
3260       s.push(s.pop() + "skewX(" + wb + ")");
3261     }
3262     if (ka[0] != kb[0] || ka[1] != kb[1]) {
3263       n = s.push(s.pop() + "scale(", null, ",", null, ")");
3264       q.push({
3265         i: n - 4,
3266         x: d3.interpolateNumber(ka[0], kb[0])
3267       }, {
3268         i: n - 2,
3269         x: d3.interpolateNumber(ka[1], kb[1])
3270       });
3271     } else if (kb[0] != 1 || kb[1] != 1) {
3272       s.push(s.pop() + "scale(" + kb + ")");
3273     }
3274     n = q.length;
3275     return function(t) {
3276       var i = -1, o;
3277       while (++i < n) s[(o = q[i]).i] = o.x(t);
3278       return s.join("");
3279     };
3280   };
3281   d3.interpolateRgb = function(a, b) {
3282     a = d3.rgb(a);
3283     b = d3.rgb(b);
3284     var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;
3285     return function(t) {
3286       return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));
3287     };
3288   };
3289   d3.interpolateHsl = function(a, b) {
3290     a = d3.hsl(a);
3291     b = d3.hsl(b);
3292     var h0 = a.h, s0 = a.s, l0 = a.l, h1 = b.h - h0, s1 = b.s - s0, l1 = b.l - l0;
3293     if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360;
3294     return function(t) {
3295       return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t) + "";
3296     };
3297   };
3298   d3.interpolateLab = function(a, b) {
3299     a = d3.lab(a);
3300     b = d3.lab(b);
3301     var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;
3302     return function(t) {
3303       return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
3304     };
3305   };
3306   d3.interpolateHcl = function(a, b) {
3307     a = d3.hcl(a);
3308     b = d3.hcl(b);
3309     var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;
3310     if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
3311     return function(t) {
3312       return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";
3313     };
3314   };
3315   d3.interpolateArray = function(a, b) {
3316     var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;
3317     for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));
3318     for (; i < na; ++i) c[i] = a[i];
3319     for (; i < nb; ++i) c[i] = b[i];
3320     return function(t) {
3321       for (i = 0; i < n0; ++i) c[i] = x[i](t);
3322       return c;
3323     };
3324   };
3325   d3.interpolateObject = function(a, b) {
3326     var i = {}, c = {}, k;
3327     for (k in a) {
3328       if (k in b) {
3329         i[k] = d3_interpolateByName(k)(a[k], b[k]);
3330       } else {
3331         c[k] = a[k];
3332       }
3333     }
3334     for (k in b) {
3335       if (!(k in a)) {
3336         c[k] = b[k];
3337       }
3338     }
3339     return function(t) {
3340       for (k in i) c[k] = i[k](t);
3341       return c;
3342     };
3343   };
3344   var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
3345   d3.interpolators = [ d3.interpolateObject, function(a, b) {
3346     return b instanceof Array && d3.interpolateArray(a, b);
3347   }, function(a, b) {
3348     return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + "");
3349   }, function(a, b) {
3350     return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b);
3351   }, function(a, b) {
3352     return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b);
3353   } ];
3354   d3.rgb = function(r, g, b) {
3355     return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b);
3356   };
3357   d3_Rgb.prototype.brighter = function(k) {
3358     k = Math.pow(.7, arguments.length ? k : 1);
3359     var r = this.r, g = this.g, b = this.b, i = 30;
3360     if (!r && !g && !b) return d3_rgb(i, i, i);
3361     if (r && r < i) r = i;
3362     if (g && g < i) g = i;
3363     if (b && b < i) b = i;
3364     return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k)));
3365   };
3366   d3_Rgb.prototype.darker = function(k) {
3367     k = Math.pow(.7, arguments.length ? k : 1);
3368     return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b));
3369   };
3370   d3_Rgb.prototype.hsl = function() {
3371     return d3_rgb_hsl(this.r, this.g, this.b);
3372   };
3373   d3_Rgb.prototype.toString = function() {
3374     return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
3375   };
3376   var d3_rgb_names = d3.map({
3377     aliceblue: "#f0f8ff",
3378     antiquewhite: "#faebd7",
3379     aqua: "#00ffff",
3380     aquamarine: "#7fffd4",
3381     azure: "#f0ffff",
3382     beige: "#f5f5dc",
3383     bisque: "#ffe4c4",
3384     black: "#000000",
3385     blanchedalmond: "#ffebcd",
3386     blue: "#0000ff",
3387     blueviolet: "#8a2be2",
3388     brown: "#a52a2a",
3389     burlywood: "#deb887",
3390     cadetblue: "#5f9ea0",
3391     chartreuse: "#7fff00",
3392     chocolate: "#d2691e",
3393     coral: "#ff7f50",
3394     cornflowerblue: "#6495ed",
3395     cornsilk: "#fff8dc",
3396     crimson: "#dc143c",
3397     cyan: "#00ffff",
3398     darkblue: "#00008b",
3399     darkcyan: "#008b8b",
3400     darkgoldenrod: "#b8860b",
3401     darkgray: "#a9a9a9",
3402     darkgreen: "#006400",
3403     darkgrey: "#a9a9a9",
3404     darkkhaki: "#bdb76b",
3405     darkmagenta: "#8b008b",
3406     darkolivegreen: "#556b2f",
3407     darkorange: "#ff8c00",
3408     darkorchid: "#9932cc",
3409     darkred: "#8b0000",
3410     darksalmon: "#e9967a",
3411     darkseagreen: "#8fbc8f",
3412     darkslateblue: "#483d8b",
3413     darkslategray: "#2f4f4f",
3414     darkslategrey: "#2f4f4f",
3415     darkturquoise: "#00ced1",
3416     darkviolet: "#9400d3",
3417     deeppink: "#ff1493",
3418     deepskyblue: "#00bfff",
3419     dimgray: "#696969",
3420     dimgrey: "#696969",
3421     dodgerblue: "#1e90ff",
3422     firebrick: "#b22222",
3423     floralwhite: "#fffaf0",
3424     forestgreen: "#228b22",
3425     fuchsia: "#ff00ff",
3426     gainsboro: "#dcdcdc",
3427     ghostwhite: "#f8f8ff",
3428     gold: "#ffd700",
3429     goldenrod: "#daa520",
3430     gray: "#808080",
3431     green: "#008000",
3432     greenyellow: "#adff2f",
3433     grey: "#808080",
3434     honeydew: "#f0fff0",
3435     hotpink: "#ff69b4",
3436     indianred: "#cd5c5c",
3437     indigo: "#4b0082",
3438     ivory: "#fffff0",
3439     khaki: "#f0e68c",
3440     lavender: "#e6e6fa",
3441     lavenderblush: "#fff0f5",
3442     lawngreen: "#7cfc00",
3443     lemonchiffon: "#fffacd",
3444     lightblue: "#add8e6",
3445     lightcoral: "#f08080",
3446     lightcyan: "#e0ffff",
3447     lightgoldenrodyellow: "#fafad2",
3448     lightgray: "#d3d3d3",
3449     lightgreen: "#90ee90",
3450     lightgrey: "#d3d3d3",
3451     lightpink: "#ffb6c1",
3452     lightsalmon: "#ffa07a",
3453     lightseagreen: "#20b2aa",
3454     lightskyblue: "#87cefa",
3455     lightslategray: "#778899",
3456     lightslategrey: "#778899",
3457     lightsteelblue: "#b0c4de",
3458     lightyellow: "#ffffe0",
3459     lime: "#00ff00",
3460     limegreen: "#32cd32",
3461     linen: "#faf0e6",
3462     magenta: "#ff00ff",
3463     maroon: "#800000",
3464     mediumaquamarine: "#66cdaa",
3465     mediumblue: "#0000cd",
3466     mediumorchid: "#ba55d3",
3467     mediumpurple: "#9370db",
3468     mediumseagreen: "#3cb371",
3469     mediumslateblue: "#7b68ee",
3470     mediumspringgreen: "#00fa9a",
3471     mediumturquoise: "#48d1cc",
3472     mediumvioletred: "#c71585",
3473     midnightblue: "#191970",
3474     mintcream: "#f5fffa",
3475     mistyrose: "#ffe4e1",
3476     moccasin: "#ffe4b5",
3477     navajowhite: "#ffdead",
3478     navy: "#000080",
3479     oldlace: "#fdf5e6",
3480     olive: "#808000",
3481     olivedrab: "#6b8e23",
3482     orange: "#ffa500",
3483     orangered: "#ff4500",
3484     orchid: "#da70d6",
3485     palegoldenrod: "#eee8aa",
3486     palegreen: "#98fb98",
3487     paleturquoise: "#afeeee",
3488     palevioletred: "#db7093",
3489     papayawhip: "#ffefd5",
3490     peachpuff: "#ffdab9",
3491     peru: "#cd853f",
3492     pink: "#ffc0cb",
3493     plum: "#dda0dd",
3494     powderblue: "#b0e0e6",
3495     purple: "#800080",
3496     red: "#ff0000",
3497     rosybrown: "#bc8f8f",
3498     royalblue: "#4169e1",
3499     saddlebrown: "#8b4513",
3500     salmon: "#fa8072",
3501     sandybrown: "#f4a460",
3502     seagreen: "#2e8b57",
3503     seashell: "#fff5ee",
3504     sienna: "#a0522d",
3505     silver: "#c0c0c0",
3506     skyblue: "#87ceeb",
3507     slateblue: "#6a5acd",
3508     slategray: "#708090",
3509     slategrey: "#708090",
3510     snow: "#fffafa",
3511     springgreen: "#00ff7f",
3512     steelblue: "#4682b4",
3513     tan: "#d2b48c",
3514     teal: "#008080",
3515     thistle: "#d8bfd8",
3516     tomato: "#ff6347",
3517     turquoise: "#40e0d0",
3518     violet: "#ee82ee",
3519     wheat: "#f5deb3",
3520     white: "#ffffff",
3521     whitesmoke: "#f5f5f5",
3522     yellow: "#ffff00",
3523     yellowgreen: "#9acd32"
3524   });
3525   d3_rgb_names.forEach(function(key, value) {
3526     d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));
3527   });
3528   d3.hsl = function(h, s, l) {
3529     return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l);
3530   };
3531   d3_Hsl.prototype.brighter = function(k) {
3532     k = Math.pow(.7, arguments.length ? k : 1);
3533     return d3_hsl(this.h, this.s, this.l / k);
3534   };
3535   d3_Hsl.prototype.darker = function(k) {
3536     k = Math.pow(.7, arguments.length ? k : 1);
3537     return d3_hsl(this.h, this.s, k * this.l);
3538   };
3539   d3_Hsl.prototype.rgb = function() {
3540     return d3_hsl_rgb(this.h, this.s, this.l);
3541   };
3542   d3_Hsl.prototype.toString = function() {
3543     return this.rgb().toString();
3544   };
3545   d3.hcl = function(h, c, l) {
3546     return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l);
3547   };
3548   d3_Hcl.prototype.brighter = function(k) {
3549     return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));
3550   };
3551   d3_Hcl.prototype.darker = function(k) {
3552     return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));
3553   };
3554   d3_Hcl.prototype.rgb = function() {
3555     return d3_hcl_lab(this.h, this.c, this.l).rgb();
3556   };
3557   d3_Hcl.prototype.toString = function() {
3558     return this.rgb() + "";
3559   };
3560   d3.lab = function(l, a, b) {
3561     return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b);
3562   };
3563   var d3_lab_K = 18;
3564   var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;
3565   d3_Lab.prototype.brighter = function(k) {
3566     return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
3567   };
3568   d3_Lab.prototype.darker = function(k) {
3569     return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
3570   };
3571   d3_Lab.prototype.rgb = function() {
3572     return d3_lab_rgb(this.l, this.a, this.b);
3573   };
3574   d3_Lab.prototype.toString = function() {
3575     return this.rgb() + "";
3576   };
3577   var d3_select = function(s, n) {
3578     return n.querySelector(s);
3579   }, d3_selectAll = function(s, n) {
3580     return n.querySelectorAll(s);
3581   }, d3_selectRoot = document.documentElement, d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) {
3582     return d3_selectMatcher.call(n, s);
3583   };
3584   if (typeof Sizzle === "function") {
3585     d3_select = function(s, n) {
3586       return Sizzle(s, n)[0] || null;
3587     };
3588     d3_selectAll = function(s, n) {
3589       return Sizzle.uniqueSort(Sizzle(s, n));
3590     };
3591     d3_selectMatches = Sizzle.matchesSelector;
3592   }
3593   var d3_selectionPrototype = [];
3594   d3.selection = function() {
3595     return d3_selectionRoot;
3596   };
3597   d3.selection.prototype = d3_selectionPrototype;
3598   d3_selectionPrototype.select = function(selector) {
3599     var subgroups = [], subgroup, subnode, group, node;
3600     if (typeof selector !== "function") selector = d3_selection_selector(selector);
3601     for (var j = -1, m = this.length; ++j < m; ) {
3602       subgroups.push(subgroup = []);
3603       subgroup.parentNode = (group = this[j]).parentNode;
3604       for (var i = -1, n = group.length; ++i < n; ) {
3605         if (node = group[i]) {
3606           subgroup.push(subnode = selector.call(node, node.__data__, i));
3607           if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
3608         } else {
3609           subgroup.push(null);
3610         }
3611       }
3612     }
3613     return d3_selection(subgroups);
3614   };
3615   d3_selectionPrototype.selectAll = function(selector) {
3616     var subgroups = [], subgroup, node;
3617     if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
3618     for (var j = -1, m = this.length; ++j < m; ) {
3619       for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
3620         if (node = group[i]) {
3621           subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));
3622           subgroup.parentNode = node;
3623         }
3624       }
3625     }
3626     return d3_selection(subgroups);
3627   };
3628   d3_selectionPrototype.attr = function(name, value) {
3629     if (arguments.length < 2) {
3630       if (typeof name === "string") {
3631         var node = this.node();
3632         name = d3.ns.qualify(name);
3633         return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name);
3634       }
3635       for (value in name) this.each(d3_selection_attr(value, name[value]));
3636       return this;
3637     }
3638     return this.each(d3_selection_attr(name, value));
3639   };
3640   d3_selectionPrototype.classed = function(name, value) {
3641     if (arguments.length < 2) {
3642       if (typeof name === "string") {
3643         var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1;
3644         if (value = node.classList) {
3645           while (++i < n) if (!value.contains(name[i])) return false;
3646         } else {
3647           value = node.className;
3648           if (value.baseVal != null) value = value.baseVal;
3649           while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false;
3650         }
3651         return true;
3652       }
3653       for (value in name) this.each(d3_selection_classed(value, name[value]));
3654       return this;
3655     }
3656     return this.each(d3_selection_classed(name, value));
3657   };
3658   d3_selectionPrototype.style = function(name, value, priority) {
3659     var n = arguments.length;
3660     if (n < 3) {
3661       if (typeof name !== "string") {
3662         if (n < 2) value = "";
3663         for (priority in name) this.each(d3_selection_style(priority, name[priority], value));
3664         return this;
3665       }
3666       if (n < 2) return window.getComputedStyle(this.node(), null).getPropertyValue(name);
3667       priority = "";
3668     }
3669     return this.each(d3_selection_style(name, value, priority));
3670   };
3671   d3_selectionPrototype.property = function(name, value) {
3672     if (arguments.length < 2) {
3673       if (typeof name === "string") return this.node()[name];
3674       for (value in name) this.each(d3_selection_property(value, name[value]));
3675       return this;
3676     }
3677     return this.each(d3_selection_property(name, value));
3678   };
3679   d3_selectionPrototype.text = function(value) {
3680     return arguments.length < 1 ? this.node().textContent : this.each(typeof value === "function" ? function() {
3681       var v = value.apply(this, arguments);
3682       this.textContent = v == null ? "" : v;
3683     } : value == null ? function() {
3684       this.textContent = "";
3685     } : function() {
3686       this.textContent = value;
3687     });
3688   };
3689   d3_selectionPrototype.html = function(value) {
3690     return arguments.length < 1 ? this.node().innerHTML : this.each(typeof value === "function" ? function() {
3691       var v = value.apply(this, arguments);
3692       this.innerHTML = v == null ? "" : v;
3693     } : value == null ? function() {
3694       this.innerHTML = "";
3695     } : function() {
3696       this.innerHTML = value;
3697     });
3698   };
3699   d3_selectionPrototype.append = function(name) {
3700     function append() {
3701       return this.appendChild(document.createElementNS(this.namespaceURI, name));
3702     }
3703     function appendNS() {
3704       return this.appendChild(document.createElementNS(name.space, name.local));
3705     }
3706     name = d3.ns.qualify(name);
3707     return this.select(name.local ? appendNS : append);
3708   };
3709   d3_selectionPrototype.insert = function(name, before) {
3710     function insert() {
3711       return this.insertBefore(document.createElementNS(this.namespaceURI, name), d3_select(before, this));
3712     }
3713     function insertNS() {
3714       return this.insertBefore(document.createElementNS(name.space, name.local), d3_select(before, this));
3715     }
3716     name = d3.ns.qualify(name);
3717     return this.select(name.local ? insertNS : insert);
3718   };
3719   d3_selectionPrototype.remove = function() {
3720     return this.each(function() {
3721       var parent = this.parentNode;
3722       if (parent) parent.removeChild(this);
3723     });
3724   };
3725   d3_selectionPrototype.data = function(value, key) {
3726     function bind(group, groupData) {
3727       var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), n1 = Math.max(n, m), updateNodes = [], enterNodes = [], exitNodes = [], node, nodeData;
3728       if (key) {
3729         var nodeByKeyValue = new d3_Map, keyValues = [], keyValue, j = groupData.length;
3730         for (i = -1; ++i < n; ) {
3731           keyValue = key.call(node = group[i], node.__data__, i);
3732           if (nodeByKeyValue.has(keyValue)) {
3733             exitNodes[j++] = node;
3734           } else {
3735             nodeByKeyValue.set(keyValue, node);
3736           }
3737           keyValues.push(keyValue);
3738         }
3739         for (i = -1; ++i < m; ) {
3740           keyValue = key.call(groupData, nodeData = groupData[i], i);
3741           if (nodeByKeyValue.has(keyValue)) {
3742             updateNodes[i] = node = nodeByKeyValue.get(keyValue);
3743             node.__data__ = nodeData;
3744             enterNodes[i] = exitNodes[i] = null;
3745           } else {
3746             enterNodes[i] = d3_selection_dataNode(nodeData);
3747             updateNodes[i] = exitNodes[i] = null;
3748           }
3749           nodeByKeyValue.remove(keyValue);
3750         }
3751         for (i = -1; ++i < n; ) {
3752           if (nodeByKeyValue.has(keyValues[i])) {
3753             exitNodes[i] = group[i];
3754           }
3755         }
3756       } else {
3757         for (i = -1; ++i < n0; ) {
3758           node = group[i];
3759           nodeData = groupData[i];
3760           if (node) {
3761             node.__data__ = nodeData;
3762             updateNodes[i] = node;
3763             enterNodes[i] = exitNodes[i] = null;
3764           } else {
3765             enterNodes[i] = d3_selection_dataNode(nodeData);
3766             updateNodes[i] = exitNodes[i] = null;
3767           }
3768         }
3769         for (; i < m; ++i) {
3770           enterNodes[i] = d3_selection_dataNode(groupData[i]);
3771           updateNodes[i] = exitNodes[i] = null;
3772         }
3773         for (; i < n1; ++i) {
3774           exitNodes[i] = group[i];
3775           enterNodes[i] = updateNodes[i] = null;
3776         }
3777       }
3778       enterNodes.update = updateNodes;
3779       enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode;
3780       enter.push(enterNodes);
3781       update.push(updateNodes);
3782       exit.push(exitNodes);
3783     }
3784     var i = -1, n = this.length, group, node;
3785     if (!arguments.length) {
3786       value = new Array(n = (group = this[0]).length);
3787       while (++i < n) {
3788         if (node = group[i]) {
3789           value[i] = node.__data__;
3790         }
3791       }
3792       return value;
3793     }
3794     var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);
3795     if (typeof value === "function") {
3796       while (++i < n) {
3797         bind(group = this[i], value.call(group, group.parentNode.__data__, i));
3798       }
3799     } else {
3800       while (++i < n) {
3801         bind(group = this[i], value);
3802       }
3803     }
3804     update.enter = function() {
3805       return enter;
3806     };
3807     update.exit = function() {
3808       return exit;
3809     };
3810     return update;
3811   };
3812   d3_selectionPrototype.datum = d3_selectionPrototype.map = function(value) {
3813     return arguments.length < 1 ? this.property("__data__") : this.property("__data__", value);
3814   };
3815   d3_selectionPrototype.filter = function(filter) {
3816     var subgroups = [], subgroup, group, node;
3817     if (typeof filter !== "function") filter = d3_selection_filter(filter);
3818     for (var j = 0, m = this.length; j < m; j++) {
3819       subgroups.push(subgroup = []);
3820       subgroup.parentNode = (group = this[j]).parentNode;
3821       for (var i = 0, n = group.length; i < n; i++) {
3822         if ((node = group[i]) && filter.call(node, node.__data__, i)) {
3823           subgroup.push(node);
3824         }
3825       }
3826     }
3827     return d3_selection(subgroups);
3828   };
3829   d3_selectionPrototype.order = function() {
3830     for (var j = -1, m = this.length; ++j < m; ) {
3831       for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
3832         if (node = group[i]) {
3833           if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
3834           next = node;
3835         }
3836       }
3837     }
3838     return this;
3839   };
3840   d3_selectionPrototype.sort = function(comparator) {
3841     comparator = d3_selection_sortComparator.apply(this, arguments);
3842     for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);
3843     return this.order();
3844   };
3845   d3_selectionPrototype.on = function(type, listener, capture) {
3846     var n = arguments.length;
3847     if (n < 3) {
3848       if (typeof type !== "string") {
3849         if (n < 2) listener = false;
3850         for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));
3851         return this;
3852       }
3853       if (n < 2) return (n = this.node()["__on" + type]) && n._;
3854       capture = false;
3855     }
3856     return this.each(d3_selection_on(type, listener, capture));
3857   };
3858   d3_selectionPrototype.each = function(callback) {
3859     return d3_selection_each(this, function(node, i, j) {
3860       callback.call(node, node.__data__, i, j);
3861     });
3862   };
3863   d3_selectionPrototype.call = function(callback) {
3864     callback.apply(this, (arguments[0] = this, arguments));
3865     return this;
3866   };
3867   d3_selectionPrototype.empty = function() {
3868     return !this.node();
3869   };
3870   d3_selectionPrototype.node = function(callback) {
3871     for (var j = 0, m = this.length; j < m; j++) {
3872       for (var group = this[j], i = 0, n = group.length; i < n; i++) {
3873         var node = group[i];
3874         if (node) return node;
3875       }
3876     }
3877     return null;
3878   };
3879   d3_selectionPrototype.transition = function() {
3880     var subgroups = [], subgroup, node;
3881     for (var j = -1, m = this.length; ++j < m; ) {
3882       subgroups.push(subgroup = []);
3883       for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
3884         subgroup.push((node = group[i]) ? {
3885           node: node,
3886           delay: d3_transitionDelay,
3887           duration: d3_transitionDuration
3888         } : null);
3889       }
3890     }
3891     return d3_transition(subgroups, d3_transitionId || ++d3_transitionNextId, Date.now());
3892   };
3893   var d3_selectionRoot = d3_selection([ [ document ] ]);
3894   d3_selectionRoot[0].parentNode = d3_selectRoot;
3895   d3.select = function(selector) {
3896     return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]);
3897   };
3898   d3.selectAll = function(selector) {
3899     return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]);
3900   };
3901   var d3_selection_enterPrototype = [];
3902   d3.selection.enter = d3_selection_enter;
3903   d3.selection.enter.prototype = d3_selection_enterPrototype;
3904   d3_selection_enterPrototype.append = d3_selectionPrototype.append;
3905   d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
3906   d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
3907   d3_selection_enterPrototype.node = d3_selectionPrototype.node;
3908   d3_selection_enterPrototype.select = function(selector) {
3909     var subgroups = [], subgroup, subnode, upgroup, group, node;
3910     for (var j = -1, m = this.length; ++j < m; ) {
3911       upgroup = (group = this[j]).update;
3912       subgroups.push(subgroup = []);
3913       subgroup.parentNode = group.parentNode;
3914       for (var i = -1, n = group.length; ++i < n; ) {
3915         if (node = group[i]) {
3916           subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
3917           subnode.__data__ = node.__data__;
3918         } else {
3919           subgroup.push(null);
3920         }
3921       }
3922     }
3923     return d3_selection(subgroups);
3924   };
3925   var d3_transitionPrototype = [], d3_transitionNextId = 0, d3_transitionId = 0, d3_transitionDefaultDelay = 0, d3_transitionDefaultDuration = 250, d3_transitionDefaultEase = d3.ease("cubic-in-out"), d3_transitionDelay = d3_transitionDefaultDelay, d3_transitionDuration = d3_transitionDefaultDuration, d3_transitionEase = d3_transitionDefaultEase;
3926   d3_transitionPrototype.call = d3_selectionPrototype.call;
3927   d3.transition = function(selection) {
3928     return arguments.length ? d3_transitionId ? selection.transition() : selection : d3_selectionRoot.transition();
3929   };
3930   d3.transition.prototype = d3_transitionPrototype;
3931   d3_transitionPrototype.select = function(selector) {
3932     var subgroups = [], subgroup, subnode, node;
3933     if (typeof selector !== "function") selector = d3_selection_selector(selector);
3934     for (var j = -1, m = this.length; ++j < m; ) {
3935       subgroups.push(subgroup = []);
3936       for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
3937         if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) {
3938           if ("__data__" in node.node) subnode.__data__ = node.node.__data__;
3939           subgroup.push({
3940             node: subnode,
3941             delay: node.delay,
3942             duration: node.duration
3943           });
3944         } else {
3945           subgroup.push(null);
3946         }
3947       }
3948     }
3949     return d3_transition(subgroups, this.id, this.time).ease(this.ease());
3950   };
3951   d3_transitionPrototype.selectAll = function(selector) {
3952     var subgroups = [], subgroup, subnodes, node;
3953     if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
3954     for (var j = -1, m = this.length; ++j < m; ) {
3955       for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
3956         if (node = group[i]) {
3957           subnodes = selector.call(node.node, node.node.__data__, i);
3958           subgroups.push(subgroup = []);
3959           for (var k = -1, o = subnodes.length; ++k < o; ) {
3960             subgroup.push({
3961               node: subnodes[k],
3962               delay: node.delay,
3963               duration: node.duration
3964             });
3965           }
3966         }
3967       }
3968     }
3969     return d3_transition(subgroups, this.id, this.time).ease(this.ease());
3970   };
3971   d3_transitionPrototype.filter = function(filter) {
3972     var subgroups = [], subgroup, group, node;
3973     if (typeof filter !== "function") filter = d3_selection_filter(filter);
3974     for (var j = 0, m = this.length; j < m; j++) {
3975       subgroups.push(subgroup = []);
3976       for (var group = this[j], i = 0, n = group.length; i < n; i++) {
3977         if ((node = group[i]) && filter.call(node.node, node.node.__data__, i)) {
3978           subgroup.push(node);
3979         }
3980       }
3981     }
3982     return d3_transition(subgroups, this.id, this.time).ease(this.ease());
3983   };
3984   d3_transitionPrototype.attr = function(name, value) {
3985     if (arguments.length < 2) {
3986       for (value in name) this.attrTween(value, d3_tweenByName(name[value], value));
3987       return this;
3988     }
3989     return this.attrTween(name, d3_tweenByName(value, name));
3990   };
3991   d3_transitionPrototype.attrTween = function(nameNS, tween) {
3992     function attrTween(d, i) {
3993       var f = tween.call(this, d, i, this.getAttribute(name));
3994       return f === d3_tweenRemove ? (this.removeAttribute(name), null) : f && function(t) {
3995         this.setAttribute(name, f(t));
3996       };
3997     }
3998     function attrTweenNS(d, i) {
3999       var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
4000       return f === d3_tweenRemove ? (this.removeAttributeNS(name.space, name.local), null) : f && function(t) {
4001         this.setAttributeNS(name.space, name.local, f(t));
4002       };
4003     }
4004     var name = d3.ns.qualify(nameNS);
4005     return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
4006   };
4007   d3_transitionPrototype.style = function(name, value, priority) {
4008     var n = arguments.length;
4009     if (n < 3) {
4010       if (typeof name !== "string") {
4011         if (n < 2) value = "";
4012         for (priority in name) this.styleTween(priority, d3_tweenByName(name[priority], priority), value);
4013         return this;
4014       }
4015       priority = "";
4016     }
4017     return this.styleTween(name, d3_tweenByName(value, name), priority);
4018   };
4019   d3_transitionPrototype.styleTween = function(name, tween, priority) {
4020     if (arguments.length < 3) priority = "";
4021     return this.tween("style." + name, function(d, i) {
4022       var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name));
4023       return f === d3_tweenRemove ? (this.style.removeProperty(name), null) : f && function(t) {
4024         this.style.setProperty(name, f(t), priority);
4025       };
4026     });
4027   };
4028   d3_transitionPrototype.text = function(value) {
4029     return this.tween("text", function(d, i) {
4030       this.textContent = typeof value === "function" ? value.call(this, d, i) : value;
4031     });
4032   };
4033   d3_transitionPrototype.remove = function() {
4034     return this.each("end.transition", function() {
4035       var p;
4036       if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);
4037     });
4038   };
4039   d3_transitionPrototype.delay = function(value) {
4040     return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
4041       node.delay = value.call(node = node.node, node.__data__, i, j) | 0;
4042     } : (value = value | 0, function(node) {
4043       node.delay = value;
4044     }));
4045   };
4046   d3_transitionPrototype.duration = function(value) {
4047     return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
4048       node.duration = Math.max(1, value.call(node = node.node, node.__data__, i, j) | 0);
4049     } : (value = Math.max(1, value | 0), function(node) {
4050       node.duration = value;
4051     }));
4052   };
4053   d3_transitionPrototype.transition = function() {
4054     return this.select(d3_this);
4055   };
4056   d3.tween = function(b, interpolate) {
4057     function tweenFunction(d, i, a) {
4058       var v = b.call(this, d, i);
4059       return v == null ? a != "" && d3_tweenRemove : a != v && interpolate(a, v);
4060     }
4061     function tweenString(d, i, a) {
4062       return a != b && interpolate(a, b);
4063     }
4064     return typeof b === "function" ? tweenFunction : b == null ? d3_tweenNull : (b += "", tweenString);
4065   };
4066   var d3_tweenRemove = {};
4067   var d3_timer_queue = null, d3_timer_interval, d3_timer_timeout;
4068   d3.timer = function(callback, delay, then) {
4069     var found = false, t0, t1 = d3_timer_queue;
4070     if (arguments.length < 3) {
4071       if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return;
4072       then = Date.now();
4073     }
4074     while (t1) {
4075       if (t1.callback === callback) {
4076         t1.then = then;
4077         t1.delay = delay;
4078         found = true;
4079         break;
4080       }
4081       t0 = t1;
4082       t1 = t1.next;
4083     }
4084     if (!found) d3_timer_queue = {
4085       callback: callback,
4086       then: then,
4087       delay: delay,
4088       next: d3_timer_queue
4089     };
4090     if (!d3_timer_interval) {
4091       d3_timer_timeout = clearTimeout(d3_timer_timeout);
4092       d3_timer_interval = 1;
4093       d3_timer_frame(d3_timer_step);
4094     }
4095   };
4096   d3.timer.flush = function() {
4097     var elapsed, now = Date.now(), t1 = d3_timer_queue;
4098     while (t1) {
4099       elapsed = now - t1.then;
4100       if (!t1.delay) t1.flush = t1.callback(elapsed);
4101       t1 = t1.next;
4102     }
4103     d3_timer_flush();
4104   };
4105   var d3_timer_frame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) {
4106     setTimeout(callback, 17);
4107   };
4108   d3.mouse = function(container) {
4109     return d3_mousePoint(container, d3_eventSource());
4110   };
4111   var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;
4112   d3.touches = function(container, touches) {
4113     if (arguments.length < 2) touches = d3_eventSource().touches;
4114     return touches ? d3_array(touches).map(function(touch) {
4115       var point = d3_mousePoint(container, touch);
4116       point.identifier = touch.identifier;
4117       return point;
4118     }) : [];
4119   };
4120   d3.scale = {};
4121   d3.scale.linear = function() {
4122     return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3.interpolate, false);
4123   };
4124   d3.scale.log = function() {
4125     return d3_scale_log(d3.scale.linear(), d3_scale_logp);
4126   };
4127   var d3_scale_logFormat = d3.format(".0e");
4128   d3_scale_logp.pow = function(x) {
4129     return Math.pow(10, x);
4130   };
4131   d3_scale_logn.pow = function(x) {
4132     return -Math.pow(10, -x);
4133   };
4134   d3.scale.pow = function() {
4135     return d3_scale_pow(d3.scale.linear(), 1);
4136   };
4137   d3.scale.sqrt = function() {
4138     return d3.scale.pow().exponent(.5);
4139   };
4140   d3.scale.ordinal = function() {
4141     return d3_scale_ordinal([], {
4142       t: "range",
4143       a: [ [] ]
4144     });
4145   };
4146   d3.scale.category10 = function() {
4147     return d3.scale.ordinal().range(d3_category10);
4148   };
4149   d3.scale.category20 = function() {
4150     return d3.scale.ordinal().range(d3_category20);
4151   };
4152   d3.scale.category20b = function() {
4153     return d3.scale.ordinal().range(d3_category20b);
4154   };
4155   d3.scale.category20c = function() {
4156     return d3.scale.ordinal().range(d3_category20c);
4157   };
4158   d3.scale.category50 = function() {
4159     return d3.scale.ordinal().range(d3_category50);
4160   };
4161   var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ];
4162   var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ];
4163   var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ];
4164   var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ];
4165   var d3_category50 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#8c864b", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf","#DC143C","#800080","#0000FF","#008000","#D2691E","#FF0000","#000000","#DB7093","#FF00FF","#7B68EE","#1f77b6", "#9edae5", "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#aec7e8", "#e7ba52", "#ffbb78", "#e7cb94", "#98df8a", "#843c39", "#ff9896", "#ad494a", "#c5b0d5", "#d6616b", "#c49c94", "#e7969c", "#f7b6d2", "#fd8d3c", "#c7c7c7", "#7b4173", "#dbdb8d", "#a55194", ];  
4166   d3.scale.quantile = function() {
4167     return d3_scale_quantile([], []);
4168   };
4169   d3.scale.quantize = function() {
4170     return d3_scale_quantize(0, 1, [ 0, 1 ]);
4171   };
4172   d3.scale.threshold = function() {
4173     return d3_scale_threshold([ .5 ], [ 0, 1 ]);
4174   };
4175   d3.scale.identity = function() {
4176     return d3_scale_identity([ 0, 1 ]);
4177   };
4178   d3.svg = {};
4179   d3.svg.arc = function() {
4180     function arc() {
4181       var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0), df = da < Math.PI ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1);
4182       return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z";
4183     }
4184     var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
4185     arc.innerRadius = function(v) {
4186       if (!arguments.length) return innerRadius;
4187       innerRadius = d3_functor(v);
4188       return arc;
4189     };
4190     arc.outerRadius = function(v) {
4191       if (!arguments.length) return outerRadius;
4192       outerRadius = d3_functor(v);
4193       return arc;
4194     };
4195     arc.startAngle = function(v) {
4196       if (!arguments.length) return startAngle;
4197       startAngle = d3_functor(v);
4198       return arc;
4199     };
4200     arc.endAngle = function(v) {
4201       if (!arguments.length) return endAngle;
4202       endAngle = d3_functor(v);
4203       return arc;
4204     };
4205     arc.centroid = function() {
4206       var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
4207       return [ Math.cos(a) * r, Math.sin(a) * r ];
4208     };
4209     return arc;
4210   };
4211   var d3_svg_arcOffset = -Math.PI / 2, d3_svg_arcMax = 2 * Math.PI - 1e-6;
4212   d3.svg.line = function() {
4213     return d3_svg_line(d3_identity);
4214   };
4215   var d3_svg_lineInterpolators = d3.map({
4216     linear: d3_svg_lineLinear,
4217     "linear-closed": d3_svg_lineLinearClosed,
4218     "step-before": d3_svg_lineStepBefore,
4219     "step-after": d3_svg_lineStepAfter,
4220     basis: d3_svg_lineBasis,
4221     "basis-open": d3_svg_lineBasisOpen,
4222     "basis-closed": d3_svg_lineBasisClosed,
4223     bundle: d3_svg_lineBundle,
4224     cardinal: d3_svg_lineCardinal,
4225     "cardinal-open": d3_svg_lineCardinalOpen,
4226     "cardinal-closed": d3_svg_lineCardinalClosed,
4227     monotone: d3_svg_lineMonotone
4228   });
4229   d3_svg_lineInterpolators.forEach(function(key, value) {
4230     value.key = key;
4231     value.closed = /-closed$/.test(key);
4232   });
4233   var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ];
4234   d3.svg.line.radial = function() {
4235     var line = d3_svg_line(d3_svg_lineRadial);
4236     line.radius = line.x, delete line.x;
4237     line.angle = line.y, delete line.y;
4238     return line;
4239   };
4240   d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
4241   d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
4242   d3.svg.area = function() {
4243     return d3_svg_area(d3_identity);
4244   };
4245   d3.svg.area.radial = function() {
4246     var area = d3_svg_area(d3_svg_lineRadial);
4247     area.radius = area.x, delete area.x;
4248     area.innerRadius = area.x0, delete area.x0;
4249     area.outerRadius = area.x1, delete area.x1;
4250     area.angle = area.y, delete area.y;
4251     area.startAngle = area.y0, delete area.y0;
4252     area.endAngle = area.y1, delete area.y1;
4253     return area;
4254   };
4255   d3.svg.chord = function() {
4256     function chord(d, i) {
4257       var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
4258       return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z";
4259     }
4260     function subgroup(self, f, d, i) {
4261       var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
4262       return {
4263         r: r,
4264         a0: a0,
4265         a1: a1,
4266         p0: [ r * Math.cos(a0), r * Math.sin(a0) ],
4267         p1: [ r * Math.cos(a1), r * Math.sin(a1) ]
4268       };
4269     }
4270     function equals(a, b) {
4271       return a.a0 == b.a0 && a.a1 == b.a1;
4272     }
4273     function arc(r, p, a) {
4274       return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p;
4275     }
4276     function curve(r0, p0, r1, p1) {
4277       return "Q 0,0 " + p1;
4278     }
4279     var source = d3_svg_chordSource, target = d3_svg_chordTarget, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
4280     chord.radius = function(v) {
4281       if (!arguments.length) return radius;
4282       radius = d3_functor(v);
4283       return chord;
4284     };
4285     chord.source = function(v) {
4286       if (!arguments.length) return source;
4287       source = d3_functor(v);
4288       return chord;
4289     };
4290     chord.target = function(v) {
4291       if (!arguments.length) return target;
4292       target = d3_functor(v);
4293       return chord;
4294     };
4295     chord.startAngle = function(v) {
4296       if (!arguments.length) return startAngle;
4297       startAngle = d3_functor(v);
4298       return chord;
4299     };
4300     chord.endAngle = function(v) {
4301       if (!arguments.length) return endAngle;
4302       endAngle = d3_functor(v);
4303       return chord;
4304     };
4305     return chord;
4306   };
4307   d3.svg.diagonal = function() {
4308     function diagonal(d, i) {
4309       var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {
4310         x: p0.x,
4311         y: m
4312       }, {
4313         x: p3.x,
4314         y: m
4315       }, p3 ];
4316       p = p.map(projection);
4317       return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
4318     }
4319     var source = d3_svg_chordSource, target = d3_svg_chordTarget, projection = d3_svg_diagonalProjection;
4320     diagonal.source = function(x) {
4321       if (!arguments.length) return source;
4322       source = d3_functor(x);
4323       return diagonal;
4324     };
4325     diagonal.target = function(x) {
4326       if (!arguments.length) return target;
4327       target = d3_functor(x);
4328       return diagonal;
4329     };
4330     diagonal.projection = function(x) {
4331       if (!arguments.length) return projection;
4332       projection = x;
4333       return diagonal;
4334     };
4335     return diagonal;
4336   };
4337   d3.svg.diagonal.radial = function() {
4338     var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;
4339     diagonal.projection = function(x) {
4340       return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;
4341     };
4342     return diagonal;
4343   };
4344   d3.svg.mouse = d3.mouse;
4345   d3.svg.touches = d3.touches;
4346   d3.svg.symbol = function() {
4347     function symbol(d, i) {
4348       return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));
4349     }
4350     var type = d3_svg_symbolType, size = d3_svg_symbolSize;
4351     symbol.type = function(x) {
4352       if (!arguments.length) return type;
4353       type = d3_functor(x);
4354       return symbol;
4355     };
4356     symbol.size = function(x) {
4357       if (!arguments.length) return size;
4358       size = d3_functor(x);
4359       return symbol;
4360     };
4361     return symbol;
4362   };
4363   var d3_svg_symbols = d3.map({
4364     circle: d3_svg_symbolCircle,
4365     cross: function(size) {
4366       var r = Math.sqrt(size / 5) / 2;
4367       return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z";
4368     },
4369     diamond: function(size) {
4370       var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;
4371       return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
4372     },
4373     square: function(size) {
4374       var r = Math.sqrt(size) / 2;
4375       return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
4376     },
4377     "triangle-down": function(size) {
4378       var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
4379       return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
4380     },
4381     "triangle-up": function(size) {
4382       var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
4383       return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";
4384     }
4385   });
4386   d3.svg.symbolTypes = d3_svg_symbols.keys();
4387   var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180);
4388   d3.svg.axis = function() {
4389     function axis(g) {
4390       g.each(function() {
4391         var g = d3.select(this);
4392         var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_;
4393         var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1);
4394         var tick = g.selectAll("g").data(ticks, String), tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform;
4395         var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathEnter = path.enter().append("path").attr("class", "domain"), pathUpdate = d3.transition(path);
4396         var scale1 = scale.copy(), scale0 = this.__chart__ || scale1;
4397         this.__chart__ = scale1;
4398         tickEnter.append("line").attr("class", "tick");
4399         tickEnter.append("text");
4400         var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
4401         switch (orient) {
4402          case "bottom":
4403           {
4404             tickTransform = d3_svg_axisX;
4405             subtickEnter.attr("y2", tickMinorSize);
4406             subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
4407             lineEnter.attr("y2", tickMajorSize);
4408             textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding);
4409             lineUpdate.attr("x2", 0).attr("y2", tickMajorSize);
4410             textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding);
4411             text.attr("dy", ".71em").attr("text-anchor", "middle");
4412             pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
4413             break;
4414           }
4415          case "top":
4416           {
4417             tickTransform = d3_svg_axisX;
4418             subtickEnter.attr("y2", -tickMinorSize);
4419             subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
4420             lineEnter.attr("y2", -tickMajorSize);
4421             textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
4422             lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize);
4423             textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
4424             text.attr("dy", "0em").attr("text-anchor", "middle");
4425             pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
4426             break;
4427           }
4428          case "left":
4429           {
4430             tickTransform = d3_svg_axisY;
4431             subtickEnter.attr("x2", -tickMinorSize);
4432             subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
4433             lineEnter.attr("x2", -tickMajorSize);
4434             textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
4435             lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0);
4436             textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0);
4437             text.attr("dy", ".32em").attr("text-anchor", "end");
4438             pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
4439             break;
4440           }
4441          case "right":
4442           {
4443             tickTransform = d3_svg_axisY;
4444             subtickEnter.attr("x2", tickMinorSize);
4445             subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
4446             lineEnter.attr("x2", tickMajorSize);
4447             textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding);
4448             lineUpdate.attr("x2", tickMajorSize).attr("y2", 0);
4449             textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0);
4450             text.attr("dy", ".32em").attr("text-anchor", "start");
4451             pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
4452             break;
4453           }
4454         }
4455         if (scale.ticks) {
4456           tickEnter.call(tickTransform, scale0);
4457           tickUpdate.call(tickTransform, scale1);
4458           tickExit.call(tickTransform, scale1);
4459           subtickEnter.call(tickTransform, scale0);
4460           subtickUpdate.call(tickTransform, scale1);
4461           subtickExit.call(tickTransform, scale1);
4462         } else {
4463           var dx = scale1.rangeBand() / 2, x = function(d) {
4464             return scale1(d) + dx;
4465           };
4466           tickEnter.call(tickTransform, x);
4467           tickUpdate.call(tickTransform, x);
4468         }
4469       });
4470     }
4471     var scale = d3.scale.linear(), orient = "bottom", tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0;
4472     axis.scale = function(x) {
4473       if (!arguments.length) return scale;
4474       scale = x;
4475       return axis;
4476     };
4477     axis.orient = function(x) {
4478       if (!arguments.length) return orient;
4479       orient = x;
4480       return axis;
4481     };
4482     axis.ticks = function() {
4483       if (!arguments.length) return tickArguments_;
4484       tickArguments_ = arguments;
4485       return axis;
4486     };
4487     axis.tickValues = function(x) {
4488       if (!arguments.length) return tickValues;
4489       tickValues = x;
4490       return axis;
4491     };
4492     axis.tickFormat = function(x) {
4493       if (!arguments.length) return tickFormat_;
4494       tickFormat_ = x;
4495       return axis;
4496     };
4497     axis.tickSize = function(x, y, z) {
4498       if (!arguments.length) return tickMajorSize;
4499       var n = arguments.length - 1;
4500       tickMajorSize = +x;
4501       tickMinorSize = n > 1 ? +y : tickMajorSize;
4502       tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
4503       return axis;
4504     };
4505     axis.tickPadding = function(x) {
4506       if (!arguments.length) return tickPadding;
4507       tickPadding = +x;
4508       return axis;
4509     };
4510     axis.tickSubdivide = function(x) {
4511       if (!arguments.length) return tickSubdivide;
4512       tickSubdivide = +x;
4513       return axis;
4514     };
4515     return axis;
4516   };
4517   d3.svg.brush = function() {
4518     function brush(g) {
4519       g.each(function() {
4520         var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e;
4521         g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
4522         bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
4523         fg.enter().append("rect").attr("class", "extent").style("cursor", "move");
4524         tz.enter().append("g").attr("class", function(d) {
4525           return "resize " + d;
4526         }).style("cursor", function(d) {
4527           return d3_svg_brushCursor[d];
4528         }).append("rect").attr("x", function(d) {
4529           return /[ew]$/.test(d) ? -3 : null;
4530         }).attr("y", function(d) {
4531           return /^[ns]/.test(d) ? -3 : null;
4532         }).attr("width", 6).attr("height", 6).style("visibility", "hidden");
4533         tz.style("display", brush.empty() ? "none" : null);
4534         tz.exit().remove();
4535         if (x) {
4536           e = d3_scaleRange(x);
4537           bg.attr("x", e[0]).attr("width", e[1] - e[0]);
4538           redrawX(g);
4539         }
4540         if (y) {
4541           e = d3_scaleRange(y);
4542           bg.attr("y", e[0]).attr("height", e[1] - e[0]);
4543           redrawY(g);
4544         }
4545         redraw(g);
4546       });
4547     }
4548     function redraw(g) {
4549       g.selectAll(".resize").attr("transform", function(d) {
4550         return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";
4551       });
4552     }
4553     function redrawX(g) {
4554       g.select(".extent").attr("x", extent[0][0]);
4555       g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]);
4556     }
4557     function redrawY(g) {
4558       g.select(".extent").attr("y", extent[0][1]);
4559       g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);
4560     }
4561     function brushstart() {
4562       function mouse() {
4563         var touches = d3.event.changedTouches;
4564         return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
4565       }
4566       function keydown() {
4567         if (d3.event.keyCode == 32) {
4568           if (!dragging) {
4569             center = null;
4570             origin[0] -= extent[1][0];
4571             origin[1] -= extent[1][1];
4572             dragging = 2;
4573           }
4574           d3_eventCancel();
4575         }
4576       }
4577       function keyup() {
4578         if (d3.event.keyCode == 32 && dragging == 2) {
4579           origin[0] += extent[1][0];
4580           origin[1] += extent[1][1];
4581           dragging = 0;
4582           d3_eventCancel();
4583         }
4584       }
4585       function brushmove() {
4586         var point = mouse(), moved = false;
4587         if (offset) {
4588           point[0] += offset[0];
4589           point[1] += offset[1];
4590         }
4591         if (!dragging) {
4592           if (d3.event.altKey) {
4593             if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ];
4594             origin[0] = extent[+(point[0] < center[0])][0];
4595             origin[1] = extent[+(point[1] < center[1])][1];
4596           } else center = null;
4597         }
4598         if (resizingX && move1(point, x, 0)) {
4599           redrawX(g);
4600           moved = true;
4601         }
4602         if (resizingY && move1(point, y, 1)) {
4603           redrawY(g);
4604           moved = true;
4605         }
4606         if (moved) {
4607           redraw(g);
4608           event_({
4609             type: "brush",
4610             mode: dragging ? "move" : "resize"
4611           });
4612         }
4613       }
4614       function move1(point, scale, i) {
4615         var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max;
4616         if (dragging) {
4617           r0 -= position;
4618           r1 -= size + position;
4619         }
4620         min = Math.max(r0, Math.min(r1, point[i]));
4621         if (dragging) {
4622           max = (min += position) + size;
4623         } else {
4624           if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
4625           if (position < min) {
4626             max = min;
4627             min = position;
4628           } else {
4629             max = position;
4630           }
4631         }
4632         if (extent[0][i] !== min || extent[1][i] !== max) {
4633           extentDomain = null;
4634           extent[0][i] = min;
4635           extent[1][i] = max;
4636           return true;
4637         }
4638       }
4639       function brushend() {
4640         brushmove();
4641         g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
4642         d3.select("body").style("cursor", null);
4643         w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null);
4644         event_({
4645           type: "brushend"
4646         });
4647         d3_eventCancel();
4648       }
4649       var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset;
4650       var w = d3.select(window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup);
4651       if (dragging) {
4652         origin[0] = extent[0][0] - origin[0];
4653         origin[1] = extent[0][1] - origin[1];
4654       } else if (resizing) {
4655         var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);
4656         offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ];
4657         origin[0] = extent[ex][0];
4658         origin[1] = extent[ey][1];
4659       } else if (d3.event.altKey) center = origin.slice();
4660       g.style("pointer-events", "none").selectAll(".resize").style("display", null);
4661       d3.select("body").style("cursor", eventTarget.style("cursor"));
4662       event_({
4663         type: "brushstart"
4664       });
4665       brushmove();
4666       d3_eventCancel();
4667     }
4668     var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain;
4669     brush.x = function(z) {
4670       if (!arguments.length) return x;
4671       x = z;
4672       resizes = d3_svg_brushResizes[!x << 1 | !y];
4673       return brush;
4674     };
4675     brush.y = function(z) {
4676       if (!arguments.length) return y;
4677       y = z;
4678       resizes = d3_svg_brushResizes[!x << 1 | !y];
4679       return brush;
4680     };
4681     brush.extent = function(z) {
4682       var x0, x1, y0, y1, t;
4683       if (!arguments.length) {
4684         z = extentDomain || extent;
4685         if (x) {
4686           x0 = z[0][0], x1 = z[1][0];
4687           if (!extentDomain) {
4688             x0 = extent[0][0], x1 = extent[1][0];
4689             if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
4690             if (x1 < x0) t = x0, x0 = x1, x1 = t;
4691           }
4692         }
4693         if (y) {
4694           y0 = z[0][1], y1 = z[1][1];
4695           if (!extentDomain) {
4696             y0 = extent[0][1], y1 = extent[1][1];
4697             if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
4698             if (y1 < y0) t = y0, y0 = y1, y1 = t;
4699           }
4700         }
4701         return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];
4702       }
4703       extentDomain = [ [ 0, 0 ], [ 0, 0 ] ];
4704       if (x) {
4705         x0 = z[0], x1 = z[1];
4706         if (y) x0 = x0[0], x1 = x1[0];
4707         extentDomain[0][0] = x0, extentDomain[1][0] = x1;
4708         if (x.invert) x0 = x(x0), x1 = x(x1);
4709         if (x1 < x0) t = x0, x0 = x1, x1 = t;
4710         extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;
4711       }
4712       if (y) {
4713         y0 = z[0], y1 = z[1];
4714         if (x) y0 = y0[1], y1 = y1[1];
4715         extentDomain[0][1] = y0, extentDomain[1][1] = y1;
4716         if (y.invert) y0 = y(y0), y1 = y(y1);
4717         if (y1 < y0) t = y0, y0 = y1, y1 = t;
4718         extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;
4719       }
4720       return brush;
4721     };
4722     brush.clear = function() {
4723       extentDomain = null;
4724       extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0;
4725       return brush;
4726     };
4727     brush.empty = function() {
4728       return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1];
4729     };
4730     return d3.rebind(brush, event, "on");
4731   };
4732   var d3_svg_brushCursor = {
4733     n: "ns-resize",
4734     e: "ew-resize",
4735     s: "ns-resize",
4736     w: "ew-resize",
4737     nw: "nwse-resize",
4738     ne: "nesw-resize",
4739     se: "nwse-resize",
4740     sw: "nesw-resize"
4741   };
4742   var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ];
4743   d3.behavior = {};
4744   d3.behavior.drag = function() {
4745     function drag() {
4746       this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown);
4747     }
4748     function mousedown() {
4749       function point() {
4750         var p = target.parentNode;
4751         return touchId ? d3.touches(p).filter(function(p) {
4752           return p.identifier === touchId;
4753         })[0] : d3.mouse(p);
4754       }
4755       function dragmove() {
4756         if (!target.parentNode) return dragend();
4757         var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1];
4758         moved |= dx | dy;
4759         origin_ = p;
4760         d3_eventCancel();
4761         event_({
4762           type: "drag",
4763           x: p[0] + offset[0],
4764           y: p[1] + offset[1],
4765           dx: dx,
4766           dy: dy
4767         });
4768       }
4769       function dragend() {
4770         event_({
4771           type: "dragend"
4772         });
4773         if (moved) {
4774           d3_eventCancel();
4775           if (d3.event.target === eventTarget) w.on("click.drag", click, true);
4776         }
4777         w.on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", null);
4778       }
4779       function click() {
4780         d3_eventCancel();
4781         w.on("click.drag", null);
4782       }
4783       var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches && d3.event.changedTouches[0].identifier, offset, origin_ = point(), moved = 0;
4784       var w = d3.select(window).on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true);
4785       if (origin) {
4786         offset = origin.apply(target, arguments);
4787         offset = [ offset.x - origin_[0], offset.y - origin_[1] ];
4788       } else {
4789         offset = [ 0, 0 ];
4790       }
4791       if (!touchId) d3_eventCancel();
4792       event_({
4793         type: "dragstart"
4794       });
4795     }
4796     var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null;
4797     drag.origin = function(x) {
4798       if (!arguments.length) return origin;
4799       origin = x;
4800       return drag;
4801     };
4802     return d3.rebind(drag, event, "on");
4803   };
4804   d3.behavior.zoom = function() {
4805     function zoom() {
4806       this.on("mousedown.zoom", mousedown).on("mousewheel.zoom", mousewheel).on("mousemove.zoom", mousemove).on("DOMMouseScroll.zoom", mousewheel).on("dblclick.zoom", dblclick).on("touchstart.zoom", touchstart).on("touchmove.zoom", touchmove).on("touchend.zoom", touchstart);
4807     }
4808     function location(p) {
4809       return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ];
4810     }
4811     function point(l) {
4812       return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ];
4813     }
4814     function scaleTo(s) {
4815       scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
4816     }
4817     function translateTo(p, l) {
4818       l = point(l);
4819       translate[0] += p[0] - l[0];
4820       translate[1] += p[1] - l[1];
4821     }
4822     function dispatch(event) {
4823       if (x1) x1.domain(x0.range().map(function(x) {
4824         return (x - translate[0]) / scale;
4825       }).map(x0.invert));
4826       if (y1) y1.domain(y0.range().map(function(y) {
4827         return (y - translate[1]) / scale;
4828       }).map(y0.invert));
4829       d3.event.preventDefault();
4830       event({
4831         type: "zoom",
4832         scale: scale,
4833         translate: translate
4834       });
4835     }
4836     function mousedown() {
4837       function mousemove() {
4838         moved = 1;
4839         translateTo(d3.mouse(target), l);
4840         dispatch(event_);
4841       }
4842       function mouseup() {
4843         if (moved) d3_eventCancel();
4844         w.on("mousemove.zoom", null).on("mouseup.zoom", null);
4845         if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true);
4846       }
4847       function click() {
4848         d3_eventCancel();
4849         w.on("click.zoom", null);
4850       }
4851       var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target));
4852       window.focus();
4853       d3_eventCancel();
4854     }
4855     function mousewheel() {
4856       if (!translate0) translate0 = location(d3.mouse(this));
4857       scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale);
4858       translateTo(d3.mouse(this), translate0);
4859       dispatch(event.of(this, arguments));
4860     }
4861     function mousemove() {
4862       translate0 = null;
4863     }
4864     function dblclick() {
4865       var p = d3.mouse(this), l = location(p);
4866       scaleTo(d3.event.shiftKey ? scale / 2 : scale * 2);
4867       translateTo(p, l);
4868       dispatch(event.of(this, arguments));
4869     }
4870     function touchstart() {
4871       var touches = d3.touches(this), now = Date.now();
4872       scale0 = scale;
4873       translate0 = {};
4874       touches.forEach(function(t) {
4875         translate0[t.identifier] = location(t);
4876       });
4877       d3_eventCancel();
4878       if (touches.length === 1) {
4879         if (now - touchtime < 500) {
4880           var p = touches[0], l = location(touches[0]);
4881           scaleTo(scale * 2);
4882           translateTo(p, l);
4883           dispatch(event.of(this, arguments));
4884         }
4885         touchtime = now;
4886       }
4887     }
4888     function touchmove() {
4889       var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier];
4890       if (p1 = touches[1]) {
4891         var p1, l1 = translate0[p1.identifier];
4892         p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];
4893         l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];
4894         scaleTo(d3.event.scale * scale0);
4895       }
4896       translateTo(p0, l0);
4897       touchtime = null;
4898       dispatch(event.of(this, arguments));
4899     }
4900     var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;
4901     zoom.translate = function(x) {
4902       if (!arguments.length) return translate;
4903       translate = x.map(Number);
4904       return zoom;
4905     };
4906     zoom.scale = function(x) {
4907       if (!arguments.length) return scale;
4908       scale = +x;
4909       return zoom;
4910     };
4911     zoom.scaleExtent = function(x) {
4912       if (!arguments.length) return scaleExtent;
4913       scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number);
4914       return zoom;
4915     };
4916     zoom.x = function(z) {
4917       if (!arguments.length) return x1;
4918       x1 = z;
4919       x0 = z.copy();
4920       return zoom;
4921     };
4922     zoom.y = function(z) {
4923       if (!arguments.length) return y1;
4924       y1 = z;
4925       y0 = z.copy();
4926       return zoom;
4927     };
4928     return d3.rebind(zoom, event, "on");
4929   };
4930   var d3_behavior_zoomDiv, d3_behavior_zoomInfinity = [ 0, Infinity ];
4931   d3.layout = {};
4932   d3.layout.bundle = function() {
4933     return function(links) {
4934       var paths = [], i = -1, n = links.length;
4935       while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
4936       return paths;
4937     };
4938   };
4939   d3.layout.chord = function() {
4940     function relayout() {
4941       var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;
4942       chords = [];
4943       groups = [];
4944       k = 0, i = -1;
4945       while (++i < n) {
4946         x = 0, j = -1;
4947         while (++j < n) {
4948           x += matrix[i][j];
4949         }
4950         groupSums.push(x);
4951         subgroupIndex.push(d3.range(n));
4952         k += x;
4953       }
4954       if (sortGroups) {
4955         groupIndex.sort(function(a, b) {
4956           return sortGroups(groupSums[a], groupSums[b]);
4957         });
4958       }
4959       if (sortSubgroups) {
4960         subgroupIndex.forEach(function(d, i) {
4961           d.sort(function(a, b) {
4962             return sortSubgroups(matrix[i][a], matrix[i][b]);
4963           });
4964         });
4965       }
4966       k = (2 * Math.PI - padding * n) / k;
4967       x = 0, i = -1;
4968       while (++i < n) {
4969         x0 = x, j = -1;
4970         while (++j < n) {
4971           var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
4972           subgroups[di + "-" + dj] = {
4973             index: di,
4974             subindex: dj,
4975             startAngle: a0,
4976             endAngle: a1,
4977             value: v
4978           };
4979         }
4980         groups[di] = {
4981           index: di,
4982           startAngle: x0,
4983           endAngle: x,
4984           value: (x - x0) / k
4985         };
4986         x += padding;
4987       }
4988       i = -1;
4989       while (++i < n) {
4990         j = i - 1;
4991         while (++j < n) {
4992           var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
4993           if (source.value || target.value) {
4994             chords.push(source.value < target.value ? {
4995               source: target,
4996               target: source
4997             } : {
4998               source: source,
4999               target: target
5000             });
5001           }
5002         }
5003       }
5004       if (sortChords) resort();
5005     }
5006     function resort() {
5007       chords.sort(function(a, b) {
5008         return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);
5009       });
5010     }
5011     var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
5012     chord.matrix = function(x) {
5013       if (!arguments.length) return matrix;
5014       n = (matrix = x) && matrix.length;
5015       chords = groups = null;
5016       return chord;
5017     };
5018     chord.padding = function(x) {
5019       if (!arguments.length) return padding;
5020       padding = x;
5021       chords = groups = null;
5022       return chord;
5023     };
5024     chord.sortGroups = function(x) {
5025       if (!arguments.length) return sortGroups;
5026       sortGroups = x;
5027       chords = groups = null;
5028       return chord;
5029     };
5030     chord.sortSubgroups = function(x) {
5031       if (!arguments.length) return sortSubgroups;
5032       sortSubgroups = x;
5033       chords = null;
5034       return chord;
5035     };
5036     chord.sortChords = function(x) {
5037       if (!arguments.length) return sortChords;
5038       sortChords = x;
5039       if (chords) resort();
5040       return chord;
5041     };
5042     chord.chords = function() {
5043       if (!chords) relayout();
5044       return chords;
5045     };
5046     chord.groups = function() {
5047       if (!groups) relayout();
5048       return groups;
5049     };
5050     return chord;
5051   };
5052   d3.layout.force = function() {
5053     function repulse(node) {
5054       return function(quad, x1, y1, x2, y2) {
5055         if (quad.point !== node) {
5056           var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy);
5057           if ((x2 - x1) * dn < theta) {
5058             var k = quad.charge * dn * dn;
5059             node.px -= dx * k;
5060             node.py -= dy * k;
5061             return true;
5062           }
5063           if (quad.point && isFinite(dn)) {
5064             var k = quad.pointCharge * dn * dn;
5065             node.px -= dx * k;
5066             node.py -= dy * k;
5067           }
5068         }
5069         return !quad.charge;
5070       };
5071     }
5072     function dragmove(d) {
5073       d.px = d3.event.x;
5074       d.py = d3.event.y;
5075       force.resume();
5076     }
5077     var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, interval, nodes = [], links = [], distances, strengths, charges;
5078     force.tick = function() {
5079       if ((alpha *= .99) < .005) {
5080         event.end({
5081           type: "end",
5082           alpha: alpha = 0
5083         });
5084         return true;
5085       }
5086       var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;
5087       for (i = 0; i < m; ++i) {
5088         o = links[i];
5089         s = o.source;
5090         t = o.target;
5091         x = t.x - s.x;
5092         y = t.y - s.y;
5093         if (l = x * x + y * y) {
5094           l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
5095           x *= l;
5096           y *= l;
5097           t.x -= x * (k = s.weight / (t.weight + s.weight));
5098           t.y -= y * k;
5099           s.x += x * (k = 1 - k);
5100           s.y += y * k;
5101         }
5102       }
5103       if (k = alpha * gravity) {
5104         x = size[0] / 2;
5105         y = size[1] / 2;
5106         i = -1;
5107         if (k) while (++i < n) {
5108           o = nodes[i];
5109           o.x += (x - o.x) * k;
5110           o.y += (y - o.y) * k;
5111         }
5112       }
5113       if (charge) {
5114         d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
5115         i = -1;
5116         while (++i < n) {
5117           if (!(o = nodes[i]).fixed) {
5118             q.visit(repulse(o));
5119           }
5120         }
5121       }
5122       i = -1;
5123       while (++i < n) {
5124         o = nodes[i];
5125         if (o.fixed) {
5126           o.x = o.px;
5127           o.y = o.py;
5128         } else {
5129           o.x -= (o.px - (o.px = o.x)) * friction;
5130           o.y -= (o.py - (o.py = o.y)) * friction;
5131         }
5132       }
5133       event.tick({
5134         type: "tick",
5135         alpha: alpha
5136       });
5137     };
5138     force.nodes = function(x) {
5139       if (!arguments.length) return nodes;
5140       nodes = x;
5141       return force;
5142     };
5143     force.links = function(x) {
5144       if (!arguments.length) return links;
5145       links = x;
5146       return force;
5147     };
5148     force.size = function(x) {
5149       if (!arguments.length) return size;
5150       size = x;
5151       return force;
5152     };
5153     force.linkDistance = function(x) {
5154       if (!arguments.length) return linkDistance;
5155       linkDistance = d3_functor(x);
5156       return force;
5157     };
5158     force.distance = force.linkDistance;
5159     force.linkStrength = function(x) {
5160       if (!arguments.length) return linkStrength;
5161       linkStrength = d3_functor(x);
5162       return force;
5163     };
5164     force.friction = function(x) {
5165       if (!arguments.length) return friction;
5166       friction = x;
5167       return force;
5168     };
5169     force.charge = function(x) {
5170       if (!arguments.length) return charge;
5171       charge = typeof x === "function" ? x : +x;
5172       return force;
5173     };
5174     force.gravity = function(x) {
5175       if (!arguments.length) return gravity;
5176       gravity = x;
5177       return force;
5178     };
5179     force.theta = function(x) {
5180       if (!arguments.length) return theta;
5181       theta = x;
5182       return force;
5183     };
5184     force.alpha = function(x) {
5185       if (!arguments.length) return alpha;
5186       if (alpha) {
5187         if (x > 0) alpha = x; else alpha = 0;
5188       } else if (x > 0) {
5189         event.start({
5190           type: "start",
5191           alpha: alpha = x
5192         });
5193         d3.timer(force.tick);
5194       }
5195       return force;
5196     };
5197     force.start = function() {
5198       function position(dimension, size) {
5199         var neighbors = neighbor(i), j = -1, m = neighbors.length, x;
5200         while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
5201         return Math.random() * size;
5202       }
5203       function neighbor() {
5204         if (!neighbors) {
5205           neighbors = [];
5206           for (j = 0; j < n; ++j) {
5207             neighbors[j] = [];
5208           }
5209           for (j = 0; j < m; ++j) {
5210             var o = links[j];
5211             neighbors[o.source.index].push(o.target);
5212             neighbors[o.target.index].push(o.source);
5213           }
5214         }
5215         return neighbors[i];
5216       }
5217       var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;
5218       for (i = 0; i < n; ++i) {
5219         (o = nodes[i]).index = i;
5220         o.weight = 0;
5221       }
5222       distances = [];
5223       strengths = [];
5224       for (i = 0; i < m; ++i) {
5225         o = links[i];
5226         if (typeof o.source == "number") o.source = nodes[o.source];
5227         if (typeof o.target == "number") o.target = nodes[o.target];
5228         distances[i] = linkDistance.call(this, o, i);
5229         strengths[i] = linkStrength.call(this, o, i);
5230         ++o.source.weight;
5231         ++o.target.weight;
5232       }
5233       for (i = 0; i < n; ++i) {
5234         o = nodes[i];
5235         if (isNaN(o.x)) o.x = position("x", w);
5236         if (isNaN(o.y)) o.y = position("y", h);
5237         if (isNaN(o.px)) o.px = o.x;
5238         if (isNaN(o.py)) o.py = o.y;
5239       }
5240       charges = [];
5241       if (typeof charge === "function") {
5242         for (i = 0; i < n; ++i) {
5243           charges[i] = +charge.call(this, nodes[i], i);
5244         }
5245       } else {
5246         for (i = 0; i < n; ++i) {
5247           charges[i] = charge;
5248         }
5249       }
5250       return force.resume();
5251     };
5252     force.resume = function() {
5253       return force.alpha(.1);
5254     };
5255     force.stop = function() {
5256       return force.alpha(0);
5257     };
5258     force.drag = function() {
5259       if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart", d3_layout_forceDragstart).on("drag", dragmove).on("dragend", d3_layout_forceDragend);
5260       this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag);
5261     };
5262     return d3.rebind(force, event, "on");
5263   };
5264   d3.layout.partition = function() {
5265     function position(node, x, dx, dy) {
5266       var children = node.children;
5267       node.x = x;
5268       node.y = node.depth * dy;
5269       node.dx = dx;
5270       node.dy = dy;
5271       if (children && (n = children.length)) {
5272         var i = -1, n, c, d;
5273         dx = node.value ? dx / node.value : 0;
5274         while (++i < n) {
5275           position(c = children[i], x, d = c.value * dx, dy);
5276           x += d;
5277         }
5278       }
5279     }
5280     function depth(node) {
5281       var children = node.children, d = 0;
5282       if (children && (n = children.length)) {
5283         var i = -1, n;
5284         while (++i < n) d = Math.max(d, depth(children[i]));
5285       }
5286       return 1 + d;
5287     }
5288     function partition(d, i) {
5289       var nodes = hierarchy.call(this, d, i);
5290       position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
5291       return nodes;
5292     }
5293     var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];
5294     partition.size = function(x) {
5295       if (!arguments.length) return size;
5296       size = x;
5297       return partition;
5298     };
5299     return d3_layout_hierarchyRebind(partition, hierarchy);
5300   };
5301   d3.layout.pie = function() {
5302     function pie(data, i) {
5303       var values = data.map(function(d, i) {
5304         return +value.call(pie, d, i);
5305       });
5306       var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle);
5307       var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - startAngle) / d3.sum(values);
5308       var index = d3.range(data.length);
5309       if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
5310         return values[j] - values[i];
5311       } : function(i, j) {
5312         return sort(data[i], data[j]);
5313       });
5314       var arcs = [];
5315       index.forEach(function(i) {
5316         var d;
5317         arcs[i] = {
5318           data: data[i],
5319           value: d = values[i],
5320           startAngle: a,
5321           endAngle: a += d * k
5322         };
5323       });
5324       return arcs;
5325     }
5326     var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * Math.PI;
5327     pie.value = function(x) {
5328       if (!arguments.length) return value;
5329       value = x;
5330       return pie;
5331     };
5332     pie.sort = function(x) {
5333       if (!arguments.length) return sort;
5334       sort = x;
5335       return pie;
5336     };
5337     pie.startAngle = function(x) {
5338       if (!arguments.length) return startAngle;
5339       startAngle = x;
5340       return pie;
5341     };
5342     pie.endAngle = function(x) {
5343       if (!arguments.length) return endAngle;
5344       endAngle = x;
5345       return pie;
5346     };
5347     return pie;
5348   };
5349   var d3_layout_pieSortByValue = {};
5350   d3.layout.stack = function() {
5351     function stack(data, index) {
5352       var series = data.map(function(d, i) {
5353         return values.call(stack, d, i);
5354       });
5355       var points = series.map(function(d, i) {
5356         return d.map(function(v, i) {
5357           return [ x.call(stack, v, i), y.call(stack, v, i) ];
5358         });
5359       });
5360       var orders = order.call(stack, points, index);
5361       series = d3.permute(series, orders);
5362       points = d3.permute(points, orders);
5363       var offsets = offset.call(stack, points, index);
5364       var n = series.length, m = series[0].length, i, j, o;
5365       for (j = 0; j < m; ++j) {
5366         out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
5367         for (i = 1; i < n; ++i) {
5368           out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
5369         }
5370       }
5371       return data;
5372     }
5373     var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
5374     stack.values = function(x) {
5375       if (!arguments.length) return values;
5376       values = x;
5377       return stack;
5378     };
5379     stack.order = function(x) {
5380       if (!arguments.length) return order;
5381       order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
5382       return stack;
5383     };
5384     stack.offset = function(x) {
5385       if (!arguments.length) return offset;
5386       offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
5387       return stack;
5388     };
5389     stack.x = function(z) {
5390       if (!arguments.length) return x;
5391       x = z;
5392       return stack;
5393     };
5394     stack.y = function(z) {
5395       if (!arguments.length) return y;
5396       y = z;
5397       return stack;
5398     };
5399     stack.out = function(z) {
5400       if (!arguments.length) return out;
5401       out = z;
5402       return stack;
5403     };
5404     return stack;
5405   };
5406   var d3_layout_stackOrders = d3.map({
5407     "inside-out": function(data) {
5408       var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) {
5409         return max[a] - max[b];
5410       }), top = 0, bottom = 0, tops = [], bottoms = [];
5411       for (i = 0; i < n; ++i) {
5412         j = index[i];
5413         if (top < bottom) {
5414           top += sums[j];
5415           tops.push(j);
5416         } else {
5417           bottom += sums[j];
5418           bottoms.push(j);
5419         }
5420       }
5421       return bottoms.reverse().concat(tops);
5422     },
5423     reverse: function(data) {
5424       return d3.range(data.length).reverse();
5425     },
5426     "default": d3_layout_stackOrderDefault
5427   });
5428   var d3_layout_stackOffsets = d3.map({
5429     silhouette: function(data) {
5430       var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];
5431       for (j = 0; j < m; ++j) {
5432         for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
5433         if (o > max) max = o;
5434         sums.push(o);
5435       }
5436       for (j = 0; j < m; ++j) {
5437         y0[j] = (max - sums[j]) / 2;
5438       }
5439       return y0;
5440     },
5441     wiggle: function(data) {
5442       var n = data.length, x = data[0], m = x.length, max = 0, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];
5443       y0[0] = o = o0 = 0;
5444       for (j = 1; j < m; ++j) {
5445         for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
5446         for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
5447           for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
5448             s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
5449           }
5450           s2 += s3 * data[i][j][1];
5451         }
5452         y0[j] = o -= s1 ? s2 / s1 * dx : 0;
5453         if (o < o0) o0 = o;
5454       }
5455       for (j = 0; j < m; ++j) y0[j] -= o0;
5456       return y0;
5457     },
5458     expand: function(data) {
5459       var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];
5460       for (j = 0; j < m; ++j) {
5461         for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
5462         if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k;
5463       }
5464       for (j = 0; j < m; ++j) y0[j] = 0;
5465       return y0;
5466     },
5467     zero: d3_layout_stackOffsetZero
5468   });
5469   d3.layout.histogram = function() {
5470     function histogram(data, i) {
5471       var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x;
5472       while (++i < m) {
5473         bin = bins[i] = [];
5474         bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
5475         bin.y = 0;
5476       }
5477       if (m > 0) {
5478         i = -1;
5479         while (++i < n) {
5480           x = values[i];
5481           if (x >= range[0] && x <= range[1]) {
5482             bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
5483             bin.y += k;
5484             bin.push(data[i]);
5485           }
5486         }
5487       }
5488       return bins;
5489     }
5490     var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;
5491     histogram.value = function(x) {
5492       if (!arguments.length) return valuer;
5493       valuer = x;
5494       return histogram;
5495     };
5496     histogram.range = function(x) {
5497       if (!arguments.length) return ranger;
5498       ranger = d3_functor(x);
5499       return histogram;
5500     };
5501     histogram.bins = function(x) {
5502       if (!arguments.length) return binner;
5503       binner = typeof x === "number" ? function(range) {
5504         return d3_layout_histogramBinFixed(range, x);
5505       } : d3_functor(x);
5506       return histogram;
5507     };
5508     histogram.frequency = function(x) {
5509       if (!arguments.length) return frequency;
5510       frequency = !!x;
5511       return histogram;
5512     };
5513     return histogram;
5514   };
5515   d3.layout.hierarchy = function() {
5516     function recurse(data, depth, nodes) {
5517       var childs = children.call(hierarchy, data, depth), node = d3_layout_hierarchyInline ? data : {
5518         data: data
5519       };
5520       node.depth = depth;
5521       nodes.push(node);
5522       if (childs && (n = childs.length)) {
5523         var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d;
5524         while (++i < n) {
5525           d = recurse(childs[i], j, nodes);
5526           d.parent = node;
5527           c.push(d);
5528           v += d.value;
5529         }
5530         if (sort) c.sort(sort);
5531         if (value) node.value = v;
5532       } else if (value) {
5533         node.value = +value.call(hierarchy, data, depth) || 0;
5534       }
5535       return node;
5536     }
5537     function revalue(node, depth) {
5538       var children = node.children, v = 0;
5539       if (children && (n = children.length)) {
5540         var i = -1, n, j = depth + 1;
5541         while (++i < n) v += revalue(children[i], j);
5542       } else if (value) {
5543         v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0;
5544       }
5545       if (value) node.value = v;
5546       return v;
5547     }
5548     function hierarchy(d) {
5549       var nodes = [];
5550       recurse(d, 0, nodes);
5551       return nodes;
5552     }
5553     var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;
5554     hierarchy.sort = function(x) {
5555       if (!arguments.length) return sort;
5556       sort = x;
5557       return hierarchy;
5558     };
5559     hierarchy.children = function(x) {
5560       if (!arguments.length) return children;
5561       children = x;
5562       return hierarchy;
5563     };
5564     hierarchy.value = function(x) {
5565       if (!arguments.length) return value;
5566       value = x;
5567       return hierarchy;
5568     };
5569     hierarchy.revalue = function(root) {
5570       revalue(root, 0);
5571       return root;
5572     };
5573     return hierarchy;
5574   };
5575   var d3_layout_hierarchyInline = false;
5576   d3.layout.pack = function() {
5577     function pack(d, i) {
5578       var nodes = hierarchy.call(this, d, i), root = nodes[0];
5579       root.x = 0;
5580       root.y = 0;
5581       d3_layout_treeVisitAfter(root, function(d) {
5582         d.r = Math.sqrt(d.value);
5583       });
5584       d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
5585       var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h);
5586       if (padding > 0) {
5587         var dr = padding * k / 2;
5588         d3_layout_treeVisitAfter(root, function(d) {
5589           d.r += dr;
5590         });
5591         d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
5592         d3_layout_treeVisitAfter(root, function(d) {
5593           d.r -= dr;
5594         });
5595         k = Math.max(2 * root.r / w, 2 * root.r / h);
5596       }
5597       d3_layout_packTransform(root, w / 2, h / 2, 1 / k);
5598       return nodes;
5599     }
5600     var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ];
5601     pack.size = function(x) {
5602       if (!arguments.length) return size;
5603       size = x;
5604       return pack;
5605     };
5606     pack.padding = function(_) {
5607       if (!arguments.length) return padding;
5608       padding = +_;
5609       return pack;
5610     };
5611     return d3_layout_hierarchyRebind(pack, hierarchy);
5612   };
5613   d3.layout.cluster = function() {
5614     function cluster(d, i) {
5615       var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0, kx, ky;
5616       d3_layout_treeVisitAfter(root, function(node) {
5617         var children = node.children;
5618         if (children && children.length) {
5619           node.x = d3_layout_clusterX(children);
5620           node.y = d3_layout_clusterY(children);
5621         } else {
5622           node.x = previousNode ? x += separation(node, previousNode) : 0;
5623           node.y = 0;
5624           previousNode = node;
5625         }
5626       });
5627       var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;
5628       d3_layout_treeVisitAfter(root, function(node) {
5629         node.x = (node.x - x0) / (x1 - x0) * size[0];
5630         node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
5631       });
5632       return nodes;
5633     }
5634     var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
5635     cluster.separation = function(x) {
5636       if (!arguments.length) return separation;
5637       separation = x;
5638       return cluster;
5639     };
5640     cluster.size = function(x) {
5641       if (!arguments.length) return size;
5642       size = x;
5643       return cluster;
5644     };
5645     return d3_layout_hierarchyRebind(cluster, hierarchy);
5646   };
5647   d3.layout.tree = function() {
5648     function tree(d, i) {
5649       function firstWalk(node, previousSibling) {
5650         var children = node.children, layout = node._tree;
5651         if (children && (n = children.length)) {
5652           var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1;
5653           while (++i < n) {
5654             child = children[i];
5655             firstWalk(child, previousChild);
5656             ancestor = apportion(child, previousChild, ancestor);
5657             previousChild = child;
5658           }
5659           d3_layout_treeShift(node);
5660           var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
5661           if (previousSibling) {
5662             layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
5663             layout.mod = layout.prelim - midpoint;
5664           } else {
5665             layout.prelim = midpoint;
5666           }
5667         } else {
5668           if (previousSibling) {
5669             layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
5670           }
5671         }
5672       }
5673       function secondWalk(node, x) {
5674         node.x = node._tree.prelim + x;
5675         var children = node.children;
5676         if (children && (n = children.length)) {
5677           var i = -1, n;
5678           x += node._tree.mod;
5679           while (++i < n) {
5680             secondWalk(children[i], x);
5681           }
5682         }
5683       }
5684       function apportion(node, previousSibling, ancestor) {
5685         if (previousSibling) {
5686           var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift;
5687           while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
5688             vom = d3_layout_treeLeft(vom);
5689             vop = d3_layout_treeRight(vop);
5690             vop._tree.ancestor = node;
5691             shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
5692             if (shift > 0) {
5693               d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
5694               sip += shift;
5695               sop += shift;
5696             }
5697             sim += vim._tree.mod;
5698             sip += vip._tree.mod;
5699             som += vom._tree.mod;
5700             sop += vop._tree.mod;
5701           }
5702           if (vim && !d3_layout_treeRight(vop)) {
5703             vop._tree.thread = vim;
5704             vop._tree.mod += sim - sop;
5705           }
5706           if (vip && !d3_layout_treeLeft(vom)) {
5707             vom._tree.thread = vip;
5708             vom._tree.mod += sip - som;
5709             ancestor = node;
5710           }
5711         }
5712         return ancestor;
5713       }
5714       var nodes = hierarchy.call(this, d, i), root = nodes[0];
5715       d3_layout_treeVisitAfter(root, function(node, previousSibling) {
5716         node._tree = {
5717           ancestor: node,
5718           prelim: 0,
5719           mod: 0,
5720           change: 0,
5721           shift: 0,
5722           number: previousSibling ? previousSibling._tree.number + 1 : 0
5723         };
5724       });
5725       firstWalk(root);
5726       secondWalk(root, -root._tree.prelim);
5727       var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1;
5728       d3_layout_treeVisitAfter(root, function(node) {
5729         node.x = (node.x - x0) / (x1 - x0) * size[0];
5730         node.y = node.depth / y1 * size[1];
5731         delete node._tree;
5732       });
5733       return nodes;
5734     }
5735     var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
5736     tree.separation = function(x) {
5737       if (!arguments.length) return separation;
5738       separation = x;
5739       return tree;
5740     };
5741     tree.size = function(x) {
5742       if (!arguments.length) return size;
5743       size = x;
5744       return tree;
5745     };
5746     return d3_layout_hierarchyRebind(tree, hierarchy);
5747   };
5748   d3.layout.treemap = function() {
5749     function scale(children, k) {
5750       var i = -1, n = children.length, child, area;
5751       while (++i < n) {
5752         area = (child = children[i]).value * (k < 0 ? 0 : k);
5753         child.area = isNaN(area) || area <= 0 ? 0 : area;
5754       }
5755     }
5756     function squarify(node) {
5757       var children = node.children;
5758       if (children && children.length) {
5759         var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = Math.min(rect.dx, rect.dy), n;
5760         scale(remaining, rect.dx * rect.dy / node.value);
5761         row.area = 0;
5762         while ((n = remaining.length) > 0) {
5763           row.push(child = remaining[n - 1]);
5764           row.area += child.area;
5765           if ((score = worst(row, u)) <= best) {
5766             remaining.pop();
5767             best = score;
5768           } else {
5769             row.area -= row.pop().area;
5770             position(row, u, rect, false);
5771             u = Math.min(rect.dx, rect.dy);
5772             row.length = row.area = 0;
5773             best = Infinity;
5774           }
5775         }
5776         if (row.length) {
5777           position(row, u, rect, true);
5778           row.length = row.area = 0;
5779         }
5780         children.forEach(squarify);
5781       }
5782     }
5783     function stickify(node) {
5784       var children = node.children;
5785       if (children && children.length) {
5786         var rect = pad(node), remaining = children.slice(), child, row = [];
5787         scale(remaining, rect.dx * rect.dy / node.value);
5788         row.area = 0;
5789         while (child = remaining.pop()) {
5790           row.push(child);
5791           row.area += child.area;
5792           if (child.z != null) {
5793             position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
5794             row.length = row.area = 0;
5795           }
5796         }
5797         children.forEach(stickify);
5798       }
5799     }
5800     function worst(row, u) {
5801       var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;
5802       while (++i < n) {
5803         if (!(r = row[i].area)) continue;
5804         if (r < rmin) rmin = r;
5805         if (r > rmax) rmax = r;
5806       }
5807       s *= s;
5808       u *= u;
5809       return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;
5810     }
5811     function position(row, u, rect, flush) {
5812       var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;
5813       if (u == rect.dx) {
5814         if (flush || v > rect.dy) v = rect.dy;
5815         while (++i < n) {
5816           o = row[i];
5817           o.x = x;
5818           o.y = y;
5819           o.dy = v;
5820           x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
5821         }
5822         o.z = true;
5823         o.dx += rect.x + rect.dx - x;
5824         rect.y += v;
5825         rect.dy -= v;
5826       } else {
5827         if (flush || v > rect.dx) v = rect.dx;
5828         while (++i < n) {
5829           o = row[i];
5830           o.x = x;
5831           o.y = y;
5832           o.dx = v;
5833           y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
5834         }
5835         o.z = false;
5836         o.dy += rect.y + rect.dy - y;
5837         rect.x += v;
5838         rect.dx -= v;
5839       }
5840     }
5841     function treemap(d) {
5842       var nodes = stickies || hierarchy(d), root = nodes[0];
5843       root.x = 0;
5844       root.y = 0;
5845       root.dx = size[0];
5846       root.dy = size[1];
5847       if (stickies) hierarchy.revalue(root);
5848       scale([ root ], root.dx * root.dy / root.value);
5849       (stickies ? stickify : squarify)(root);
5850       if (sticky) stickies = nodes;
5851       return nodes;
5852     }
5853     var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, ratio = .5 * (1 + Math.sqrt(5));
5854     treemap.size = function(x) {
5855       if (!arguments.length) return size;
5856       size = x;
5857       return treemap;
5858     };
5859     treemap.padding = function(x) {
5860       function padFunction(node) {
5861         var p = x.call(treemap, node, node.depth);
5862         return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p);
5863       }
5864       function padConstant(node) {
5865         return d3_layout_treemapPad(node, x);
5866       }
5867       if (!arguments.length) return padding;
5868       var type;
5869       pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], padConstant) : padConstant;
5870       return treemap;
5871     };
5872     treemap.round = function(x) {
5873       if (!arguments.length) return round != Number;
5874       round = x ? Math.round : Number;
5875       return treemap;
5876     };
5877     treemap.sticky = function(x) {
5878       if (!arguments.length) return sticky;
5879       sticky = x;
5880       stickies = null;
5881       return treemap;
5882     };
5883     treemap.ratio = function(x) {
5884       if (!arguments.length) return ratio;
5885       ratio = x;
5886       return treemap;
5887     };
5888     return d3_layout_hierarchyRebind(treemap, hierarchy);
5889   };
5890   d3.csv = d3_dsv(",", "text/csv");
5891   d3.tsv = d3_dsv("     ", "text/tab-separated-values");
5892   d3.geo = {};
5893   var d3_geo_radians = Math.PI / 180;
5894   d3.geo.azimuthal = function() {
5895     function azimuthal(coordinates) {
5896       var x1 = coordinates[0] * d3_geo_radians - x0, y1 = coordinates[1] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1), cy1 = Math.cos(y1), sy1 = Math.sin(y1), cc = mode !== "orthographic" ? sy0 * sy1 + cy0 * cy1 * cx1 : null, c, k = mode === "stereographic" ? 1 / (1 + cc) : mode === "gnomonic" ? 1 / cc : mode === "equidistant" ? (c = Math.acos(cc), c ? c / Math.sin(c) : 0) : mode === "equalarea" ? Math.sqrt(2 / (1 + cc)) : 1, x = k * cy1 * sx1, y = k * (sy0 * cy1 * cx1 - cy0 * sy1);
5897       return [ scale * x + translate[0], scale * y + translate[1] ];
5898     }
5899     var mode = "orthographic", origin, scale = 200, translate = [ 480, 250 ], x0, y0, cy0, sy0;
5900     azimuthal.invert = function(coordinates) {
5901       var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p = Math.sqrt(x * x + y * y), c = mode === "stereographic" ? 2 * Math.atan(p) : mode === "gnomonic" ? Math.atan(p) : mode === "equidistant" ? p : mode === "equalarea" ? 2 * Math.asin(.5 * p) : Math.asin(p), sc = Math.sin(c), cc = Math.cos(c);
5902       return [ (x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_geo_radians, Math.asin(cc * sy0 - (p ? y * sc * cy0 / p : 0)) / d3_geo_radians ];
5903     };
5904     azimuthal.mode = function(x) {
5905       if (!arguments.length) return mode;
5906       mode = x + "";
5907       return azimuthal;
5908     };
5909     azimuthal.origin = function(x) {
5910       if (!arguments.length) return origin;
5911       origin = x;
5912       x0 = origin[0] * d3_geo_radians;
5913       y0 = origin[1] * d3_geo_radians;
5914       cy0 = Math.cos(y0);
5915       sy0 = Math.sin(y0);
5916       return azimuthal;
5917     };
5918     azimuthal.scale = function(x) {
5919       if (!arguments.length) return scale;
5920       scale = +x;
5921       return azimuthal;
5922     };
5923     azimuthal.translate = function(x) {
5924       if (!arguments.length) return translate;
5925       translate = [ +x[0], +x[1] ];
5926       return azimuthal;
5927     };
5928     return azimuthal.origin([ 0, 0 ]);
5929   };
5930   d3.geo.albers = function() {
5931     function albers(coordinates) {
5932       var t = n * (d3_geo_radians * coordinates[0] - lng0), p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n;
5933       return [ scale * p * Math.sin(t) + translate[0], scale * (p * Math.cos(t) - p0) + translate[1] ];
5934     }
5935     function reload() {
5936       var phi1 = d3_geo_radians * parallels[0], phi2 = d3_geo_radians * parallels[1], lat0 = d3_geo_radians * origin[1], s = Math.sin(phi1), c = Math.cos(phi1);
5937       lng0 = d3_geo_radians * origin[0];
5938       n = .5 * (s + Math.sin(phi2));
5939       C = c * c + 2 * n * s;
5940       p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n;
5941       return albers;
5942     }
5943     var origin = [ -98, 38 ], parallels = [ 29.5, 45.5 ], scale = 1e3, translate = [ 480, 250 ], lng0, n, C, p0;
5944     albers.invert = function(coordinates) {
5945       var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p0y = p0 + y, t = Math.atan2(x, p0y), p = Math.sqrt(x * x + p0y * p0y);
5946       return [ (lng0 + t / n) / d3_geo_radians, Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians ];
5947     };
5948     albers.origin = function(x) {
5949       if (!arguments.length) return origin;
5950       origin = [ +x[0], +x[1] ];
5951       return reload();
5952     };
5953     albers.parallels = function(x) {
5954       if (!arguments.length) return parallels;
5955       parallels = [ +x[0], +x[1] ];
5956       return reload();
5957     };
5958     albers.scale = function(x) {
5959       if (!arguments.length) return scale;
5960       scale = +x;
5961       return albers;
5962     };
5963     albers.translate = function(x) {
5964       if (!arguments.length) return translate;
5965       translate = [ +x[0], +x[1] ];
5966       return albers;
5967     };
5968     return reload();
5969   };
5970   d3.geo.albersUsa = function() {
5971     function albersUsa(coordinates) {
5972       var lon = coordinates[0], lat = coordinates[1];
5973       return (lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48)(coordinates);
5974     }
5975     var lower48 = d3.geo.albers();
5976     var alaska = d3.geo.albers().origin([ -160, 60 ]).parallels([ 55, 65 ]);
5977     var hawaii = d3.geo.albers().origin([ -160, 20 ]).parallels([ 8, 18 ]);
5978     var puertoRico = d3.geo.albers().origin([ -60, 10 ]).parallels([ 8, 18 ]);
5979     albersUsa.scale = function(x) {
5980       if (!arguments.length) return lower48.scale();
5981       lower48.scale(x);
5982       alaska.scale(x * .6);
5983       hawaii.scale(x);
5984       puertoRico.scale(x * 1.5);
5985       return albersUsa.translate(lower48.translate());
5986     };
5987     albersUsa.translate = function(x) {
5988       if (!arguments.length) return lower48.translate();
5989       var dz = lower48.scale() / 1e3, dx = x[0], dy = x[1];
5990       lower48.translate(x);
5991       alaska.translate([ dx - 400 * dz, dy + 170 * dz ]);
5992       hawaii.translate([ dx - 190 * dz, dy + 200 * dz ]);
5993       puertoRico.translate([ dx + 580 * dz, dy + 430 * dz ]);
5994       return albersUsa;
5995     };
5996     return albersUsa.scale(lower48.scale());
5997   };
5998   d3.geo.bonne = function() {
5999     function bonne(coordinates) {
6000       var x = coordinates[0] * d3_geo_radians - x0, y = coordinates[1] * d3_geo_radians - y0;
6001       if (y1) {
6002         var p = c1 + y1 - y, E = x * Math.cos(y) / p;
6003         x = p * Math.sin(E);
6004         y = p * Math.cos(E) - c1;
6005       } else {
6006         x *= Math.cos(y);
6007         y *= -1;
6008       }
6009       return [ scale * x + translate[0], scale * y + translate[1] ];
6010     }
6011     var scale = 200, translate = [ 480, 250 ], x0, y0, y1, c1;
6012     bonne.invert = function(coordinates) {
6013       var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
6014       if (y1) {
6015         var c = c1 + y, p = Math.sqrt(x * x + c * c);
6016         y = c1 + y1 - p;
6017         x = x0 + p * Math.atan2(x, c) / Math.cos(y);
6018       } else {
6019         y *= -1;
6020         x /= Math.cos(y);
6021       }
6022       return [ x / d3_geo_radians, y / d3_geo_radians ];
6023     };
6024     bonne.parallel = function(x) {
6025       if (!arguments.length) return y1 / d3_geo_radians;
6026       c1 = 1 / Math.tan(y1 = x * d3_geo_radians);
6027       return bonne;
6028     };
6029     bonne.origin = function(x) {
6030       if (!arguments.length) return [ x0 / d3_geo_radians, y0 / d3_geo_radians ];
6031       x0 = x[0] * d3_geo_radians;
6032       y0 = x[1] * d3_geo_radians;
6033       return bonne;
6034     };
6035     bonne.scale = function(x) {
6036       if (!arguments.length) return scale;
6037       scale = +x;
6038       return bonne;
6039     };
6040     bonne.translate = function(x) {
6041       if (!arguments.length) return translate;
6042       translate = [ +x[0], +x[1] ];
6043       return bonne;
6044     };
6045     return bonne.origin([ 0, 0 ]).parallel(45);
6046   };
6047   d3.geo.equirectangular = function() {
6048     function equirectangular(coordinates) {
6049       var x = coordinates[0] / 360, y = -coordinates[1] / 360;
6050       return [ scale * x + translate[0], scale * y + translate[1] ];
6051     }
6052     var scale = 500, translate = [ 480, 250 ];
6053     equirectangular.invert = function(coordinates) {
6054       var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
6055       return [ 360 * x, -360 * y ];
6056     };
6057     equirectangular.scale = function(x) {
6058       if (!arguments.length) return scale;
6059       scale = +x;
6060       return equirectangular;
6061     };
6062     equirectangular.translate = function(x) {
6063       if (!arguments.length) return translate;
6064       translate = [ +x[0], +x[1] ];
6065       return equirectangular;
6066     };
6067     return equirectangular;
6068   };
6069   d3.geo.mercator = function() {
6070     function mercator(coordinates) {
6071       var x = coordinates[0] / 360, y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360;
6072       return [ scale * x + translate[0], scale * Math.max(-.5, Math.min(.5, y)) + translate[1] ];
6073     }
6074     var scale = 500, translate = [ 480, 250 ];
6075     mercator.invert = function(coordinates) {
6076       var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
6077       return [ 360 * x, 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90 ];
6078     };
6079     mercator.scale = function(x) {
6080       if (!arguments.length) return scale;
6081       scale = +x;
6082       return mercator;
6083     };
6084     mercator.translate = function(x) {
6085       if (!arguments.length) return translate;
6086       translate = [ +x[0], +x[1] ];
6087       return mercator;
6088     };
6089     return mercator;
6090   };
6091   d3.geo.path = function() {
6092     function path(d, i) {
6093       if (typeof pointRadius === "function") pointCircle = d3_path_circle(pointRadius.apply(this, arguments));
6094       pathType(d);
6095       var result = buffer.length ? buffer.join("") : null;
6096       buffer = [];
6097       return result;
6098     }
6099     function project(coordinates) {
6100       return projection(coordinates).join(",");
6101     }
6102     function polygonArea(coordinates) {
6103       var sum = area(coordinates[0]), i = 0, n = coordinates.length;
6104       while (++i < n) sum -= area(coordinates[i]);
6105       return sum;
6106     }
6107     function polygonCentroid(coordinates) {
6108       var polygon = d3.geom.polygon(coordinates[0].map(projection)), area = polygon.area(), centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1), x = centroid[0], y = centroid[1], z = area, i = 0, n = coordinates.length;
6109       while (++i < n) {
6110         polygon = d3.geom.polygon(coordinates[i].map(projection));
6111         area = polygon.area();
6112         centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1);
6113         x -= centroid[0];
6114         y -= centroid[1];
6115         z -= area;
6116       }
6117       return [ x, y, 6 * z ];
6118     }
6119     function area(coordinates) {
6120       return Math.abs(d3.geom.polygon(coordinates.map(projection)).area());
6121     }
6122     var pointRadius = 4.5, pointCircle = d3_path_circle(pointRadius), projection = d3.geo.albersUsa(), buffer = [];
6123     var pathType = d3_geo_type({
6124       FeatureCollection: function(o) {
6125         var features = o.features, i = -1, n = features.length;
6126         while (++i < n) buffer.push(pathType(features[i].geometry));
6127       },
6128       Feature: function(o) {
6129         pathType(o.geometry);
6130       },
6131       Point: function(o) {
6132         buffer.push("M", project(o.coordinates), pointCircle);
6133       },
6134       MultiPoint: function(o) {
6135         var coordinates = o.coordinates, i = -1, n = coordinates.length;
6136         while (++i < n) buffer.push("M", project(coordinates[i]), pointCircle);
6137       },
6138       LineString: function(o) {
6139         var coordinates = o.coordinates, i = -1, n = coordinates.length;
6140         buffer.push("M");
6141         while (++i < n) buffer.push(project(coordinates[i]), "L");
6142         buffer.pop();
6143       },
6144       MultiLineString: function(o) {
6145         var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m;
6146         while (++i < n) {
6147           subcoordinates = coordinates[i];
6148           j = -1;
6149           m = subcoordinates.length;
6150           buffer.push("M");
6151           while (++j < m) buffer.push(project(subcoordinates[j]), "L");
6152           buffer.pop();
6153         }
6154       },
6155       Polygon: function(o) {
6156         var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m;
6157         while (++i < n) {
6158           subcoordinates = coordinates[i];
6159           j = -1;
6160           if ((m = subcoordinates.length - 1) > 0) {
6161             buffer.push("M");
6162             while (++j < m) buffer.push(project(subcoordinates[j]), "L");
6163             buffer[buffer.length - 1] = "Z";
6164           }
6165         }
6166       },
6167       MultiPolygon: function(o) {
6168         var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m, subsubcoordinates, k, p;
6169         while (++i < n) {
6170           subcoordinates = coordinates[i];
6171           j = -1;
6172           m = subcoordinates.length;
6173           while (++j < m) {
6174             subsubcoordinates = subcoordinates[j];
6175             k = -1;
6176             if ((p = subsubcoordinates.length - 1) > 0) {
6177               buffer.push("M");
6178               while (++k < p) buffer.push(project(subsubcoordinates[k]), "L");
6179               buffer[buffer.length - 1] = "Z";
6180             }
6181           }
6182         }
6183       },
6184       GeometryCollection: function(o) {
6185         var geometries = o.geometries, i = -1, n = geometries.length;
6186         while (++i < n) buffer.push(pathType(geometries[i]));
6187       }
6188     });
6189     var areaType = path.area = d3_geo_type({
6190       FeatureCollection: function(o) {
6191         var area = 0, features = o.features, i = -1, n = features.length;
6192         while (++i < n) area += areaType(features[i]);
6193         return area;
6194       },
6195       Feature: function(o) {
6196         return areaType(o.geometry);
6197       },
6198       Polygon: function(o) {
6199         return polygonArea(o.coordinates);
6200       },
6201       MultiPolygon: function(o) {
6202         var sum = 0, coordinates = o.coordinates, i = -1, n = coordinates.length;
6203         while (++i < n) sum += polygonArea(coordinates[i]);
6204         return sum;
6205       },
6206       GeometryCollection: function(o) {
6207         var sum = 0, geometries = o.geometries, i = -1, n = geometries.length;
6208         while (++i < n) sum += areaType(geometries[i]);
6209         return sum;
6210       }
6211     }, 0);
6212     var centroidType = path.centroid = d3_geo_type({
6213       Feature: function(o) {
6214         return centroidType(o.geometry);
6215       },
6216       Polygon: function(o) {
6217         var centroid = polygonCentroid(o.coordinates);
6218         return [ centroid[0] / centroid[2], centroid[1] / centroid[2] ];
6219       },
6220       MultiPolygon: function(o) {
6221         var area = 0, coordinates = o.coordinates, centroid, x = 0, y = 0, z = 0, i = -1, n = coordinates.length;
6222         while (++i < n) {
6223           centroid = polygonCentroid(coordinates[i]);
6224           x += centroid[0];
6225           y += centroid[1];
6226           z += centroid[2];
6227         }
6228         return [ x / z, y / z ];
6229       }
6230     });
6231     path.projection = function(x) {
6232       projection = x;
6233       return path;
6234     };
6235     path.pointRadius = function(x) {
6236       if (typeof x === "function") pointRadius = x; else {
6237         pointRadius = +x;
6238         pointCircle = d3_path_circle(pointRadius);
6239       }
6240       return path;
6241     };
6242     return path;
6243   };
6244   d3.geo.bounds = function(feature) {
6245     var left = Infinity, bottom = Infinity, right = -Infinity, top = -Infinity;
6246     d3_geo_bounds(feature, function(x, y) {
6247       if (x < left) left = x;
6248       if (x > right) right = x;
6249       if (y < bottom) bottom = y;
6250       if (y > top) top = y;
6251     });
6252     return [ [ left, bottom ], [ right, top ] ];
6253   };
6254   var d3_geo_boundsTypes = {
6255     Feature: d3_geo_boundsFeature,
6256     FeatureCollection: d3_geo_boundsFeatureCollection,
6257     GeometryCollection: d3_geo_boundsGeometryCollection,
6258     LineString: d3_geo_boundsLineString,
6259     MultiLineString: d3_geo_boundsMultiLineString,
6260     MultiPoint: d3_geo_boundsLineString,
6261     MultiPolygon: d3_geo_boundsMultiPolygon,
6262     Point: d3_geo_boundsPoint,
6263     Polygon: d3_geo_boundsPolygon
6264   };
6265   d3.geo.circle = function() {
6266     function circle() {}
6267     function visible(point) {
6268       return arc.distance(point) < radians;
6269     }
6270     function clip(coordinates) {
6271       var i = -1, n = coordinates.length, clipped = [], p0, p1, p2, d0, d1;
6272       while (++i < n) {
6273         d1 = arc.distance(p2 = coordinates[i]);
6274         if (d1 < radians) {
6275           if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1)));
6276           clipped.push(p2);
6277           p0 = p1 = null;
6278         } else {
6279           p1 = p2;
6280           if (!p0 && clipped.length) {
6281             clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0)));
6282             p0 = p1;
6283           }
6284         }
6285         d0 = d1;
6286       }
6287       p0 = coordinates[0];
6288       p1 = clipped[0];
6289       if (p1 && p2[0] === p0[0] && p2[1] === p0[1] && !(p2[0] === p1[0] && p2[1] === p1[1])) {
6290         clipped.push(p1);
6291       }
6292       return resample(clipped);
6293     }
6294     function resample(coordinates) {
6295       var i = 0, n = coordinates.length, j, m, resampled = n ? [ coordinates[0] ] : coordinates, resamples, origin = arc.source();
6296       while (++i < n) {
6297         resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates;
6298         for (j = 0, m = resamples.length; ++j < m; ) resampled.push(resamples[j]);
6299       }
6300       arc.source(origin);
6301       return resampled;
6302     }
6303     var origin = [ 0, 0 ], degrees = 90 - .01, radians = degrees * d3_geo_radians, arc = d3.geo.greatArc().source(origin).target(d3_identity);
6304     circle.clip = function(d) {
6305       if (typeof origin === "function") arc.source(origin.apply(this, arguments));
6306       return clipType(d) || null;
6307     };
6308     var clipType = d3_geo_type({
6309       FeatureCollection: function(o) {
6310         var features = o.features.map(clipType).filter(d3_identity);
6311         return features && (o = Object.create(o), o.features = features, o);
6312       },
6313       Feature: function(o) {
6314         var geometry = clipType(o.geometry);
6315         return geometry && (o = Object.create(o), o.geometry = geometry, o);
6316       },
6317       Point: function(o) {
6318         return visible(o.coordinates) && o;
6319       },
6320       MultiPoint: function(o) {
6321         var coordinates = o.coordinates.filter(visible);
6322         return coordinates.length && {
6323           type: o.type,
6324           coordinates: coordinates
6325         };
6326       },
6327       LineString: function(o) {
6328         var coordinates = clip(o.coordinates);
6329         return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
6330       },
6331       MultiLineString: function(o) {
6332         var coordinates = o.coordinates.map(clip).filter(function(d) {
6333           return d.length;
6334         });
6335         return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
6336       },
6337       Polygon: function(o) {
6338         var coordinates = o.coordinates.map(clip);
6339         return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o);
6340       },
6341       MultiPolygon: function(o) {
6342         var coordinates = o.coordinates.map(function(d) {
6343           return d.map(clip);
6344         }).filter(function(d) {
6345           return d[0].length;
6346         });
6347         return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
6348       },
6349       GeometryCollection: function(o) {
6350         var geometries = o.geometries.map(clipType).filter(d3_identity);
6351         return geometries.length && (o = Object.create(o), o.geometries = geometries, o);
6352       }
6353     });
6354     circle.origin = function(x) {
6355       if (!arguments.length) return origin;
6356       origin = x;
6357       if (typeof origin !== "function") arc.source(origin);
6358       return circle;
6359     };
6360     circle.angle = function(x) {
6361       if (!arguments.length) return degrees;
6362       radians = (degrees = +x) * d3_geo_radians;
6363       return circle;
6364     };
6365     return d3.rebind(circle, arc, "precision");
6366   };
6367   d3.geo.greatArc = function() {
6368     function greatArc() {
6369       var d = greatArc.distance.apply(this, arguments), t = 0, dt = precision / d, coordinates = [ p0 ];
6370       while ((t += dt) < 1) coordinates.push(interpolate(t));
6371       coordinates.push(p1);
6372       return {
6373         type: "LineString",
6374         coordinates: coordinates
6375       };
6376     }
6377     var source = d3_geo_greatArcSource, p0, target = d3_geo_greatArcTarget, p1, precision = 6 * d3_geo_radians, interpolate = d3_geo_greatArcInterpolator();
6378     greatArc.distance = function() {
6379       if (typeof source === "function") interpolate.source(p0 = source.apply(this, arguments));
6380       if (typeof target === "function") interpolate.target(p1 = target.apply(this, arguments));
6381       return interpolate.distance();
6382     };
6383     greatArc.source = function(_) {
6384       if (!arguments.length) return source;
6385       source = _;
6386       if (typeof source !== "function") interpolate.source(p0 = source);
6387       return greatArc;
6388     };
6389     greatArc.target = function(_) {
6390       if (!arguments.length) return target;
6391       target = _;
6392       if (typeof target !== "function") interpolate.target(p1 = target);
6393       return greatArc;
6394     };
6395     greatArc.precision = function(_) {
6396       if (!arguments.length) return precision / d3_geo_radians;
6397       precision = _ * d3_geo_radians;
6398       return greatArc;
6399     };
6400     return greatArc;
6401   };
6402   d3.geo.greatCircle = d3.geo.circle;
6403   d3.geom = {};
6404   d3.geom.contour = function(grid, start) {
6405     var s = start || d3_geom_contourStart(grid), c = [], x = s[0], y = s[1], dx = 0, dy = 0, pdx = NaN, pdy = NaN, i = 0;
6406     do {
6407       i = 0;
6408       if (grid(x - 1, y - 1)) i += 1;
6409       if (grid(x, y - 1)) i += 2;
6410       if (grid(x - 1, y)) i += 4;
6411       if (grid(x, y)) i += 8;
6412       if (i === 6) {
6413         dx = pdy === -1 ? -1 : 1;
6414         dy = 0;
6415       } else if (i === 9) {
6416         dx = 0;
6417         dy = pdx === 1 ? -1 : 1;
6418       } else {
6419         dx = d3_geom_contourDx[i];
6420         dy = d3_geom_contourDy[i];
6421       }
6422       if (dx != pdx && dy != pdy) {
6423         c.push([ x, y ]);
6424         pdx = dx;
6425         pdy = dy;
6426       }
6427       x += dx;
6428       y += dy;
6429     } while (s[0] != x || s[1] != y);
6430     return c;
6431   };
6432   var d3_geom_contourDx = [ 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 0, 0, -1, 0, -1, NaN ], d3_geom_contourDy = [ 0, -1, 0, 0, 0, -1, 0, 0, 1, -1, 1, 1, 0, -1, 0, NaN ];
6433   d3.geom.hull = function(vertices) {
6434     if (vertices.length < 3) return [];
6435     var len = vertices.length, plen = len - 1, points = [], stack = [], i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
6436     for (i = 1; i < len; ++i) {
6437       if (vertices[i][1] < vertices[h][1]) {
6438         h = i;
6439       } else if (vertices[i][1] == vertices[h][1]) {
6440         h = vertices[i][0] < vertices[h][0] ? i : h;
6441       }
6442     }
6443     for (i = 0; i < len; ++i) {
6444       if (i === h) continue;
6445       y1 = vertices[i][1] - vertices[h][1];
6446       x1 = vertices[i][0] - vertices[h][0];
6447       points.push({
6448         angle: Math.atan2(y1, x1),
6449         index: i
6450       });
6451     }
6452     points.sort(function(a, b) {
6453       return a.angle - b.angle;
6454     });
6455     a = points[0].angle;
6456     v = points[0].index;
6457     u = 0;
6458     for (i = 1; i < plen; ++i) {
6459       j = points[i].index;
6460       if (a == points[i].angle) {
6461         x1 = vertices[v][0] - vertices[h][0];
6462         y1 = vertices[v][1] - vertices[h][1];
6463         x2 = vertices[j][0] - vertices[h][0];
6464         y2 = vertices[j][1] - vertices[h][1];
6465         if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) {
6466           points[i].index = -1;
6467         } else {
6468           points[u].index = -1;
6469           a = points[i].angle;
6470           u = i;
6471           v = j;
6472         }
6473       } else {
6474         a = points[i].angle;
6475         u = i;
6476         v = j;
6477       }
6478     }
6479     stack.push(h);
6480     for (i = 0, j = 0; i < 2; ++j) {
6481       if (points[j].index !== -1) {
6482         stack.push(points[j].index);
6483         i++;
6484       }
6485     }
6486     sp = stack.length;
6487     for (; j < plen; ++j) {
6488       if (points[j].index === -1) continue;
6489       while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) {
6490         --sp;
6491       }
6492       stack[sp++] = points[j].index;
6493     }
6494     var poly = [];
6495     for (i = 0; i < sp; ++i) {
6496       poly.push(vertices[stack[i]]);
6497     }
6498     return poly;
6499   };
6500   d3.geom.polygon = function(coordinates) {
6501     coordinates.area = function() {
6502       var i = 0, n = coordinates.length, a = coordinates[n - 1][0] * coordinates[0][1], b = coordinates[n - 1][1] * coordinates[0][0];
6503       while (++i < n) {
6504         a += coordinates[i - 1][0] * coordinates[i][1];
6505         b += coordinates[i - 1][1] * coordinates[i][0];
6506       }
6507       return (b - a) * .5;
6508     };
6509     coordinates.centroid = function(k) {
6510       var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c;
6511       if (!arguments.length) k = -1 / (6 * coordinates.area());
6512       while (++i < n) {
6513         a = b;
6514         b = coordinates[i];
6515         c = a[0] * b[1] - b[0] * a[1];
6516         x += (a[0] + b[0]) * c;
6517         y += (a[1] + b[1]) * c;
6518       }
6519       return [ x * k, y * k ];
6520     };
6521     coordinates.clip = function(subject) {
6522       var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d;
6523       while (++i < n) {
6524         input = subject.slice();
6525         subject.length = 0;
6526         b = coordinates[i];
6527         c = input[(m = input.length) - 1];
6528         j = -1;
6529         while (++j < m) {
6530           d = input[j];
6531           if (d3_geom_polygonInside(d, a, b)) {
6532             if (!d3_geom_polygonInside(c, a, b)) {
6533               subject.push(d3_geom_polygonIntersect(c, d, a, b));
6534             }
6535             subject.push(d);
6536           } else if (d3_geom_polygonInside(c, a, b)) {
6537             subject.push(d3_geom_polygonIntersect(c, d, a, b));
6538           }
6539           c = d;
6540         }
6541         a = b;
6542       }
6543       return subject;
6544     };
6545     return coordinates;
6546   };
6547   d3.geom.voronoi = function(vertices) {
6548     var polygons = vertices.map(function() {
6549       return [];
6550     });
6551     d3_voronoi_tessellate(vertices, function(e) {
6552       var s1, s2, x1, x2, y1, y2;
6553       if (e.a === 1 && e.b >= 0) {
6554         s1 = e.ep.r;
6555         s2 = e.ep.l;
6556       } else {
6557         s1 = e.ep.l;
6558         s2 = e.ep.r;
6559       }
6560       if (e.a === 1) {
6561         y1 = s1 ? s1.y : -1e6;
6562         x1 = e.c - e.b * y1;
6563         y2 = s2 ? s2.y : 1e6;
6564         x2 = e.c - e.b * y2;
6565       } else {
6566         x1 = s1 ? s1.x : -1e6;
6567         y1 = e.c - e.a * x1;
6568         x2 = s2 ? s2.x : 1e6;
6569         y2 = e.c - e.a * x2;
6570       }
6571       var v1 = [ x1, y1 ], v2 = [ x2, y2 ];
6572       polygons[e.region.l.index].push(v1, v2);
6573       polygons[e.region.r.index].push(v1, v2);
6574     });
6575     return polygons.map(function(polygon, i) {
6576       var cx = vertices[i][0], cy = vertices[i][1];
6577       polygon.forEach(function(v) {
6578         v.angle = Math.atan2(v[0] - cx, v[1] - cy);
6579       });
6580       return polygon.sort(function(a, b) {
6581         return a.angle - b.angle;
6582       }).filter(function(d, i) {
6583         return !i || d.angle - polygon[i - 1].angle > 1e-10;
6584       });
6585     });
6586   };
6587   var d3_voronoi_opposite = {
6588     l: "r",
6589     r: "l"
6590   };
6591   d3.geom.delaunay = function(vertices) {
6592     var edges = vertices.map(function() {
6593       return [];
6594     }), triangles = [];
6595     d3_voronoi_tessellate(vertices, function(e) {
6596       edges[e.region.l.index].push(vertices[e.region.r.index]);
6597     });
6598     edges.forEach(function(edge, i) {
6599       var v = vertices[i], cx = v[0], cy = v[1];
6600       edge.forEach(function(v) {
6601         v.angle = Math.atan2(v[0] - cx, v[1] - cy);
6602       });
6603       edge.sort(function(a, b) {
6604         return a.angle - b.angle;
6605       });
6606       for (var j = 0, m = edge.length - 1; j < m; j++) {
6607         triangles.push([ v, edge[j], edge[j + 1] ]);
6608       }
6609     });
6610     return triangles;
6611   };
6612   d3.geom.quadtree = function(points, x1, y1, x2, y2) {
6613     function insert(n, p, x1, y1, x2, y2) {
6614       if (isNaN(p.x) || isNaN(p.y)) return;
6615       if (n.leaf) {
6616         var v = n.point;
6617         if (v) {
6618           if (Math.abs(v.x - p.x) + Math.abs(v.y - p.y) < .01) {
6619             insertChild(n, p, x1, y1, x2, y2);
6620           } else {
6621             n.point = null;
6622             insertChild(n, v, x1, y1, x2, y2);
6623             insertChild(n, p, x1, y1, x2, y2);
6624           }
6625         } else {
6626           n.point = p;
6627         }
6628       } else {
6629         insertChild(n, p, x1, y1, x2, y2);
6630       }
6631     }
6632     function insertChild(n, p, x1, y1, x2, y2) {
6633       var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = p.x >= sx, bottom = p.y >= sy, i = (bottom << 1) + right;
6634       n.leaf = false;
6635       n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
6636       if (right) x1 = sx; else x2 = sx;
6637       if (bottom) y1 = sy; else y2 = sy;
6638       insert(n, p, x1, y1, x2, y2);
6639     }
6640     var p, i = -1, n = points.length;
6641     if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint);
6642     if (arguments.length < 5) {
6643       if (arguments.length === 3) {
6644         y2 = x2 = y1;
6645         y1 = x1;
6646       } else {
6647         x1 = y1 = Infinity;
6648         x2 = y2 = -Infinity;
6649         while (++i < n) {
6650           p = points[i];
6651           if (p.x < x1) x1 = p.x;
6652           if (p.y < y1) y1 = p.y;
6653           if (p.x > x2) x2 = p.x;
6654           if (p.y > y2) y2 = p.y;
6655         }
6656         var dx = x2 - x1, dy = y2 - y1;
6657         if (dx > dy) y2 = y1 + dx; else x2 = x1 + dy;
6658       }
6659     }
6660     var root = d3_geom_quadtreeNode();
6661     root.add = function(p) {
6662       insert(root, p, x1, y1, x2, y2);
6663     };
6664     root.visit = function(f) {
6665       d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
6666     };
6667     points.forEach(root.add);
6668     return root;
6669   };
6670   d3.time = {};
6671   var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
6672   d3_time_utc.prototype = {
6673     getDate: function() {
6674       return this._.getUTCDate();
6675     },
6676     getDay: function() {
6677       return this._.getUTCDay();
6678     },
6679     getFullYear: function() {
6680       return this._.getUTCFullYear();
6681     },
6682     getHours: function() {
6683       return this._.getUTCHours();
6684     },
6685     getMilliseconds: function() {
6686       return this._.getUTCMilliseconds();
6687     },
6688     getMinutes: function() {
6689       return this._.getUTCMinutes();
6690     },
6691     getMonth: function() {
6692       return this._.getUTCMonth();
6693     },
6694     getSeconds: function() {
6695       return this._.getUTCSeconds();
6696     },
6697     getTime: function() {
6698       return this._.getTime();
6699     },
6700     getTimezoneOffset: function() {
6701       return 0;
6702     },
6703     valueOf: function() {
6704       return this._.valueOf();
6705     },
6706     setDate: function() {
6707       d3_time_prototype.setUTCDate.apply(this._, arguments);
6708     },
6709     setDay: function() {
6710       d3_time_prototype.setUTCDay.apply(this._, arguments);
6711     },
6712     setFullYear: function() {
6713       d3_time_prototype.setUTCFullYear.apply(this._, arguments);
6714     },
6715     setHours: function() {
6716       d3_time_prototype.setUTCHours.apply(this._, arguments);
6717     },
6718     setMilliseconds: function() {
6719       d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);
6720     },
6721     setMinutes: function() {
6722       d3_time_prototype.setUTCMinutes.apply(this._, arguments);
6723     },
6724     setMonth: function() {
6725       d3_time_prototype.setUTCMonth.apply(this._, arguments);
6726     },
6727     setSeconds: function() {
6728       d3_time_prototype.setUTCSeconds.apply(this._, arguments);
6729     },
6730     setTime: function() {
6731       d3_time_prototype.setTime.apply(this._, arguments);
6732     }
6733   };
6734   var d3_time_prototype = Date.prototype;
6735   var d3_time_formatDateTime = "%a %b %e %H:%M:%S %Y", d3_time_formatDate = "%m/%d/%y", d3_time_formatTime = "%H:%M:%S";
6736   var d3_time_days = d3_time_daySymbols, d3_time_dayAbbreviations = d3_time_days.map(d3_time_formatAbbreviate), d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = d3_time_months.map(d3_time_formatAbbreviate);
6737   d3.time.format = function(template) {
6738     function format(date) {
6739       var string = [], i = -1, j = 0, c, f;
6740       while (++i < n) {
6741         if (template.charCodeAt(i) == 37) {
6742           string.push(template.substring(j, i), (f = d3_time_formats[c = template.charAt(++i)]) ? f(date) : c);
6743           j = i + 1;
6744         }
6745       }
6746       string.push(template.substring(j, i));
6747       return string.join("");
6748     }
6749     var n = template.length;
6750     format.parse = function(string) {
6751       var d = {
6752         y: 1900,
6753         m: 0,
6754         d: 1,
6755         H: 0,
6756         M: 0,
6757         S: 0,
6758         L: 0
6759       }, i = d3_time_parse(d, template, string, 0);
6760       if (i != string.length) return null;
6761       if ("p" in d) d.H = d.H % 12 + d.p * 12;
6762       var date = new d3_time;
6763       date.setFullYear(d.y, d.m, d.d);
6764       date.setHours(d.H, d.M, d.S, d.L);
6765       return date;
6766     };
6767     format.toString = function() {
6768       return template;
6769     };
6770     return format;
6771   };
6772   var d3_time_zfill2 = d3.format("02d"), d3_time_zfill3 = d3.format("03d"), d3_time_zfill4 = d3.format("04d"), d3_time_sfill2 = d3.format("2d");
6773   var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_monthRe = d3_time_formatRe(d3_time_months), d3_time_monthLookup = d3_time_formatLookup(d3_time_months), d3_time_monthAbbrevRe = d3_time_formatRe(d3_time_monthAbbreviations), d3_time_monthAbbrevLookup = d3_time_formatLookup(d3_time_monthAbbreviations);
6774   var d3_time_formats = {
6775     a: function(d) {
6776       return d3_time_dayAbbreviations[d.getDay()];
6777     },
6778     A: function(d) {
6779       return d3_time_days[d.getDay()];
6780     },
6781     b: function(d) {
6782       return d3_time_monthAbbreviations[d.getMonth()];
6783     },
6784     B: function(d) {
6785       return d3_time_months[d.getMonth()];
6786     },
6787     c: d3.time.format(d3_time_formatDateTime),
6788     d: function(d) {
6789       return d3_time_zfill2(d.getDate());
6790     },
6791     e: function(d) {
6792       return d3_time_sfill2(d.getDate());
6793     },
6794     H: function(d) {
6795       return d3_time_zfill2(d.getHours());
6796     },
6797     I: function(d) {
6798       return d3_time_zfill2(d.getHours() % 12 || 12);
6799     },
6800     j: function(d) {
6801       return d3_time_zfill3(1 + d3.time.dayOfYear(d));
6802     },
6803     L: function(d) {
6804       return d3_time_zfill3(d.getMilliseconds());
6805     },
6806     m: function(d) {
6807       return d3_time_zfill2(d.getMonth() + 1);
6808     },
6809     M: function(d) {
6810       return d3_time_zfill2(d.getMinutes());
6811     },
6812     p: function(d) {
6813       return d.getHours() >= 12 ? "PM" : "AM";
6814     },
6815     S: function(d) {
6816       return d3_time_zfill2(d.getSeconds());
6817     },
6818     U: function(d) {
6819       return d3_time_zfill2(d3.time.sundayOfYear(d));
6820     },
6821     w: function(d) {
6822       return d.getDay();
6823     },
6824     W: function(d) {
6825       return d3_time_zfill2(d3.time.mondayOfYear(d));
6826     },
6827     x: d3.time.format(d3_time_formatDate),
6828     X: d3.time.format(d3_time_formatTime),
6829     y: function(d) {
6830       return d3_time_zfill2(d.getFullYear() % 100);
6831     },
6832     Y: function(d) {
6833       return d3_time_zfill4(d.getFullYear() % 1e4);
6834     },
6835     Z: d3_time_zone,
6836     "%": function(d) {
6837       return "%";
6838     }
6839   };
6840   var d3_time_parsers = {
6841     a: d3_time_parseWeekdayAbbrev,
6842     A: d3_time_parseWeekday,
6843     b: d3_time_parseMonthAbbrev,
6844     B: d3_time_parseMonth,
6845     c: d3_time_parseLocaleFull,
6846     d: d3_time_parseDay,
6847     e: d3_time_parseDay,
6848     H: d3_time_parseHour24,
6849     I: d3_time_parseHour24,
6850     L: d3_time_parseMilliseconds,
6851     m: d3_time_parseMonthNumber,
6852     M: d3_time_parseMinutes,
6853     p: d3_time_parseAmPm,
6854     S: d3_time_parseSeconds,
6855     x: d3_time_parseLocaleDate,
6856     X: d3_time_parseLocaleTime,
6857     y: d3_time_parseYear,
6858     Y: d3_time_parseFullYear
6859   };
6860   var d3_time_numberRe = /^\s*\d+/;
6861   var d3_time_amPmLookup = d3.map({
6862     am: 0,
6863     pm: 1
6864   });
6865   d3.time.format.utc = function(template) {
6866     function format(date) {
6867       try {
6868         d3_time = d3_time_utc;
6869         var utc = new d3_time;
6870         utc._ = date;
6871         return local(utc);
6872       } finally {
6873         d3_time = Date;
6874       }
6875     }
6876     var local = d3.time.format(template);
6877     format.parse = function(string) {
6878       try {
6879         d3_time = d3_time_utc;
6880         var date = local.parse(string);
6881         return date && date._;
6882       } finally {
6883         d3_time = Date;
6884       }
6885     };
6886     format.toString = local.toString;
6887     return format;
6888   };
6889   var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
6890   d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso;
6891   d3_time_formatIsoNative.parse = function(string) {
6892     var date = new Date(string);
6893     return isNaN(date) ? null : date;
6894   };
6895   d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
6896   d3.time.second = d3_time_interval(function(date) {
6897     return new d3_time(Math.floor(date / 1e3) * 1e3);
6898   }, function(date, offset) {
6899     date.setTime(date.getTime() + Math.floor(offset) * 1e3);
6900   }, function(date) {
6901     return date.getSeconds();
6902   });
6903   d3.time.seconds = d3.time.second.range;
6904   d3.time.seconds.utc = d3.time.second.utc.range;
6905   d3.time.minute = d3_time_interval(function(date) {
6906     return new d3_time(Math.floor(date / 6e4) * 6e4);
6907   }, function(date, offset) {
6908     date.setTime(date.getTime() + Math.floor(offset) * 6e4);
6909   }, function(date) {
6910     return date.getMinutes();
6911   });
6912   d3.time.minutes = d3.time.minute.range;
6913   d3.time.minutes.utc = d3.time.minute.utc.range;
6914   d3.time.hour = d3_time_interval(function(date) {
6915     var timezone = date.getTimezoneOffset() / 60;
6916     return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
6917   }, function(date, offset) {
6918     date.setTime(date.getTime() + Math.floor(offset) * 36e5);
6919   }, function(date) {
6920     return date.getHours();
6921   });
6922   d3.time.hours = d3.time.hour.range;
6923   d3.time.hours.utc = d3.time.hour.utc.range;
6924   d3.time.day = d3_time_interval(function(date) {
6925     var day = new d3_time(1970, 0);
6926     day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
6927     return day;
6928   }, function(date, offset) {
6929     date.setDate(date.getDate() + offset);
6930   }, function(date) {
6931     return date.getDate() - 1;
6932   });
6933   d3.time.days = d3.time.day.range;
6934   d3.time.days.utc = d3.time.day.utc.range;
6935   d3.time.dayOfYear = function(date) {
6936     var year = d3.time.year(date);
6937     return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
6938   };
6939   d3_time_daySymbols.forEach(function(day, i) {
6940     day = day.toLowerCase();
6941     i = 7 - i;
6942     var interval = d3.time[day] = d3_time_interval(function(date) {
6943       (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
6944       return date;
6945     }, function(date, offset) {
6946       date.setDate(date.getDate() + Math.floor(offset) * 7);
6947     }, function(date) {
6948       var day = d3.time.year(date).getDay();
6949       return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
6950     });
6951     d3.time[day + "s"] = interval.range;
6952     d3.time[day + "s"].utc = interval.utc.range;
6953     d3.time[day + "OfYear"] = function(date) {
6954       var day = d3.time.year(date).getDay();
6955       return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7);
6956     };
6957   });
6958   d3.time.week = d3.time.sunday;
6959   d3.time.weeks = d3.time.sunday.range;
6960   d3.time.weeks.utc = d3.time.sunday.utc.range;
6961   d3.time.weekOfYear = d3.time.sundayOfYear;
6962   d3.time.month = d3_time_interval(function(date) {
6963     date = d3.time.day(date);
6964     date.setDate(1);
6965     return date;
6966   }, function(date, offset) {
6967     date.setMonth(date.getMonth() + offset);
6968   }, function(date) {
6969     return date.getMonth();
6970   });
6971   d3.time.months = d3.time.month.range;
6972   d3.time.months.utc = d3.time.month.utc.range;
6973   d3.time.year = d3_time_interval(function(date) {
6974     date = d3.time.day(date);
6975     date.setMonth(0, 1);
6976     return date;
6977   }, function(date, offset) {
6978     date.setFullYear(date.getFullYear() + offset);
6979   }, function(date) {
6980     return date.getFullYear();
6981   });
6982   d3.time.years = d3.time.year.range;
6983   d3.time.years.utc = d3.time.year.utc.range;
6984   var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];
6985   var d3_time_scaleLocalMethods = [ [ d3.time.second, 1 ], [ d3.time.second, 5 ], [ d3.time.second, 15 ], [ d3.time.second, 30 ], [ d3.time.minute, 1 ], [ d3.time.minute, 5 ], [ d3.time.minute, 15 ], [ d3.time.minute, 30 ], [ d3.time.hour, 1 ], [ d3.time.hour, 3 ], [ d3.time.hour, 6 ], [ d3.time.hour, 12 ], [ d3.time.day, 1 ], [ d3.time.day, 2 ], [ d3.time.week, 1 ], [ d3.time.month, 1 ], [ d3.time.month, 3 ], [ d3.time.year, 1 ] ];
6986   var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), function(d) {
6987     return true;
6988   } ], [ d3.time.format("%B"), function(d) {
6989     return d.getMonth();
6990   } ], [ d3.time.format("%b %d"), function(d) {
6991     return d.getDate() != 1;
6992   } ], [ d3.time.format("%a %d"), function(d) {
6993     return d.getDay() && d.getDate() != 1;
6994   } ], [ d3.time.format("%I %p"), function(d) {
6995     return d.getHours();
6996   } ], [ d3.time.format("%I:%M"), function(d) {
6997     return d.getMinutes();
6998   } ], [ d3.time.format(":%S"), function(d) {
6999     return d.getSeconds();
7000   } ], [ d3.time.format(".%L"), function(d) {
7001     return d.getMilliseconds();
7002   } ] ];
7003   var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
7004   d3_time_scaleLocalMethods.year = function(extent, m) {
7005     return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear);
7006   };
7007   d3.time.scale = function() {
7008     return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
7009   };
7010   var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
7011     return [ m[0].utc, m[1] ];
7012   });
7013   var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), function(d) {
7014     return true;
7015   } ], [ d3.time.format.utc("%B"), function(d) {
7016     return d.getUTCMonth();
7017   } ], [ d3.time.format.utc("%b %d"), function(d) {
7018     return d.getUTCDate() != 1;
7019   } ], [ d3.time.format.utc("%a %d"), function(d) {
7020     return d.getUTCDay() && d.getUTCDate() != 1;
7021   } ], [ d3.time.format.utc("%I %p"), function(d) {
7022     return d.getUTCHours();
7023   } ], [ d3.time.format.utc("%I:%M"), function(d) {
7024     return d.getUTCMinutes();
7025   } ], [ d3.time.format.utc(":%S"), function(d) {
7026     return d.getUTCSeconds();
7027   } ], [ d3.time.format.utc(".%L"), function(d) {
7028     return d.getUTCMilliseconds();
7029   } ] ];
7030   var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
7031   d3_time_scaleUTCMethods.year = function(extent, m) {
7032     return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear);
7033   };
7034   d3.time.scale.utc = function() {
7035     return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
7036   };
7037 })();