Initial OpenECOMP policy/engine commit
[policy/engine.git] / ecomp-sdk-app / src / main / webapp / static / fusion / raptor / 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   var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ];
4159   var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ];
4160   var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ];
4161   var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ];
4162   d3.scale.quantile = function() {
4163     return d3_scale_quantile([], []);
4164   };
4165   d3.scale.quantize = function() {
4166     return d3_scale_quantize(0, 1, [ 0, 1 ]);
4167   };
4168   d3.scale.threshold = function() {
4169     return d3_scale_threshold([ .5 ], [ 0, 1 ]);
4170   };
4171   d3.scale.identity = function() {
4172     return d3_scale_identity([ 0, 1 ]);
4173   };
4174   d3.svg = {};
4175   d3.svg.arc = function() {
4176     function arc() {
4177       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);
4178       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";
4179     }
4180     var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
4181     arc.innerRadius = function(v) {
4182       if (!arguments.length) return innerRadius;
4183       innerRadius = d3_functor(v);
4184       return arc;
4185     };
4186     arc.outerRadius = function(v) {
4187       if (!arguments.length) return outerRadius;
4188       outerRadius = d3_functor(v);
4189       return arc;
4190     };
4191     arc.startAngle = function(v) {
4192       if (!arguments.length) return startAngle;
4193       startAngle = d3_functor(v);
4194       return arc;
4195     };
4196     arc.endAngle = function(v) {
4197       if (!arguments.length) return endAngle;
4198       endAngle = d3_functor(v);
4199       return arc;
4200     };
4201     arc.centroid = function() {
4202       var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
4203       return [ Math.cos(a) * r, Math.sin(a) * r ];
4204     };
4205     return arc;
4206   };
4207   var d3_svg_arcOffset = -Math.PI / 2, d3_svg_arcMax = 2 * Math.PI - 1e-6;
4208   d3.svg.line = function() {
4209     return d3_svg_line(d3_identity);
4210   };
4211   var d3_svg_lineInterpolators = d3.map({
4212     linear: d3_svg_lineLinear,
4213     "linear-closed": d3_svg_lineLinearClosed,
4214     "step-before": d3_svg_lineStepBefore,
4215     "step-after": d3_svg_lineStepAfter,
4216     basis: d3_svg_lineBasis,
4217     "basis-open": d3_svg_lineBasisOpen,
4218     "basis-closed": d3_svg_lineBasisClosed,
4219     bundle: d3_svg_lineBundle,
4220     cardinal: d3_svg_lineCardinal,
4221     "cardinal-open": d3_svg_lineCardinalOpen,
4222     "cardinal-closed": d3_svg_lineCardinalClosed,
4223     monotone: d3_svg_lineMonotone
4224   });
4225   d3_svg_lineInterpolators.forEach(function(key, value) {
4226     value.key = key;
4227     value.closed = /-closed$/.test(key);
4228   });
4229   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 ];
4230   d3.svg.line.radial = function() {
4231     var line = d3_svg_line(d3_svg_lineRadial);
4232     line.radius = line.x, delete line.x;
4233     line.angle = line.y, delete line.y;
4234     return line;
4235   };
4236   d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
4237   d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
4238   d3.svg.area = function() {
4239     return d3_svg_area(d3_identity);
4240   };
4241   d3.svg.area.radial = function() {
4242     var area = d3_svg_area(d3_svg_lineRadial);
4243     area.radius = area.x, delete area.x;
4244     area.innerRadius = area.x0, delete area.x0;
4245     area.outerRadius = area.x1, delete area.x1;
4246     area.angle = area.y, delete area.y;
4247     area.startAngle = area.y0, delete area.y0;
4248     area.endAngle = area.y1, delete area.y1;
4249     return area;
4250   };
4251   d3.svg.chord = function() {
4252     function chord(d, i) {
4253       var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
4254       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";
4255     }
4256     function subgroup(self, f, d, i) {
4257       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;
4258       return {
4259         r: r,
4260         a0: a0,
4261         a1: a1,
4262         p0: [ r * Math.cos(a0), r * Math.sin(a0) ],
4263         p1: [ r * Math.cos(a1), r * Math.sin(a1) ]
4264       };
4265     }
4266     function equals(a, b) {
4267       return a.a0 == b.a0 && a.a1 == b.a1;
4268     }
4269     function arc(r, p, a) {
4270       return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p;
4271     }
4272     function curve(r0, p0, r1, p1) {
4273       return "Q 0,0 " + p1;
4274     }
4275     var source = d3_svg_chordSource, target = d3_svg_chordTarget, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
4276     chord.radius = function(v) {
4277       if (!arguments.length) return radius;
4278       radius = d3_functor(v);
4279       return chord;
4280     };
4281     chord.source = function(v) {
4282       if (!arguments.length) return source;
4283       source = d3_functor(v);
4284       return chord;
4285     };
4286     chord.target = function(v) {
4287       if (!arguments.length) return target;
4288       target = d3_functor(v);
4289       return chord;
4290     };
4291     chord.startAngle = function(v) {
4292       if (!arguments.length) return startAngle;
4293       startAngle = d3_functor(v);
4294       return chord;
4295     };
4296     chord.endAngle = function(v) {
4297       if (!arguments.length) return endAngle;
4298       endAngle = d3_functor(v);
4299       return chord;
4300     };
4301     return chord;
4302   };
4303   d3.svg.diagonal = function() {
4304     function diagonal(d, i) {
4305       var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {
4306         x: p0.x,
4307         y: m
4308       }, {
4309         x: p3.x,
4310         y: m
4311       }, p3 ];
4312       p = p.map(projection);
4313       return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
4314     }
4315     var source = d3_svg_chordSource, target = d3_svg_chordTarget, projection = d3_svg_diagonalProjection;
4316     diagonal.source = function(x) {
4317       if (!arguments.length) return source;
4318       source = d3_functor(x);
4319       return diagonal;
4320     };
4321     diagonal.target = function(x) {
4322       if (!arguments.length) return target;
4323       target = d3_functor(x);
4324       return diagonal;
4325     };
4326     diagonal.projection = function(x) {
4327       if (!arguments.length) return projection;
4328       projection = x;
4329       return diagonal;
4330     };
4331     return diagonal;
4332   };
4333   d3.svg.diagonal.radial = function() {
4334     var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;
4335     diagonal.projection = function(x) {
4336       return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;
4337     };
4338     return diagonal;
4339   };
4340   d3.svg.mouse = d3.mouse;
4341   d3.svg.touches = d3.touches;
4342   d3.svg.symbol = function() {
4343     function symbol(d, i) {
4344       return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));
4345     }
4346     var type = d3_svg_symbolType, size = d3_svg_symbolSize;
4347     symbol.type = function(x) {
4348       if (!arguments.length) return type;
4349       type = d3_functor(x);
4350       return symbol;
4351     };
4352     symbol.size = function(x) {
4353       if (!arguments.length) return size;
4354       size = d3_functor(x);
4355       return symbol;
4356     };
4357     return symbol;
4358   };
4359   var d3_svg_symbols = d3.map({
4360     circle: d3_svg_symbolCircle,
4361     cross: function(size) {
4362       var r = Math.sqrt(size / 5) / 2;
4363       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";
4364     },
4365     diamond: function(size) {
4366       var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;
4367       return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
4368     },
4369     square: function(size) {
4370       var r = Math.sqrt(size) / 2;
4371       return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
4372     },
4373     "triangle-down": function(size) {
4374       var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
4375       return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
4376     },
4377     "triangle-up": 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   });
4382   d3.svg.symbolTypes = d3_svg_symbols.keys();
4383   var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180);
4384   d3.svg.axis = function() {
4385     function axis(g) {
4386       g.each(function() {
4387         var g = d3.select(this);
4388         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_;
4389         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);
4390         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;
4391         var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathEnter = path.enter().append("path").attr("class", "domain"), pathUpdate = d3.transition(path);
4392         var scale1 = scale.copy(), scale0 = this.__chart__ || scale1;
4393         this.__chart__ = scale1;
4394         tickEnter.append("line").attr("class", "tick");
4395         tickEnter.append("text");
4396         var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
4397         switch (orient) {
4398          case "bottom":
4399           {
4400             tickTransform = d3_svg_axisX;
4401             subtickEnter.attr("y2", tickMinorSize);
4402             subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
4403             lineEnter.attr("y2", tickMajorSize);
4404             textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding);
4405             lineUpdate.attr("x2", 0).attr("y2", tickMajorSize);
4406             textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding);
4407             text.attr("dy", ".71em").attr("text-anchor", "middle");
4408             pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
4409             break;
4410           }
4411          case "top":
4412           {
4413             tickTransform = d3_svg_axisX;
4414             subtickEnter.attr("y2", -tickMinorSize);
4415             subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
4416             lineEnter.attr("y2", -tickMajorSize);
4417             textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
4418             lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize);
4419             textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
4420             text.attr("dy", "0em").attr("text-anchor", "middle");
4421             pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
4422             break;
4423           }
4424          case "left":
4425           {
4426             tickTransform = d3_svg_axisY;
4427             subtickEnter.attr("x2", -tickMinorSize);
4428             subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
4429             lineEnter.attr("x2", -tickMajorSize);
4430             textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
4431             lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0);
4432             textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0);
4433             text.attr("dy", ".32em").attr("text-anchor", "end");
4434             pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
4435             break;
4436           }
4437          case "right":
4438           {
4439             tickTransform = d3_svg_axisY;
4440             subtickEnter.attr("x2", tickMinorSize);
4441             subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
4442             lineEnter.attr("x2", tickMajorSize);
4443             textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding);
4444             lineUpdate.attr("x2", tickMajorSize).attr("y2", 0);
4445             textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0);
4446             text.attr("dy", ".32em").attr("text-anchor", "start");
4447             pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
4448             break;
4449           }
4450         }
4451         if (scale.ticks) {
4452           tickEnter.call(tickTransform, scale0);
4453           tickUpdate.call(tickTransform, scale1);
4454           tickExit.call(tickTransform, scale1);
4455           subtickEnter.call(tickTransform, scale0);
4456           subtickUpdate.call(tickTransform, scale1);
4457           subtickExit.call(tickTransform, scale1);
4458         } else {
4459           var dx = scale1.rangeBand() / 2, x = function(d) {
4460             return scale1(d) + dx;
4461           };
4462           tickEnter.call(tickTransform, x);
4463           tickUpdate.call(tickTransform, x);
4464         }
4465       });
4466     }
4467     var scale = d3.scale.linear(), orient = "bottom", tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0;
4468     axis.scale = function(x) {
4469       if (!arguments.length) return scale;
4470       scale = x;
4471       return axis;
4472     };
4473     axis.orient = function(x) {
4474       if (!arguments.length) return orient;
4475       orient = x;
4476       return axis;
4477     };
4478     axis.ticks = function() {
4479       if (!arguments.length) return tickArguments_;
4480       tickArguments_ = arguments;
4481       return axis;
4482     };
4483     axis.tickValues = function(x) {
4484       if (!arguments.length) return tickValues;
4485       tickValues = x;
4486       return axis;
4487     };
4488     axis.tickFormat = function(x) {
4489       if (!arguments.length) return tickFormat_;
4490       tickFormat_ = x;
4491       return axis;
4492     };
4493     axis.tickSize = function(x, y, z) {
4494       if (!arguments.length) return tickMajorSize;
4495       var n = arguments.length - 1;
4496       tickMajorSize = +x;
4497       tickMinorSize = n > 1 ? +y : tickMajorSize;
4498       tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
4499       return axis;
4500     };
4501     axis.tickPadding = function(x) {
4502       if (!arguments.length) return tickPadding;
4503       tickPadding = +x;
4504       return axis;
4505     };
4506     axis.tickSubdivide = function(x) {
4507       if (!arguments.length) return tickSubdivide;
4508       tickSubdivide = +x;
4509       return axis;
4510     };
4511     return axis;
4512   };
4513   d3.svg.brush = function() {
4514     function brush(g) {
4515       g.each(function() {
4516         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;
4517         g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
4518         bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
4519         fg.enter().append("rect").attr("class", "extent").style("cursor", "move");
4520         tz.enter().append("g").attr("class", function(d) {
4521           return "resize " + d;
4522         }).style("cursor", function(d) {
4523           return d3_svg_brushCursor[d];
4524         }).append("rect").attr("x", function(d) {
4525           return /[ew]$/.test(d) ? -3 : null;
4526         }).attr("y", function(d) {
4527           return /^[ns]/.test(d) ? -3 : null;
4528         }).attr("width", 6).attr("height", 6).style("visibility", "hidden");
4529         tz.style("display", brush.empty() ? "none" : null);
4530         tz.exit().remove();
4531         if (x) {
4532           e = d3_scaleRange(x);
4533           bg.attr("x", e[0]).attr("width", e[1] - e[0]);
4534           redrawX(g);
4535         }
4536         if (y) {
4537           e = d3_scaleRange(y);
4538           bg.attr("y", e[0]).attr("height", e[1] - e[0]);
4539           redrawY(g);
4540         }
4541         redraw(g);
4542       });
4543     }
4544     function redraw(g) {
4545       g.selectAll(".resize").attr("transform", function(d) {
4546         return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";
4547       });
4548     }
4549     function redrawX(g) {
4550       g.select(".extent").attr("x", extent[0][0]);
4551       g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]);
4552     }
4553     function redrawY(g) {
4554       g.select(".extent").attr("y", extent[0][1]);
4555       g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);
4556     }
4557     function brushstart() {
4558       function mouse() {
4559         var touches = d3.event.changedTouches;
4560         return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
4561       }
4562       function keydown() {
4563         if (d3.event.keyCode == 32) {
4564           if (!dragging) {
4565             center = null;
4566             origin[0] -= extent[1][0];
4567             origin[1] -= extent[1][1];
4568             dragging = 2;
4569           }
4570           d3_eventCancel();
4571         }
4572       }
4573       function keyup() {
4574         if (d3.event.keyCode == 32 && dragging == 2) {
4575           origin[0] += extent[1][0];
4576           origin[1] += extent[1][1];
4577           dragging = 0;
4578           d3_eventCancel();
4579         }
4580       }
4581       function brushmove() {
4582         var point = mouse(), moved = false;
4583         if (offset) {
4584           point[0] += offset[0];
4585           point[1] += offset[1];
4586         }
4587         if (!dragging) {
4588           if (d3.event.altKey) {
4589             if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ];
4590             origin[0] = extent[+(point[0] < center[0])][0];
4591             origin[1] = extent[+(point[1] < center[1])][1];
4592           } else center = null;
4593         }
4594         if (resizingX && move1(point, x, 0)) {
4595           redrawX(g);
4596           moved = true;
4597         }
4598         if (resizingY && move1(point, y, 1)) {
4599           redrawY(g);
4600           moved = true;
4601         }
4602         if (moved) {
4603           redraw(g);
4604           event_({
4605             type: "brush",
4606             mode: dragging ? "move" : "resize"
4607           });
4608         }
4609       }
4610       function move1(point, scale, i) {
4611         var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max;
4612         if (dragging) {
4613           r0 -= position;
4614           r1 -= size + position;
4615         }
4616         min = Math.max(r0, Math.min(r1, point[i]));
4617         if (dragging) {
4618           max = (min += position) + size;
4619         } else {
4620           if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
4621           if (position < min) {
4622             max = min;
4623             min = position;
4624           } else {
4625             max = position;
4626           }
4627         }
4628         if (extent[0][i] !== min || extent[1][i] !== max) {
4629           extentDomain = null;
4630           extent[0][i] = min;
4631           extent[1][i] = max;
4632           return true;
4633         }
4634       }
4635       function brushend() {
4636         brushmove();
4637         g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
4638         d3.select("body").style("cursor", null);
4639         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);
4640         event_({
4641           type: "brushend"
4642         });
4643         d3_eventCancel();
4644       }
4645       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;
4646       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);
4647       if (dragging) {
4648         origin[0] = extent[0][0] - origin[0];
4649         origin[1] = extent[0][1] - origin[1];
4650       } else if (resizing) {
4651         var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);
4652         offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ];
4653         origin[0] = extent[ex][0];
4654         origin[1] = extent[ey][1];
4655       } else if (d3.event.altKey) center = origin.slice();
4656       g.style("pointer-events", "none").selectAll(".resize").style("display", null);
4657       d3.select("body").style("cursor", eventTarget.style("cursor"));
4658       event_({
4659         type: "brushstart"
4660       });
4661       brushmove();
4662       d3_eventCancel();
4663     }
4664     var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain;
4665     brush.x = function(z) {
4666       if (!arguments.length) return x;
4667       x = z;
4668       resizes = d3_svg_brushResizes[!x << 1 | !y];
4669       return brush;
4670     };
4671     brush.y = function(z) {
4672       if (!arguments.length) return y;
4673       y = z;
4674       resizes = d3_svg_brushResizes[!x << 1 | !y];
4675       return brush;
4676     };
4677     brush.extent = function(z) {
4678       var x0, x1, y0, y1, t;
4679       if (!arguments.length) {
4680         z = extentDomain || extent;
4681         if (x) {
4682           x0 = z[0][0], x1 = z[1][0];
4683           if (!extentDomain) {
4684             x0 = extent[0][0], x1 = extent[1][0];
4685             if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
4686             if (x1 < x0) t = x0, x0 = x1, x1 = t;
4687           }
4688         }
4689         if (y) {
4690           y0 = z[0][1], y1 = z[1][1];
4691           if (!extentDomain) {
4692             y0 = extent[0][1], y1 = extent[1][1];
4693             if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
4694             if (y1 < y0) t = y0, y0 = y1, y1 = t;
4695           }
4696         }
4697         return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];
4698       }
4699       extentDomain = [ [ 0, 0 ], [ 0, 0 ] ];
4700       if (x) {
4701         x0 = z[0], x1 = z[1];
4702         if (y) x0 = x0[0], x1 = x1[0];
4703         extentDomain[0][0] = x0, extentDomain[1][0] = x1;
4704         if (x.invert) x0 = x(x0), x1 = x(x1);
4705         if (x1 < x0) t = x0, x0 = x1, x1 = t;
4706         extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;
4707       }
4708       if (y) {
4709         y0 = z[0], y1 = z[1];
4710         if (x) y0 = y0[1], y1 = y1[1];
4711         extentDomain[0][1] = y0, extentDomain[1][1] = y1;
4712         if (y.invert) y0 = y(y0), y1 = y(y1);
4713         if (y1 < y0) t = y0, y0 = y1, y1 = t;
4714         extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;
4715       }
4716       return brush;
4717     };
4718     brush.clear = function() {
4719       extentDomain = null;
4720       extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0;
4721       return brush;
4722     };
4723     brush.empty = function() {
4724       return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1];
4725     };
4726     return d3.rebind(brush, event, "on");
4727   };
4728   var d3_svg_brushCursor = {
4729     n: "ns-resize",
4730     e: "ew-resize",
4731     s: "ns-resize",
4732     w: "ew-resize",
4733     nw: "nwse-resize",
4734     ne: "nesw-resize",
4735     se: "nwse-resize",
4736     sw: "nesw-resize"
4737   };
4738   var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ];
4739   d3.behavior = {};
4740   d3.behavior.drag = function() {
4741     function drag() {
4742       this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown);
4743     }
4744     function mousedown() {
4745       function point() {
4746         var p = target.parentNode;
4747         return touchId ? d3.touches(p).filter(function(p) {
4748           return p.identifier === touchId;
4749         })[0] : d3.mouse(p);
4750       }
4751       function dragmove() {
4752         if (!target.parentNode) return dragend();
4753         var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1];
4754         moved |= dx | dy;
4755         origin_ = p;
4756         d3_eventCancel();
4757         event_({
4758           type: "drag",
4759           x: p[0] + offset[0],
4760           y: p[1] + offset[1],
4761           dx: dx,
4762           dy: dy
4763         });
4764       }
4765       function dragend() {
4766         event_({
4767           type: "dragend"
4768         });
4769         if (moved) {
4770           d3_eventCancel();
4771           if (d3.event.target === eventTarget) w.on("click.drag", click, true);
4772         }
4773         w.on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", null);
4774       }
4775       function click() {
4776         d3_eventCancel();
4777         w.on("click.drag", null);
4778       }
4779       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;
4780       var w = d3.select(window).on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true);
4781       if (origin) {
4782         offset = origin.apply(target, arguments);
4783         offset = [ offset.x - origin_[0], offset.y - origin_[1] ];
4784       } else {
4785         offset = [ 0, 0 ];
4786       }
4787       if (!touchId) d3_eventCancel();
4788       event_({
4789         type: "dragstart"
4790       });
4791     }
4792     var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null;
4793     drag.origin = function(x) {
4794       if (!arguments.length) return origin;
4795       origin = x;
4796       return drag;
4797     };
4798     return d3.rebind(drag, event, "on");
4799   };
4800   d3.behavior.zoom = function() {
4801     function zoom() {
4802       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);
4803     }
4804     function location(p) {
4805       return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ];
4806     }
4807     function point(l) {
4808       return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ];
4809     }
4810     function scaleTo(s) {
4811       scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
4812     }
4813     function translateTo(p, l) {
4814       l = point(l);
4815       translate[0] += p[0] - l[0];
4816       translate[1] += p[1] - l[1];
4817     }
4818     function dispatch(event) {
4819       if (x1) x1.domain(x0.range().map(function(x) {
4820         return (x - translate[0]) / scale;
4821       }).map(x0.invert));
4822       if (y1) y1.domain(y0.range().map(function(y) {
4823         return (y - translate[1]) / scale;
4824       }).map(y0.invert));
4825       d3.event.preventDefault();
4826       event({
4827         type: "zoom",
4828         scale: scale,
4829         translate: translate
4830       });
4831     }
4832     function mousedown() {
4833       function mousemove() {
4834         moved = 1;
4835         translateTo(d3.mouse(target), l);
4836         dispatch(event_);
4837       }
4838       function mouseup() {
4839         if (moved) d3_eventCancel();
4840         w.on("mousemove.zoom", null).on("mouseup.zoom", null);
4841         if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true);
4842       }
4843       function click() {
4844         d3_eventCancel();
4845         w.on("click.zoom", null);
4846       }
4847       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));
4848       window.focus();
4849       d3_eventCancel();
4850     }
4851     function mousewheel() {
4852       if (!translate0) translate0 = location(d3.mouse(this));
4853       scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale);
4854       translateTo(d3.mouse(this), translate0);
4855       dispatch(event.of(this, arguments));
4856     }
4857     function mousemove() {
4858       translate0 = null;
4859     }
4860     function dblclick() {
4861       var p = d3.mouse(this), l = location(p);
4862       scaleTo(d3.event.shiftKey ? scale / 2 : scale * 2);
4863       translateTo(p, l);
4864       dispatch(event.of(this, arguments));
4865     }
4866     function touchstart() {
4867       var touches = d3.touches(this), now = Date.now();
4868       scale0 = scale;
4869       translate0 = {};
4870       touches.forEach(function(t) {
4871         translate0[t.identifier] = location(t);
4872       });
4873       d3_eventCancel();
4874       if (touches.length === 1) {
4875         if (now - touchtime < 500) {
4876           var p = touches[0], l = location(touches[0]);
4877           scaleTo(scale * 2);
4878           translateTo(p, l);
4879           dispatch(event.of(this, arguments));
4880         }
4881         touchtime = now;
4882       }
4883     }
4884     function touchmove() {
4885       var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier];
4886       if (p1 = touches[1]) {
4887         var p1, l1 = translate0[p1.identifier];
4888         p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];
4889         l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];
4890         scaleTo(d3.event.scale * scale0);
4891       }
4892       translateTo(p0, l0);
4893       touchtime = null;
4894       dispatch(event.of(this, arguments));
4895     }
4896     var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;
4897     zoom.translate = function(x) {
4898       if (!arguments.length) return translate;
4899       translate = x.map(Number);
4900       return zoom;
4901     };
4902     zoom.scale = function(x) {
4903       if (!arguments.length) return scale;
4904       scale = +x;
4905       return zoom;
4906     };
4907     zoom.scaleExtent = function(x) {
4908       if (!arguments.length) return scaleExtent;
4909       scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number);
4910       return zoom;
4911     };
4912     zoom.x = function(z) {
4913       if (!arguments.length) return x1;
4914       x1 = z;
4915       x0 = z.copy();
4916       return zoom;
4917     };
4918     zoom.y = function(z) {
4919       if (!arguments.length) return y1;
4920       y1 = z;
4921       y0 = z.copy();
4922       return zoom;
4923     };
4924     return d3.rebind(zoom, event, "on");
4925   };
4926   var d3_behavior_zoomDiv, d3_behavior_zoomInfinity = [ 0, Infinity ];
4927   d3.layout = {};
4928   d3.layout.bundle = function() {
4929     return function(links) {
4930       var paths = [], i = -1, n = links.length;
4931       while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
4932       return paths;
4933     };
4934   };
4935   d3.layout.chord = function() {
4936     function relayout() {
4937       var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;
4938       chords = [];
4939       groups = [];
4940       k = 0, i = -1;
4941       while (++i < n) {
4942         x = 0, j = -1;
4943         while (++j < n) {
4944           x += matrix[i][j];
4945         }
4946         groupSums.push(x);
4947         subgroupIndex.push(d3.range(n));
4948         k += x;
4949       }
4950       if (sortGroups) {
4951         groupIndex.sort(function(a, b) {
4952           return sortGroups(groupSums[a], groupSums[b]);
4953         });
4954       }
4955       if (sortSubgroups) {
4956         subgroupIndex.forEach(function(d, i) {
4957           d.sort(function(a, b) {
4958             return sortSubgroups(matrix[i][a], matrix[i][b]);
4959           });
4960         });
4961       }
4962       k = (2 * Math.PI - padding * n) / k;
4963       x = 0, i = -1;
4964       while (++i < n) {
4965         x0 = x, j = -1;
4966         while (++j < n) {
4967           var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
4968           subgroups[di + "-" + dj] = {
4969             index: di,
4970             subindex: dj,
4971             startAngle: a0,
4972             endAngle: a1,
4973             value: v
4974           };
4975         }
4976         groups[di] = {
4977           index: di,
4978           startAngle: x0,
4979           endAngle: x,
4980           value: (x - x0) / k
4981         };
4982         x += padding;
4983       }
4984       i = -1;
4985       while (++i < n) {
4986         j = i - 1;
4987         while (++j < n) {
4988           var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
4989           if (source.value || target.value) {
4990             chords.push(source.value < target.value ? {
4991               source: target,
4992               target: source
4993             } : {
4994               source: source,
4995               target: target
4996             });
4997           }
4998         }
4999       }
5000       if (sortChords) resort();
5001     }
5002     function resort() {
5003       chords.sort(function(a, b) {
5004         return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);
5005       });
5006     }
5007     var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
5008     chord.matrix = function(x) {
5009       if (!arguments.length) return matrix;
5010       n = (matrix = x) && matrix.length;
5011       chords = groups = null;
5012       return chord;
5013     };
5014     chord.padding = function(x) {
5015       if (!arguments.length) return padding;
5016       padding = x;
5017       chords = groups = null;
5018       return chord;
5019     };
5020     chord.sortGroups = function(x) {
5021       if (!arguments.length) return sortGroups;
5022       sortGroups = x;
5023       chords = groups = null;
5024       return chord;
5025     };
5026     chord.sortSubgroups = function(x) {
5027       if (!arguments.length) return sortSubgroups;
5028       sortSubgroups = x;
5029       chords = null;
5030       return chord;
5031     };
5032     chord.sortChords = function(x) {
5033       if (!arguments.length) return sortChords;
5034       sortChords = x;
5035       if (chords) resort();
5036       return chord;
5037     };
5038     chord.chords = function() {
5039       if (!chords) relayout();
5040       return chords;
5041     };
5042     chord.groups = function() {
5043       if (!groups) relayout();
5044       return groups;
5045     };
5046     return chord;
5047   };
5048   d3.layout.force = function() {
5049     function repulse(node) {
5050       return function(quad, x1, y1, x2, y2) {
5051         if (quad.point !== node) {
5052           var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy);
5053           if ((x2 - x1) * dn < theta) {
5054             var k = quad.charge * dn * dn;
5055             node.px -= dx * k;
5056             node.py -= dy * k;
5057             return true;
5058           }
5059           if (quad.point && isFinite(dn)) {
5060             var k = quad.pointCharge * dn * dn;
5061             node.px -= dx * k;
5062             node.py -= dy * k;
5063           }
5064         }
5065         return !quad.charge;
5066       };
5067     }
5068     function dragmove(d) {
5069       d.px = d3.event.x;
5070       d.py = d3.event.y;
5071       force.resume();
5072     }
5073     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;
5074     force.tick = function() {
5075       if ((alpha *= .99) < .005) {
5076         event.end({
5077           type: "end",
5078           alpha: alpha = 0
5079         });
5080         return true;
5081       }
5082       var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;
5083       for (i = 0; i < m; ++i) {
5084         o = links[i];
5085         s = o.source;
5086         t = o.target;
5087         x = t.x - s.x;
5088         y = t.y - s.y;
5089         if (l = x * x + y * y) {
5090           l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
5091           x *= l;
5092           y *= l;
5093           t.x -= x * (k = s.weight / (t.weight + s.weight));
5094           t.y -= y * k;
5095           s.x += x * (k = 1 - k);
5096           s.y += y * k;
5097         }
5098       }
5099       if (k = alpha * gravity) {
5100         x = size[0] / 2;
5101         y = size[1] / 2;
5102         i = -1;
5103         if (k) while (++i < n) {
5104           o = nodes[i];
5105           o.x += (x - o.x) * k;
5106           o.y += (y - o.y) * k;
5107         }
5108       }
5109       if (charge) {
5110         d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
5111         i = -1;
5112         while (++i < n) {
5113           if (!(o = nodes[i]).fixed) {
5114             q.visit(repulse(o));
5115           }
5116         }
5117       }
5118       i = -1;
5119       while (++i < n) {
5120         o = nodes[i];
5121         if (o.fixed) {
5122           o.x = o.px;
5123           o.y = o.py;
5124         } else {
5125           o.x -= (o.px - (o.px = o.x)) * friction;
5126           o.y -= (o.py - (o.py = o.y)) * friction;
5127         }
5128       }
5129       event.tick({
5130         type: "tick",
5131         alpha: alpha
5132       });
5133     };
5134     force.nodes = function(x) {
5135       if (!arguments.length) return nodes;
5136       nodes = x;
5137       return force;
5138     };
5139     force.links = function(x) {
5140       if (!arguments.length) return links;
5141       links = x;
5142       return force;
5143     };
5144     force.size = function(x) {
5145       if (!arguments.length) return size;
5146       size = x;
5147       return force;
5148     };
5149     force.linkDistance = function(x) {
5150       if (!arguments.length) return linkDistance;
5151       linkDistance = d3_functor(x);
5152       return force;
5153     };
5154     force.distance = force.linkDistance;
5155     force.linkStrength = function(x) {
5156       if (!arguments.length) return linkStrength;
5157       linkStrength = d3_functor(x);
5158       return force;
5159     };
5160     force.friction = function(x) {
5161       if (!arguments.length) return friction;
5162       friction = x;
5163       return force;
5164     };
5165     force.charge = function(x) {
5166       if (!arguments.length) return charge;
5167       charge = typeof x === "function" ? x : +x;
5168       return force;
5169     };
5170     force.gravity = function(x) {
5171       if (!arguments.length) return gravity;
5172       gravity = x;
5173       return force;
5174     };
5175     force.theta = function(x) {
5176       if (!arguments.length) return theta;
5177       theta = x;
5178       return force;
5179     };
5180     force.alpha = function(x) {
5181       if (!arguments.length) return alpha;
5182       if (alpha) {
5183         if (x > 0) alpha = x; else alpha = 0;
5184       } else if (x > 0) {
5185         event.start({
5186           type: "start",
5187           alpha: alpha = x
5188         });
5189         d3.timer(force.tick);
5190       }
5191       return force;
5192     };
5193     force.start = function() {
5194       function position(dimension, size) {
5195         var neighbors = neighbor(i), j = -1, m = neighbors.length, x;
5196         while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
5197         return Math.random() * size;
5198       }
5199       function neighbor() {
5200         if (!neighbors) {
5201           neighbors = [];
5202           for (j = 0; j < n; ++j) {
5203             neighbors[j] = [];
5204           }
5205           for (j = 0; j < m; ++j) {
5206             var o = links[j];
5207             neighbors[o.source.index].push(o.target);
5208             neighbors[o.target.index].push(o.source);
5209           }
5210         }
5211         return neighbors[i];
5212       }
5213       var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;
5214       for (i = 0; i < n; ++i) {
5215         (o = nodes[i]).index = i;
5216         o.weight = 0;
5217       }
5218       distances = [];
5219       strengths = [];
5220       for (i = 0; i < m; ++i) {
5221         o = links[i];
5222         if (typeof o.source == "number") o.source = nodes[o.source];
5223         if (typeof o.target == "number") o.target = nodes[o.target];
5224         distances[i] = linkDistance.call(this, o, i);
5225         strengths[i] = linkStrength.call(this, o, i);
5226         ++o.source.weight;
5227         ++o.target.weight;
5228       }
5229       for (i = 0; i < n; ++i) {
5230         o = nodes[i];
5231         if (isNaN(o.x)) o.x = position("x", w);
5232         if (isNaN(o.y)) o.y = position("y", h);
5233         if (isNaN(o.px)) o.px = o.x;
5234         if (isNaN(o.py)) o.py = o.y;
5235       }
5236       charges = [];
5237       if (typeof charge === "function") {
5238         for (i = 0; i < n; ++i) {
5239           charges[i] = +charge.call(this, nodes[i], i);
5240         }
5241       } else {
5242         for (i = 0; i < n; ++i) {
5243           charges[i] = charge;
5244         }
5245       }
5246       return force.resume();
5247     };
5248     force.resume = function() {
5249       return force.alpha(.1);
5250     };
5251     force.stop = function() {
5252       return force.alpha(0);
5253     };
5254     force.drag = function() {
5255       if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart", d3_layout_forceDragstart).on("drag", dragmove).on("dragend", d3_layout_forceDragend);
5256       this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag);
5257     };
5258     return d3.rebind(force, event, "on");
5259   };
5260   d3.layout.partition = function() {
5261     function position(node, x, dx, dy) {
5262       var children = node.children;
5263       node.x = x;
5264       node.y = node.depth * dy;
5265       node.dx = dx;
5266       node.dy = dy;
5267       if (children && (n = children.length)) {
5268         var i = -1, n, c, d;
5269         dx = node.value ? dx / node.value : 0;
5270         while (++i < n) {
5271           position(c = children[i], x, d = c.value * dx, dy);
5272           x += d;
5273         }
5274       }
5275     }
5276     function depth(node) {
5277       var children = node.children, d = 0;
5278       if (children && (n = children.length)) {
5279         var i = -1, n;
5280         while (++i < n) d = Math.max(d, depth(children[i]));
5281       }
5282       return 1 + d;
5283     }
5284     function partition(d, i) {
5285       var nodes = hierarchy.call(this, d, i);
5286       position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
5287       return nodes;
5288     }
5289     var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];
5290     partition.size = function(x) {
5291       if (!arguments.length) return size;
5292       size = x;
5293       return partition;
5294     };
5295     return d3_layout_hierarchyRebind(partition, hierarchy);
5296   };
5297   d3.layout.pie = function() {
5298     function pie(data, i) {
5299       var values = data.map(function(d, i) {
5300         return +value.call(pie, d, i);
5301       });
5302       var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle);
5303       var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - startAngle) / d3.sum(values);
5304       var index = d3.range(data.length);
5305       if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
5306         return values[j] - values[i];
5307       } : function(i, j) {
5308         return sort(data[i], data[j]);
5309       });
5310       var arcs = [];
5311       index.forEach(function(i) {
5312         var d;
5313         arcs[i] = {
5314           data: data[i],
5315           value: d = values[i],
5316           startAngle: a,
5317           endAngle: a += d * k
5318         };
5319       });
5320       return arcs;
5321     }
5322     var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * Math.PI;
5323     pie.value = function(x) {
5324       if (!arguments.length) return value;
5325       value = x;
5326       return pie;
5327     };
5328     pie.sort = function(x) {
5329       if (!arguments.length) return sort;
5330       sort = x;
5331       return pie;
5332     };
5333     pie.startAngle = function(x) {
5334       if (!arguments.length) return startAngle;
5335       startAngle = x;
5336       return pie;
5337     };
5338     pie.endAngle = function(x) {
5339       if (!arguments.length) return endAngle;
5340       endAngle = x;
5341       return pie;
5342     };
5343     return pie;
5344   };
5345   var d3_layout_pieSortByValue = {};
5346   d3.layout.stack = function() {
5347     function stack(data, index) {
5348       var series = data.map(function(d, i) {
5349         return values.call(stack, d, i);
5350       });
5351       var points = series.map(function(d, i) {
5352         return d.map(function(v, i) {
5353           return [ x.call(stack, v, i), y.call(stack, v, i) ];
5354         });
5355       });
5356       var orders = order.call(stack, points, index);
5357       series = d3.permute(series, orders);
5358       points = d3.permute(points, orders);
5359       var offsets = offset.call(stack, points, index);
5360       var n = series.length, m = series[0].length, i, j, o;
5361       for (j = 0; j < m; ++j) {
5362         out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
5363         for (i = 1; i < n; ++i) {
5364           out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
5365         }
5366       }
5367       return data;
5368     }
5369     var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
5370     stack.values = function(x) {
5371       if (!arguments.length) return values;
5372       values = x;
5373       return stack;
5374     };
5375     stack.order = function(x) {
5376       if (!arguments.length) return order;
5377       order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
5378       return stack;
5379     };
5380     stack.offset = function(x) {
5381       if (!arguments.length) return offset;
5382       offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
5383       return stack;
5384     };
5385     stack.x = function(z) {
5386       if (!arguments.length) return x;
5387       x = z;
5388       return stack;
5389     };
5390     stack.y = function(z) {
5391       if (!arguments.length) return y;
5392       y = z;
5393       return stack;
5394     };
5395     stack.out = function(z) {
5396       if (!arguments.length) return out;
5397       out = z;
5398       return stack;
5399     };
5400     return stack;
5401   };
5402   var d3_layout_stackOrders = d3.map({
5403     "inside-out": function(data) {
5404       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) {
5405         return max[a] - max[b];
5406       }), top = 0, bottom = 0, tops = [], bottoms = [];
5407       for (i = 0; i < n; ++i) {
5408         j = index[i];
5409         if (top < bottom) {
5410           top += sums[j];
5411           tops.push(j);
5412         } else {
5413           bottom += sums[j];
5414           bottoms.push(j);
5415         }
5416       }
5417       return bottoms.reverse().concat(tops);
5418     },
5419     reverse: function(data) {
5420       return d3.range(data.length).reverse();
5421     },
5422     "default": d3_layout_stackOrderDefault
5423   });
5424   var d3_layout_stackOffsets = d3.map({
5425     silhouette: function(data) {
5426       var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];
5427       for (j = 0; j < m; ++j) {
5428         for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
5429         if (o > max) max = o;
5430         sums.push(o);
5431       }
5432       for (j = 0; j < m; ++j) {
5433         y0[j] = (max - sums[j]) / 2;
5434       }
5435       return y0;
5436     },
5437     wiggle: function(data) {
5438       var n = data.length, x = data[0], m = x.length, max = 0, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];
5439       y0[0] = o = o0 = 0;
5440       for (j = 1; j < m; ++j) {
5441         for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
5442         for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
5443           for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
5444             s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
5445           }
5446           s2 += s3 * data[i][j][1];
5447         }
5448         y0[j] = o -= s1 ? s2 / s1 * dx : 0;
5449         if (o < o0) o0 = o;
5450       }
5451       for (j = 0; j < m; ++j) y0[j] -= o0;
5452       return y0;
5453     },
5454     expand: function(data) {
5455       var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];
5456       for (j = 0; j < m; ++j) {
5457         for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
5458         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;
5459       }
5460       for (j = 0; j < m; ++j) y0[j] = 0;
5461       return y0;
5462     },
5463     zero: d3_layout_stackOffsetZero
5464   });
5465   d3.layout.histogram = function() {
5466     function histogram(data, i) {
5467       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;
5468       while (++i < m) {
5469         bin = bins[i] = [];
5470         bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
5471         bin.y = 0;
5472       }
5473       if (m > 0) {
5474         i = -1;
5475         while (++i < n) {
5476           x = values[i];
5477           if (x >= range[0] && x <= range[1]) {
5478             bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
5479             bin.y += k;
5480             bin.push(data[i]);
5481           }
5482         }
5483       }
5484       return bins;
5485     }
5486     var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;
5487     histogram.value = function(x) {
5488       if (!arguments.length) return valuer;
5489       valuer = x;
5490       return histogram;
5491     };
5492     histogram.range = function(x) {
5493       if (!arguments.length) return ranger;
5494       ranger = d3_functor(x);
5495       return histogram;
5496     };
5497     histogram.bins = function(x) {
5498       if (!arguments.length) return binner;
5499       binner = typeof x === "number" ? function(range) {
5500         return d3_layout_histogramBinFixed(range, x);
5501       } : d3_functor(x);
5502       return histogram;
5503     };
5504     histogram.frequency = function(x) {
5505       if (!arguments.length) return frequency;
5506       frequency = !!x;
5507       return histogram;
5508     };
5509     return histogram;
5510   };
5511   d3.layout.hierarchy = function() {
5512     function recurse(data, depth, nodes) {
5513       var childs = children.call(hierarchy, data, depth), node = d3_layout_hierarchyInline ? data : {
5514         data: data
5515       };
5516       node.depth = depth;
5517       nodes.push(node);
5518       if (childs && (n = childs.length)) {
5519         var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d;
5520         while (++i < n) {
5521           d = recurse(childs[i], j, nodes);
5522           d.parent = node;
5523           c.push(d);
5524           v += d.value;
5525         }
5526         if (sort) c.sort(sort);
5527         if (value) node.value = v;
5528       } else if (value) {
5529         node.value = +value.call(hierarchy, data, depth) || 0;
5530       }
5531       return node;
5532     }
5533     function revalue(node, depth) {
5534       var children = node.children, v = 0;
5535       if (children && (n = children.length)) {
5536         var i = -1, n, j = depth + 1;
5537         while (++i < n) v += revalue(children[i], j);
5538       } else if (value) {
5539         v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0;
5540       }
5541       if (value) node.value = v;
5542       return v;
5543     }
5544     function hierarchy(d) {
5545       var nodes = [];
5546       recurse(d, 0, nodes);
5547       return nodes;
5548     }
5549     var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;
5550     hierarchy.sort = function(x) {
5551       if (!arguments.length) return sort;
5552       sort = x;
5553       return hierarchy;
5554     };
5555     hierarchy.children = function(x) {
5556       if (!arguments.length) return children;
5557       children = x;
5558       return hierarchy;
5559     };
5560     hierarchy.value = function(x) {
5561       if (!arguments.length) return value;
5562       value = x;
5563       return hierarchy;
5564     };
5565     hierarchy.revalue = function(root) {
5566       revalue(root, 0);
5567       return root;
5568     };
5569     return hierarchy;
5570   };
5571   var d3_layout_hierarchyInline = false;
5572   d3.layout.pack = function() {
5573     function pack(d, i) {
5574       var nodes = hierarchy.call(this, d, i), root = nodes[0];
5575       root.x = 0;
5576       root.y = 0;
5577       d3_layout_treeVisitAfter(root, function(d) {
5578         d.r = Math.sqrt(d.value);
5579       });
5580       d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
5581       var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h);
5582       if (padding > 0) {
5583         var dr = padding * k / 2;
5584         d3_layout_treeVisitAfter(root, function(d) {
5585           d.r += dr;
5586         });
5587         d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
5588         d3_layout_treeVisitAfter(root, function(d) {
5589           d.r -= dr;
5590         });
5591         k = Math.max(2 * root.r / w, 2 * root.r / h);
5592       }
5593       d3_layout_packTransform(root, w / 2, h / 2, 1 / k);
5594       return nodes;
5595     }
5596     var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ];
5597     pack.size = function(x) {
5598       if (!arguments.length) return size;
5599       size = x;
5600       return pack;
5601     };
5602     pack.padding = function(_) {
5603       if (!arguments.length) return padding;
5604       padding = +_;
5605       return pack;
5606     };
5607     return d3_layout_hierarchyRebind(pack, hierarchy);
5608   };
5609   d3.layout.cluster = function() {
5610     function cluster(d, i) {
5611       var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0, kx, ky;
5612       d3_layout_treeVisitAfter(root, function(node) {
5613         var children = node.children;
5614         if (children && children.length) {
5615           node.x = d3_layout_clusterX(children);
5616           node.y = d3_layout_clusterY(children);
5617         } else {
5618           node.x = previousNode ? x += separation(node, previousNode) : 0;
5619           node.y = 0;
5620           previousNode = node;
5621         }
5622       });
5623       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;
5624       d3_layout_treeVisitAfter(root, function(node) {
5625         node.x = (node.x - x0) / (x1 - x0) * size[0];
5626         node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
5627       });
5628       return nodes;
5629     }
5630     var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
5631     cluster.separation = function(x) {
5632       if (!arguments.length) return separation;
5633       separation = x;
5634       return cluster;
5635     };
5636     cluster.size = function(x) {
5637       if (!arguments.length) return size;
5638       size = x;
5639       return cluster;
5640     };
5641     return d3_layout_hierarchyRebind(cluster, hierarchy);
5642   };
5643   d3.layout.tree = function() {
5644     function tree(d, i) {
5645       function firstWalk(node, previousSibling) {
5646         var children = node.children, layout = node._tree;
5647         if (children && (n = children.length)) {
5648           var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1;
5649           while (++i < n) {
5650             child = children[i];
5651             firstWalk(child, previousChild);
5652             ancestor = apportion(child, previousChild, ancestor);
5653             previousChild = child;
5654           }
5655           d3_layout_treeShift(node);
5656           var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
5657           if (previousSibling) {
5658             layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
5659             layout.mod = layout.prelim - midpoint;
5660           } else {
5661             layout.prelim = midpoint;
5662           }
5663         } else {
5664           if (previousSibling) {
5665             layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
5666           }
5667         }
5668       }
5669       function secondWalk(node, x) {
5670         node.x = node._tree.prelim + x;
5671         var children = node.children;
5672         if (children && (n = children.length)) {
5673           var i = -1, n;
5674           x += node._tree.mod;
5675           while (++i < n) {
5676             secondWalk(children[i], x);
5677           }
5678         }
5679       }
5680       function apportion(node, previousSibling, ancestor) {
5681         if (previousSibling) {
5682           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;
5683           while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
5684             vom = d3_layout_treeLeft(vom);
5685             vop = d3_layout_treeRight(vop);
5686             vop._tree.ancestor = node;
5687             shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
5688             if (shift > 0) {
5689               d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
5690               sip += shift;
5691               sop += shift;
5692             }
5693             sim += vim._tree.mod;
5694             sip += vip._tree.mod;
5695             som += vom._tree.mod;
5696             sop += vop._tree.mod;
5697           }
5698           if (vim && !d3_layout_treeRight(vop)) {
5699             vop._tree.thread = vim;
5700             vop._tree.mod += sim - sop;
5701           }
5702           if (vip && !d3_layout_treeLeft(vom)) {
5703             vom._tree.thread = vip;
5704             vom._tree.mod += sip - som;
5705             ancestor = node;
5706           }
5707         }
5708         return ancestor;
5709       }
5710       var nodes = hierarchy.call(this, d, i), root = nodes[0];
5711       d3_layout_treeVisitAfter(root, function(node, previousSibling) {
5712         node._tree = {
5713           ancestor: node,
5714           prelim: 0,
5715           mod: 0,
5716           change: 0,
5717           shift: 0,
5718           number: previousSibling ? previousSibling._tree.number + 1 : 0
5719         };
5720       });
5721       firstWalk(root);
5722       secondWalk(root, -root._tree.prelim);
5723       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;
5724       d3_layout_treeVisitAfter(root, function(node) {
5725         node.x = (node.x - x0) / (x1 - x0) * size[0];
5726         node.y = node.depth / y1 * size[1];
5727         delete node._tree;
5728       });
5729       return nodes;
5730     }
5731     var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
5732     tree.separation = function(x) {
5733       if (!arguments.length) return separation;
5734       separation = x;
5735       return tree;
5736     };
5737     tree.size = function(x) {
5738       if (!arguments.length) return size;
5739       size = x;
5740       return tree;
5741     };
5742     return d3_layout_hierarchyRebind(tree, hierarchy);
5743   };
5744   d3.layout.treemap = function() {
5745     function scale(children, k) {
5746       var i = -1, n = children.length, child, area;
5747       while (++i < n) {
5748         area = (child = children[i]).value * (k < 0 ? 0 : k);
5749         child.area = isNaN(area) || area <= 0 ? 0 : area;
5750       }
5751     }
5752     function squarify(node) {
5753       var children = node.children;
5754       if (children && children.length) {
5755         var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = Math.min(rect.dx, rect.dy), n;
5756         scale(remaining, rect.dx * rect.dy / node.value);
5757         row.area = 0;
5758         while ((n = remaining.length) > 0) {
5759           row.push(child = remaining[n - 1]);
5760           row.area += child.area;
5761           if ((score = worst(row, u)) <= best) {
5762             remaining.pop();
5763             best = score;
5764           } else {
5765             row.area -= row.pop().area;
5766             position(row, u, rect, false);
5767             u = Math.min(rect.dx, rect.dy);
5768             row.length = row.area = 0;
5769             best = Infinity;
5770           }
5771         }
5772         if (row.length) {
5773           position(row, u, rect, true);
5774           row.length = row.area = 0;
5775         }
5776         children.forEach(squarify);
5777       }
5778     }
5779     function stickify(node) {
5780       var children = node.children;
5781       if (children && children.length) {
5782         var rect = pad(node), remaining = children.slice(), child, row = [];
5783         scale(remaining, rect.dx * rect.dy / node.value);
5784         row.area = 0;
5785         while (child = remaining.pop()) {
5786           row.push(child);
5787           row.area += child.area;
5788           if (child.z != null) {
5789             position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
5790             row.length = row.area = 0;
5791           }
5792         }
5793         children.forEach(stickify);
5794       }
5795     }
5796     function worst(row, u) {
5797       var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;
5798       while (++i < n) {
5799         if (!(r = row[i].area)) continue;
5800         if (r < rmin) rmin = r;
5801         if (r > rmax) rmax = r;
5802       }
5803       s *= s;
5804       u *= u;
5805       return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;
5806     }
5807     function position(row, u, rect, flush) {
5808       var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;
5809       if (u == rect.dx) {
5810         if (flush || v > rect.dy) v = rect.dy;
5811         while (++i < n) {
5812           o = row[i];
5813           o.x = x;
5814           o.y = y;
5815           o.dy = v;
5816           x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
5817         }
5818         o.z = true;
5819         o.dx += rect.x + rect.dx - x;
5820         rect.y += v;
5821         rect.dy -= v;
5822       } else {
5823         if (flush || v > rect.dx) v = rect.dx;
5824         while (++i < n) {
5825           o = row[i];
5826           o.x = x;
5827           o.y = y;
5828           o.dx = v;
5829           y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
5830         }
5831         o.z = false;
5832         o.dy += rect.y + rect.dy - y;
5833         rect.x += v;
5834         rect.dx -= v;
5835       }
5836     }
5837     function treemap(d) {
5838       var nodes = stickies || hierarchy(d), root = nodes[0];
5839       root.x = 0;
5840       root.y = 0;
5841       root.dx = size[0];
5842       root.dy = size[1];
5843       if (stickies) hierarchy.revalue(root);
5844       scale([ root ], root.dx * root.dy / root.value);
5845       (stickies ? stickify : squarify)(root);
5846       if (sticky) stickies = nodes;
5847       return nodes;
5848     }
5849     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));
5850     treemap.size = function(x) {
5851       if (!arguments.length) return size;
5852       size = x;
5853       return treemap;
5854     };
5855     treemap.padding = function(x) {
5856       function padFunction(node) {
5857         var p = x.call(treemap, node, node.depth);
5858         return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p);
5859       }
5860       function padConstant(node) {
5861         return d3_layout_treemapPad(node, x);
5862       }
5863       if (!arguments.length) return padding;
5864       var type;
5865       pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], padConstant) : padConstant;
5866       return treemap;
5867     };
5868     treemap.round = function(x) {
5869       if (!arguments.length) return round != Number;
5870       round = x ? Math.round : Number;
5871       return treemap;
5872     };
5873     treemap.sticky = function(x) {
5874       if (!arguments.length) return sticky;
5875       sticky = x;
5876       stickies = null;
5877       return treemap;
5878     };
5879     treemap.ratio = function(x) {
5880       if (!arguments.length) return ratio;
5881       ratio = x;
5882       return treemap;
5883     };
5884     return d3_layout_hierarchyRebind(treemap, hierarchy);
5885   };
5886   d3.csv = d3_dsv(",", "text/csv");
5887   d3.tsv = d3_dsv("     ", "text/tab-separated-values");
5888   d3.geo = {};
5889   var d3_geo_radians = Math.PI / 180;
5890   d3.geo.azimuthal = function() {
5891     function azimuthal(coordinates) {
5892       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);
5893       return [ scale * x + translate[0], scale * y + translate[1] ];
5894     }
5895     var mode = "orthographic", origin, scale = 200, translate = [ 480, 250 ], x0, y0, cy0, sy0;
5896     azimuthal.invert = function(coordinates) {
5897       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);
5898       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 ];
5899     };
5900     azimuthal.mode = function(x) {
5901       if (!arguments.length) return mode;
5902       mode = x + "";
5903       return azimuthal;
5904     };
5905     azimuthal.origin = function(x) {
5906       if (!arguments.length) return origin;
5907       origin = x;
5908       x0 = origin[0] * d3_geo_radians;
5909       y0 = origin[1] * d3_geo_radians;
5910       cy0 = Math.cos(y0);
5911       sy0 = Math.sin(y0);
5912       return azimuthal;
5913     };
5914     azimuthal.scale = function(x) {
5915       if (!arguments.length) return scale;
5916       scale = +x;
5917       return azimuthal;
5918     };
5919     azimuthal.translate = function(x) {
5920       if (!arguments.length) return translate;
5921       translate = [ +x[0], +x[1] ];
5922       return azimuthal;
5923     };
5924     return azimuthal.origin([ 0, 0 ]);
5925   };
5926   d3.geo.albers = function() {
5927     function albers(coordinates) {
5928       var t = n * (d3_geo_radians * coordinates[0] - lng0), p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n;
5929       return [ scale * p * Math.sin(t) + translate[0], scale * (p * Math.cos(t) - p0) + translate[1] ];
5930     }
5931     function reload() {
5932       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);
5933       lng0 = d3_geo_radians * origin[0];
5934       n = .5 * (s + Math.sin(phi2));
5935       C = c * c + 2 * n * s;
5936       p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n;
5937       return albers;
5938     }
5939     var origin = [ -98, 38 ], parallels = [ 29.5, 45.5 ], scale = 1e3, translate = [ 480, 250 ], lng0, n, C, p0;
5940     albers.invert = function(coordinates) {
5941       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);
5942       return [ (lng0 + t / n) / d3_geo_radians, Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians ];
5943     };
5944     albers.origin = function(x) {
5945       if (!arguments.length) return origin;
5946       origin = [ +x[0], +x[1] ];
5947       return reload();
5948     };
5949     albers.parallels = function(x) {
5950       if (!arguments.length) return parallels;
5951       parallels = [ +x[0], +x[1] ];
5952       return reload();
5953     };
5954     albers.scale = function(x) {
5955       if (!arguments.length) return scale;
5956       scale = +x;
5957       return albers;
5958     };
5959     albers.translate = function(x) {
5960       if (!arguments.length) return translate;
5961       translate = [ +x[0], +x[1] ];
5962       return albers;
5963     };
5964     return reload();
5965   };
5966   d3.geo.albersUsa = function() {
5967     function albersUsa(coordinates) {
5968       var lon = coordinates[0], lat = coordinates[1];
5969       return (lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48)(coordinates);
5970     }
5971     var lower48 = d3.geo.albers();
5972     var alaska = d3.geo.albers().origin([ -160, 60 ]).parallels([ 55, 65 ]);
5973     var hawaii = d3.geo.albers().origin([ -160, 20 ]).parallels([ 8, 18 ]);
5974     var puertoRico = d3.geo.albers().origin([ -60, 10 ]).parallels([ 8, 18 ]);
5975     albersUsa.scale = function(x) {
5976       if (!arguments.length) return lower48.scale();
5977       lower48.scale(x);
5978       alaska.scale(x * .6);
5979       hawaii.scale(x);
5980       puertoRico.scale(x * 1.5);
5981       return albersUsa.translate(lower48.translate());
5982     };
5983     albersUsa.translate = function(x) {
5984       if (!arguments.length) return lower48.translate();
5985       var dz = lower48.scale() / 1e3, dx = x[0], dy = x[1];
5986       lower48.translate(x);
5987       alaska.translate([ dx - 400 * dz, dy + 170 * dz ]);
5988       hawaii.translate([ dx - 190 * dz, dy + 200 * dz ]);
5989       puertoRico.translate([ dx + 580 * dz, dy + 430 * dz ]);
5990       return albersUsa;
5991     };
5992     return albersUsa.scale(lower48.scale());
5993   };
5994   d3.geo.bonne = function() {
5995     function bonne(coordinates) {
5996       var x = coordinates[0] * d3_geo_radians - x0, y = coordinates[1] * d3_geo_radians - y0;
5997       if (y1) {
5998         var p = c1 + y1 - y, E = x * Math.cos(y) / p;
5999         x = p * Math.sin(E);
6000         y = p * Math.cos(E) - c1;
6001       } else {
6002         x *= Math.cos(y);
6003         y *= -1;
6004       }
6005       return [ scale * x + translate[0], scale * y + translate[1] ];
6006     }
6007     var scale = 200, translate = [ 480, 250 ], x0, y0, y1, c1;
6008     bonne.invert = function(coordinates) {
6009       var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
6010       if (y1) {
6011         var c = c1 + y, p = Math.sqrt(x * x + c * c);
6012         y = c1 + y1 - p;
6013         x = x0 + p * Math.atan2(x, c) / Math.cos(y);
6014       } else {
6015         y *= -1;
6016         x /= Math.cos(y);
6017       }
6018       return [ x / d3_geo_radians, y / d3_geo_radians ];
6019     };
6020     bonne.parallel = function(x) {
6021       if (!arguments.length) return y1 / d3_geo_radians;
6022       c1 = 1 / Math.tan(y1 = x * d3_geo_radians);
6023       return bonne;
6024     };
6025     bonne.origin = function(x) {
6026       if (!arguments.length) return [ x0 / d3_geo_radians, y0 / d3_geo_radians ];
6027       x0 = x[0] * d3_geo_radians;
6028       y0 = x[1] * d3_geo_radians;
6029       return bonne;
6030     };
6031     bonne.scale = function(x) {
6032       if (!arguments.length) return scale;
6033       scale = +x;
6034       return bonne;
6035     };
6036     bonne.translate = function(x) {
6037       if (!arguments.length) return translate;
6038       translate = [ +x[0], +x[1] ];
6039       return bonne;
6040     };
6041     return bonne.origin([ 0, 0 ]).parallel(45);
6042   };
6043   d3.geo.equirectangular = function() {
6044     function equirectangular(coordinates) {
6045       var x = coordinates[0] / 360, y = -coordinates[1] / 360;
6046       return [ scale * x + translate[0], scale * y + translate[1] ];
6047     }
6048     var scale = 500, translate = [ 480, 250 ];
6049     equirectangular.invert = function(coordinates) {
6050       var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
6051       return [ 360 * x, -360 * y ];
6052     };
6053     equirectangular.scale = function(x) {
6054       if (!arguments.length) return scale;
6055       scale = +x;
6056       return equirectangular;
6057     };
6058     equirectangular.translate = function(x) {
6059       if (!arguments.length) return translate;
6060       translate = [ +x[0], +x[1] ];
6061       return equirectangular;
6062     };
6063     return equirectangular;
6064   };
6065   d3.geo.mercator = function() {
6066     function mercator(coordinates) {
6067       var x = coordinates[0] / 360, y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360;
6068       return [ scale * x + translate[0], scale * Math.max(-.5, Math.min(.5, y)) + translate[1] ];
6069     }
6070     var scale = 500, translate = [ 480, 250 ];
6071     mercator.invert = function(coordinates) {
6072       var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
6073       return [ 360 * x, 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90 ];
6074     };
6075     mercator.scale = function(x) {
6076       if (!arguments.length) return scale;
6077       scale = +x;
6078       return mercator;
6079     };
6080     mercator.translate = function(x) {
6081       if (!arguments.length) return translate;
6082       translate = [ +x[0], +x[1] ];
6083       return mercator;
6084     };
6085     return mercator;
6086   };
6087   d3.geo.path = function() {
6088     function path(d, i) {
6089       if (typeof pointRadius === "function") pointCircle = d3_path_circle(pointRadius.apply(this, arguments));
6090       pathType(d);
6091       var result = buffer.length ? buffer.join("") : null;
6092       buffer = [];
6093       return result;
6094     }
6095     function project(coordinates) {
6096       return projection(coordinates).join(",");
6097     }
6098     function polygonArea(coordinates) {
6099       var sum = area(coordinates[0]), i = 0, n = coordinates.length;
6100       while (++i < n) sum -= area(coordinates[i]);
6101       return sum;
6102     }
6103     function polygonCentroid(coordinates) {
6104       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;
6105       while (++i < n) {
6106         polygon = d3.geom.polygon(coordinates[i].map(projection));
6107         area = polygon.area();
6108         centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1);
6109         x -= centroid[0];
6110         y -= centroid[1];
6111         z -= area;
6112       }
6113       return [ x, y, 6 * z ];
6114     }
6115     function area(coordinates) {
6116       return Math.abs(d3.geom.polygon(coordinates.map(projection)).area());
6117     }
6118     var pointRadius = 4.5, pointCircle = d3_path_circle(pointRadius), projection = d3.geo.albersUsa(), buffer = [];
6119     var pathType = d3_geo_type({
6120       FeatureCollection: function(o) {
6121         var features = o.features, i = -1, n = features.length;
6122         while (++i < n) buffer.push(pathType(features[i].geometry));
6123       },
6124       Feature: function(o) {
6125         pathType(o.geometry);
6126       },
6127       Point: function(o) {
6128         buffer.push("M", project(o.coordinates), pointCircle);
6129       },
6130       MultiPoint: function(o) {
6131         var coordinates = o.coordinates, i = -1, n = coordinates.length;
6132         while (++i < n) buffer.push("M", project(coordinates[i]), pointCircle);
6133       },
6134       LineString: function(o) {
6135         var coordinates = o.coordinates, i = -1, n = coordinates.length;
6136         buffer.push("M");
6137         while (++i < n) buffer.push(project(coordinates[i]), "L");
6138         buffer.pop();
6139       },
6140       MultiLineString: function(o) {
6141         var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m;
6142         while (++i < n) {
6143           subcoordinates = coordinates[i];
6144           j = -1;
6145           m = subcoordinates.length;
6146           buffer.push("M");
6147           while (++j < m) buffer.push(project(subcoordinates[j]), "L");
6148           buffer.pop();
6149         }
6150       },
6151       Polygon: function(o) {
6152         var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m;
6153         while (++i < n) {
6154           subcoordinates = coordinates[i];
6155           j = -1;
6156           if ((m = subcoordinates.length - 1) > 0) {
6157             buffer.push("M");
6158             while (++j < m) buffer.push(project(subcoordinates[j]), "L");
6159             buffer[buffer.length - 1] = "Z";
6160           }
6161         }
6162       },
6163       MultiPolygon: function(o) {
6164         var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m, subsubcoordinates, k, p;
6165         while (++i < n) {
6166           subcoordinates = coordinates[i];
6167           j = -1;
6168           m = subcoordinates.length;
6169           while (++j < m) {
6170             subsubcoordinates = subcoordinates[j];
6171             k = -1;
6172             if ((p = subsubcoordinates.length - 1) > 0) {
6173               buffer.push("M");
6174               while (++k < p) buffer.push(project(subsubcoordinates[k]), "L");
6175               buffer[buffer.length - 1] = "Z";
6176             }
6177           }
6178         }
6179       },
6180       GeometryCollection: function(o) {
6181         var geometries = o.geometries, i = -1, n = geometries.length;
6182         while (++i < n) buffer.push(pathType(geometries[i]));
6183       }
6184     });
6185     var areaType = path.area = d3_geo_type({
6186       FeatureCollection: function(o) {
6187         var area = 0, features = o.features, i = -1, n = features.length;
6188         while (++i < n) area += areaType(features[i]);
6189         return area;
6190       },
6191       Feature: function(o) {
6192         return areaType(o.geometry);
6193       },
6194       Polygon: function(o) {
6195         return polygonArea(o.coordinates);
6196       },
6197       MultiPolygon: function(o) {
6198         var sum = 0, coordinates = o.coordinates, i = -1, n = coordinates.length;
6199         while (++i < n) sum += polygonArea(coordinates[i]);
6200         return sum;
6201       },
6202       GeometryCollection: function(o) {
6203         var sum = 0, geometries = o.geometries, i = -1, n = geometries.length;
6204         while (++i < n) sum += areaType(geometries[i]);
6205         return sum;
6206       }
6207     }, 0);
6208     var centroidType = path.centroid = d3_geo_type({
6209       Feature: function(o) {
6210         return centroidType(o.geometry);
6211       },
6212       Polygon: function(o) {
6213         var centroid = polygonCentroid(o.coordinates);
6214         return [ centroid[0] / centroid[2], centroid[1] / centroid[2] ];
6215       },
6216       MultiPolygon: function(o) {
6217         var area = 0, coordinates = o.coordinates, centroid, x = 0, y = 0, z = 0, i = -1, n = coordinates.length;
6218         while (++i < n) {
6219           centroid = polygonCentroid(coordinates[i]);
6220           x += centroid[0];
6221           y += centroid[1];
6222           z += centroid[2];
6223         }
6224         return [ x / z, y / z ];
6225       }
6226     });
6227     path.projection = function(x) {
6228       projection = x;
6229       return path;
6230     };
6231     path.pointRadius = function(x) {
6232       if (typeof x === "function") pointRadius = x; else {
6233         pointRadius = +x;
6234         pointCircle = d3_path_circle(pointRadius);
6235       }
6236       return path;
6237     };
6238     return path;
6239   };
6240   d3.geo.bounds = function(feature) {
6241     var left = Infinity, bottom = Infinity, right = -Infinity, top = -Infinity;
6242     d3_geo_bounds(feature, function(x, y) {
6243       if (x < left) left = x;
6244       if (x > right) right = x;
6245       if (y < bottom) bottom = y;
6246       if (y > top) top = y;
6247     });
6248     return [ [ left, bottom ], [ right, top ] ];
6249   };
6250   var d3_geo_boundsTypes = {
6251     Feature: d3_geo_boundsFeature,
6252     FeatureCollection: d3_geo_boundsFeatureCollection,
6253     GeometryCollection: d3_geo_boundsGeometryCollection,
6254     LineString: d3_geo_boundsLineString,
6255     MultiLineString: d3_geo_boundsMultiLineString,
6256     MultiPoint: d3_geo_boundsLineString,
6257     MultiPolygon: d3_geo_boundsMultiPolygon,
6258     Point: d3_geo_boundsPoint,
6259     Polygon: d3_geo_boundsPolygon
6260   };
6261   d3.geo.circle = function() {
6262     function circle() {}
6263     function visible(point) {
6264       return arc.distance(point) < radians;
6265     }
6266     function clip(coordinates) {
6267       var i = -1, n = coordinates.length, clipped = [], p0, p1, p2, d0, d1;
6268       while (++i < n) {
6269         d1 = arc.distance(p2 = coordinates[i]);
6270         if (d1 < radians) {
6271           if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1)));
6272           clipped.push(p2);
6273           p0 = p1 = null;
6274         } else {
6275           p1 = p2;
6276           if (!p0 && clipped.length) {
6277             clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0)));
6278             p0 = p1;
6279           }
6280         }
6281         d0 = d1;
6282       }
6283       p0 = coordinates[0];
6284       p1 = clipped[0];
6285       if (p1 && p2[0] === p0[0] && p2[1] === p0[1] && !(p2[0] === p1[0] && p2[1] === p1[1])) {
6286         clipped.push(p1);
6287       }
6288       return resample(clipped);
6289     }
6290     function resample(coordinates) {
6291       var i = 0, n = coordinates.length, j, m, resampled = n ? [ coordinates[0] ] : coordinates, resamples, origin = arc.source();
6292       while (++i < n) {
6293         resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates;
6294         for (j = 0, m = resamples.length; ++j < m; ) resampled.push(resamples[j]);
6295       }
6296       arc.source(origin);
6297       return resampled;
6298     }
6299     var origin = [ 0, 0 ], degrees = 90 - .01, radians = degrees * d3_geo_radians, arc = d3.geo.greatArc().source(origin).target(d3_identity);
6300     circle.clip = function(d) {
6301       if (typeof origin === "function") arc.source(origin.apply(this, arguments));
6302       return clipType(d) || null;
6303     };
6304     var clipType = d3_geo_type({
6305       FeatureCollection: function(o) {
6306         var features = o.features.map(clipType).filter(d3_identity);
6307         return features && (o = Object.create(o), o.features = features, o);
6308       },
6309       Feature: function(o) {
6310         var geometry = clipType(o.geometry);
6311         return geometry && (o = Object.create(o), o.geometry = geometry, o);
6312       },
6313       Point: function(o) {
6314         return visible(o.coordinates) && o;
6315       },
6316       MultiPoint: function(o) {
6317         var coordinates = o.coordinates.filter(visible);
6318         return coordinates.length && {
6319           type: o.type,
6320           coordinates: coordinates
6321         };
6322       },
6323       LineString: function(o) {
6324         var coordinates = clip(o.coordinates);
6325         return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
6326       },
6327       MultiLineString: function(o) {
6328         var coordinates = o.coordinates.map(clip).filter(function(d) {
6329           return d.length;
6330         });
6331         return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
6332       },
6333       Polygon: function(o) {
6334         var coordinates = o.coordinates.map(clip);
6335         return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o);
6336       },
6337       MultiPolygon: function(o) {
6338         var coordinates = o.coordinates.map(function(d) {
6339           return d.map(clip);
6340         }).filter(function(d) {
6341           return d[0].length;
6342         });
6343         return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
6344       },
6345       GeometryCollection: function(o) {
6346         var geometries = o.geometries.map(clipType).filter(d3_identity);
6347         return geometries.length && (o = Object.create(o), o.geometries = geometries, o);
6348       }
6349     });
6350     circle.origin = function(x) {
6351       if (!arguments.length) return origin;
6352       origin = x;
6353       if (typeof origin !== "function") arc.source(origin);
6354       return circle;
6355     };
6356     circle.angle = function(x) {
6357       if (!arguments.length) return degrees;
6358       radians = (degrees = +x) * d3_geo_radians;
6359       return circle;
6360     };
6361     return d3.rebind(circle, arc, "precision");
6362   };
6363   d3.geo.greatArc = function() {
6364     function greatArc() {
6365       var d = greatArc.distance.apply(this, arguments), t = 0, dt = precision / d, coordinates = [ p0 ];
6366       while ((t += dt) < 1) coordinates.push(interpolate(t));
6367       coordinates.push(p1);
6368       return {
6369         type: "LineString",
6370         coordinates: coordinates
6371       };
6372     }
6373     var source = d3_geo_greatArcSource, p0, target = d3_geo_greatArcTarget, p1, precision = 6 * d3_geo_radians, interpolate = d3_geo_greatArcInterpolator();
6374     greatArc.distance = function() {
6375       if (typeof source === "function") interpolate.source(p0 = source.apply(this, arguments));
6376       if (typeof target === "function") interpolate.target(p1 = target.apply(this, arguments));
6377       return interpolate.distance();
6378     };
6379     greatArc.source = function(_) {
6380       if (!arguments.length) return source;
6381       source = _;
6382       if (typeof source !== "function") interpolate.source(p0 = source);
6383       return greatArc;
6384     };
6385     greatArc.target = function(_) {
6386       if (!arguments.length) return target;
6387       target = _;
6388       if (typeof target !== "function") interpolate.target(p1 = target);
6389       return greatArc;
6390     };
6391     greatArc.precision = function(_) {
6392       if (!arguments.length) return precision / d3_geo_radians;
6393       precision = _ * d3_geo_radians;
6394       return greatArc;
6395     };
6396     return greatArc;
6397   };
6398   d3.geo.greatCircle = d3.geo.circle;
6399   d3.geom = {};
6400   d3.geom.contour = function(grid, start) {
6401     var s = start || d3_geom_contourStart(grid), c = [], x = s[0], y = s[1], dx = 0, dy = 0, pdx = NaN, pdy = NaN, i = 0;
6402     do {
6403       i = 0;
6404       if (grid(x - 1, y - 1)) i += 1;
6405       if (grid(x, y - 1)) i += 2;
6406       if (grid(x - 1, y)) i += 4;
6407       if (grid(x, y)) i += 8;
6408       if (i === 6) {
6409         dx = pdy === -1 ? -1 : 1;
6410         dy = 0;
6411       } else if (i === 9) {
6412         dx = 0;
6413         dy = pdx === 1 ? -1 : 1;
6414       } else {
6415         dx = d3_geom_contourDx[i];
6416         dy = d3_geom_contourDy[i];
6417       }
6418       if (dx != pdx && dy != pdy) {
6419         c.push([ x, y ]);
6420         pdx = dx;
6421         pdy = dy;
6422       }
6423       x += dx;
6424       y += dy;
6425     } while (s[0] != x || s[1] != y);
6426     return c;
6427   };
6428   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 ];
6429   d3.geom.hull = function(vertices) {
6430     if (vertices.length < 3) return [];
6431     var len = vertices.length, plen = len - 1, points = [], stack = [], i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
6432     for (i = 1; i < len; ++i) {
6433       if (vertices[i][1] < vertices[h][1]) {
6434         h = i;
6435       } else if (vertices[i][1] == vertices[h][1]) {
6436         h = vertices[i][0] < vertices[h][0] ? i : h;
6437       }
6438     }
6439     for (i = 0; i < len; ++i) {
6440       if (i === h) continue;
6441       y1 = vertices[i][1] - vertices[h][1];
6442       x1 = vertices[i][0] - vertices[h][0];
6443       points.push({
6444         angle: Math.atan2(y1, x1),
6445         index: i
6446       });
6447     }
6448     points.sort(function(a, b) {
6449       return a.angle - b.angle;
6450     });
6451     a = points[0].angle;
6452     v = points[0].index;
6453     u = 0;
6454     for (i = 1; i < plen; ++i) {
6455       j = points[i].index;
6456       if (a == points[i].angle) {
6457         x1 = vertices[v][0] - vertices[h][0];
6458         y1 = vertices[v][1] - vertices[h][1];
6459         x2 = vertices[j][0] - vertices[h][0];
6460         y2 = vertices[j][1] - vertices[h][1];
6461         if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) {
6462           points[i].index = -1;
6463         } else {
6464           points[u].index = -1;
6465           a = points[i].angle;
6466           u = i;
6467           v = j;
6468         }
6469       } else {
6470         a = points[i].angle;
6471         u = i;
6472         v = j;
6473       }
6474     }
6475     stack.push(h);
6476     for (i = 0, j = 0; i < 2; ++j) {
6477       if (points[j].index !== -1) {
6478         stack.push(points[j].index);
6479         i++;
6480       }
6481     }
6482     sp = stack.length;
6483     for (; j < plen; ++j) {
6484       if (points[j].index === -1) continue;
6485       while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) {
6486         --sp;
6487       }
6488       stack[sp++] = points[j].index;
6489     }
6490     var poly = [];
6491     for (i = 0; i < sp; ++i) {
6492       poly.push(vertices[stack[i]]);
6493     }
6494     return poly;
6495   };
6496   d3.geom.polygon = function(coordinates) {
6497     coordinates.area = function() {
6498       var i = 0, n = coordinates.length, a = coordinates[n - 1][0] * coordinates[0][1], b = coordinates[n - 1][1] * coordinates[0][0];
6499       while (++i < n) {
6500         a += coordinates[i - 1][0] * coordinates[i][1];
6501         b += coordinates[i - 1][1] * coordinates[i][0];
6502       }
6503       return (b - a) * .5;
6504     };
6505     coordinates.centroid = function(k) {
6506       var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c;
6507       if (!arguments.length) k = -1 / (6 * coordinates.area());
6508       while (++i < n) {
6509         a = b;
6510         b = coordinates[i];
6511         c = a[0] * b[1] - b[0] * a[1];
6512         x += (a[0] + b[0]) * c;
6513         y += (a[1] + b[1]) * c;
6514       }
6515       return [ x * k, y * k ];
6516     };
6517     coordinates.clip = function(subject) {
6518       var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d;
6519       while (++i < n) {
6520         input = subject.slice();
6521         subject.length = 0;
6522         b = coordinates[i];
6523         c = input[(m = input.length) - 1];
6524         j = -1;
6525         while (++j < m) {
6526           d = input[j];
6527           if (d3_geom_polygonInside(d, a, b)) {
6528             if (!d3_geom_polygonInside(c, a, b)) {
6529               subject.push(d3_geom_polygonIntersect(c, d, a, b));
6530             }
6531             subject.push(d);
6532           } else if (d3_geom_polygonInside(c, a, b)) {
6533             subject.push(d3_geom_polygonIntersect(c, d, a, b));
6534           }
6535           c = d;
6536         }
6537         a = b;
6538       }
6539       return subject;
6540     };
6541     return coordinates;
6542   };
6543   d3.geom.voronoi = function(vertices) {
6544     var polygons = vertices.map(function() {
6545       return [];
6546     });
6547     d3_voronoi_tessellate(vertices, function(e) {
6548       var s1, s2, x1, x2, y1, y2;
6549       if (e.a === 1 && e.b >= 0) {
6550         s1 = e.ep.r;
6551         s2 = e.ep.l;
6552       } else {
6553         s1 = e.ep.l;
6554         s2 = e.ep.r;
6555       }
6556       if (e.a === 1) {
6557         y1 = s1 ? s1.y : -1e6;
6558         x1 = e.c - e.b * y1;
6559         y2 = s2 ? s2.y : 1e6;
6560         x2 = e.c - e.b * y2;
6561       } else {
6562         x1 = s1 ? s1.x : -1e6;
6563         y1 = e.c - e.a * x1;
6564         x2 = s2 ? s2.x : 1e6;
6565         y2 = e.c - e.a * x2;
6566       }
6567       var v1 = [ x1, y1 ], v2 = [ x2, y2 ];
6568       polygons[e.region.l.index].push(v1, v2);
6569       polygons[e.region.r.index].push(v1, v2);
6570     });
6571     return polygons.map(function(polygon, i) {
6572       var cx = vertices[i][0], cy = vertices[i][1];
6573       polygon.forEach(function(v) {
6574         v.angle = Math.atan2(v[0] - cx, v[1] - cy);
6575       });
6576       return polygon.sort(function(a, b) {
6577         return a.angle - b.angle;
6578       }).filter(function(d, i) {
6579         return !i || d.angle - polygon[i - 1].angle > 1e-10;
6580       });
6581     });
6582   };
6583   var d3_voronoi_opposite = {
6584     l: "r",
6585     r: "l"
6586   };
6587   d3.geom.delaunay = function(vertices) {
6588     var edges = vertices.map(function() {
6589       return [];
6590     }), triangles = [];
6591     d3_voronoi_tessellate(vertices, function(e) {
6592       edges[e.region.l.index].push(vertices[e.region.r.index]);
6593     });
6594     edges.forEach(function(edge, i) {
6595       var v = vertices[i], cx = v[0], cy = v[1];
6596       edge.forEach(function(v) {
6597         v.angle = Math.atan2(v[0] - cx, v[1] - cy);
6598       });
6599       edge.sort(function(a, b) {
6600         return a.angle - b.angle;
6601       });
6602       for (var j = 0, m = edge.length - 1; j < m; j++) {
6603         triangles.push([ v, edge[j], edge[j + 1] ]);
6604       }
6605     });
6606     return triangles;
6607   };
6608   d3.geom.quadtree = function(points, x1, y1, x2, y2) {
6609     function insert(n, p, x1, y1, x2, y2) {
6610       if (isNaN(p.x) || isNaN(p.y)) return;
6611       if (n.leaf) {
6612         var v = n.point;
6613         if (v) {
6614           if (Math.abs(v.x - p.x) + Math.abs(v.y - p.y) < .01) {
6615             insertChild(n, p, x1, y1, x2, y2);
6616           } else {
6617             n.point = null;
6618             insertChild(n, v, x1, y1, x2, y2);
6619             insertChild(n, p, x1, y1, x2, y2);
6620           }
6621         } else {
6622           n.point = p;
6623         }
6624       } else {
6625         insertChild(n, p, x1, y1, x2, y2);
6626       }
6627     }
6628     function insertChild(n, p, x1, y1, x2, y2) {
6629       var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = p.x >= sx, bottom = p.y >= sy, i = (bottom << 1) + right;
6630       n.leaf = false;
6631       n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
6632       if (right) x1 = sx; else x2 = sx;
6633       if (bottom) y1 = sy; else y2 = sy;
6634       insert(n, p, x1, y1, x2, y2);
6635     }
6636     var p, i = -1, n = points.length;
6637     if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint);
6638     if (arguments.length < 5) {
6639       if (arguments.length === 3) {
6640         y2 = x2 = y1;
6641         y1 = x1;
6642       } else {
6643         x1 = y1 = Infinity;
6644         x2 = y2 = -Infinity;
6645         while (++i < n) {
6646           p = points[i];
6647           if (p.x < x1) x1 = p.x;
6648           if (p.y < y1) y1 = p.y;
6649           if (p.x > x2) x2 = p.x;
6650           if (p.y > y2) y2 = p.y;
6651         }
6652         var dx = x2 - x1, dy = y2 - y1;
6653         if (dx > dy) y2 = y1 + dx; else x2 = x1 + dy;
6654       }
6655     }
6656     var root = d3_geom_quadtreeNode();
6657     root.add = function(p) {
6658       insert(root, p, x1, y1, x2, y2);
6659     };
6660     root.visit = function(f) {
6661       d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
6662     };
6663     points.forEach(root.add);
6664     return root;
6665   };
6666   d3.time = {};
6667   var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
6668   d3_time_utc.prototype = {
6669     getDate: function() {
6670       return this._.getUTCDate();
6671     },
6672     getDay: function() {
6673       return this._.getUTCDay();
6674     },
6675     getFullYear: function() {
6676       return this._.getUTCFullYear();
6677     },
6678     getHours: function() {
6679       return this._.getUTCHours();
6680     },
6681     getMilliseconds: function() {
6682       return this._.getUTCMilliseconds();
6683     },
6684     getMinutes: function() {
6685       return this._.getUTCMinutes();
6686     },
6687     getMonth: function() {
6688       return this._.getUTCMonth();
6689     },
6690     getSeconds: function() {
6691       return this._.getUTCSeconds();
6692     },
6693     getTime: function() {
6694       return this._.getTime();
6695     },
6696     getTimezoneOffset: function() {
6697       return 0;
6698     },
6699     valueOf: function() {
6700       return this._.valueOf();
6701     },
6702     setDate: function() {
6703       d3_time_prototype.setUTCDate.apply(this._, arguments);
6704     },
6705     setDay: function() {
6706       d3_time_prototype.setUTCDay.apply(this._, arguments);
6707     },
6708     setFullYear: function() {
6709       d3_time_prototype.setUTCFullYear.apply(this._, arguments);
6710     },
6711     setHours: function() {
6712       d3_time_prototype.setUTCHours.apply(this._, arguments);
6713     },
6714     setMilliseconds: function() {
6715       d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);
6716     },
6717     setMinutes: function() {
6718       d3_time_prototype.setUTCMinutes.apply(this._, arguments);
6719     },
6720     setMonth: function() {
6721       d3_time_prototype.setUTCMonth.apply(this._, arguments);
6722     },
6723     setSeconds: function() {
6724       d3_time_prototype.setUTCSeconds.apply(this._, arguments);
6725     },
6726     setTime: function() {
6727       d3_time_prototype.setTime.apply(this._, arguments);
6728     }
6729   };
6730   var d3_time_prototype = Date.prototype;
6731   var d3_time_formatDateTime = "%a %b %e %H:%M:%S %Y", d3_time_formatDate = "%m/%d/%y", d3_time_formatTime = "%H:%M:%S";
6732   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);
6733   d3.time.format = function(template) {
6734     function format(date) {
6735       var string = [], i = -1, j = 0, c, f;
6736       while (++i < n) {
6737         if (template.charCodeAt(i) == 37) {
6738           string.push(template.substring(j, i), (f = d3_time_formats[c = template.charAt(++i)]) ? f(date) : c);
6739           j = i + 1;
6740         }
6741       }
6742       string.push(template.substring(j, i));
6743       return string.join("");
6744     }
6745     var n = template.length;
6746     format.parse = function(string) {
6747       var d = {
6748         y: 1900,
6749         m: 0,
6750         d: 1,
6751         H: 0,
6752         M: 0,
6753         S: 0,
6754         L: 0
6755       }, i = d3_time_parse(d, template, string, 0);
6756       if (i != string.length) return null;
6757       if ("p" in d) d.H = d.H % 12 + d.p * 12;
6758       var date = new d3_time;
6759       date.setFullYear(d.y, d.m, d.d);
6760       date.setHours(d.H, d.M, d.S, d.L);
6761       return date;
6762     };
6763     format.toString = function() {
6764       return template;
6765     };
6766     return format;
6767   };
6768   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");
6769   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);
6770   var d3_time_formats = {
6771     a: function(d) {
6772       return d3_time_dayAbbreviations[d.getDay()];
6773     },
6774     A: function(d) {
6775       return d3_time_days[d.getDay()];
6776     },
6777     b: function(d) {
6778       return d3_time_monthAbbreviations[d.getMonth()];
6779     },
6780     B: function(d) {
6781       return d3_time_months[d.getMonth()];
6782     },
6783     c: d3.time.format(d3_time_formatDateTime),
6784     d: function(d) {
6785       return d3_time_zfill2(d.getDate());
6786     },
6787     e: function(d) {
6788       return d3_time_sfill2(d.getDate());
6789     },
6790     H: function(d) {
6791       return d3_time_zfill2(d.getHours());
6792     },
6793     I: function(d) {
6794       return d3_time_zfill2(d.getHours() % 12 || 12);
6795     },
6796     j: function(d) {
6797       return d3_time_zfill3(1 + d3.time.dayOfYear(d));
6798     },
6799     L: function(d) {
6800       return d3_time_zfill3(d.getMilliseconds());
6801     },
6802     m: function(d) {
6803       return d3_time_zfill2(d.getMonth() + 1);
6804     },
6805     M: function(d) {
6806       return d3_time_zfill2(d.getMinutes());
6807     },
6808     p: function(d) {
6809       return d.getHours() >= 12 ? "PM" : "AM";
6810     },
6811     S: function(d) {
6812       return d3_time_zfill2(d.getSeconds());
6813     },
6814     U: function(d) {
6815       return d3_time_zfill2(d3.time.sundayOfYear(d));
6816     },
6817     w: function(d) {
6818       return d.getDay();
6819     },
6820     W: function(d) {
6821       return d3_time_zfill2(d3.time.mondayOfYear(d));
6822     },
6823     x: d3.time.format(d3_time_formatDate),
6824     X: d3.time.format(d3_time_formatTime),
6825     y: function(d) {
6826       return d3_time_zfill2(d.getFullYear() % 100);
6827     },
6828     Y: function(d) {
6829       return d3_time_zfill4(d.getFullYear() % 1e4);
6830     },
6831     Z: d3_time_zone,
6832     "%": function(d) {
6833       return "%";
6834     }
6835   };
6836   var d3_time_parsers = {
6837     a: d3_time_parseWeekdayAbbrev,
6838     A: d3_time_parseWeekday,
6839     b: d3_time_parseMonthAbbrev,
6840     B: d3_time_parseMonth,
6841     c: d3_time_parseLocaleFull,
6842     d: d3_time_parseDay,
6843     e: d3_time_parseDay,
6844     H: d3_time_parseHour24,
6845     I: d3_time_parseHour24,
6846     L: d3_time_parseMilliseconds,
6847     m: d3_time_parseMonthNumber,
6848     M: d3_time_parseMinutes,
6849     p: d3_time_parseAmPm,
6850     S: d3_time_parseSeconds,
6851     x: d3_time_parseLocaleDate,
6852     X: d3_time_parseLocaleTime,
6853     y: d3_time_parseYear,
6854     Y: d3_time_parseFullYear
6855   };
6856   var d3_time_numberRe = /^\s*\d+/;
6857   var d3_time_amPmLookup = d3.map({
6858     am: 0,
6859     pm: 1
6860   });
6861   d3.time.format.utc = function(template) {
6862     function format(date) {
6863       try {
6864         d3_time = d3_time_utc;
6865         var utc = new d3_time;
6866         utc._ = date;
6867         return local(utc);
6868       } finally {
6869         d3_time = Date;
6870       }
6871     }
6872     var local = d3.time.format(template);
6873     format.parse = function(string) {
6874       try {
6875         d3_time = d3_time_utc;
6876         var date = local.parse(string);
6877         return date && date._;
6878       } finally {
6879         d3_time = Date;
6880       }
6881     };
6882     format.toString = local.toString;
6883     return format;
6884   };
6885   var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
6886   d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso;
6887   d3_time_formatIsoNative.parse = function(string) {
6888     var date = new Date(string);
6889     return isNaN(date) ? null : date;
6890   };
6891   d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
6892   d3.time.second = d3_time_interval(function(date) {
6893     return new d3_time(Math.floor(date / 1e3) * 1e3);
6894   }, function(date, offset) {
6895     date.setTime(date.getTime() + Math.floor(offset) * 1e3);
6896   }, function(date) {
6897     return date.getSeconds();
6898   });
6899   d3.time.seconds = d3.time.second.range;
6900   d3.time.seconds.utc = d3.time.second.utc.range;
6901   d3.time.minute = d3_time_interval(function(date) {
6902     return new d3_time(Math.floor(date / 6e4) * 6e4);
6903   }, function(date, offset) {
6904     date.setTime(date.getTime() + Math.floor(offset) * 6e4);
6905   }, function(date) {
6906     return date.getMinutes();
6907   });
6908   d3.time.minutes = d3.time.minute.range;
6909   d3.time.minutes.utc = d3.time.minute.utc.range;
6910   d3.time.hour = d3_time_interval(function(date) {
6911     var timezone = date.getTimezoneOffset() / 60;
6912     return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
6913   }, function(date, offset) {
6914     date.setTime(date.getTime() + Math.floor(offset) * 36e5);
6915   }, function(date) {
6916     return date.getHours();
6917   });
6918   d3.time.hours = d3.time.hour.range;
6919   d3.time.hours.utc = d3.time.hour.utc.range;
6920   d3.time.day = d3_time_interval(function(date) {
6921     var day = new d3_time(1970, 0);
6922     day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
6923     return day;
6924   }, function(date, offset) {
6925     date.setDate(date.getDate() + offset);
6926   }, function(date) {
6927     return date.getDate() - 1;
6928   });
6929   d3.time.days = d3.time.day.range;
6930   d3.time.days.utc = d3.time.day.utc.range;
6931   d3.time.dayOfYear = function(date) {
6932     var year = d3.time.year(date);
6933     return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
6934   };
6935   d3_time_daySymbols.forEach(function(day, i) {
6936     day = day.toLowerCase();
6937     i = 7 - i;
6938     var interval = d3.time[day] = d3_time_interval(function(date) {
6939       (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
6940       return date;
6941     }, function(date, offset) {
6942       date.setDate(date.getDate() + Math.floor(offset) * 7);
6943     }, function(date) {
6944       var day = d3.time.year(date).getDay();
6945       return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
6946     });
6947     d3.time[day + "s"] = interval.range;
6948     d3.time[day + "s"].utc = interval.utc.range;
6949     d3.time[day + "OfYear"] = function(date) {
6950       var day = d3.time.year(date).getDay();
6951       return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7);
6952     };
6953   });
6954   d3.time.week = d3.time.sunday;
6955   d3.time.weeks = d3.time.sunday.range;
6956   d3.time.weeks.utc = d3.time.sunday.utc.range;
6957   d3.time.weekOfYear = d3.time.sundayOfYear;
6958   d3.time.month = d3_time_interval(function(date) {
6959     date = d3.time.day(date);
6960     date.setDate(1);
6961     return date;
6962   }, function(date, offset) {
6963     date.setMonth(date.getMonth() + offset);
6964   }, function(date) {
6965     return date.getMonth();
6966   });
6967   d3.time.months = d3.time.month.range;
6968   d3.time.months.utc = d3.time.month.utc.range;
6969   d3.time.year = d3_time_interval(function(date) {
6970     date = d3.time.day(date);
6971     date.setMonth(0, 1);
6972     return date;
6973   }, function(date, offset) {
6974     date.setFullYear(date.getFullYear() + offset);
6975   }, function(date) {
6976     return date.getFullYear();
6977   });
6978   d3.time.years = d3.time.year.range;
6979   d3.time.years.utc = d3.time.year.utc.range;
6980   var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];
6981   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 ] ];
6982   var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), function(d) {
6983     return true;
6984   } ], [ d3.time.format("%B"), function(d) {
6985     return d.getMonth();
6986   } ], [ d3.time.format("%b %d"), function(d) {
6987     return d.getDate() != 1;
6988   } ], [ d3.time.format("%a %d"), function(d) {
6989     return d.getDay() && d.getDate() != 1;
6990   } ], [ d3.time.format("%I %p"), function(d) {
6991     return d.getHours();
6992   } ], [ d3.time.format("%I:%M"), function(d) {
6993     return d.getMinutes();
6994   } ], [ d3.time.format(":%S"), function(d) {
6995     return d.getSeconds();
6996   } ], [ d3.time.format(".%L"), function(d) {
6997     return d.getMilliseconds();
6998   } ] ];
6999   var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
7000   d3_time_scaleLocalMethods.year = function(extent, m) {
7001     return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear);
7002   };
7003   d3.time.scale = function() {
7004     return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
7005   };
7006   var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
7007     return [ m[0].utc, m[1] ];
7008   });
7009   var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), function(d) {
7010     return true;
7011   } ], [ d3.time.format.utc("%B"), function(d) {
7012     return d.getUTCMonth();
7013   } ], [ d3.time.format.utc("%b %d"), function(d) {
7014     return d.getUTCDate() != 1;
7015   } ], [ d3.time.format.utc("%a %d"), function(d) {
7016     return d.getUTCDay() && d.getUTCDate() != 1;
7017   } ], [ d3.time.format.utc("%I %p"), function(d) {
7018     return d.getUTCHours();
7019   } ], [ d3.time.format.utc("%I:%M"), function(d) {
7020     return d.getUTCMinutes();
7021   } ], [ d3.time.format.utc(":%S"), function(d) {
7022     return d.getUTCSeconds();
7023   } ], [ d3.time.format.utc(".%L"), function(d) {
7024     return d.getUTCMilliseconds();
7025   } ] ];
7026   var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
7027   d3_time_scaleUTCMethods.year = function(extent, m) {
7028     return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear);
7029   };
7030   d3.time.scale.utc = function() {
7031     return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
7032   };
7033 })();