• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1!function() {
2  var d3 = {
3    version: "3.4.4"
4  };
5  if (!Date.now) Date.now = function() {
6    return +new Date();
7  };
8  var d3_arraySlice = [].slice, d3_array = function(list) {
9    return d3_arraySlice.call(list);
10  };
11  var d3_document = document, d3_documentElement = d3_document.documentElement, d3_window = window;
12  try {
13    d3_array(d3_documentElement.childNodes)[0].nodeType;
14  } catch (e) {
15    d3_array = function(list) {
16      var i = list.length, array = new Array(i);
17      while (i--) array[i] = list[i];
18      return array;
19    };
20  }
21  try {
22    d3_document.createElement("div").style.setProperty("opacity", 0, "");
23  } catch (error) {
24    var d3_element_prototype = d3_window.Element.prototype, d3_element_setAttribute = d3_element_prototype.setAttribute, d3_element_setAttributeNS = d3_element_prototype.setAttributeNS, d3_style_prototype = d3_window.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;
25    d3_element_prototype.setAttribute = function(name, value) {
26      d3_element_setAttribute.call(this, name, value + "");
27    };
28    d3_element_prototype.setAttributeNS = function(space, local, value) {
29      d3_element_setAttributeNS.call(this, space, local, value + "");
30    };
31    d3_style_prototype.setProperty = function(name, value, priority) {
32      d3_style_setProperty.call(this, name, value + "", priority);
33    };
34  }
35  d3.ascending = d3_ascending;
36  function d3_ascending(a, b) {
37    return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
38  }
39  d3.descending = function(a, b) {
40    return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
41  };
42  d3.min = function(array, f) {
43    var i = -1, n = array.length, a, b;
44    if (arguments.length === 1) {
45      while (++i < n && !((a = array[i]) != null && a <= a)) a = undefined;
46      while (++i < n) if ((b = array[i]) != null && a > b) a = b;
47    } else {
48      while (++i < n && !((a = f.call(array, array[i], i)) != null && a <= a)) a = undefined;
49      while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
50    }
51    return a;
52  };
53  d3.max = function(array, f) {
54    var i = -1, n = array.length, a, b;
55    if (arguments.length === 1) {
56      while (++i < n && !((a = array[i]) != null && a <= a)) a = undefined;
57      while (++i < n) if ((b = array[i]) != null && b > a) a = b;
58    } else {
59      while (++i < n && !((a = f.call(array, array[i], i)) != null && a <= a)) a = undefined;
60      while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
61    }
62    return a;
63  };
64  d3.extent = function(array, f) {
65    var i = -1, n = array.length, a, b, c;
66    if (arguments.length === 1) {
67      while (++i < n && !((a = c = array[i]) != null && a <= a)) a = c = undefined;
68      while (++i < n) if ((b = array[i]) != null) {
69        if (a > b) a = b;
70        if (c < b) c = b;
71      }
72    } else {
73      while (++i < n && !((a = c = f.call(array, array[i], i)) != null && a <= a)) a = undefined;
74      while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
75        if (a > b) a = b;
76        if (c < b) c = b;
77      }
78    }
79    return [ a, c ];
80  };
81  d3.sum = function(array, f) {
82    var s = 0, n = array.length, a, i = -1;
83    if (arguments.length === 1) {
84      while (++i < n) if (!isNaN(a = +array[i])) s += a;
85    } else {
86      while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
87    }
88    return s;
89  };
90  function d3_number(x) {
91    return x != null && !isNaN(x);
92  }
93  d3.mean = function(array, f) {
94    var n = array.length, a, m = 0, i = -1, j = 0;
95    if (arguments.length === 1) {
96      while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
97    } else {
98      while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
99    }
100    return j ? m : undefined;
101  };
102  d3.quantile = function(values, p) {
103    var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h;
104    return e ? v + e * (values[h] - v) : v;
105  };
106  d3.median = function(array, f) {
107    if (arguments.length > 1) array = array.map(f);
108    array = array.filter(d3_number);
109    return array.length ? d3.quantile(array.sort(d3_ascending), .5) : undefined;
110  };
111  function d3_bisector(compare) {
112    return {
113      left: function(a, x, lo, hi) {
114        if (arguments.length < 3) lo = 0;
115        if (arguments.length < 4) hi = a.length;
116        while (lo < hi) {
117          var mid = lo + hi >>> 1;
118          if (compare(a[mid], x) < 0) lo = mid + 1; else hi = mid;
119        }
120        return lo;
121      },
122      right: function(a, x, lo, hi) {
123        if (arguments.length < 3) lo = 0;
124        if (arguments.length < 4) hi = a.length;
125        while (lo < hi) {
126          var mid = lo + hi >>> 1;
127          if (compare(a[mid], x) > 0) hi = mid; else lo = mid + 1;
128        }
129        return lo;
130      }
131    };
132  }
133  var d3_bisect = d3_bisector(d3_ascending);
134  d3.bisectLeft = d3_bisect.left;
135  d3.bisect = d3.bisectRight = d3_bisect.right;
136  d3.bisector = function(f) {
137    return d3_bisector(f.length === 1 ? function(d, x) {
138      return d3_ascending(f(d), x);
139    } : f);
140  };
141  d3.shuffle = function(array) {
142    var m = array.length, t, i;
143    while (m) {
144      i = Math.random() * m-- | 0;
145      t = array[m], array[m] = array[i], array[i] = t;
146    }
147    return array;
148  };
149  d3.permute = function(array, indexes) {
150    var i = indexes.length, permutes = new Array(i);
151    while (i--) permutes[i] = array[indexes[i]];
152    return permutes;
153  };
154  d3.pairs = function(array) {
155    var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n);
156    while (i < n) pairs[i] = [ p0 = p1, p1 = array[++i] ];
157    return pairs;
158  };
159  d3.zip = function() {
160    if (!(n = arguments.length)) return [];
161    for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) {
162      for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) {
163        zip[j] = arguments[j][i];
164      }
165    }
166    return zips;
167  };
168  function d3_zipLength(d) {
169    return d.length;
170  }
171  d3.transpose = function(matrix) {
172    return d3.zip.apply(d3, matrix);
173  };
174  d3.keys = function(map) {
175    var keys = [];
176    for (var key in map) keys.push(key);
177    return keys;
178  };
179  d3.values = function(map) {
180    var values = [];
181    for (var key in map) values.push(map[key]);
182    return values;
183  };
184  d3.entries = function(map) {
185    var entries = [];
186    for (var key in map) entries.push({
187      key: key,
188      value: map[key]
189    });
190    return entries;
191  };
192  d3.merge = function(arrays) {
193    var n = arrays.length, m, i = -1, j = 0, merged, array;
194    while (++i < n) j += arrays[i].length;
195    merged = new Array(j);
196    while (--n >= 0) {
197      array = arrays[n];
198      m = array.length;
199      while (--m >= 0) {
200        merged[--j] = array[m];
201      }
202    }
203    return merged;
204  };
205  var abs = Math.abs;
206  d3.range = function(start, stop, step) {
207    if (arguments.length < 3) {
208      step = 1;
209      if (arguments.length < 2) {
210        stop = start;
211        start = 0;
212      }
213    }
214    if ((stop - start) / step === Infinity) throw new Error("infinite range");
215    var range = [], k = d3_range_integerScale(abs(step)), i = -1, j;
216    start *= k, stop *= k, step *= k;
217    if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k);
218    return range;
219  };
220  function d3_range_integerScale(x) {
221    var k = 1;
222    while (x * k % 1) k *= 10;
223    return k;
224  }
225  function d3_class(ctor, properties) {
226    try {
227      for (var key in properties) {
228        Object.defineProperty(ctor.prototype, key, {
229          value: properties[key],
230          enumerable: false
231        });
232      }
233    } catch (e) {
234      ctor.prototype = properties;
235    }
236  }
237  d3.map = function(object) {
238    var map = new d3_Map();
239    if (object instanceof d3_Map) object.forEach(function(key, value) {
240      map.set(key, value);
241    }); else for (var key in object) map.set(key, object[key]);
242    return map;
243  };
244  function d3_Map() {}
245  d3_class(d3_Map, {
246    has: d3_map_has,
247    get: function(key) {
248      return this[d3_map_prefix + key];
249    },
250    set: function(key, value) {
251      return this[d3_map_prefix + key] = value;
252    },
253    remove: d3_map_remove,
254    keys: d3_map_keys,
255    values: function() {
256      var values = [];
257      this.forEach(function(key, value) {
258        values.push(value);
259      });
260      return values;
261    },
262    entries: function() {
263      var entries = [];
264      this.forEach(function(key, value) {
265        entries.push({
266          key: key,
267          value: value
268        });
269      });
270      return entries;
271    },
272    size: d3_map_size,
273    empty: d3_map_empty,
274    forEach: function(f) {
275      for (var key in this) if (key.charCodeAt(0) === d3_map_prefixCode) f.call(this, key.substring(1), this[key]);
276    }
277  });
278  var d3_map_prefix = "\x00", d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
279  function d3_map_has(key) {
280    return d3_map_prefix + key in this;
281  }
282  function d3_map_remove(key) {
283    key = d3_map_prefix + key;
284    return key in this && delete this[key];
285  }
286  function d3_map_keys() {
287    var keys = [];
288    this.forEach(function(key) {
289      keys.push(key);
290    });
291    return keys;
292  }
293  function d3_map_size() {
294    var size = 0;
295    for (var key in this) if (key.charCodeAt(0) === d3_map_prefixCode) ++size;
296    return size;
297  }
298  function d3_map_empty() {
299    for (var key in this) if (key.charCodeAt(0) === d3_map_prefixCode) return false;
300    return true;
301  }
302  d3.nest = function() {
303    var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
304    function map(mapType, array, depth) {
305      if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
306      var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values;
307      while (++i < n) {
308        if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
309          values.push(object);
310        } else {
311          valuesByKey.set(keyValue, [ object ]);
312        }
313      }
314      if (mapType) {
315        object = mapType();
316        setter = function(keyValue, values) {
317          object.set(keyValue, map(mapType, values, depth));
318        };
319      } else {
320        object = {};
321        setter = function(keyValue, values) {
322          object[keyValue] = map(mapType, values, depth);
323        };
324      }
325      valuesByKey.forEach(setter);
326      return object;
327    }
328    function entries(map, depth) {
329      if (depth >= keys.length) return map;
330      var array = [], sortKey = sortKeys[depth++];
331      map.forEach(function(key, keyMap) {
332        array.push({
333          key: key,
334          values: entries(keyMap, depth)
335        });
336      });
337      return sortKey ? array.sort(function(a, b) {
338        return sortKey(a.key, b.key);
339      }) : array;
340    }
341    nest.map = function(array, mapType) {
342      return map(mapType, array, 0);
343    };
344    nest.entries = function(array) {
345      return entries(map(d3.map, array, 0), 0);
346    };
347    nest.key = function(d) {
348      keys.push(d);
349      return nest;
350    };
351    nest.sortKeys = function(order) {
352      sortKeys[keys.length - 1] = order;
353      return nest;
354    };
355    nest.sortValues = function(order) {
356      sortValues = order;
357      return nest;
358    };
359    nest.rollup = function(f) {
360      rollup = f;
361      return nest;
362    };
363    return nest;
364  };
365  d3.set = function(array) {
366    var set = new d3_Set();
367    if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]);
368    return set;
369  };
370  function d3_Set() {}
371  d3_class(d3_Set, {
372    has: d3_map_has,
373    add: function(value) {
374      this[d3_map_prefix + value] = true;
375      return value;
376    },
377    remove: function(value) {
378      value = d3_map_prefix + value;
379      return value in this && delete this[value];
380    },
381    values: d3_map_keys,
382    size: d3_map_size,
383    empty: d3_map_empty,
384    forEach: function(f) {
385      for (var value in this) if (value.charCodeAt(0) === d3_map_prefixCode) f.call(this, value.substring(1));
386    }
387  });
388  d3.behavior = {};
389  d3.rebind = function(target, source) {
390    var i = 1, n = arguments.length, method;
391    while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
392    return target;
393  };
394  function d3_rebind(target, source, method) {
395    return function() {
396      var value = method.apply(source, arguments);
397      return value === source ? target : value;
398    };
399  }
400  function d3_vendorSymbol(object, name) {
401    if (name in object) return name;
402    name = name.charAt(0).toUpperCase() + name.substring(1);
403    for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) {
404      var prefixName = d3_vendorPrefixes[i] + name;
405      if (prefixName in object) return prefixName;
406    }
407  }
408  var d3_vendorPrefixes = [ "webkit", "ms", "moz", "Moz", "o", "O" ];
409  function d3_noop() {}
410  d3.dispatch = function() {
411    var dispatch = new d3_dispatch(), i = -1, n = arguments.length;
412    while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
413    return dispatch;
414  };
415  function d3_dispatch() {}
416  d3_dispatch.prototype.on = function(type, listener) {
417    var i = type.indexOf("."), name = "";
418    if (i >= 0) {
419      name = type.substring(i + 1);
420      type = type.substring(0, i);
421    }
422    if (type) return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);
423    if (arguments.length === 2) {
424      if (listener == null) for (type in this) {
425        if (this.hasOwnProperty(type)) this[type].on(name, null);
426      }
427      return this;
428    }
429  };
430  function d3_dispatch_event(dispatch) {
431    var listeners = [], listenerByName = new d3_Map();
432    function event() {
433      var z = listeners, i = -1, n = z.length, l;
434      while (++i < n) if (l = z[i].on) l.apply(this, arguments);
435      return dispatch;
436    }
437    event.on = function(name, listener) {
438      var l = listenerByName.get(name), i;
439      if (arguments.length < 2) return l && l.on;
440      if (l) {
441        l.on = null;
442        listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
443        listenerByName.remove(name);
444      }
445      if (listener) listeners.push(listenerByName.set(name, {
446        on: listener
447      }));
448      return dispatch;
449    };
450    return event;
451  }
452  d3.event = null;
453  function d3_eventPreventDefault() {
454    d3.event.preventDefault();
455  }
456  function d3_eventSource() {
457    var e = d3.event, s;
458    while (s = e.sourceEvent) e = s;
459    return e;
460  }
461  function d3_eventDispatch(target) {
462    var dispatch = new d3_dispatch(), i = 0, n = arguments.length;
463    while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
464    dispatch.of = function(thiz, argumentz) {
465      return function(e1) {
466        try {
467          var e0 = e1.sourceEvent = d3.event;
468          e1.target = target;
469          d3.event = e1;
470          dispatch[e1.type].apply(thiz, argumentz);
471        } finally {
472          d3.event = e0;
473        }
474      };
475    };
476    return dispatch;
477  }
478  d3.requote = function(s) {
479    return s.replace(d3_requote_re, "\\$&");
480  };
481  var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
482  var d3_subclass = {}.__proto__ ? function(object, prototype) {
483    object.__proto__ = prototype;
484  } : function(object, prototype) {
485    for (var property in prototype) object[property] = prototype[property];
486  };
487  function d3_selection(groups) {
488    d3_subclass(groups, d3_selectionPrototype);
489    return groups;
490  }
491  var d3_select = function(s, n) {
492    return n.querySelector(s);
493  }, d3_selectAll = function(s, n) {
494    return n.querySelectorAll(s);
495  }, d3_selectMatcher = d3_documentElement[d3_vendorSymbol(d3_documentElement, "matchesSelector")], d3_selectMatches = function(n, s) {
496    return d3_selectMatcher.call(n, s);
497  };
498  if (typeof Sizzle === "function") {
499    d3_select = function(s, n) {
500      return Sizzle(s, n)[0] || null;
501    };
502    d3_selectAll = Sizzle;
503    d3_selectMatches = Sizzle.matchesSelector;
504  }
505  d3.selection = function() {
506    return d3_selectionRoot;
507  };
508  var d3_selectionPrototype = d3.selection.prototype = [];
509  d3_selectionPrototype.select = function(selector) {
510    var subgroups = [], subgroup, subnode, group, node;
511    selector = d3_selection_selector(selector);
512    for (var j = -1, m = this.length; ++j < m; ) {
513      subgroups.push(subgroup = []);
514      subgroup.parentNode = (group = this[j]).parentNode;
515      for (var i = -1, n = group.length; ++i < n; ) {
516        if (node = group[i]) {
517          subgroup.push(subnode = selector.call(node, node.__data__, i, j));
518          if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
519        } else {
520          subgroup.push(null);
521        }
522      }
523    }
524    return d3_selection(subgroups);
525  };
526  function d3_selection_selector(selector) {
527    return typeof selector === "function" ? selector : function() {
528      return d3_select(selector, this);
529    };
530  }
531  d3_selectionPrototype.selectAll = function(selector) {
532    var subgroups = [], subgroup, node;
533    selector = d3_selection_selectorAll(selector);
534    for (var j = -1, m = this.length; ++j < m; ) {
535      for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
536        if (node = group[i]) {
537          subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i, j)));
538          subgroup.parentNode = node;
539        }
540      }
541    }
542    return d3_selection(subgroups);
543  };
544  function d3_selection_selectorAll(selector) {
545    return typeof selector === "function" ? selector : function() {
546      return d3_selectAll(selector, this);
547    };
548  }
549  var d3_nsPrefix = {
550    svg: "http://www.w3.org/2000/svg",
551    xhtml: "http://www.w3.org/1999/xhtml",
552    xlink: "http://www.w3.org/1999/xlink",
553    xml: "http://www.w3.org/XML/1998/namespace",
554    xmlns: "http://www.w3.org/2000/xmlns/"
555  };
556  d3.ns = {
557    prefix: d3_nsPrefix,
558    qualify: function(name) {
559      var i = name.indexOf(":"), prefix = name;
560      if (i >= 0) {
561        prefix = name.substring(0, i);
562        name = name.substring(i + 1);
563      }
564      return d3_nsPrefix.hasOwnProperty(prefix) ? {
565        space: d3_nsPrefix[prefix],
566        local: name
567      } : name;
568    }
569  };
570  d3_selectionPrototype.attr = function(name, value) {
571    if (arguments.length < 2) {
572      if (typeof name === "string") {
573        var node = this.node();
574        name = d3.ns.qualify(name);
575        return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name);
576      }
577      for (value in name) this.each(d3_selection_attr(value, name[value]));
578      return this;
579    }
580    return this.each(d3_selection_attr(name, value));
581  };
582  function d3_selection_attr(name, value) {
583    name = d3.ns.qualify(name);
584    function attrNull() {
585      this.removeAttribute(name);
586    }
587    function attrNullNS() {
588      this.removeAttributeNS(name.space, name.local);
589    }
590    function attrConstant() {
591      this.setAttribute(name, value);
592    }
593    function attrConstantNS() {
594      this.setAttributeNS(name.space, name.local, value);
595    }
596    function attrFunction() {
597      var x = value.apply(this, arguments);
598      if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);
599    }
600    function attrFunctionNS() {
601      var x = value.apply(this, arguments);
602      if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);
603    }
604    return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;
605  }
606  function d3_collapse(s) {
607    return s.trim().replace(/\s+/g, " ");
608  }
609  d3_selectionPrototype.classed = function(name, value) {
610    if (arguments.length < 2) {
611      if (typeof name === "string") {
612        var node = this.node(), n = (name = d3_selection_classes(name)).length, i = -1;
613        if (value = node.classList) {
614          while (++i < n) if (!value.contains(name[i])) return false;
615        } else {
616          value = node.getAttribute("class");
617          while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false;
618        }
619        return true;
620      }
621      for (value in name) this.each(d3_selection_classed(value, name[value]));
622      return this;
623    }
624    return this.each(d3_selection_classed(name, value));
625  };
626  function d3_selection_classedRe(name) {
627    return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g");
628  }
629  function d3_selection_classes(name) {
630    return name.trim().split(/^|\s+/);
631  }
632  function d3_selection_classed(name, value) {
633    name = d3_selection_classes(name).map(d3_selection_classedName);
634    var n = name.length;
635    function classedConstant() {
636      var i = -1;
637      while (++i < n) name[i](this, value);
638    }
639    function classedFunction() {
640      var i = -1, x = value.apply(this, arguments);
641      while (++i < n) name[i](this, x);
642    }
643    return typeof value === "function" ? classedFunction : classedConstant;
644  }
645  function d3_selection_classedName(name) {
646    var re = d3_selection_classedRe(name);
647    return function(node, value) {
648      if (c = node.classList) return value ? c.add(name) : c.remove(name);
649      var c = node.getAttribute("class") || "";
650      if (value) {
651        re.lastIndex = 0;
652        if (!re.test(c)) node.setAttribute("class", d3_collapse(c + " " + name));
653      } else {
654        node.setAttribute("class", d3_collapse(c.replace(re, " ")));
655      }
656    };
657  }
658  d3_selectionPrototype.style = function(name, value, priority) {
659    var n = arguments.length;
660    if (n < 3) {
661      if (typeof name !== "string") {
662        if (n < 2) value = "";
663        for (priority in name) this.each(d3_selection_style(priority, name[priority], value));
664        return this;
665      }
666      if (n < 2) return d3_window.getComputedStyle(this.node(), null).getPropertyValue(name);
667      priority = "";
668    }
669    return this.each(d3_selection_style(name, value, priority));
670  };
671  function d3_selection_style(name, value, priority) {
672    function styleNull() {
673      this.style.removeProperty(name);
674    }
675    function styleConstant() {
676      this.style.setProperty(name, value, priority);
677    }
678    function styleFunction() {
679      var x = value.apply(this, arguments);
680      if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority);
681    }
682    return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant;
683  }
684  d3_selectionPrototype.property = function(name, value) {
685    if (arguments.length < 2) {
686      if (typeof name === "string") return this.node()[name];
687      for (value in name) this.each(d3_selection_property(value, name[value]));
688      return this;
689    }
690    return this.each(d3_selection_property(name, value));
691  };
692  function d3_selection_property(name, value) {
693    function propertyNull() {
694      delete this[name];
695    }
696    function propertyConstant() {
697      this[name] = value;
698    }
699    function propertyFunction() {
700      var x = value.apply(this, arguments);
701      if (x == null) delete this[name]; else this[name] = x;
702    }
703    return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant;
704  }
705  d3_selectionPrototype.text = function(value) {
706    return arguments.length ? this.each(typeof value === "function" ? function() {
707      var v = value.apply(this, arguments);
708      this.textContent = v == null ? "" : v;
709    } : value == null ? function() {
710      this.textContent = "";
711    } : function() {
712      this.textContent = value;
713    }) : this.node().textContent;
714  };
715  d3_selectionPrototype.html = function(value) {
716    throw "disallowed by chromium security";
717    return arguments.length ? this.each(typeof value === "function" ? function() {
718      var v = value.apply(this, arguments);
719      this.innerHTML = v == null ? "" : v;
720    } : value == null ? function() {
721      this.innerHTML = "";
722    } : function() {
723      this.innerHTML = value;
724    }) : this.node().innerHTML;
725  };
726  d3_selectionPrototype.append = function(name) {
727    name = d3_selection_creator(name);
728    return this.select(function() {
729      return this.appendChild(name.apply(this, arguments));
730    });
731  };
732  function d3_selection_creator(name) {
733    return typeof name === "function" ? name : (name = d3.ns.qualify(name)).local ? function() {
734      return this.ownerDocument.createElementNS(name.space, name.local);
735    } : function() {
736      return this.ownerDocument.createElementNS(this.namespaceURI, name);
737    };
738  }
739  d3_selectionPrototype.insert = function(name, before) {
740    name = d3_selection_creator(name);
741    before = d3_selection_selector(before);
742    return this.select(function() {
743      return this.insertBefore(name.apply(this, arguments), before.apply(this, arguments) || null);
744    });
745  };
746  d3_selectionPrototype.remove = function() {
747    return this.each(function() {
748      var parent = this.parentNode;
749      if (parent) parent.removeChild(this);
750    });
751  };
752  d3_selectionPrototype.data = function(value, key) {
753    var i = -1, n = this.length, group, node;
754    if (!arguments.length) {
755      value = new Array(n = (group = this[0]).length);
756      while (++i < n) {
757        if (node = group[i]) {
758          value[i] = node.__data__;
759        }
760      }
761      return value;
762    }
763    function bind(group, groupData) {
764      var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData;
765      if (key) {
766        var nodeByKeyValue = new d3_Map(), dataByKeyValue = new d3_Map(), keyValues = [], keyValue;
767        for (i = -1; ++i < n; ) {
768          keyValue = key.call(node = group[i], node.__data__, i);
769          if (nodeByKeyValue.has(keyValue)) {
770            exitNodes[i] = node;
771          } else {
772            nodeByKeyValue.set(keyValue, node);
773          }
774          keyValues.push(keyValue);
775        }
776        for (i = -1; ++i < m; ) {
777          keyValue = key.call(groupData, nodeData = groupData[i], i);
778          if (node = nodeByKeyValue.get(keyValue)) {
779            updateNodes[i] = node;
780            node.__data__ = nodeData;
781          } else if (!dataByKeyValue.has(keyValue)) {
782            enterNodes[i] = d3_selection_dataNode(nodeData);
783          }
784          dataByKeyValue.set(keyValue, nodeData);
785          nodeByKeyValue.remove(keyValue);
786        }
787        for (i = -1; ++i < n; ) {
788          if (nodeByKeyValue.has(keyValues[i])) {
789            exitNodes[i] = group[i];
790          }
791        }
792      } else {
793        for (i = -1; ++i < n0; ) {
794          node = group[i];
795          nodeData = groupData[i];
796          if (node) {
797            node.__data__ = nodeData;
798            updateNodes[i] = node;
799          } else {
800            enterNodes[i] = d3_selection_dataNode(nodeData);
801          }
802        }
803        for (;i < m; ++i) {
804          enterNodes[i] = d3_selection_dataNode(groupData[i]);
805        }
806        for (;i < n; ++i) {
807          exitNodes[i] = group[i];
808        }
809      }
810      enterNodes.update = updateNodes;
811      enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode;
812      enter.push(enterNodes);
813      update.push(updateNodes);
814      exit.push(exitNodes);
815    }
816    var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);
817    if (typeof value === "function") {
818      while (++i < n) {
819        bind(group = this[i], value.call(group, group.parentNode.__data__, i));
820      }
821    } else {
822      while (++i < n) {
823        bind(group = this[i], value);
824      }
825    }
826    update.enter = function() {
827      return enter;
828    };
829    update.exit = function() {
830      return exit;
831    };
832    return update;
833  };
834  function d3_selection_dataNode(data) {
835    return {
836      __data__: data
837    };
838  }
839  d3_selectionPrototype.datum = function(value) {
840    return arguments.length ? this.property("__data__", value) : this.property("__data__");
841  };
842  d3_selectionPrototype.filter = function(filter) {
843    var subgroups = [], subgroup, group, node;
844    if (typeof filter !== "function") filter = d3_selection_filter(filter);
845    for (var j = 0, m = this.length; j < m; j++) {
846      subgroups.push(subgroup = []);
847      subgroup.parentNode = (group = this[j]).parentNode;
848      for (var i = 0, n = group.length; i < n; i++) {
849        if ((node = group[i]) && filter.call(node, node.__data__, i, j)) {
850          subgroup.push(node);
851        }
852      }
853    }
854    return d3_selection(subgroups);
855  };
856  function d3_selection_filter(selector) {
857    return function() {
858      return d3_selectMatches(this, selector);
859    };
860  }
861  d3_selectionPrototype.order = function() {
862    for (var j = -1, m = this.length; ++j < m; ) {
863      for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
864        if (node = group[i]) {
865          if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
866          next = node;
867        }
868      }
869    }
870    return this;
871  };
872  d3_selectionPrototype.sort = function(comparator) {
873    comparator = d3_selection_sortComparator.apply(this, arguments);
874    for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);
875    return this.order();
876  };
877  function d3_selection_sortComparator(comparator) {
878    if (!arguments.length) comparator = d3_ascending;
879    return function(a, b) {
880      return a && b ? comparator(a.__data__, b.__data__) : !a - !b;
881    };
882  }
883  d3_selectionPrototype.each = function(callback) {
884    return d3_selection_each(this, function(node, i, j) {
885      callback.call(node, node.__data__, i, j);
886    });
887  };
888  function d3_selection_each(groups, callback) {
889    for (var j = 0, m = groups.length; j < m; j++) {
890      for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {
891        if (node = group[i]) callback(node, i, j);
892      }
893    }
894    return groups;
895  }
896  d3_selectionPrototype.call = function(callback) {
897    var args = d3_array(arguments);
898    callback.apply(args[0] = this, args);
899    return this;
900  };
901  d3_selectionPrototype.empty = function() {
902    return !this.node();
903  };
904  d3_selectionPrototype.node = function() {
905    for (var j = 0, m = this.length; j < m; j++) {
906      for (var group = this[j], i = 0, n = group.length; i < n; i++) {
907        var node = group[i];
908        if (node) return node;
909      }
910    }
911    return null;
912  };
913  d3_selectionPrototype.size = function() {
914    var n = 0;
915    this.each(function() {
916      ++n;
917    });
918    return n;
919  };
920  function d3_selection_enter(selection) {
921    d3_subclass(selection, d3_selection_enterPrototype);
922    return selection;
923  }
924  var d3_selection_enterPrototype = [];
925  d3.selection.enter = d3_selection_enter;
926  d3.selection.enter.prototype = d3_selection_enterPrototype;
927  d3_selection_enterPrototype.append = d3_selectionPrototype.append;
928  d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
929  d3_selection_enterPrototype.node = d3_selectionPrototype.node;
930  d3_selection_enterPrototype.call = d3_selectionPrototype.call;
931  d3_selection_enterPrototype.size = d3_selectionPrototype.size;
932  d3_selection_enterPrototype.select = function(selector) {
933    var subgroups = [], subgroup, subnode, upgroup, group, node;
934    for (var j = -1, m = this.length; ++j < m; ) {
935      upgroup = (group = this[j]).update;
936      subgroups.push(subgroup = []);
937      subgroup.parentNode = group.parentNode;
938      for (var i = -1, n = group.length; ++i < n; ) {
939        if (node = group[i]) {
940          subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i, j));
941          subnode.__data__ = node.__data__;
942        } else {
943          subgroup.push(null);
944        }
945      }
946    }
947    return d3_selection(subgroups);
948  };
949  d3_selection_enterPrototype.insert = function(name, before) {
950    if (arguments.length < 2) before = d3_selection_enterInsertBefore(this);
951    return d3_selectionPrototype.insert.call(this, name, before);
952  };
953  function d3_selection_enterInsertBefore(enter) {
954    var i0, j0;
955    return function(d, i, j) {
956      var group = enter[j].update, n = group.length, node;
957      if (j != j0) j0 = j, i0 = 0;
958      if (i >= i0) i0 = i + 1;
959      while (!(node = group[i0]) && ++i0 < n) ;
960      return node;
961    };
962  }
963  d3_selectionPrototype.transition = function() {
964    var id = d3_transitionInheritId || ++d3_transitionId, subgroups = [], subgroup, node, transition = d3_transitionInherit || {
965      time: Date.now(),
966      ease: d3_ease_cubicInOut,
967      delay: 0,
968      duration: 250
969    };
970    for (var j = -1, m = this.length; ++j < m; ) {
971      subgroups.push(subgroup = []);
972      for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
973        if (node = group[i]) d3_transitionNode(node, i, id, transition);
974        subgroup.push(node);
975      }
976    }
977    return d3_transition(subgroups, id);
978  };
979  d3_selectionPrototype.interrupt = function() {
980    return this.each(d3_selection_interrupt);
981  };
982  function d3_selection_interrupt() {
983    var lock = this.__transition__;
984    if (lock) ++lock.active;
985  }
986  d3.select = function(node) {
987    var group = [ typeof node === "string" ? d3_select(node, d3_document) : node ];
988    group.parentNode = d3_documentElement;
989    return d3_selection([ group ]);
990  };
991  d3.selectAll = function(nodes) {
992    var group = d3_array(typeof nodes === "string" ? d3_selectAll(nodes, d3_document) : nodes);
993    group.parentNode = d3_documentElement;
994    return d3_selection([ group ]);
995  };
996  var d3_selectionRoot = d3.select(d3_documentElement);
997  d3_selectionPrototype.on = function(type, listener, capture) {
998    var n = arguments.length;
999    if (n < 3) {
1000      if (typeof type !== "string") {
1001        if (n < 2) listener = false;
1002        for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));
1003        return this;
1004      }
1005      if (n < 2) return (n = this.node()["__on" + type]) && n._;
1006      capture = false;
1007    }
1008    return this.each(d3_selection_on(type, listener, capture));
1009  };
1010  function d3_selection_on(type, listener, capture) {
1011    var name = "__on" + type, i = type.indexOf("."), wrap = d3_selection_onListener;
1012    if (i > 0) type = type.substring(0, i);
1013    var filter = d3_selection_onFilters.get(type);
1014    if (filter) type = filter, wrap = d3_selection_onFilter;
1015    function onRemove() {
1016      var l = this[name];
1017      if (l) {
1018        this.removeEventListener(type, l, l.$);
1019        delete this[name];
1020      }
1021    }
1022    function onAdd() {
1023      var l = wrap(listener, d3_array(arguments));
1024      onRemove.call(this);
1025      this.addEventListener(type, this[name] = l, l.$ = capture);
1026      l._ = listener;
1027    }
1028    function removeAll() {
1029      var re = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match;
1030      for (var name in this) {
1031        if (match = name.match(re)) {
1032          var l = this[name];
1033          this.removeEventListener(match[1], l, l.$);
1034          delete this[name];
1035        }
1036      }
1037    }
1038    return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll;
1039  }
1040  var d3_selection_onFilters = d3.map({
1041    mouseenter: "mouseover",
1042    mouseleave: "mouseout"
1043  });
1044  d3_selection_onFilters.forEach(function(k) {
1045    if ("on" + k in d3_document) d3_selection_onFilters.remove(k);
1046  });
1047  function d3_selection_onListener(listener, argumentz) {
1048    return function(e) {
1049      var o = d3.event;
1050      d3.event = e;
1051      argumentz[0] = this.__data__;
1052      try {
1053        listener.apply(this, argumentz);
1054      } finally {
1055        d3.event = o;
1056      }
1057    };
1058  }
1059  function d3_selection_onFilter(listener, argumentz) {
1060    var l = d3_selection_onListener(listener, argumentz);
1061    return function(e) {
1062      var target = this, related = e.relatedTarget;
1063      if (!related || related !== target && !(related.compareDocumentPosition(target) & 8)) {
1064        l.call(target, e);
1065      }
1066    };
1067  }
1068  var d3_event_dragSelect = "onselectstart" in d3_document ? null : d3_vendorSymbol(d3_documentElement.style, "userSelect"), d3_event_dragId = 0;
1069  function d3_event_dragSuppress() {
1070    var name = ".dragsuppress-" + ++d3_event_dragId, click = "click" + name, w = d3.select(d3_window).on("touchmove" + name, d3_eventPreventDefault).on("dragstart" + name, d3_eventPreventDefault).on("selectstart" + name, d3_eventPreventDefault);
1071    if (d3_event_dragSelect) {
1072      var style = d3_documentElement.style, select = style[d3_event_dragSelect];
1073      style[d3_event_dragSelect] = "none";
1074    }
1075    return function(suppressClick) {
1076      w.on(name, null);
1077      if (d3_event_dragSelect) style[d3_event_dragSelect] = select;
1078      if (suppressClick) {
1079        function off() {
1080          w.on(click, null);
1081        }
1082        w.on(click, function() {
1083          d3_eventPreventDefault();
1084          off();
1085        }, true);
1086        setTimeout(off, 0);
1087      }
1088    };
1089  }
1090  d3.mouse = function(container) {
1091    return d3_mousePoint(container, d3_eventSource());
1092  };
1093  function d3_mousePoint(container, e) {
1094    if (e.changedTouches) e = e.changedTouches[0];
1095    var svg = container.ownerSVGElement || container;
1096    if (svg.createSVGPoint) {
1097      var point = svg.createSVGPoint();
1098      point.x = e.clientX, point.y = e.clientY;
1099      point = point.matrixTransform(container.getScreenCTM().inverse());
1100      return [ point.x, point.y ];
1101    }
1102    var rect = container.getBoundingClientRect();
1103    return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
1104  }
1105  d3.touches = function(container, touches) {
1106    if (arguments.length < 2) touches = d3_eventSource().touches;
1107    return touches ? d3_array(touches).map(function(touch) {
1108      var point = d3_mousePoint(container, touch);
1109      point.identifier = touch.identifier;
1110      return point;
1111    }) : [];
1112  };
1113  d3.behavior.drag = function() {
1114    var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null, mousedown = dragstart(d3_noop, d3.mouse, d3_behavior_dragMouseSubject, "mousemove", "mouseup"), touchstart = dragstart(d3_behavior_dragTouchId, d3.touch, d3_behavior_dragTouchSubject, "touchmove", "touchend");
1115    function drag() {
1116      this.on("mousedown.drag", mousedown).on("touchstart.drag", touchstart);
1117    }
1118    function dragstart(id, position, subject, move, end) {
1119      return function() {
1120        var that = this, target = d3.event.target, parent = that.parentNode, dispatch = event.of(that, arguments), dragged = 0, dragId = id(), dragName = ".drag" + (dragId == null ? "" : "-" + dragId), dragOffset, dragSubject = d3.select(subject()).on(move + dragName, moved).on(end + dragName, ended), dragRestore = d3_event_dragSuppress(), position0 = position(parent, dragId);
1121        if (origin) {
1122          dragOffset = origin.apply(that, arguments);
1123          dragOffset = [ dragOffset.x - position0[0], dragOffset.y - position0[1] ];
1124        } else {
1125          dragOffset = [ 0, 0 ];
1126        }
1127        dispatch({
1128          type: "dragstart"
1129        });
1130        function moved() {
1131          var position1 = position(parent, dragId), dx, dy;
1132          if (!position1) return;
1133          dx = position1[0] - position0[0];
1134          dy = position1[1] - position0[1];
1135          dragged |= dx | dy;
1136          position0 = position1;
1137          dispatch({
1138            type: "drag",
1139            x: position1[0] + dragOffset[0],
1140            y: position1[1] + dragOffset[1],
1141            dx: dx,
1142            dy: dy
1143          });
1144        }
1145        function ended() {
1146          if (!position(parent, dragId)) return;
1147          dragSubject.on(move + dragName, null).on(end + dragName, null);
1148          dragRestore(dragged && d3.event.target === target);
1149          dispatch({
1150            type: "dragend"
1151          });
1152        }
1153      };
1154    }
1155    drag.origin = function(x) {
1156      if (!arguments.length) return origin;
1157      origin = x;
1158      return drag;
1159    };
1160    return d3.rebind(drag, event, "on");
1161  };
1162  function d3_behavior_dragTouchId() {
1163    return d3.event.changedTouches[0].identifier;
1164  }
1165  function d3_behavior_dragTouchSubject() {
1166    return d3.event.target;
1167  }
1168  function d3_behavior_dragMouseSubject() {
1169    return d3_window;
1170  }
1171  var π = Math.PI, τ = 2 * π, halfπ = π / 2, ε = 1e-6, ε2 = ε * ε, d3_radians = π / 180, d3_degrees = 180 / π;
1172  function d3_sgn(x) {
1173    return x > 0 ? 1 : x < 0 ? -1 : 0;
1174  }
1175  function d3_cross2d(a, b, c) {
1176    return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
1177  }
1178  function d3_acos(x) {
1179    return x > 1 ? 0 : x < -1 ? π : Math.acos(x);
1180  }
1181  function d3_asin(x) {
1182    return x > 1 ? halfπ : x < -1 ? -halfπ : Math.asin(x);
1183  }
1184  function d3_sinh(x) {
1185    return ((x = Math.exp(x)) - 1 / x) / 2;
1186  }
1187  function d3_cosh(x) {
1188    return ((x = Math.exp(x)) + 1 / x) / 2;
1189  }
1190  function d3_tanh(x) {
1191    return ((x = Math.exp(2 * x)) - 1) / (x + 1);
1192  }
1193  function d3_haversin(x) {
1194    return (x = Math.sin(x / 2)) * x;
1195  }
1196  var ρ = Math.SQRT2, ρ2 = 2, ρ4 = 4;
1197  d3.interpolateZoom = function(p0, p1) {
1198    var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2];
1199    var dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + ρ4 * d2) / (2 * w0 * ρ2 * d1), b1 = (w1 * w1 - w0 * w0 - ρ4 * d2) / (2 * w1 * ρ2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1), dr = r1 - r0, S = (dr || Math.log(w1 / w0)) / ρ;
1200    function interpolate(t) {
1201      var s = t * S;
1202      if (dr) {
1203        var coshr0 = d3_cosh(r0), u = w0 / (ρ2 * d1) * (coshr0 * d3_tanh(ρ * s + r0) - d3_sinh(r0));
1204        return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / d3_cosh(ρ * s + r0) ];
1205      }
1206      return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(ρ * s) ];
1207    }
1208    interpolate.duration = S * 1e3;
1209    return interpolate;
1210  };
1211  d3.behavior.zoom = function() {
1212    var view = {
1213      x: 0,
1214      y: 0,
1215      k: 1
1216    }, translate0, center, size = [ 960, 500 ], scaleExtent = d3_behavior_zoomInfinity, mousedown = "mousedown.zoom", mousemove = "mousemove.zoom", mouseup = "mouseup.zoom", mousewheelTimer, touchstart = "touchstart.zoom", touchtime, event = d3_eventDispatch(zoom, "zoomstart", "zoom", "zoomend"), x0, x1, y0, y1;
1217    function zoom(g) {
1218      g.on(mousedown, mousedowned).on(d3_behavior_zoomWheel + ".zoom", mousewheeled).on(mousemove, mousewheelreset).on("dblclick.zoom", dblclicked).on(touchstart, touchstarted);
1219    }
1220    zoom.event = function(g) {
1221      g.each(function() {
1222        var dispatch = event.of(this, arguments), view1 = view;
1223        if (d3_transitionInheritId) {
1224          d3.select(this).transition().each("start.zoom", function() {
1225            view = this.__chart__ || {
1226              x: 0,
1227              y: 0,
1228              k: 1
1229            };
1230            zoomstarted(dispatch);
1231          }).tween("zoom:zoom", function() {
1232            var dx = size[0], dy = size[1], cx = dx / 2, cy = dy / 2, i = d3.interpolateZoom([ (cx - view.x) / view.k, (cy - view.y) / view.k, dx / view.k ], [ (cx - view1.x) / view1.k, (cy - view1.y) / view1.k, dx / view1.k ]);
1233            return function(t) {
1234              var l = i(t), k = dx / l[2];
1235              this.__chart__ = view = {
1236                x: cx - l[0] * k,
1237                y: cy - l[1] * k,
1238                k: k
1239              };
1240              zoomed(dispatch);
1241            };
1242          }).each("end.zoom", function() {
1243            zoomended(dispatch);
1244          });
1245        } else {
1246          this.__chart__ = view;
1247          zoomstarted(dispatch);
1248          zoomed(dispatch);
1249          zoomended(dispatch);
1250        }
1251      });
1252    };
1253    zoom.translate = function(_) {
1254      if (!arguments.length) return [ view.x, view.y ];
1255      view = {
1256        x: +_[0],
1257        y: +_[1],
1258        k: view.k
1259      };
1260      rescale();
1261      return zoom;
1262    };
1263    zoom.scale = function(_) {
1264      if (!arguments.length) return view.k;
1265      view = {
1266        x: view.x,
1267        y: view.y,
1268        k: +_
1269      };
1270      rescale();
1271      return zoom;
1272    };
1273    zoom.scaleExtent = function(_) {
1274      if (!arguments.length) return scaleExtent;
1275      scaleExtent = _ == null ? d3_behavior_zoomInfinity : [ +_[0], +_[1] ];
1276      return zoom;
1277    };
1278    zoom.center = function(_) {
1279      if (!arguments.length) return center;
1280      center = _ && [ +_[0], +_[1] ];
1281      return zoom;
1282    };
1283    zoom.size = function(_) {
1284      if (!arguments.length) return size;
1285      size = _ && [ +_[0], +_[1] ];
1286      return zoom;
1287    };
1288    zoom.x = function(z) {
1289      if (!arguments.length) return x1;
1290      x1 = z;
1291      x0 = z.copy();
1292      view = {
1293        x: 0,
1294        y: 0,
1295        k: 1
1296      };
1297      return zoom;
1298    };
1299    zoom.y = function(z) {
1300      if (!arguments.length) return y1;
1301      y1 = z;
1302      y0 = z.copy();
1303      view = {
1304        x: 0,
1305        y: 0,
1306        k: 1
1307      };
1308      return zoom;
1309    };
1310    function location(p) {
1311      return [ (p[0] - view.x) / view.k, (p[1] - view.y) / view.k ];
1312    }
1313    function point(l) {
1314      return [ l[0] * view.k + view.x, l[1] * view.k + view.y ];
1315    }
1316    function scaleTo(s) {
1317      view.k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
1318    }
1319    function translateTo(p, l) {
1320      l = point(l);
1321      view.x += p[0] - l[0];
1322      view.y += p[1] - l[1];
1323    }
1324    function rescale() {
1325      if (x1) x1.domain(x0.range().map(function(x) {
1326        return (x - view.x) / view.k;
1327      }).map(x0.invert));
1328      if (y1) y1.domain(y0.range().map(function(y) {
1329        return (y - view.y) / view.k;
1330      }).map(y0.invert));
1331    }
1332    function zoomstarted(dispatch) {
1333      dispatch({
1334        type: "zoomstart"
1335      });
1336    }
1337    function zoomed(dispatch) {
1338      rescale();
1339      dispatch({
1340        type: "zoom",
1341        scale: view.k,
1342        translate: [ view.x, view.y ]
1343      });
1344    }
1345    function zoomended(dispatch) {
1346      dispatch({
1347        type: "zoomend"
1348      });
1349    }
1350    function mousedowned() {
1351      var that = this, target = d3.event.target, dispatch = event.of(that, arguments), dragged = 0, subject = d3.select(d3_window).on(mousemove, moved).on(mouseup, ended), location0 = location(d3.mouse(that)), dragRestore = d3_event_dragSuppress();
1352      d3_selection_interrupt.call(that);
1353      zoomstarted(dispatch);
1354      function moved() {
1355        dragged = 1;
1356        translateTo(d3.mouse(that), location0);
1357        zoomed(dispatch);
1358      }
1359      function ended() {
1360        subject.on(mousemove, d3_window === that ? mousewheelreset : null).on(mouseup, null);
1361        dragRestore(dragged && d3.event.target === target);
1362        zoomended(dispatch);
1363      }
1364    }
1365    function touchstarted() {
1366      var that = this, dispatch = event.of(that, arguments), locations0 = {}, distance0 = 0, scale0, zoomName = ".zoom-" + d3.event.changedTouches[0].identifier, touchmove = "touchmove" + zoomName, touchend = "touchend" + zoomName, target = d3.select(d3.event.target).on(touchmove, moved).on(touchend, ended), subject = d3.select(that).on(mousedown, null).on(touchstart, started), dragRestore = d3_event_dragSuppress();
1367      d3_selection_interrupt.call(that);
1368      started();
1369      zoomstarted(dispatch);
1370      function relocate() {
1371        var touches = d3.touches(that);
1372        scale0 = view.k;
1373        touches.forEach(function(t) {
1374          if (t.identifier in locations0) locations0[t.identifier] = location(t);
1375        });
1376        return touches;
1377      }
1378      function started() {
1379        var changed = d3.event.changedTouches;
1380        for (var i = 0, n = changed.length; i < n; ++i) {
1381          locations0[changed[i].identifier] = null;
1382        }
1383        var touches = relocate(), now = Date.now();
1384        if (touches.length === 1) {
1385          if (now - touchtime < 500) {
1386            var p = touches[0], l = locations0[p.identifier];
1387            scaleTo(view.k * 2);
1388            translateTo(p, l);
1389            d3_eventPreventDefault();
1390            zoomed(dispatch);
1391          }
1392          touchtime = now;
1393        } else if (touches.length > 1) {
1394          var p = touches[0], q = touches[1], dx = p[0] - q[0], dy = p[1] - q[1];
1395          distance0 = dx * dx + dy * dy;
1396        }
1397      }
1398      function moved() {
1399        var touches = d3.touches(that), p0, l0, p1, l1;
1400        for (var i = 0, n = touches.length; i < n; ++i, l1 = null) {
1401          p1 = touches[i];
1402          if (l1 = locations0[p1.identifier]) {
1403            if (l0) break;
1404            p0 = p1, l0 = l1;
1405          }
1406        }
1407        if (l1) {
1408          var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1, scale1 = distance0 && Math.sqrt(distance1 / distance0);
1409          p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];
1410          l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];
1411          scaleTo(scale1 * scale0);
1412        }
1413        touchtime = null;
1414        translateTo(p0, l0);
1415        zoomed(dispatch);
1416      }
1417      function ended() {
1418        if (d3.event.touches.length) {
1419          var changed = d3.event.changedTouches;
1420          for (var i = 0, n = changed.length; i < n; ++i) {
1421            delete locations0[changed[i].identifier];
1422          }
1423          for (var identifier in locations0) {
1424            return void relocate();
1425          }
1426        }
1427        target.on(zoomName, null);
1428        subject.on(mousedown, mousedowned).on(touchstart, touchstarted);
1429        dragRestore();
1430        zoomended(dispatch);
1431      }
1432    }
1433    function mousewheeled() {
1434      var dispatch = event.of(this, arguments);
1435      if (mousewheelTimer) clearTimeout(mousewheelTimer); else d3_selection_interrupt.call(this),
1436      zoomstarted(dispatch);
1437      mousewheelTimer = setTimeout(function() {
1438        mousewheelTimer = null;
1439        zoomended(dispatch);
1440      }, 50);
1441      d3_eventPreventDefault();
1442      var point = center || d3.mouse(this);
1443      if (!translate0) translate0 = location(point);
1444      scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * view.k);
1445      translateTo(point, translate0);
1446      zoomed(dispatch);
1447    }
1448    function mousewheelreset() {
1449      translate0 = null;
1450    }
1451    function dblclicked() {
1452      var dispatch = event.of(this, arguments), p = d3.mouse(this), l = location(p), k = Math.log(view.k) / Math.LN2;
1453      zoomstarted(dispatch);
1454      scaleTo(Math.pow(2, d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1));
1455      translateTo(p, l);
1456      zoomed(dispatch);
1457      zoomended(dispatch);
1458    }
1459    return d3.rebind(zoom, event, "on");
1460  };
1461  var d3_behavior_zoomInfinity = [ 0, Infinity ];
1462  var d3_behavior_zoomDelta, d3_behavior_zoomWheel = "onwheel" in d3_document ? (d3_behavior_zoomDelta = function() {
1463    return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1);
1464  }, "wheel") : "onmousewheel" in d3_document ? (d3_behavior_zoomDelta = function() {
1465    return d3.event.wheelDelta;
1466  }, "mousewheel") : (d3_behavior_zoomDelta = function() {
1467    return -d3.event.detail;
1468  }, "MozMousePixelScroll");
1469  function d3_Color() {}
1470  d3_Color.prototype.toString = function() {
1471    return this.rgb() + "";
1472  };
1473  d3.hsl = function(h, s, l) {
1474    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);
1475  };
1476  function d3_hsl(h, s, l) {
1477    return new d3_Hsl(h, s, l);
1478  }
1479  function d3_Hsl(h, s, l) {
1480    this.h = h;
1481    this.s = s;
1482    this.l = l;
1483  }
1484  var d3_hslPrototype = d3_Hsl.prototype = new d3_Color();
1485  d3_hslPrototype.brighter = function(k) {
1486    k = Math.pow(.7, arguments.length ? k : 1);
1487    return d3_hsl(this.h, this.s, this.l / k);
1488  };
1489  d3_hslPrototype.darker = function(k) {
1490    k = Math.pow(.7, arguments.length ? k : 1);
1491    return d3_hsl(this.h, this.s, k * this.l);
1492  };
1493  d3_hslPrototype.rgb = function() {
1494    return d3_hsl_rgb(this.h, this.s, this.l);
1495  };
1496  function d3_hsl_rgb(h, s, l) {
1497    var m1, m2;
1498    h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h;
1499    s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s;
1500    l = l < 0 ? 0 : l > 1 ? 1 : l;
1501    m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
1502    m1 = 2 * l - m2;
1503    function v(h) {
1504      if (h > 360) h -= 360; else if (h < 0) h += 360;
1505      if (h < 60) return m1 + (m2 - m1) * h / 60;
1506      if (h < 180) return m2;
1507      if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
1508      return m1;
1509    }
1510    function vv(h) {
1511      return Math.round(v(h) * 255);
1512    }
1513    return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
1514  }
1515  d3.hcl = function(h, c, l) {
1516    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);
1517  };
1518  function d3_hcl(h, c, l) {
1519    return new d3_Hcl(h, c, l);
1520  }
1521  function d3_Hcl(h, c, l) {
1522    this.h = h;
1523    this.c = c;
1524    this.l = l;
1525  }
1526  var d3_hclPrototype = d3_Hcl.prototype = new d3_Color();
1527  d3_hclPrototype.brighter = function(k) {
1528    return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));
1529  };
1530  d3_hclPrototype.darker = function(k) {
1531    return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));
1532  };
1533  d3_hclPrototype.rgb = function() {
1534    return d3_hcl_lab(this.h, this.c, this.l).rgb();
1535  };
1536  function d3_hcl_lab(h, c, l) {
1537    if (isNaN(h)) h = 0;
1538    if (isNaN(c)) c = 0;
1539    return d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c);
1540  }
1541  d3.lab = function(l, a, b) {
1542    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);
1543  };
1544  function d3_lab(l, a, b) {
1545    return new d3_Lab(l, a, b);
1546  }
1547  function d3_Lab(l, a, b) {
1548    this.l = l;
1549    this.a = a;
1550    this.b = b;
1551  }
1552  var d3_lab_K = 18;
1553  var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;
1554  var d3_labPrototype = d3_Lab.prototype = new d3_Color();
1555  d3_labPrototype.brighter = function(k) {
1556    return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
1557  };
1558  d3_labPrototype.darker = function(k) {
1559    return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
1560  };
1561  d3_labPrototype.rgb = function() {
1562    return d3_lab_rgb(this.l, this.a, this.b);
1563  };
1564  function d3_lab_rgb(l, a, b) {
1565    var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
1566    x = d3_lab_xyz(x) * d3_lab_X;
1567    y = d3_lab_xyz(y) * d3_lab_Y;
1568    z = d3_lab_xyz(z) * d3_lab_Z;
1569    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));
1570  }
1571  function d3_lab_hcl(l, a, b) {
1572    return l > 0 ? d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l) : d3_hcl(NaN, NaN, l);
1573  }
1574  function d3_lab_xyz(x) {
1575    return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
1576  }
1577  function d3_xyz_lab(x) {
1578    return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
1579  }
1580  function d3_xyz_rgb(r) {
1581    return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055));
1582  }
1583  d3.rgb = function(r, g, b) {
1584    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);
1585  };
1586  function d3_rgbNumber(value) {
1587    return d3_rgb(value >> 16, value >> 8 & 255, value & 255);
1588  }
1589  function d3_rgbString(value) {
1590    return d3_rgbNumber(value) + "";
1591  }
1592  function d3_rgb(r, g, b) {
1593    return new d3_Rgb(r, g, b);
1594  }
1595  function d3_Rgb(r, g, b) {
1596    this.r = r;
1597    this.g = g;
1598    this.b = b;
1599  }
1600  var d3_rgbPrototype = d3_Rgb.prototype = new d3_Color();
1601  d3_rgbPrototype.brighter = function(k) {
1602    k = Math.pow(.7, arguments.length ? k : 1);
1603    var r = this.r, g = this.g, b = this.b, i = 30;
1604    if (!r && !g && !b) return d3_rgb(i, i, i);
1605    if (r && r < i) r = i;
1606    if (g && g < i) g = i;
1607    if (b && b < i) b = i;
1608    return d3_rgb(Math.min(255, ~~(r / k)), Math.min(255, ~~(g / k)), Math.min(255, ~~(b / k)));
1609  };
1610  d3_rgbPrototype.darker = function(k) {
1611    k = Math.pow(.7, arguments.length ? k : 1);
1612    return d3_rgb(~~(k * this.r), ~~(k * this.g), ~~(k * this.b));
1613  };
1614  d3_rgbPrototype.hsl = function() {
1615    return d3_rgb_hsl(this.r, this.g, this.b);
1616  };
1617  d3_rgbPrototype.toString = function() {
1618    return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
1619  };
1620  function d3_rgb_hex(v) {
1621    return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);
1622  }
1623  function d3_rgb_parse(format, rgb, hsl) {
1624    var r = 0, g = 0, b = 0, m1, m2, color;
1625    m1 = /([a-z]+)\((.*)\)/i.exec(format);
1626    if (m1) {
1627      m2 = m1[2].split(",");
1628      switch (m1[1]) {
1629       case "hsl":
1630        {
1631          return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);
1632        }
1633
1634       case "rgb":
1635        {
1636          return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));
1637        }
1638      }
1639    }
1640    if (color = d3_rgb_names.get(format)) return rgb(color.r, color.g, color.b);
1641    if (format != null && format.charAt(0) === "#" && !isNaN(color = parseInt(format.substring(1), 16))) {
1642      if (format.length === 4) {
1643        r = (color & 3840) >> 4;
1644        r = r >> 4 | r;
1645        g = color & 240;
1646        g = g >> 4 | g;
1647        b = color & 15;
1648        b = b << 4 | b;
1649      } else if (format.length === 7) {
1650        r = (color & 16711680) >> 16;
1651        g = (color & 65280) >> 8;
1652        b = color & 255;
1653      }
1654    }
1655    return rgb(r, g, b);
1656  }
1657  function d3_rgb_hsl(r, g, b) {
1658    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;
1659    if (d) {
1660      s = l < .5 ? d / (max + min) : d / (2 - max - min);
1661      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;
1662      h *= 60;
1663    } else {
1664      h = NaN;
1665      s = l > 0 && l < 1 ? 0 : h;
1666    }
1667    return d3_hsl(h, s, l);
1668  }
1669  function d3_rgb_lab(r, g, b) {
1670    r = d3_rgb_xyz(r);
1671    g = d3_rgb_xyz(g);
1672    b = d3_rgb_xyz(b);
1673    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);
1674    return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
1675  }
1676  function d3_rgb_xyz(r) {
1677    return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4);
1678  }
1679  function d3_rgb_parseNumber(c) {
1680    var f = parseFloat(c);
1681    return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
1682  }
1683  var d3_rgb_names = d3.map({
1684    aliceblue: 15792383,
1685    antiquewhite: 16444375,
1686    aqua: 65535,
1687    aquamarine: 8388564,
1688    azure: 15794175,
1689    beige: 16119260,
1690    bisque: 16770244,
1691    black: 0,
1692    blanchedalmond: 16772045,
1693    blue: 255,
1694    blueviolet: 9055202,
1695    brown: 10824234,
1696    burlywood: 14596231,
1697    cadetblue: 6266528,
1698    chartreuse: 8388352,
1699    chocolate: 13789470,
1700    coral: 16744272,
1701    cornflowerblue: 6591981,
1702    cornsilk: 16775388,
1703    crimson: 14423100,
1704    cyan: 65535,
1705    darkblue: 139,
1706    darkcyan: 35723,
1707    darkgoldenrod: 12092939,
1708    darkgray: 11119017,
1709    darkgreen: 25600,
1710    darkgrey: 11119017,
1711    darkkhaki: 12433259,
1712    darkmagenta: 9109643,
1713    darkolivegreen: 5597999,
1714    darkorange: 16747520,
1715    darkorchid: 10040012,
1716    darkred: 9109504,
1717    darksalmon: 15308410,
1718    darkseagreen: 9419919,
1719    darkslateblue: 4734347,
1720    darkslategray: 3100495,
1721    darkslategrey: 3100495,
1722    darkturquoise: 52945,
1723    darkviolet: 9699539,
1724    deeppink: 16716947,
1725    deepskyblue: 49151,
1726    dimgray: 6908265,
1727    dimgrey: 6908265,
1728    dodgerblue: 2003199,
1729    firebrick: 11674146,
1730    floralwhite: 16775920,
1731    forestgreen: 2263842,
1732    fuchsia: 16711935,
1733    gainsboro: 14474460,
1734    ghostwhite: 16316671,
1735    gold: 16766720,
1736    goldenrod: 14329120,
1737    gray: 8421504,
1738    green: 32768,
1739    greenyellow: 11403055,
1740    grey: 8421504,
1741    honeydew: 15794160,
1742    hotpink: 16738740,
1743    indianred: 13458524,
1744    indigo: 4915330,
1745    ivory: 16777200,
1746    khaki: 15787660,
1747    lavender: 15132410,
1748    lavenderblush: 16773365,
1749    lawngreen: 8190976,
1750    lemonchiffon: 16775885,
1751    lightblue: 11393254,
1752    lightcoral: 15761536,
1753    lightcyan: 14745599,
1754    lightgoldenrodyellow: 16448210,
1755    lightgray: 13882323,
1756    lightgreen: 9498256,
1757    lightgrey: 13882323,
1758    lightpink: 16758465,
1759    lightsalmon: 16752762,
1760    lightseagreen: 2142890,
1761    lightskyblue: 8900346,
1762    lightslategray: 7833753,
1763    lightslategrey: 7833753,
1764    lightsteelblue: 11584734,
1765    lightyellow: 16777184,
1766    lime: 65280,
1767    limegreen: 3329330,
1768    linen: 16445670,
1769    magenta: 16711935,
1770    maroon: 8388608,
1771    mediumaquamarine: 6737322,
1772    mediumblue: 205,
1773    mediumorchid: 12211667,
1774    mediumpurple: 9662683,
1775    mediumseagreen: 3978097,
1776    mediumslateblue: 8087790,
1777    mediumspringgreen: 64154,
1778    mediumturquoise: 4772300,
1779    mediumvioletred: 13047173,
1780    midnightblue: 1644912,
1781    mintcream: 16121850,
1782    mistyrose: 16770273,
1783    moccasin: 16770229,
1784    navajowhite: 16768685,
1785    navy: 128,
1786    oldlace: 16643558,
1787    olive: 8421376,
1788    olivedrab: 7048739,
1789    orange: 16753920,
1790    orangered: 16729344,
1791    orchid: 14315734,
1792    palegoldenrod: 15657130,
1793    palegreen: 10025880,
1794    paleturquoise: 11529966,
1795    palevioletred: 14381203,
1796    papayawhip: 16773077,
1797    peachpuff: 16767673,
1798    peru: 13468991,
1799    pink: 16761035,
1800    plum: 14524637,
1801    powderblue: 11591910,
1802    purple: 8388736,
1803    red: 16711680,
1804    rosybrown: 12357519,
1805    royalblue: 4286945,
1806    saddlebrown: 9127187,
1807    salmon: 16416882,
1808    sandybrown: 16032864,
1809    seagreen: 3050327,
1810    seashell: 16774638,
1811    sienna: 10506797,
1812    silver: 12632256,
1813    skyblue: 8900331,
1814    slateblue: 6970061,
1815    slategray: 7372944,
1816    slategrey: 7372944,
1817    snow: 16775930,
1818    springgreen: 65407,
1819    steelblue: 4620980,
1820    tan: 13808780,
1821    teal: 32896,
1822    thistle: 14204888,
1823    tomato: 16737095,
1824    turquoise: 4251856,
1825    violet: 15631086,
1826    wheat: 16113331,
1827    white: 16777215,
1828    whitesmoke: 16119285,
1829    yellow: 16776960,
1830    yellowgreen: 10145074
1831  });
1832  d3_rgb_names.forEach(function(key, value) {
1833    d3_rgb_names.set(key, d3_rgbNumber(value));
1834  });
1835  function d3_functor(v) {
1836    return typeof v === "function" ? v : function() {
1837      return v;
1838    };
1839  }
1840  d3.functor = d3_functor;
1841  function d3_identity(d) {
1842    return d;
1843  }
1844  d3.xhr = d3_xhrType(d3_identity);
1845  function d3_xhrType(response) {
1846    return function(url, mimeType, callback) {
1847      if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType,
1848      mimeType = null;
1849      return d3_xhr(url, mimeType, response, callback);
1850    };
1851  }
1852  function d3_xhr(url, mimeType, response, callback) {
1853    var xhr = {}, dispatch = d3.dispatch("beforesend", "progress", "load", "error"), headers = {}, request = new XMLHttpRequest(), responseType = null;
1854    if (d3_window.XDomainRequest && !("withCredentials" in request) && /^(http(s)?:)?\/\//.test(url)) request = new XDomainRequest();
1855    "onload" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() {
1856      request.readyState > 3 && respond();
1857    };
1858    function respond() {
1859      var status = request.status, result;
1860      if (!status && request.responseText || status >= 200 && status < 300 || status === 304) {
1861        try {
1862          result = response.call(xhr, request);
1863        } catch (e) {
1864          dispatch.error.call(xhr, e);
1865          return;
1866        }
1867        dispatch.load.call(xhr, result);
1868      } else {
1869        dispatch.error.call(xhr, request);
1870      }
1871    }
1872    request.onprogress = function(event) {
1873      var o = d3.event;
1874      d3.event = event;
1875      try {
1876        dispatch.progress.call(xhr, request);
1877      } finally {
1878        d3.event = o;
1879      }
1880    };
1881    xhr.header = function(name, value) {
1882      name = (name + "").toLowerCase();
1883      if (arguments.length < 2) return headers[name];
1884      if (value == null) delete headers[name]; else headers[name] = value + "";
1885      return xhr;
1886    };
1887    xhr.mimeType = function(value) {
1888      if (!arguments.length) return mimeType;
1889      mimeType = value == null ? null : value + "";
1890      return xhr;
1891    };
1892    xhr.responseType = function(value) {
1893      if (!arguments.length) return responseType;
1894      responseType = value;
1895      return xhr;
1896    };
1897    xhr.response = function(value) {
1898      response = value;
1899      return xhr;
1900    };
1901    [ "get", "post" ].forEach(function(method) {
1902      xhr[method] = function() {
1903        return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments)));
1904      };
1905    });
1906    xhr.send = function(method, data, callback) {
1907      if (arguments.length === 2 && typeof data === "function") callback = data, data = null;
1908      request.open(method, url, true);
1909      if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*";
1910      if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]);
1911      if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType);
1912      if (responseType != null) request.responseType = responseType;
1913      if (callback != null) xhr.on("error", callback).on("load", function(request) {
1914        callback(null, request);
1915      });
1916      dispatch.beforesend.call(xhr, request);
1917      request.send(data == null ? null : data);
1918      return xhr;
1919    };
1920    xhr.abort = function() {
1921      request.abort();
1922      return xhr;
1923    };
1924    d3.rebind(xhr, dispatch, "on");
1925    return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback));
1926  }
1927  function d3_xhr_fixCallback(callback) {
1928    return callback.length === 1 ? function(error, request) {
1929      callback(error == null ? request : null);
1930    } : callback;
1931  }
1932  d3.dsv = function(delimiter, mimeType) {
1933    var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);
1934    function dsv(url, row, callback) {
1935      if (arguments.length < 3) callback = row, row = null;
1936      var xhr = d3_xhr(url, mimeType, row == null ? response : typedResponse(row), callback);
1937      xhr.row = function(_) {
1938        return arguments.length ? xhr.response((row = _) == null ? response : typedResponse(_)) : row;
1939      };
1940      return xhr;
1941    }
1942    function response(request) {
1943      return dsv.parse(request.responseText);
1944    }
1945    function typedResponse(f) {
1946      return function(request) {
1947        return dsv.parse(request.responseText, f);
1948      };
1949    }
1950    dsv.parse = function(text, f) {
1951      var o;
1952      return dsv.parseRows(text, function(row, i) {
1953        if (o) return o(row, i - 1);
1954        var a = new Function("d", "return {" + row.map(function(name, i) {
1955          return JSON.stringify(name) + ": d[" + i + "]";
1956        }).join(",") + "}");
1957        o = f ? function(row, i) {
1958          return f(a(row), i);
1959        } : a;
1960      });
1961    };
1962    dsv.parseRows = function(text, f) {
1963      var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol;
1964      function token() {
1965        if (I >= N) return EOF;
1966        if (eol) return eol = false, EOL;
1967        var j = I;
1968        if (text.charCodeAt(j) === 34) {
1969          var i = j;
1970          while (i++ < N) {
1971            if (text.charCodeAt(i) === 34) {
1972              if (text.charCodeAt(i + 1) !== 34) break;
1973              ++i;
1974            }
1975          }
1976          I = i + 2;
1977          var c = text.charCodeAt(i + 1);
1978          if (c === 13) {
1979            eol = true;
1980            if (text.charCodeAt(i + 2) === 10) ++I;
1981          } else if (c === 10) {
1982            eol = true;
1983          }
1984          return text.substring(j + 1, i).replace(/""/g, '"');
1985        }
1986        while (I < N) {
1987          var c = text.charCodeAt(I++), k = 1;
1988          if (c === 10) eol = true; else if (c === 13) {
1989            eol = true;
1990            if (text.charCodeAt(I) === 10) ++I, ++k;
1991          } else if (c !== delimiterCode) continue;
1992          return text.substring(j, I - k);
1993        }
1994        return text.substring(j);
1995      }
1996      while ((t = token()) !== EOF) {
1997        var a = [];
1998        while (t !== EOL && t !== EOF) {
1999          a.push(t);
2000          t = token();
2001        }
2002        if (f && !(a = f(a, n++))) continue;
2003        rows.push(a);
2004      }
2005      return rows;
2006    };
2007    dsv.format = function(rows) {
2008      if (Array.isArray(rows[0])) return dsv.formatRows(rows);
2009      var fieldSet = new d3_Set(), fields = [];
2010      rows.forEach(function(row) {
2011        for (var field in row) {
2012          if (!fieldSet.has(field)) {
2013            fields.push(fieldSet.add(field));
2014          }
2015        }
2016      });
2017      return [ fields.map(formatValue).join(delimiter) ].concat(rows.map(function(row) {
2018        return fields.map(function(field) {
2019          return formatValue(row[field]);
2020        }).join(delimiter);
2021      })).join("\n");
2022    };
2023    dsv.formatRows = function(rows) {
2024      return rows.map(formatRow).join("\n");
2025    };
2026    function formatRow(row) {
2027      return row.map(formatValue).join(delimiter);
2028    }
2029    function formatValue(text) {
2030      return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text;
2031    }
2032    return dsv;
2033  };
2034  d3.csv = d3.dsv(",", "text/csv");
2035  d3.tsv = d3.dsv("	", "text/tab-separated-values");
2036  d3.touch = function(container, touches, identifier) {
2037    if (arguments.length < 3) identifier = touches, touches = d3_eventSource().changedTouches;
2038    if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) {
2039      if ((touch = touches[i]).identifier === identifier) {
2040        return d3_mousePoint(container, touch);
2041      }
2042    }
2043  };
2044  var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_active, d3_timer_frame = d3_window[d3_vendorSymbol(d3_window, "requestAnimationFrame")] || function(callback) {
2045    setTimeout(callback, 17);
2046  };
2047  d3.timer = function(callback, delay, then) {
2048    var n = arguments.length;
2049    if (n < 2) delay = 0;
2050    if (n < 3) then = Date.now();
2051    var time = then + delay, timer = {
2052      c: callback,
2053      t: time,
2054      f: false,
2055      n: null
2056    };
2057    if (d3_timer_queueTail) d3_timer_queueTail.n = timer; else d3_timer_queueHead = timer;
2058    d3_timer_queueTail = timer;
2059    if (!d3_timer_interval) {
2060      d3_timer_timeout = clearTimeout(d3_timer_timeout);
2061      d3_timer_interval = 1;
2062      d3_timer_frame(d3_timer_step);
2063    }
2064  };
2065  function d3_timer_step() {
2066    var now = d3_timer_mark(), delay = d3_timer_sweep() - now;
2067    if (delay > 24) {
2068      if (isFinite(delay)) {
2069        clearTimeout(d3_timer_timeout);
2070        d3_timer_timeout = setTimeout(d3_timer_step, delay);
2071      }
2072      d3_timer_interval = 0;
2073    } else {
2074      d3_timer_interval = 1;
2075      d3_timer_frame(d3_timer_step);
2076    }
2077  }
2078  d3.timer.flush = function() {
2079    d3_timer_mark();
2080    d3_timer_sweep();
2081  };
2082  function d3_timer_mark() {
2083    var now = Date.now();
2084    d3_timer_active = d3_timer_queueHead;
2085    while (d3_timer_active) {
2086      if (now >= d3_timer_active.t) d3_timer_active.f = d3_timer_active.c(now - d3_timer_active.t);
2087      d3_timer_active = d3_timer_active.n;
2088    }
2089    return now;
2090  }
2091  function d3_timer_sweep() {
2092    var t0, t1 = d3_timer_queueHead, time = Infinity;
2093    while (t1) {
2094      if (t1.f) {
2095        t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;
2096      } else {
2097        if (t1.t < time) time = t1.t;
2098        t1 = (t0 = t1).n;
2099      }
2100    }
2101    d3_timer_queueTail = t0;
2102    return time;
2103  }
2104  function d3_format_precision(x, p) {
2105    return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1);
2106  }
2107  d3.round = function(x, n) {
2108    return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);
2109  };
2110  var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
2111  d3.formatPrefix = function(value, precision) {
2112    var i = 0;
2113    if (value) {
2114      if (value < 0) value *= -1;
2115      if (precision) value = d3.round(value, d3_format_precision(value, precision));
2116      i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
2117      i = Math.max(-24, Math.min(24, Math.floor((i - 1) / 3) * 3));
2118    }
2119    return d3_formatPrefixes[8 + i / 3];
2120  };
2121  function d3_formatPrefix(d, i) {
2122    var k = Math.pow(10, abs(8 - i) * 3);
2123    return {
2124      scale: i > 8 ? function(d) {
2125        return d / k;
2126      } : function(d) {
2127        return d * k;
2128      },
2129      symbol: d
2130    };
2131  }
2132  function d3_locale_numberFormat(locale) {
2133    var locale_decimal = locale.decimal, locale_thousands = locale.thousands, locale_grouping = locale.grouping, locale_currency = locale.currency, formatGroup = locale_grouping ? function(value) {
2134      var i = value.length, t = [], j = 0, g = locale_grouping[0];
2135      while (i > 0 && g > 0) {
2136        t.push(value.substring(i -= g, i + g));
2137        g = locale_grouping[j = (j + 1) % locale_grouping.length];
2138      }
2139      return t.reverse().join(locale_thousands);
2140    } : d3_identity;
2141    return function(specifier) {
2142      var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "", symbol = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, prefix = "", suffix = "", integer = false;
2143      if (precision) precision = +precision.substring(1);
2144      if (zfill || fill === "0" && align === "=") {
2145        zfill = fill = "0";
2146        align = "=";
2147        if (comma) width -= Math.floor((width - 1) / 4);
2148      }
2149      switch (type) {
2150       case "n":
2151        comma = true;
2152        type = "g";
2153        break;
2154
2155       case "%":
2156        scale = 100;
2157        suffix = "%";
2158        type = "f";
2159        break;
2160
2161       case "p":
2162        scale = 100;
2163        suffix = "%";
2164        type = "r";
2165        break;
2166
2167       case "b":
2168       case "o":
2169       case "x":
2170       case "X":
2171        if (symbol === "#") prefix = "0" + type.toLowerCase();
2172
2173       case "c":
2174       case "d":
2175        integer = true;
2176        precision = 0;
2177        break;
2178
2179       case "s":
2180        scale = -1;
2181        type = "r";
2182        break;
2183      }
2184      if (symbol === "$") prefix = locale_currency[0], suffix = locale_currency[1];
2185      if (type == "r" && !precision) type = "g";
2186      if (precision != null) {
2187        if (type == "g") precision = Math.max(1, Math.min(21, precision)); else if (type == "e" || type == "f") precision = Math.max(0, Math.min(20, precision));
2188      }
2189      type = d3_format_types.get(type) || d3_format_typeDefault;
2190      var zcomma = zfill && comma;
2191      return function(value) {
2192        var fullSuffix = suffix;
2193        if (integer && value % 1) return "";
2194        var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign;
2195        if (scale < 0) {
2196          var unit = d3.formatPrefix(value, precision);
2197          value = unit.scale(value);
2198          fullSuffix = unit.symbol + suffix;
2199        } else {
2200          value *= scale;
2201        }
2202        value = type(value, precision);
2203        var i = value.lastIndexOf("."), before = i < 0 ? value : value.substring(0, i), after = i < 0 ? "" : locale_decimal + value.substring(i + 1);
2204        if (!zfill && comma) before = formatGroup(before);
2205        var length = prefix.length + before.length + after.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : "";
2206        if (zcomma) before = formatGroup(padding + before);
2207        negative += prefix;
2208        value = before + after;
2209        return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + fullSuffix;
2210      };
2211    };
2212  }
2213  var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i;
2214  var d3_format_types = d3.map({
2215    b: function(x) {
2216      return x.toString(2);
2217    },
2218    c: function(x) {
2219      return String.fromCharCode(x);
2220    },
2221    o: function(x) {
2222      return x.toString(8);
2223    },
2224    x: function(x) {
2225      return x.toString(16);
2226    },
2227    X: function(x) {
2228      return x.toString(16).toUpperCase();
2229    },
2230    g: function(x, p) {
2231      return x.toPrecision(p);
2232    },
2233    e: function(x, p) {
2234      return x.toExponential(p);
2235    },
2236    f: function(x, p) {
2237      return x.toFixed(p);
2238    },
2239    r: function(x, p) {
2240      return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p))));
2241    }
2242  });
2243  function d3_format_typeDefault(x) {
2244    return x + "";
2245  }
2246  var d3_time = d3.time = {}, d3_date = Date;
2247  function d3_date_utc() {
2248    this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]);
2249  }
2250  d3_date_utc.prototype = {
2251    getDate: function() {
2252      return this._.getUTCDate();
2253    },
2254    getDay: function() {
2255      return this._.getUTCDay();
2256    },
2257    getFullYear: function() {
2258      return this._.getUTCFullYear();
2259    },
2260    getHours: function() {
2261      return this._.getUTCHours();
2262    },
2263    getMilliseconds: function() {
2264      return this._.getUTCMilliseconds();
2265    },
2266    getMinutes: function() {
2267      return this._.getUTCMinutes();
2268    },
2269    getMonth: function() {
2270      return this._.getUTCMonth();
2271    },
2272    getSeconds: function() {
2273      return this._.getUTCSeconds();
2274    },
2275    getTime: function() {
2276      return this._.getTime();
2277    },
2278    getTimezoneOffset: function() {
2279      return 0;
2280    },
2281    valueOf: function() {
2282      return this._.valueOf();
2283    },
2284    setDate: function() {
2285      d3_time_prototype.setUTCDate.apply(this._, arguments);
2286    },
2287    setDay: function() {
2288      d3_time_prototype.setUTCDay.apply(this._, arguments);
2289    },
2290    setFullYear: function() {
2291      d3_time_prototype.setUTCFullYear.apply(this._, arguments);
2292    },
2293    setHours: function() {
2294      d3_time_prototype.setUTCHours.apply(this._, arguments);
2295    },
2296    setMilliseconds: function() {
2297      d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);
2298    },
2299    setMinutes: function() {
2300      d3_time_prototype.setUTCMinutes.apply(this._, arguments);
2301    },
2302    setMonth: function() {
2303      d3_time_prototype.setUTCMonth.apply(this._, arguments);
2304    },
2305    setSeconds: function() {
2306      d3_time_prototype.setUTCSeconds.apply(this._, arguments);
2307    },
2308    setTime: function() {
2309      d3_time_prototype.setTime.apply(this._, arguments);
2310    }
2311  };
2312  var d3_time_prototype = Date.prototype;
2313  function d3_time_interval(local, step, number) {
2314    function round(date) {
2315      var d0 = local(date), d1 = offset(d0, 1);
2316      return date - d0 < d1 - date ? d0 : d1;
2317    }
2318    function ceil(date) {
2319      step(date = local(new d3_date(date - 1)), 1);
2320      return date;
2321    }
2322    function offset(date, k) {
2323      step(date = new d3_date(+date), k);
2324      return date;
2325    }
2326    function range(t0, t1, dt) {
2327      var time = ceil(t0), times = [];
2328      if (dt > 1) {
2329        while (time < t1) {
2330          if (!(number(time) % dt)) times.push(new Date(+time));
2331          step(time, 1);
2332        }
2333      } else {
2334        while (time < t1) times.push(new Date(+time)), step(time, 1);
2335      }
2336      return times;
2337    }
2338    function range_utc(t0, t1, dt) {
2339      try {
2340        d3_date = d3_date_utc;
2341        var utc = new d3_date_utc();
2342        utc._ = t0;
2343        return range(utc, t1, dt);
2344      } finally {
2345        d3_date = Date;
2346      }
2347    }
2348    local.floor = local;
2349    local.round = round;
2350    local.ceil = ceil;
2351    local.offset = offset;
2352    local.range = range;
2353    var utc = local.utc = d3_time_interval_utc(local);
2354    utc.floor = utc;
2355    utc.round = d3_time_interval_utc(round);
2356    utc.ceil = d3_time_interval_utc(ceil);
2357    utc.offset = d3_time_interval_utc(offset);
2358    utc.range = range_utc;
2359    return local;
2360  }
2361  function d3_time_interval_utc(method) {
2362    return function(date, k) {
2363      try {
2364        d3_date = d3_date_utc;
2365        var utc = new d3_date_utc();
2366        utc._ = date;
2367        return method(utc, k)._;
2368      } finally {
2369        d3_date = Date;
2370      }
2371    };
2372  }
2373  d3_time.year = d3_time_interval(function(date) {
2374    date = d3_time.day(date);
2375    date.setMonth(0, 1);
2376    return date;
2377  }, function(date, offset) {
2378    date.setFullYear(date.getFullYear() + offset);
2379  }, function(date) {
2380    return date.getFullYear();
2381  });
2382  d3_time.years = d3_time.year.range;
2383  d3_time.years.utc = d3_time.year.utc.range;
2384  d3_time.day = d3_time_interval(function(date) {
2385    var day = new d3_date(2e3, 0);
2386    day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
2387    return day;
2388  }, function(date, offset) {
2389    date.setDate(date.getDate() + offset);
2390  }, function(date) {
2391    return date.getDate() - 1;
2392  });
2393  d3_time.days = d3_time.day.range;
2394  d3_time.days.utc = d3_time.day.utc.range;
2395  d3_time.dayOfYear = function(date) {
2396    var year = d3_time.year(date);
2397    return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
2398  };
2399  [ "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" ].forEach(function(day, i) {
2400    i = 7 - i;
2401    var interval = d3_time[day] = d3_time_interval(function(date) {
2402      (date = d3_time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
2403      return date;
2404    }, function(date, offset) {
2405      date.setDate(date.getDate() + Math.floor(offset) * 7);
2406    }, function(date) {
2407      var day = d3_time.year(date).getDay();
2408      return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
2409    });
2410    d3_time[day + "s"] = interval.range;
2411    d3_time[day + "s"].utc = interval.utc.range;
2412    d3_time[day + "OfYear"] = function(date) {
2413      var day = d3_time.year(date).getDay();
2414      return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7);
2415    };
2416  });
2417  d3_time.week = d3_time.sunday;
2418  d3_time.weeks = d3_time.sunday.range;
2419  d3_time.weeks.utc = d3_time.sunday.utc.range;
2420  d3_time.weekOfYear = d3_time.sundayOfYear;
2421  function d3_locale_timeFormat(locale) {
2422    var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_days = locale.days, locale_shortDays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths;
2423    function d3_time_format(template) {
2424      var n = template.length;
2425      function format(date) {
2426        var string = [], i = -1, j = 0, c, p, f;
2427        while (++i < n) {
2428          if (template.charCodeAt(i) === 37) {
2429            string.push(template.substring(j, i));
2430            if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i);
2431            if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p);
2432            string.push(c);
2433            j = i + 1;
2434          }
2435        }
2436        string.push(template.substring(j, i));
2437        return string.join("");
2438      }
2439      format.parse = function(string) {
2440        var d = {
2441          y: 1900,
2442          m: 0,
2443          d: 1,
2444          H: 0,
2445          M: 0,
2446          S: 0,
2447          L: 0,
2448          Z: null
2449        }, i = d3_time_parse(d, template, string, 0);
2450        if (i != string.length) return null;
2451        if ("p" in d) d.H = d.H % 12 + d.p * 12;
2452        var localZ = d.Z != null && d3_date !== d3_date_utc, date = new (localZ ? d3_date_utc : d3_date)();
2453        if ("j" in d) date.setFullYear(d.y, 0, d.j); else if ("w" in d && ("W" in d || "U" in d)) {
2454          date.setFullYear(d.y, 0, 1);
2455          date.setFullYear(d.y, 0, "W" in d ? (d.w + 6) % 7 + d.W * 7 - (date.getDay() + 5) % 7 : d.w + d.U * 7 - (date.getDay() + 6) % 7);
2456        } else date.setFullYear(d.y, d.m, d.d);
2457        date.setHours(d.H + Math.floor(d.Z / 100), d.M + d.Z % 100, d.S, d.L);
2458        return localZ ? date._ : date;
2459      };
2460      format.toString = function() {
2461        return template;
2462      };
2463      return format;
2464    }
2465    function d3_time_parse(date, template, string, j) {
2466      var c, p, t, i = 0, n = template.length, m = string.length;
2467      while (i < n) {
2468        if (j >= m) return -1;
2469        c = template.charCodeAt(i++);
2470        if (c === 37) {
2471          t = template.charAt(i++);
2472          p = d3_time_parsers[t in d3_time_formatPads ? template.charAt(i++) : t];
2473          if (!p || (j = p(date, string, j)) < 0) return -1;
2474        } else if (c != string.charCodeAt(j++)) {
2475          return -1;
2476        }
2477      }
2478      return j;
2479    }
2480    d3_time_format.utc = function(template) {
2481      var local = d3_time_format(template);
2482      function format(date) {
2483        try {
2484          d3_date = d3_date_utc;
2485          var utc = new d3_date();
2486          utc._ = date;
2487          return local(utc);
2488        } finally {
2489          d3_date = Date;
2490        }
2491      }
2492      format.parse = function(string) {
2493        try {
2494          d3_date = d3_date_utc;
2495          var date = local.parse(string);
2496          return date && date._;
2497        } finally {
2498          d3_date = Date;
2499        }
2500      };
2501      format.toString = local.toString;
2502      return format;
2503    };
2504    d3_time_format.multi = d3_time_format.utc.multi = d3_time_formatMulti;
2505    var d3_time_periodLookup = d3.map(), d3_time_dayRe = d3_time_formatRe(locale_days), d3_time_dayLookup = d3_time_formatLookup(locale_days), d3_time_dayAbbrevRe = d3_time_formatRe(locale_shortDays), d3_time_dayAbbrevLookup = d3_time_formatLookup(locale_shortDays), d3_time_monthRe = d3_time_formatRe(locale_months), d3_time_monthLookup = d3_time_formatLookup(locale_months), d3_time_monthAbbrevRe = d3_time_formatRe(locale_shortMonths), d3_time_monthAbbrevLookup = d3_time_formatLookup(locale_shortMonths);
2506    locale_periods.forEach(function(p, i) {
2507      d3_time_periodLookup.set(p.toLowerCase(), i);
2508    });
2509    var d3_time_formats = {
2510      a: function(d) {
2511        return locale_shortDays[d.getDay()];
2512      },
2513      A: function(d) {
2514        return locale_days[d.getDay()];
2515      },
2516      b: function(d) {
2517        return locale_shortMonths[d.getMonth()];
2518      },
2519      B: function(d) {
2520        return locale_months[d.getMonth()];
2521      },
2522      c: d3_time_format(locale_dateTime),
2523      d: function(d, p) {
2524        return d3_time_formatPad(d.getDate(), p, 2);
2525      },
2526      e: function(d, p) {
2527        return d3_time_formatPad(d.getDate(), p, 2);
2528      },
2529      H: function(d, p) {
2530        return d3_time_formatPad(d.getHours(), p, 2);
2531      },
2532      I: function(d, p) {
2533        return d3_time_formatPad(d.getHours() % 12 || 12, p, 2);
2534      },
2535      j: function(d, p) {
2536        return d3_time_formatPad(1 + d3_time.dayOfYear(d), p, 3);
2537      },
2538      L: function(d, p) {
2539        return d3_time_formatPad(d.getMilliseconds(), p, 3);
2540      },
2541      m: function(d, p) {
2542        return d3_time_formatPad(d.getMonth() + 1, p, 2);
2543      },
2544      M: function(d, p) {
2545        return d3_time_formatPad(d.getMinutes(), p, 2);
2546      },
2547      p: function(d) {
2548        return locale_periods[+(d.getHours() >= 12)];
2549      },
2550      S: function(d, p) {
2551        return d3_time_formatPad(d.getSeconds(), p, 2);
2552      },
2553      U: function(d, p) {
2554        return d3_time_formatPad(d3_time.sundayOfYear(d), p, 2);
2555      },
2556      w: function(d) {
2557        return d.getDay();
2558      },
2559      W: function(d, p) {
2560        return d3_time_formatPad(d3_time.mondayOfYear(d), p, 2);
2561      },
2562      x: d3_time_format(locale_date),
2563      X: d3_time_format(locale_time),
2564      y: function(d, p) {
2565        return d3_time_formatPad(d.getFullYear() % 100, p, 2);
2566      },
2567      Y: function(d, p) {
2568        return d3_time_formatPad(d.getFullYear() % 1e4, p, 4);
2569      },
2570      Z: d3_time_zone,
2571      "%": function() {
2572        return "%";
2573      }
2574    };
2575    var d3_time_parsers = {
2576      a: d3_time_parseWeekdayAbbrev,
2577      A: d3_time_parseWeekday,
2578      b: d3_time_parseMonthAbbrev,
2579      B: d3_time_parseMonth,
2580      c: d3_time_parseLocaleFull,
2581      d: d3_time_parseDay,
2582      e: d3_time_parseDay,
2583      H: d3_time_parseHour24,
2584      I: d3_time_parseHour24,
2585      j: d3_time_parseDayOfYear,
2586      L: d3_time_parseMilliseconds,
2587      m: d3_time_parseMonthNumber,
2588      M: d3_time_parseMinutes,
2589      p: d3_time_parseAmPm,
2590      S: d3_time_parseSeconds,
2591      U: d3_time_parseWeekNumberSunday,
2592      w: d3_time_parseWeekdayNumber,
2593      W: d3_time_parseWeekNumberMonday,
2594      x: d3_time_parseLocaleDate,
2595      X: d3_time_parseLocaleTime,
2596      y: d3_time_parseYear,
2597      Y: d3_time_parseFullYear,
2598      Z: d3_time_parseZone,
2599      "%": d3_time_parseLiteralPercent
2600    };
2601    function d3_time_parseWeekdayAbbrev(date, string, i) {
2602      d3_time_dayAbbrevRe.lastIndex = 0;
2603      var n = d3_time_dayAbbrevRe.exec(string.substring(i));
2604      return n ? (date.w = d3_time_dayAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
2605    }
2606    function d3_time_parseWeekday(date, string, i) {
2607      d3_time_dayRe.lastIndex = 0;
2608      var n = d3_time_dayRe.exec(string.substring(i));
2609      return n ? (date.w = d3_time_dayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
2610    }
2611    function d3_time_parseMonthAbbrev(date, string, i) {
2612      d3_time_monthAbbrevRe.lastIndex = 0;
2613      var n = d3_time_monthAbbrevRe.exec(string.substring(i));
2614      return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
2615    }
2616    function d3_time_parseMonth(date, string, i) {
2617      d3_time_monthRe.lastIndex = 0;
2618      var n = d3_time_monthRe.exec(string.substring(i));
2619      return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
2620    }
2621    function d3_time_parseLocaleFull(date, string, i) {
2622      return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
2623    }
2624    function d3_time_parseLocaleDate(date, string, i) {
2625      return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
2626    }
2627    function d3_time_parseLocaleTime(date, string, i) {
2628      return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
2629    }
2630    function d3_time_parseAmPm(date, string, i) {
2631      var n = d3_time_periodLookup.get(string.substring(i, i += 2).toLowerCase());
2632      return n == null ? -1 : (date.p = n, i);
2633    }
2634    return d3_time_format;
2635  }
2636  var d3_time_formatPads = {
2637    "-": "",
2638    _: " ",
2639    "0": "0"
2640  }, d3_time_numberRe = /^\s*\d+/, d3_time_percentRe = /^%/;
2641  function d3_time_formatPad(value, fill, width) {
2642    var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length;
2643    return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
2644  }
2645  function d3_time_formatRe(names) {
2646    return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i");
2647  }
2648  function d3_time_formatLookup(names) {
2649    var map = new d3_Map(), i = -1, n = names.length;
2650    while (++i < n) map.set(names[i].toLowerCase(), i);
2651    return map;
2652  }
2653  function d3_time_parseWeekdayNumber(date, string, i) {
2654    d3_time_numberRe.lastIndex = 0;
2655    var n = d3_time_numberRe.exec(string.substring(i, i + 1));
2656    return n ? (date.w = +n[0], i + n[0].length) : -1;
2657  }
2658  function d3_time_parseWeekNumberSunday(date, string, i) {
2659    d3_time_numberRe.lastIndex = 0;
2660    var n = d3_time_numberRe.exec(string.substring(i));
2661    return n ? (date.U = +n[0], i + n[0].length) : -1;
2662  }
2663  function d3_time_parseWeekNumberMonday(date, string, i) {
2664    d3_time_numberRe.lastIndex = 0;
2665    var n = d3_time_numberRe.exec(string.substring(i));
2666    return n ? (date.W = +n[0], i + n[0].length) : -1;
2667  }
2668  function d3_time_parseFullYear(date, string, i) {
2669    d3_time_numberRe.lastIndex = 0;
2670    var n = d3_time_numberRe.exec(string.substring(i, i + 4));
2671    return n ? (date.y = +n[0], i + n[0].length) : -1;
2672  }
2673  function d3_time_parseYear(date, string, i) {
2674    d3_time_numberRe.lastIndex = 0;
2675    var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2676    return n ? (date.y = d3_time_expandYear(+n[0]), i + n[0].length) : -1;
2677  }
2678  function d3_time_parseZone(date, string, i) {
2679    return /^[+-]\d{4}$/.test(string = string.substring(i, i + 5)) ? (date.Z = +string,
2680    i + 5) : -1;
2681  }
2682  function d3_time_expandYear(d) {
2683    return d + (d > 68 ? 1900 : 2e3);
2684  }
2685  function d3_time_parseMonthNumber(date, string, i) {
2686    d3_time_numberRe.lastIndex = 0;
2687    var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2688    return n ? (date.m = n[0] - 1, i + n[0].length) : -1;
2689  }
2690  function d3_time_parseDay(date, string, i) {
2691    d3_time_numberRe.lastIndex = 0;
2692    var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2693    return n ? (date.d = +n[0], i + n[0].length) : -1;
2694  }
2695  function d3_time_parseDayOfYear(date, string, i) {
2696    d3_time_numberRe.lastIndex = 0;
2697    var n = d3_time_numberRe.exec(string.substring(i, i + 3));
2698    return n ? (date.j = +n[0], i + n[0].length) : -1;
2699  }
2700  function d3_time_parseHour24(date, string, i) {
2701    d3_time_numberRe.lastIndex = 0;
2702    var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2703    return n ? (date.H = +n[0], i + n[0].length) : -1;
2704  }
2705  function d3_time_parseMinutes(date, string, i) {
2706    d3_time_numberRe.lastIndex = 0;
2707    var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2708    return n ? (date.M = +n[0], i + n[0].length) : -1;
2709  }
2710  function d3_time_parseSeconds(date, string, i) {
2711    d3_time_numberRe.lastIndex = 0;
2712    var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2713    return n ? (date.S = +n[0], i + n[0].length) : -1;
2714  }
2715  function d3_time_parseMilliseconds(date, string, i) {
2716    d3_time_numberRe.lastIndex = 0;
2717    var n = d3_time_numberRe.exec(string.substring(i, i + 3));
2718    return n ? (date.L = +n[0], i + n[0].length) : -1;
2719  }
2720  function d3_time_zone(d) {
2721    var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(abs(z) / 60), zm = abs(z) % 60;
2722    return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2);
2723  }
2724  function d3_time_parseLiteralPercent(date, string, i) {
2725    d3_time_percentRe.lastIndex = 0;
2726    var n = d3_time_percentRe.exec(string.substring(i, i + 1));
2727    return n ? i + n[0].length : -1;
2728  }
2729  function d3_time_formatMulti(formats) {
2730    var n = formats.length, i = -1;
2731    while (++i < n) formats[i][0] = this(formats[i][0]);
2732    return function(date) {
2733      var i = 0, f = formats[i];
2734      while (!f[1](date)) f = formats[++i];
2735      return f[0](date);
2736    };
2737  }
2738  d3.locale = function(locale) {
2739    return {
2740      numberFormat: d3_locale_numberFormat(locale),
2741      timeFormat: d3_locale_timeFormat(locale)
2742    };
2743  };
2744  var d3_locale_enUS = d3.locale({
2745    decimal: ".",
2746    thousands: ",",
2747    grouping: [ 3 ],
2748    currency: [ "$", "" ],
2749    dateTime: "%a %b %e %X %Y",
2750    date: "%m/%d/%Y",
2751    time: "%H:%M:%S",
2752    periods: [ "AM", "PM" ],
2753    days: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ],
2754    shortDays: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ],
2755    months: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ],
2756    shortMonths: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ]
2757  });
2758  d3.format = d3_locale_enUS.numberFormat;
2759  d3.geo = {};
2760  function d3_adder() {}
2761  d3_adder.prototype = {
2762    s: 0,
2763    t: 0,
2764    add: function(y) {
2765      d3_adderSum(y, this.t, d3_adderTemp);
2766      d3_adderSum(d3_adderTemp.s, this.s, this);
2767      if (this.s) this.t += d3_adderTemp.t; else this.s = d3_adderTemp.t;
2768    },
2769    reset: function() {
2770      this.s = this.t = 0;
2771    },
2772    valueOf: function() {
2773      return this.s;
2774    }
2775  };
2776  var d3_adderTemp = new d3_adder();
2777  function d3_adderSum(a, b, o) {
2778    var x = o.s = a + b, bv = x - a, av = x - bv;
2779    o.t = a - av + (b - bv);
2780  }
2781  d3.geo.stream = function(object, listener) {
2782    if (object && d3_geo_streamObjectType.hasOwnProperty(object.type)) {
2783      d3_geo_streamObjectType[object.type](object, listener);
2784    } else {
2785      d3_geo_streamGeometry(object, listener);
2786    }
2787  };
2788  function d3_geo_streamGeometry(geometry, listener) {
2789    if (geometry && d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) {
2790      d3_geo_streamGeometryType[geometry.type](geometry, listener);
2791    }
2792  }
2793  var d3_geo_streamObjectType = {
2794    Feature: function(feature, listener) {
2795      d3_geo_streamGeometry(feature.geometry, listener);
2796    },
2797    FeatureCollection: function(object, listener) {
2798      var features = object.features, i = -1, n = features.length;
2799      while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener);
2800    }
2801  };
2802  var d3_geo_streamGeometryType = {
2803    Sphere: function(object, listener) {
2804      listener.sphere();
2805    },
2806    Point: function(object, listener) {
2807      object = object.coordinates;
2808      listener.point(object[0], object[1], object[2]);
2809    },
2810    MultiPoint: function(object, listener) {
2811      var coordinates = object.coordinates, i = -1, n = coordinates.length;
2812      while (++i < n) object = coordinates[i], listener.point(object[0], object[1], object[2]);
2813    },
2814    LineString: function(object, listener) {
2815      d3_geo_streamLine(object.coordinates, listener, 0);
2816    },
2817    MultiLineString: function(object, listener) {
2818      var coordinates = object.coordinates, i = -1, n = coordinates.length;
2819      while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0);
2820    },
2821    Polygon: function(object, listener) {
2822      d3_geo_streamPolygon(object.coordinates, listener);
2823    },
2824    MultiPolygon: function(object, listener) {
2825      var coordinates = object.coordinates, i = -1, n = coordinates.length;
2826      while (++i < n) d3_geo_streamPolygon(coordinates[i], listener);
2827    },
2828    GeometryCollection: function(object, listener) {
2829      var geometries = object.geometries, i = -1, n = geometries.length;
2830      while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
2831    }
2832  };
2833  function d3_geo_streamLine(coordinates, listener, closed) {
2834    var i = -1, n = coordinates.length - closed, coordinate;
2835    listener.lineStart();
2836    while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1], coordinate[2]);
2837    listener.lineEnd();
2838  }
2839  function d3_geo_streamPolygon(coordinates, listener) {
2840    var i = -1, n = coordinates.length;
2841    listener.polygonStart();
2842    while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1);
2843    listener.polygonEnd();
2844  }
2845  d3.geo.area = function(object) {
2846    d3_geo_areaSum = 0;
2847    d3.geo.stream(object, d3_geo_area);
2848    return d3_geo_areaSum;
2849  };
2850  var d3_geo_areaSum, d3_geo_areaRingSum = new d3_adder();
2851  var d3_geo_area = {
2852    sphere: function() {
2853      d3_geo_areaSum += 4 * π;
2854    },
2855    point: d3_noop,
2856    lineStart: d3_noop,
2857    lineEnd: d3_noop,
2858    polygonStart: function() {
2859      d3_geo_areaRingSum.reset();
2860      d3_geo_area.lineStart = d3_geo_areaRingStart;
2861    },
2862    polygonEnd: function() {
2863      var area = 2 * d3_geo_areaRingSum;
2864      d3_geo_areaSum += area < 0 ? 4 * π + area : area;
2865      d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop;
2866    }
2867  };
2868  function d3_geo_areaRingStart() {
2869    var λ00, φ00, λ0, cosφ0, sinφ0;
2870    d3_geo_area.point = function(λ, φ) {
2871      d3_geo_area.point = nextPoint;
2872      λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4),
2873      sinφ0 = Math.sin(φ);
2874    };
2875    function nextPoint(λ, φ) {
2876      λ *= d3_radians;
2877      φ = φ * d3_radians / 2 + π / 4;
2878      var  = λ - λ0, sdλ =  >= 0 ? 1 : -1, adλ = sdλ * , cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u = cosφ0 * cosφ + k * Math.cos(adλ), v = k * sdλ * Math.sin(adλ);
2879      d3_geo_areaRingSum.add(Math.atan2(v, u));
2880      λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ;
2881    }
2882    d3_geo_area.lineEnd = function() {
2883      nextPoint(λ00, φ00);
2884    };
2885  }
2886  function d3_geo_cartesian(spherical) {
2887    var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ);
2888    return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ];
2889  }
2890  function d3_geo_cartesianDot(a, b) {
2891    return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
2892  }
2893  function d3_geo_cartesianCross(a, b) {
2894    return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ];
2895  }
2896  function d3_geo_cartesianAdd(a, b) {
2897    a[0] += b[0];
2898    a[1] += b[1];
2899    a[2] += b[2];
2900  }
2901  function d3_geo_cartesianScale(vector, k) {
2902    return [ vector[0] * k, vector[1] * k, vector[2] * k ];
2903  }
2904  function d3_geo_cartesianNormalize(d) {
2905    var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
2906    d[0] /= l;
2907    d[1] /= l;
2908    d[2] /= l;
2909  }
2910  function d3_geo_spherical(cartesian) {
2911    return [ Math.atan2(cartesian[1], cartesian[0]), d3_asin(cartesian[2]) ];
2912  }
2913  function d3_geo_sphericalEqual(a, b) {
2914    return abs(a[0] - b[0]) < ε && abs(a[1] - b[1]) < ε;
2915  }
2916  d3.geo.bounds = function() {
2917    var λ0, φ0, λ1, φ1, λ_, λ__, φ__, p0, dλSum, ranges, range;
2918    var bound = {
2919      point: point,
2920      lineStart: lineStart,
2921      lineEnd: lineEnd,
2922      polygonStart: function() {
2923        bound.point = ringPoint;
2924        bound.lineStart = ringStart;
2925        bound.lineEnd = ringEnd;
2926        dλSum = 0;
2927        d3_geo_area.polygonStart();
2928      },
2929      polygonEnd: function() {
2930        d3_geo_area.polygonEnd();
2931        bound.point = point;
2932        bound.lineStart = lineStart;
2933        bound.lineEnd = lineEnd;
2934        if (d3_geo_areaRingSum < 0) λ0 = -(λ1 = 180), φ0 = -(φ1 = 90); else if (dλSum > ε) φ1 = 90; else if (dλSum < -ε) φ0 = -90;
2935        range[0] = λ0, range[1] = λ1;
2936      }
2937    };
2938    function point(λ, φ) {
2939      ranges.push(range = [ λ0 = λ, λ1 = λ ]);
2940      if (φ < φ0) φ0 = φ;
2941      if (φ > φ1) φ1 = φ;
2942    }
2943    function linePoint(λ, φ) {
2944      var p = d3_geo_cartesian([ λ * d3_radians, φ * d3_radians ]);
2945      if (p0) {
2946        var normal = d3_geo_cartesianCross(p0, p), equatorial = [ normal[1], -normal[0], 0 ], inflection = d3_geo_cartesianCross(equatorial, normal);
2947        d3_geo_cartesianNormalize(inflection);
2948        inflection = d3_geo_spherical(inflection);
2949        var  = λ - λ_, s =  > 0 ? 1 : -1, λi = inflection[0] * d3_degrees * s, antimeridian = abs() > 180;
2950        if (antimeridian ^ (s * λ_ < λi && λi < s * λ)) {
2951          var φi = inflection[1] * d3_degrees;
2952          if (φi > φ1) φ1 = φi;
2953        } else if (λi = (λi + 360) % 360 - 180, antimeridian ^ (s * λ_ < λi && λi < s * λ)) {
2954          var φi = -inflection[1] * d3_degrees;
2955          if (φi < φ0) φ0 = φi;
2956        } else {
2957          if (φ < φ0) φ0 = φ;
2958          if (φ > φ1) φ1 = φ;
2959        }
2960        if (antimeridian) {
2961          if (λ < λ_) {
2962            if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ;
2963          } else {
2964            if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ;
2965          }
2966        } else {
2967          if (λ1 >= λ0) {
2968            if (λ < λ0) λ0 = λ;
2969            if (λ > λ1) λ1 = λ;
2970          } else {
2971            if (λ > λ_) {
2972              if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ;
2973            } else {
2974              if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ;
2975            }
2976          }
2977        }
2978      } else {
2979        point(λ, φ);
2980      }
2981      p0 = p, λ_ = λ;
2982    }
2983    function lineStart() {
2984      bound.point = linePoint;
2985    }
2986    function lineEnd() {
2987      range[0] = λ0, range[1] = λ1;
2988      bound.point = point;
2989      p0 = null;
2990    }
2991    function ringPoint(λ, φ) {
2992      if (p0) {
2993        var  = λ - λ_;
2994        dλSum += abs() > 180 ?  + ( > 0 ? 360 : -360) : ;
2995      } else λ__ = λ, φ__ = φ;
2996      d3_geo_area.point(λ, φ);
2997      linePoint(λ, φ);
2998    }
2999    function ringStart() {
3000      d3_geo_area.lineStart();
3001    }
3002    function ringEnd() {
3003      ringPoint(λ__, φ__);
3004      d3_geo_area.lineEnd();
3005      if (abs(dλSum) > ε) λ0 = -(λ1 = 180);
3006      range[0] = λ0, range[1] = λ1;
3007      p0 = null;
3008    }
3009    function angle(λ0, λ1) {
3010      return (λ1 -= λ0) < 0 ? λ1 + 360 : λ1;
3011    }
3012    function compareRanges(a, b) {
3013      return a[0] - b[0];
3014    }
3015    function withinRange(x, range) {
3016      return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;
3017    }
3018    return function(feature) {
3019      φ1 = λ1 = -(λ0 = φ0 = Infinity);
3020      ranges = [];
3021      d3.geo.stream(feature, bound);
3022      var n = ranges.length;
3023      if (n) {
3024        ranges.sort(compareRanges);
3025        for (var i = 1, a = ranges[0], b, merged = [ a ]; i < n; ++i) {
3026          b = ranges[i];
3027          if (withinRange(b[0], a) || withinRange(b[1], a)) {
3028            if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1];
3029            if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0];
3030          } else {
3031            merged.push(a = b);
3032          }
3033        }
3034        var best = -Infinity, ;
3035        for (var n = merged.length - 1, i = 0, a = merged[n], b; i <= n; a = b, ++i) {
3036          b = merged[i];
3037          if (( = angle(a[1], b[0])) > best) best = , λ0 = b[0], λ1 = a[1];
3038        }
3039      }
3040      ranges = range = null;
3041      return λ0 === Infinity || φ0 === Infinity ? [ [ NaN, NaN ], [ NaN, NaN ] ] : [ [ λ0, φ0 ], [ λ1, φ1 ] ];
3042    };
3043  }();
3044  d3.geo.centroid = function(object) {
3045    d3_geo_centroidW0 = d3_geo_centroidW1 = d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0;
3046    d3.geo.stream(object, d3_geo_centroid);
3047    var x = d3_geo_centroidX2, y = d3_geo_centroidY2, z = d3_geo_centroidZ2, m = x * x + y * y + z * z;
3048    if (m < ε2) {
3049      x = d3_geo_centroidX1, y = d3_geo_centroidY1, z = d3_geo_centroidZ1;
3050      if (d3_geo_centroidW1 < ε) x = d3_geo_centroidX0, y = d3_geo_centroidY0, z = d3_geo_centroidZ0;
3051      m = x * x + y * y + z * z;
3052      if (m < ε2) return [ NaN, NaN ];
3053    }
3054    return [ Math.atan2(y, x) * d3_degrees, d3_asin(z / Math.sqrt(m)) * d3_degrees ];
3055  };
3056  var d3_geo_centroidW0, d3_geo_centroidW1, d3_geo_centroidX0, d3_geo_centroidY0, d3_geo_centroidZ0, d3_geo_centroidX1, d3_geo_centroidY1, d3_geo_centroidZ1, d3_geo_centroidX2, d3_geo_centroidY2, d3_geo_centroidZ2;
3057  var d3_geo_centroid = {
3058    sphere: d3_noop,
3059    point: d3_geo_centroidPoint,
3060    lineStart: d3_geo_centroidLineStart,
3061    lineEnd: d3_geo_centroidLineEnd,
3062    polygonStart: function() {
3063      d3_geo_centroid.lineStart = d3_geo_centroidRingStart;
3064    },
3065    polygonEnd: function() {
3066      d3_geo_centroid.lineStart = d3_geo_centroidLineStart;
3067    }
3068  };
3069  function d3_geo_centroidPoint(λ, φ) {
3070    λ *= d3_radians;
3071    var cosφ = Math.cos(φ *= d3_radians);
3072    d3_geo_centroidPointXYZ(cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ));
3073  }
3074  function d3_geo_centroidPointXYZ(x, y, z) {
3075    ++d3_geo_centroidW0;
3076    d3_geo_centroidX0 += (x - d3_geo_centroidX0) / d3_geo_centroidW0;
3077    d3_geo_centroidY0 += (y - d3_geo_centroidY0) / d3_geo_centroidW0;
3078    d3_geo_centroidZ0 += (z - d3_geo_centroidZ0) / d3_geo_centroidW0;
3079  }
3080  function d3_geo_centroidLineStart() {
3081    var x0, y0, z0;
3082    d3_geo_centroid.point = function(λ, φ) {
3083      λ *= d3_radians;
3084      var cosφ = Math.cos(φ *= d3_radians);
3085      x0 = cosφ * Math.cos(λ);
3086      y0 = cosφ * Math.sin(λ);
3087      z0 = Math.sin(φ);
3088      d3_geo_centroid.point = nextPoint;
3089      d3_geo_centroidPointXYZ(x0, y0, z0);
3090    };
3091    function nextPoint(λ, φ) {
3092      λ *= d3_radians;
3093      var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);
3094      d3_geo_centroidW1 += w;
3095      d3_geo_centroidX1 += w * (x0 + (x0 = x));
3096      d3_geo_centroidY1 += w * (y0 + (y0 = y));
3097      d3_geo_centroidZ1 += w * (z0 + (z0 = z));
3098      d3_geo_centroidPointXYZ(x0, y0, z0);
3099    }
3100  }
3101  function d3_geo_centroidLineEnd() {
3102    d3_geo_centroid.point = d3_geo_centroidPoint;
3103  }
3104  function d3_geo_centroidRingStart() {
3105    var λ00, φ00, x0, y0, z0;
3106    d3_geo_centroid.point = function(λ, φ) {
3107      λ00 = λ, φ00 = φ;
3108      d3_geo_centroid.point = nextPoint;
3109      λ *= d3_radians;
3110      var cosφ = Math.cos(φ *= d3_radians);
3111      x0 = cosφ * Math.cos(λ);
3112      y0 = cosφ * Math.sin(λ);
3113      z0 = Math.sin(φ);
3114      d3_geo_centroidPointXYZ(x0, y0, z0);
3115    };
3116    d3_geo_centroid.lineEnd = function() {
3117      nextPoint(λ00, φ00);
3118      d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd;
3119      d3_geo_centroid.point = d3_geo_centroidPoint;
3120    };
3121    function nextPoint(λ, φ) {
3122      λ *= d3_radians;
3123      var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = Math.sqrt(cx * cx + cy * cy + cz * cz), u = x0 * x + y0 * y + z0 * z, v = m && -d3_acos(u) / m, w = Math.atan2(m, u);
3124      d3_geo_centroidX2 += v * cx;
3125      d3_geo_centroidY2 += v * cy;
3126      d3_geo_centroidZ2 += v * cz;
3127      d3_geo_centroidW1 += w;
3128      d3_geo_centroidX1 += w * (x0 + (x0 = x));
3129      d3_geo_centroidY1 += w * (y0 + (y0 = y));
3130      d3_geo_centroidZ1 += w * (z0 + (z0 = z));
3131      d3_geo_centroidPointXYZ(x0, y0, z0);
3132    }
3133  }
3134  function d3_true() {
3135    return true;
3136  }
3137  function d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener) {
3138    var subject = [], clip = [];
3139    segments.forEach(function(segment) {
3140      if ((n = segment.length - 1) <= 0) return;
3141      var n, p0 = segment[0], p1 = segment[n];
3142      if (d3_geo_sphericalEqual(p0, p1)) {
3143        listener.lineStart();
3144        for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]);
3145        listener.lineEnd();
3146        return;
3147      }
3148      var a = new d3_geo_clipPolygonIntersection(p0, segment, null, true), b = new d3_geo_clipPolygonIntersection(p0, null, a, false);
3149      a.o = b;
3150      subject.push(a);
3151      clip.push(b);
3152      a = new d3_geo_clipPolygonIntersection(p1, segment, null, false);
3153      b = new d3_geo_clipPolygonIntersection(p1, null, a, true);
3154      a.o = b;
3155      subject.push(a);
3156      clip.push(b);
3157    });
3158    clip.sort(compare);
3159    d3_geo_clipPolygonLinkCircular(subject);
3160    d3_geo_clipPolygonLinkCircular(clip);
3161    if (!subject.length) return;
3162    for (var i = 0, entry = clipStartInside, n = clip.length; i < n; ++i) {
3163      clip[i].e = entry = !entry;
3164    }
3165    var start = subject[0], points, point;
3166    while (1) {
3167      var current = start, isSubject = true;
3168      while (current.v) if ((current = current.n) === start) return;
3169      points = current.z;
3170      listener.lineStart();
3171      do {
3172        current.v = current.o.v = true;
3173        if (current.e) {
3174          if (isSubject) {
3175            for (var i = 0, n = points.length; i < n; ++i) listener.point((point = points[i])[0], point[1]);
3176          } else {
3177            interpolate(current.x, current.n.x, 1, listener);
3178          }
3179          current = current.n;
3180        } else {
3181          if (isSubject) {
3182            points = current.p.z;
3183            for (var i = points.length - 1; i >= 0; --i) listener.point((point = points[i])[0], point[1]);
3184          } else {
3185            interpolate(current.x, current.p.x, -1, listener);
3186          }
3187          current = current.p;
3188        }
3189        current = current.o;
3190        points = current.z;
3191        isSubject = !isSubject;
3192      } while (!current.v);
3193      listener.lineEnd();
3194    }
3195  }
3196  function d3_geo_clipPolygonLinkCircular(array) {
3197    if (!(n = array.length)) return;
3198    var n, i = 0, a = array[0], b;
3199    while (++i < n) {
3200      a.n = b = array[i];
3201      b.p = a;
3202      a = b;
3203    }
3204    a.n = b = array[0];
3205    b.p = a;
3206  }
3207  function d3_geo_clipPolygonIntersection(point, points, other, entry) {
3208    this.x = point;
3209    this.z = points;
3210    this.o = other;
3211    this.e = entry;
3212    this.v = false;
3213    this.n = this.p = null;
3214  }
3215  function d3_geo_clip(pointVisible, clipLine, interpolate, clipStart) {
3216    return function(rotate, listener) {
3217      var line = clipLine(listener), rotatedClipStart = rotate.invert(clipStart[0], clipStart[1]);
3218      var clip = {
3219        point: point,
3220        lineStart: lineStart,
3221        lineEnd: lineEnd,
3222        polygonStart: function() {
3223          clip.point = pointRing;
3224          clip.lineStart = ringStart;
3225          clip.lineEnd = ringEnd;
3226          segments = [];
3227          polygon = [];
3228          listener.polygonStart();
3229        },
3230        polygonEnd: function() {
3231          clip.point = point;
3232          clip.lineStart = lineStart;
3233          clip.lineEnd = lineEnd;
3234          segments = d3.merge(segments);
3235          var clipStartInside = d3_geo_pointInPolygon(rotatedClipStart, polygon);
3236          if (segments.length) {
3237            d3_geo_clipPolygon(segments, d3_geo_clipSort, clipStartInside, interpolate, listener);
3238          } else if (clipStartInside) {
3239            listener.lineStart();
3240            interpolate(null, null, 1, listener);
3241            listener.lineEnd();
3242          }
3243          listener.polygonEnd();
3244          segments = polygon = null;
3245        },
3246        sphere: function() {
3247          listener.polygonStart();
3248          listener.lineStart();
3249          interpolate(null, null, 1, listener);
3250          listener.lineEnd();
3251          listener.polygonEnd();
3252        }
3253      };
3254      function point(λ, φ) {
3255        var point = rotate(λ, φ);
3256        if (pointVisible(λ = point[0], φ = point[1])) listener.point(λ, φ);
3257      }
3258      function pointLine(λ, φ) {
3259        var point = rotate(λ, φ);
3260        line.point(point[0], point[1]);
3261      }
3262      function lineStart() {
3263        clip.point = pointLine;
3264        line.lineStart();
3265      }
3266      function lineEnd() {
3267        clip.point = point;
3268        line.lineEnd();
3269      }
3270      var segments;
3271      var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), polygon, ring;
3272      function pointRing(λ, φ) {
3273        ring.push([ λ, φ ]);
3274        var point = rotate(λ, φ);
3275        ringListener.point(point[0], point[1]);
3276      }
3277      function ringStart() {
3278        ringListener.lineStart();
3279        ring = [];
3280      }
3281      function ringEnd() {
3282        pointRing(ring[0][0], ring[0][1]);
3283        ringListener.lineEnd();
3284        var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length;
3285        ring.pop();
3286        polygon.push(ring);
3287        ring = null;
3288        if (!n) return;
3289        if (clean & 1) {
3290          segment = ringSegments[0];
3291          var n = segment.length - 1, i = -1, point;
3292          listener.lineStart();
3293          while (++i < n) listener.point((point = segment[i])[0], point[1]);
3294          listener.lineEnd();
3295          return;
3296        }
3297        if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
3298        segments.push(ringSegments.filter(d3_geo_clipSegmentLength1));
3299      }
3300      return clip;
3301    };
3302  }
3303  function d3_geo_clipSegmentLength1(segment) {
3304    return segment.length > 1;
3305  }
3306  function d3_geo_clipBufferListener() {
3307    var lines = [], line;
3308    return {
3309      lineStart: function() {
3310        lines.push(line = []);
3311      },
3312      point: function(λ, φ) {
3313        line.push([ λ, φ ]);
3314      },
3315      lineEnd: d3_noop,
3316      buffer: function() {
3317        var buffer = lines;
3318        lines = [];
3319        line = null;
3320        return buffer;
3321      },
3322      rejoin: function() {
3323        if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
3324      }
3325    };
3326  }
3327  function d3_geo_clipSort(a, b) {
3328    return ((a = a.x)[0] < 0 ? a[1] - halfπ - ε : halfπ - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfπ - ε : halfπ - b[1]);
3329  }
3330  function d3_geo_pointInPolygon(point, polygon) {
3331    var meridian = point[0], parallel = point[1], meridianNormal = [ Math.sin(meridian), -Math.cos(meridian), 0 ], polarAngle = 0, winding = 0;
3332    d3_geo_areaRingSum.reset();
3333    for (var i = 0, n = polygon.length; i < n; ++i) {
3334      var ring = polygon[i], m = ring.length;
3335      if (!m) continue;
3336      var point0 = ring[0], λ0 = point0[0], φ0 = point0[1] / 2 + π / 4, sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), j = 1;
3337      while (true) {
3338        if (j === m) j = 0;
3339        point = ring[j];
3340        var λ = point[0], φ = point[1] / 2 + π / 4, sinφ = Math.sin(φ), cosφ = Math.cos(φ),  = λ - λ0, sdλ =  >= 0 ? 1 : -1, adλ = sdλ * , antimeridian = adλ > π, k = sinφ0 * sinφ;
3341        d3_geo_areaRingSum.add(Math.atan2(k * sdλ * Math.sin(adλ), cosφ0 * cosφ + k * Math.cos(adλ)));
3342        polarAngle += antimeridian ?  + sdλ * τ : ;
3343        if (antimeridian ^ λ0 >= meridian ^ λ >= meridian) {
3344          var arc = d3_geo_cartesianCross(d3_geo_cartesian(point0), d3_geo_cartesian(point));
3345          d3_geo_cartesianNormalize(arc);
3346          var intersection = d3_geo_cartesianCross(meridianNormal, arc);
3347          d3_geo_cartesianNormalize(intersection);
3348          var φarc = (antimeridian ^  >= 0 ? -1 : 1) * d3_asin(intersection[2]);
3349          if (parallel > φarc || parallel === φarc && (arc[0] || arc[1])) {
3350            winding += antimeridian ^  >= 0 ? 1 : -1;
3351          }
3352        }
3353        if (!j++) break;
3354        λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ, point0 = point;
3355      }
3356    }
3357    return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < 0) ^ winding & 1;
3358  }
3359  var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate, [ -π, -π / 2 ]);
3360  function d3_geo_clipAntimeridianLine(listener) {
3361    var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean;
3362    return {
3363      lineStart: function() {
3364        listener.lineStart();
3365        clean = 1;
3366      },
3367      point: function(λ1, φ1) {
3368        var sλ1 = λ1 > 0 ? π : -π,  = abs(λ1 - λ0);
3369        if (abs( - π) < ε) {
3370          listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? halfπ : -halfπ);
3371          listener.point(sλ0, φ0);
3372          listener.lineEnd();
3373          listener.lineStart();
3374          listener.point(sλ1, φ0);
3375          listener.point(λ1, φ0);
3376          clean = 0;
3377        } else if (sλ0 !== sλ1 &&  >= π) {
3378          if (abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε;
3379          if (abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε;
3380          φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1);
3381          listener.point(sλ0, φ0);
3382          listener.lineEnd();
3383          listener.lineStart();
3384          listener.point(sλ1, φ0);
3385          clean = 0;
3386        }
3387        listener.point(λ0 = λ1, φ0 = φ1);
3388        sλ0 = sλ1;
3389      },
3390      lineEnd: function() {
3391        listener.lineEnd();
3392        λ0 = φ0 = NaN;
3393      },
3394      clean: function() {
3395        return 2 - clean;
3396      }
3397    };
3398  }
3399  function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) {
3400    var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1);
3401    return abs(sinλ0_λ1) > ε ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2;
3402  }
3403  function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) {
3404    var φ;
3405    if (from == null) {
3406      φ = direction * halfπ;
3407      listener.point(-π, φ);
3408      listener.point(0, φ);
3409      listener.point(π, φ);
3410      listener.point(π, 0);
3411      listener.point(π, -φ);
3412      listener.point(0, -φ);
3413      listener.point(-π, -φ);
3414      listener.point(-π, 0);
3415      listener.point(-π, φ);
3416    } else if (abs(from[0] - to[0]) > ε) {
3417      var s = from[0] < to[0] ? π : -π;
3418      φ = direction * s / 2;
3419      listener.point(-s, φ);
3420      listener.point(0, φ);
3421      listener.point(s, φ);
3422    } else {
3423      listener.point(to[0], to[1]);
3424    }
3425  }
3426  function d3_geo_clipCircle(radius) {
3427    var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = abs(cr) > ε, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians);
3428    return d3_geo_clip(visible, clipLine, interpolate, smallRadius ? [ 0, -radius ] : [ -π, radius - π ]);
3429    function visible(λ, φ) {
3430      return Math.cos(λ) * Math.cos(φ) > cr;
3431    }
3432    function clipLine(listener) {
3433      var point0, c0, v0, v00, clean;
3434      return {
3435        lineStart: function() {
3436          v00 = v0 = false;
3437          clean = 1;
3438        },
3439        point: function(λ, φ) {
3440          var point1 = [ λ, φ ], point2, v = visible(λ, φ), c = smallRadius ? v ? 0 : code(λ, φ) : v ? code(λ + (λ < 0 ? π : -π), φ) : 0;
3441          if (!point0 && (v00 = v0 = v)) listener.lineStart();
3442          if (v !== v0) {
3443            point2 = intersect(point0, point1);
3444            if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) {
3445              point1[0] += ε;
3446              point1[1] += ε;
3447              v = visible(point1[0], point1[1]);
3448            }
3449          }
3450          if (v !== v0) {
3451            clean = 0;
3452            if (v) {
3453              listener.lineStart();
3454              point2 = intersect(point1, point0);
3455              listener.point(point2[0], point2[1]);
3456            } else {
3457              point2 = intersect(point0, point1);
3458              listener.point(point2[0], point2[1]);
3459              listener.lineEnd();
3460            }
3461            point0 = point2;
3462          } else if (notHemisphere && point0 && smallRadius ^ v) {
3463            var t;
3464            if (!(c & c0) && (t = intersect(point1, point0, true))) {
3465              clean = 0;
3466              if (smallRadius) {
3467                listener.lineStart();
3468                listener.point(t[0][0], t[0][1]);
3469                listener.point(t[1][0], t[1][1]);
3470                listener.lineEnd();
3471              } else {
3472                listener.point(t[1][0], t[1][1]);
3473                listener.lineEnd();
3474                listener.lineStart();
3475                listener.point(t[0][0], t[0][1]);
3476              }
3477            }
3478          }
3479          if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) {
3480            listener.point(point1[0], point1[1]);
3481          }
3482          point0 = point1, v0 = v, c0 = c;
3483        },
3484        lineEnd: function() {
3485          if (v0) listener.lineEnd();
3486          point0 = null;
3487        },
3488        clean: function() {
3489          return clean | (v00 && v0) << 1;
3490        }
3491      };
3492    }
3493    function intersect(a, b, two) {
3494      var pa = d3_geo_cartesian(a), pb = d3_geo_cartesian(b);
3495      var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
3496      if (!determinant) return !two && a;
3497      var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2);
3498      d3_geo_cartesianAdd(A, B);
3499      var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t2 = w * w - uu * (d3_geo_cartesianDot(A, A) - 1);
3500      if (t2 < 0) return;
3501      var t = Math.sqrt(t2), q = d3_geo_cartesianScale(u, (-w - t) / uu);
3502      d3_geo_cartesianAdd(q, A);
3503      q = d3_geo_spherical(q);
3504      if (!two) return q;
3505      var λ0 = a[0], λ1 = b[0], φ0 = a[1], φ1 = b[1], z;
3506      if (λ1 < λ0) z = λ0, λ0 = λ1, λ1 = z;
3507      var δλ = λ1 - λ0, polar = abs(δλ - π) < ε, meridian = polar || δλ < ε;
3508      if (!polar && φ1 < φ0) z = φ0, φ0 = φ1, φ1 = z;
3509      if (meridian ? polar ? φ0 + φ1 > 0 ^ q[1] < (abs(q[0] - λ0) < ε ? φ0 : φ1) : φ0 <= q[1] && q[1] <= φ1 : δλ > π ^ (λ0 <= q[0] && q[0] <= λ1)) {
3510        var q1 = d3_geo_cartesianScale(u, (-w + t) / uu);
3511        d3_geo_cartesianAdd(q1, A);
3512        return [ q, d3_geo_spherical(q1) ];
3513      }
3514    }
3515    function code(λ, φ) {
3516      var r = smallRadius ? radius : π - radius, code = 0;
3517      if (λ < -r) code |= 1; else if (λ > r) code |= 2;
3518      if (φ < -r) code |= 4; else if (φ > r) code |= 8;
3519      return code;
3520    }
3521  }
3522  function d3_geom_clipLine(x0, y0, x1, y1) {
3523    return function(line) {
3524      var a = line.a, b = line.b, ax = a.x, ay = a.y, bx = b.x, by = b.y, t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r;
3525      r = x0 - ax;
3526      if (!dx && r > 0) return;
3527      r /= dx;
3528      if (dx < 0) {
3529        if (r < t0) return;
3530        if (r < t1) t1 = r;
3531      } else if (dx > 0) {
3532        if (r > t1) return;
3533        if (r > t0) t0 = r;
3534      }
3535      r = x1 - ax;
3536      if (!dx && r < 0) return;
3537      r /= dx;
3538      if (dx < 0) {
3539        if (r > t1) return;
3540        if (r > t0) t0 = r;
3541      } else if (dx > 0) {
3542        if (r < t0) return;
3543        if (r < t1) t1 = r;
3544      }
3545      r = y0 - ay;
3546      if (!dy && r > 0) return;
3547      r /= dy;
3548      if (dy < 0) {
3549        if (r < t0) return;
3550        if (r < t1) t1 = r;
3551      } else if (dy > 0) {
3552        if (r > t1) return;
3553        if (r > t0) t0 = r;
3554      }
3555      r = y1 - ay;
3556      if (!dy && r < 0) return;
3557      r /= dy;
3558      if (dy < 0) {
3559        if (r > t1) return;
3560        if (r > t0) t0 = r;
3561      } else if (dy > 0) {
3562        if (r < t0) return;
3563        if (r < t1) t1 = r;
3564      }
3565      if (t0 > 0) line.a = {
3566        x: ax + t0 * dx,
3567        y: ay + t0 * dy
3568      };
3569      if (t1 < 1) line.b = {
3570        x: ax + t1 * dx,
3571        y: ay + t1 * dy
3572      };
3573      return line;
3574    };
3575  }
3576  var d3_geo_clipExtentMAX = 1e9;
3577  d3.geo.clipExtent = function() {
3578    var x0, y0, x1, y1, stream, clip, clipExtent = {
3579      stream: function(output) {
3580        if (stream) stream.valid = false;
3581        stream = clip(output);
3582        stream.valid = true;
3583        return stream;
3584      },
3585      extent: function(_) {
3586        if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ];
3587        clip = d3_geo_clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]);
3588        if (stream) stream.valid = false, stream = null;
3589        return clipExtent;
3590      }
3591    };
3592    return clipExtent.extent([ [ 0, 0 ], [ 960, 500 ] ]);
3593  };
3594  function d3_geo_clipExtent(x0, y0, x1, y1) {
3595    return function(listener) {
3596      var listener_ = listener, bufferListener = d3_geo_clipBufferListener(), clipLine = d3_geom_clipLine(x0, y0, x1, y1), segments, polygon, ring;
3597      var clip = {
3598        point: point,
3599        lineStart: lineStart,
3600        lineEnd: lineEnd,
3601        polygonStart: function() {
3602          listener = bufferListener;
3603          segments = [];
3604          polygon = [];
3605          clean = true;
3606        },
3607        polygonEnd: function() {
3608          listener = listener_;
3609          segments = d3.merge(segments);
3610          var clipStartInside = insidePolygon([ x0, y1 ]), inside = clean && clipStartInside, visible = segments.length;
3611          if (inside || visible) {
3612            listener.polygonStart();
3613            if (inside) {
3614              listener.lineStart();
3615              interpolate(null, null, 1, listener);
3616              listener.lineEnd();
3617            }
3618            if (visible) {
3619              d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener);
3620            }
3621            listener.polygonEnd();
3622          }
3623          segments = polygon = ring = null;
3624        }
3625      };
3626      function insidePolygon(p) {
3627        var wn = 0, n = polygon.length, y = p[1];
3628        for (var i = 0; i < n; ++i) {
3629          for (var j = 1, v = polygon[i], m = v.length, a = v[0], b; j < m; ++j) {
3630            b = v[j];
3631            if (a[1] <= y) {
3632              if (b[1] > y && d3_cross2d(a, b, p) > 0) ++wn;
3633            } else {
3634              if (b[1] <= y && d3_cross2d(a, b, p) < 0) --wn;
3635            }
3636            a = b;
3637          }
3638        }
3639        return wn !== 0;
3640      }
3641      function interpolate(from, to, direction, listener) {
3642        var a = 0, a1 = 0;
3643        if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoints(from, to) < 0 ^ direction > 0) {
3644          do {
3645            listener.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);
3646          } while ((a = (a + direction + 4) % 4) !== a1);
3647        } else {
3648          listener.point(to[0], to[1]);
3649        }
3650      }
3651      function pointVisible(x, y) {
3652        return x0 <= x && x <= x1 && y0 <= y && y <= y1;
3653      }
3654      function point(x, y) {
3655        if (pointVisible(x, y)) listener.point(x, y);
3656      }
3657      var x__, y__, v__, x_, y_, v_, first, clean;
3658      function lineStart() {
3659        clip.point = linePoint;
3660        if (polygon) polygon.push(ring = []);
3661        first = true;
3662        v_ = false;
3663        x_ = y_ = NaN;
3664      }
3665      function lineEnd() {
3666        if (segments) {
3667          linePoint(x__, y__);
3668          if (v__ && v_) bufferListener.rejoin();
3669          segments.push(bufferListener.buffer());
3670        }
3671        clip.point = point;
3672        if (v_) listener.lineEnd();
3673      }
3674      function linePoint(x, y) {
3675        x = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, x));
3676        y = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, y));
3677        var v = pointVisible(x, y);
3678        if (polygon) ring.push([ x, y ]);
3679        if (first) {
3680          x__ = x, y__ = y, v__ = v;
3681          first = false;
3682          if (v) {
3683            listener.lineStart();
3684            listener.point(x, y);
3685          }
3686        } else {
3687          if (v && v_) listener.point(x, y); else {
3688            var l = {
3689              a: {
3690                x: x_,
3691                y: y_
3692              },
3693              b: {
3694                x: x,
3695                y: y
3696              }
3697            };
3698            if (clipLine(l)) {
3699              if (!v_) {
3700                listener.lineStart();
3701                listener.point(l.a.x, l.a.y);
3702              }
3703              listener.point(l.b.x, l.b.y);
3704              if (!v) listener.lineEnd();
3705              clean = false;
3706            } else if (v) {
3707              listener.lineStart();
3708              listener.point(x, y);
3709              clean = false;
3710            }
3711          }
3712        }
3713        x_ = x, y_ = y, v_ = v;
3714      }
3715      return clip;
3716    };
3717    function corner(p, direction) {
3718      return abs(p[0] - x0) < ε ? direction > 0 ? 0 : 3 : abs(p[0] - x1) < ε ? direction > 0 ? 2 : 1 : abs(p[1] - y0) < ε ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
3719    }
3720    function compare(a, b) {
3721      return comparePoints(a.x, b.x);
3722    }
3723    function comparePoints(a, b) {
3724      var ca = corner(a, 1), cb = corner(b, 1);
3725      return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0];
3726    }
3727  }
3728  function d3_geo_compose(a, b) {
3729    function compose(x, y) {
3730      return x = a(x, y), b(x[0], x[1]);
3731    }
3732    if (a.invert && b.invert) compose.invert = function(x, y) {
3733      return x = b.invert(x, y), x && a.invert(x[0], x[1]);
3734    };
3735    return compose;
3736  }
3737  function d3_geo_conic(projectAt) {
3738    var φ0 = 0, φ1 = π / 3, m = d3_geo_projectionMutator(projectAt), p = m(φ0, φ1);
3739    p.parallels = function(_) {
3740      if (!arguments.length) return [ φ0 / π * 180, φ1 / π * 180 ];
3741      return m(φ0 = _[0] * π / 180, φ1 = _[1] * π / 180);
3742    };
3743    return p;
3744  }
3745  function d3_geo_conicEqualArea(φ0, φ1) {
3746    var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), ρ0 = Math.sqrt(C) / n;
3747    function forward(λ, φ) {
3748      var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n;
3749      return [ ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ) ];
3750    }
3751    forward.invert = function(x, y) {
3752      var ρ0_y = ρ0 - y;
3753      return [ Math.atan2(x, ρ0_y) / n, d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ];
3754    };
3755    return forward;
3756  }
3757  (d3.geo.conicEqualArea = function() {
3758    return d3_geo_conic(d3_geo_conicEqualArea);
3759  }).raw = d3_geo_conicEqualArea;
3760  d3.geo.albers = function() {
3761    return d3.geo.conicEqualArea().rotate([ 96, 0 ]).center([ -.6, 38.7 ]).parallels([ 29.5, 45.5 ]).scale(1070);
3762  };
3763  d3.geo.albersUsa = function() {
3764    var lower48 = d3.geo.albers();
3765    var alaska = d3.geo.conicEqualArea().rotate([ 154, 0 ]).center([ -2, 58.5 ]).parallels([ 55, 65 ]);
3766    var hawaii = d3.geo.conicEqualArea().rotate([ 157, 0 ]).center([ -3, 19.9 ]).parallels([ 8, 18 ]);
3767    var point, pointStream = {
3768      point: function(x, y) {
3769        point = [ x, y ];
3770      }
3771    }, lower48Point, alaskaPoint, hawaiiPoint;
3772    function albersUsa(coordinates) {
3773      var x = coordinates[0], y = coordinates[1];
3774      point = null;
3775      (lower48Point(x, y), point) || (alaskaPoint(x, y), point) || hawaiiPoint(x, y);
3776      return point;
3777    }
3778    albersUsa.invert = function(coordinates) {
3779      var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k;
3780      return (y >= .12 && y < .234 && x >= -.425 && x < -.214 ? alaska : y >= .166 && y < .234 && x >= -.214 && x < -.115 ? hawaii : lower48).invert(coordinates);
3781    };
3782    albersUsa.stream = function(stream) {
3783      var lower48Stream = lower48.stream(stream), alaskaStream = alaska.stream(stream), hawaiiStream = hawaii.stream(stream);
3784      return {
3785        point: function(x, y) {
3786          lower48Stream.point(x, y);
3787          alaskaStream.point(x, y);
3788          hawaiiStream.point(x, y);
3789        },
3790        sphere: function() {
3791          lower48Stream.sphere();
3792          alaskaStream.sphere();
3793          hawaiiStream.sphere();
3794        },
3795        lineStart: function() {
3796          lower48Stream.lineStart();
3797          alaskaStream.lineStart();
3798          hawaiiStream.lineStart();
3799        },
3800        lineEnd: function() {
3801          lower48Stream.lineEnd();
3802          alaskaStream.lineEnd();
3803          hawaiiStream.lineEnd();
3804        },
3805        polygonStart: function() {
3806          lower48Stream.polygonStart();
3807          alaskaStream.polygonStart();
3808          hawaiiStream.polygonStart();
3809        },
3810        polygonEnd: function() {
3811          lower48Stream.polygonEnd();
3812          alaskaStream.polygonEnd();
3813          hawaiiStream.polygonEnd();
3814        }
3815      };
3816    };
3817    albersUsa.precision = function(_) {
3818      if (!arguments.length) return lower48.precision();
3819      lower48.precision(_);
3820      alaska.precision(_);
3821      hawaii.precision(_);
3822      return albersUsa;
3823    };
3824    albersUsa.scale = function(_) {
3825      if (!arguments.length) return lower48.scale();
3826      lower48.scale(_);
3827      alaska.scale(_ * .35);
3828      hawaii.scale(_);
3829      return albersUsa.translate(lower48.translate());
3830    };
3831    albersUsa.translate = function(_) {
3832      if (!arguments.length) return lower48.translate();
3833      var k = lower48.scale(), x = +_[0], y = +_[1];
3834      lower48Point = lower48.translate(_).clipExtent([ [ x - .455 * k, y - .238 * k ], [ x + .455 * k, y + .238 * k ] ]).stream(pointStream).point;
3835      alaskaPoint = alaska.translate([ x - .307 * k, y + .201 * k ]).clipExtent([ [ x - .425 * k + ε, y + .12 * k + ε ], [ x - .214 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point;
3836      hawaiiPoint = hawaii.translate([ x - .205 * k, y + .212 * k ]).clipExtent([ [ x - .214 * k + ε, y + .166 * k + ε ], [ x - .115 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point;
3837      return albersUsa;
3838    };
3839    return albersUsa.scale(1070);
3840  };
3841  var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = {
3842    point: d3_noop,
3843    lineStart: d3_noop,
3844    lineEnd: d3_noop,
3845    polygonStart: function() {
3846      d3_geo_pathAreaPolygon = 0;
3847      d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart;
3848    },
3849    polygonEnd: function() {
3850      d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop;
3851      d3_geo_pathAreaSum += abs(d3_geo_pathAreaPolygon / 2);
3852    }
3853  };
3854  function d3_geo_pathAreaRingStart() {
3855    var x00, y00, x0, y0;
3856    d3_geo_pathArea.point = function(x, y) {
3857      d3_geo_pathArea.point = nextPoint;
3858      x00 = x0 = x, y00 = y0 = y;
3859    };
3860    function nextPoint(x, y) {
3861      d3_geo_pathAreaPolygon += y0 * x - x0 * y;
3862      x0 = x, y0 = y;
3863    }
3864    d3_geo_pathArea.lineEnd = function() {
3865      nextPoint(x00, y00);
3866    };
3867  }
3868  var d3_geo_pathBoundsX0, d3_geo_pathBoundsY0, d3_geo_pathBoundsX1, d3_geo_pathBoundsY1;
3869  var d3_geo_pathBounds = {
3870    point: d3_geo_pathBoundsPoint,
3871    lineStart: d3_noop,
3872    lineEnd: d3_noop,
3873    polygonStart: d3_noop,
3874    polygonEnd: d3_noop
3875  };
3876  function d3_geo_pathBoundsPoint(x, y) {
3877    if (x < d3_geo_pathBoundsX0) d3_geo_pathBoundsX0 = x;
3878    if (x > d3_geo_pathBoundsX1) d3_geo_pathBoundsX1 = x;
3879    if (y < d3_geo_pathBoundsY0) d3_geo_pathBoundsY0 = y;
3880    if (y > d3_geo_pathBoundsY1) d3_geo_pathBoundsY1 = y;
3881  }
3882  function d3_geo_pathBuffer() {
3883    var pointCircle = d3_geo_pathBufferCircle(4.5), buffer = [];
3884    var stream = {
3885      point: point,
3886      lineStart: function() {
3887        stream.point = pointLineStart;
3888      },
3889      lineEnd: lineEnd,
3890      polygonStart: function() {
3891        stream.lineEnd = lineEndPolygon;
3892      },
3893      polygonEnd: function() {
3894        stream.lineEnd = lineEnd;
3895        stream.point = point;
3896      },
3897      pointRadius: function(_) {
3898        pointCircle = d3_geo_pathBufferCircle(_);
3899        return stream;
3900      },
3901      result: function() {
3902        if (buffer.length) {
3903          var result = buffer.join("");
3904          buffer = [];
3905          return result;
3906        }
3907      }
3908    };
3909    function point(x, y) {
3910      buffer.push("M", x, ",", y, pointCircle);
3911    }
3912    function pointLineStart(x, y) {
3913      buffer.push("M", x, ",", y);
3914      stream.point = pointLine;
3915    }
3916    function pointLine(x, y) {
3917      buffer.push("L", x, ",", y);
3918    }
3919    function lineEnd() {
3920      stream.point = point;
3921    }
3922    function lineEndPolygon() {
3923      buffer.push("Z");
3924    }
3925    return stream;
3926  }
3927  function d3_geo_pathBufferCircle(radius) {
3928    return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
3929  }
3930  var d3_geo_pathCentroid = {
3931    point: d3_geo_pathCentroidPoint,
3932    lineStart: d3_geo_pathCentroidLineStart,
3933    lineEnd: d3_geo_pathCentroidLineEnd,
3934    polygonStart: function() {
3935      d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart;
3936    },
3937    polygonEnd: function() {
3938      d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;
3939      d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart;
3940      d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd;
3941    }
3942  };
3943  function d3_geo_pathCentroidPoint(x, y) {
3944    d3_geo_centroidX0 += x;
3945    d3_geo_centroidY0 += y;
3946    ++d3_geo_centroidZ0;
3947  }
3948  function d3_geo_pathCentroidLineStart() {
3949    var x0, y0;
3950    d3_geo_pathCentroid.point = function(x, y) {
3951      d3_geo_pathCentroid.point = nextPoint;
3952      d3_geo_pathCentroidPoint(x0 = x, y0 = y);
3953    };
3954    function nextPoint(x, y) {
3955      var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy);
3956      d3_geo_centroidX1 += z * (x0 + x) / 2;
3957      d3_geo_centroidY1 += z * (y0 + y) / 2;
3958      d3_geo_centroidZ1 += z;
3959      d3_geo_pathCentroidPoint(x0 = x, y0 = y);
3960    }
3961  }
3962  function d3_geo_pathCentroidLineEnd() {
3963    d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;
3964  }
3965  function d3_geo_pathCentroidRingStart() {
3966    var x00, y00, x0, y0;
3967    d3_geo_pathCentroid.point = function(x, y) {
3968      d3_geo_pathCentroid.point = nextPoint;
3969      d3_geo_pathCentroidPoint(x00 = x0 = x, y00 = y0 = y);
3970    };
3971    function nextPoint(x, y) {
3972      var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy);
3973      d3_geo_centroidX1 += z * (x0 + x) / 2;
3974      d3_geo_centroidY1 += z * (y0 + y) / 2;
3975      d3_geo_centroidZ1 += z;
3976      z = y0 * x - x0 * y;
3977      d3_geo_centroidX2 += z * (x0 + x);
3978      d3_geo_centroidY2 += z * (y0 + y);
3979      d3_geo_centroidZ2 += z * 3;
3980      d3_geo_pathCentroidPoint(x0 = x, y0 = y);
3981    }
3982    d3_geo_pathCentroid.lineEnd = function() {
3983      nextPoint(x00, y00);
3984    };
3985  }
3986  function d3_geo_pathContext(context) {
3987    var pointRadius = 4.5;
3988    var stream = {
3989      point: point,
3990      lineStart: function() {
3991        stream.point = pointLineStart;
3992      },
3993      lineEnd: lineEnd,
3994      polygonStart: function() {
3995        stream.lineEnd = lineEndPolygon;
3996      },
3997      polygonEnd: function() {
3998        stream.lineEnd = lineEnd;
3999        stream.point = point;
4000      },
4001      pointRadius: function(_) {
4002        pointRadius = _;
4003        return stream;
4004      },
4005      result: d3_noop
4006    };
4007    function point(x, y) {
4008      context.moveTo(x, y);
4009      context.arc(x, y, pointRadius, 0, τ);
4010    }
4011    function pointLineStart(x, y) {
4012      context.moveTo(x, y);
4013      stream.point = pointLine;
4014    }
4015    function pointLine(x, y) {
4016      context.lineTo(x, y);
4017    }
4018    function lineEnd() {
4019      stream.point = point;
4020    }
4021    function lineEndPolygon() {
4022      context.closePath();
4023    }
4024    return stream;
4025  }
4026  function d3_geo_resample(project) {
4027    var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16;
4028    function resample(stream) {
4029      return (maxDepth ? resampleRecursive : resampleNone)(stream);
4030    }
4031    function resampleNone(stream) {
4032      return d3_geo_transformPoint(stream, function(x, y) {
4033        x = project(x, y);
4034        stream.point(x[0], x[1]);
4035      });
4036    }
4037    function resampleRecursive(stream) {
4038      var λ00, φ00, x00, y00, a00, b00, c00, λ0, x0, y0, a0, b0, c0;
4039      var resample = {
4040        point: point,
4041        lineStart: lineStart,
4042        lineEnd: lineEnd,
4043        polygonStart: function() {
4044          stream.polygonStart();
4045          resample.lineStart = ringStart;
4046        },
4047        polygonEnd: function() {
4048          stream.polygonEnd();
4049          resample.lineStart = lineStart;
4050        }
4051      };
4052      function point(x, y) {
4053        x = project(x, y);
4054        stream.point(x[0], x[1]);
4055      }
4056      function lineStart() {
4057        x0 = NaN;
4058        resample.point = linePoint;
4059        stream.lineStart();
4060      }
4061      function linePoint(λ, φ) {
4062        var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ);
4063        resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);
4064        stream.point(x0, y0);
4065      }
4066      function lineEnd() {
4067        resample.point = point;
4068        stream.lineEnd();
4069      }
4070      function ringStart() {
4071        lineStart();
4072        resample.point = ringPoint;
4073        resample.lineEnd = ringEnd;
4074      }
4075      function ringPoint(λ, φ) {
4076        linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;
4077        resample.point = linePoint;
4078      }
4079      function ringEnd() {
4080        resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream);
4081        resample.lineEnd = lineEnd;
4082        lineEnd();
4083      }
4084      return resample;
4085    }
4086    function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) {
4087      var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;
4088      if (d2 > 4 * δ2 && depth--) {
4089        var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = abs(abs(c) - 1) < ε || abs(λ0 - λ1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2;
4090        if (dz * dz / d2 > δ2 || abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
4091          resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream);
4092          stream.point(x2, y2);
4093          resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream);
4094        }
4095      }
4096    }
4097    resample.precision = function(_) {
4098      if (!arguments.length) return Math.sqrt(δ2);
4099      maxDepth = (δ2 = _ * _) > 0 && 16;
4100      return resample;
4101    };
4102    return resample;
4103  }
4104  d3.geo.path = function() {
4105    var pointRadius = 4.5, projection, context, projectStream, contextStream, cacheStream;
4106    function path(object) {
4107      if (object) {
4108        if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
4109        if (!cacheStream || !cacheStream.valid) cacheStream = projectStream(contextStream);
4110        d3.geo.stream(object, cacheStream);
4111      }
4112      return contextStream.result();
4113    }
4114    path.area = function(object) {
4115      d3_geo_pathAreaSum = 0;
4116      d3.geo.stream(object, projectStream(d3_geo_pathArea));
4117      return d3_geo_pathAreaSum;
4118    };
4119    path.centroid = function(object) {
4120      d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0;
4121      d3.geo.stream(object, projectStream(d3_geo_pathCentroid));
4122      return d3_geo_centroidZ2 ? [ d3_geo_centroidX2 / d3_geo_centroidZ2, d3_geo_centroidY2 / d3_geo_centroidZ2 ] : d3_geo_centroidZ1 ? [ d3_geo_centroidX1 / d3_geo_centroidZ1, d3_geo_centroidY1 / d3_geo_centroidZ1 ] : d3_geo_centroidZ0 ? [ d3_geo_centroidX0 / d3_geo_centroidZ0, d3_geo_centroidY0 / d3_geo_centroidZ0 ] : [ NaN, NaN ];
4123    };
4124    path.bounds = function(object) {
4125      d3_geo_pathBoundsX1 = d3_geo_pathBoundsY1 = -(d3_geo_pathBoundsX0 = d3_geo_pathBoundsY0 = Infinity);
4126      d3.geo.stream(object, projectStream(d3_geo_pathBounds));
4127      return [ [ d3_geo_pathBoundsX0, d3_geo_pathBoundsY0 ], [ d3_geo_pathBoundsX1, d3_geo_pathBoundsY1 ] ];
4128    };
4129    path.projection = function(_) {
4130      if (!arguments.length) return projection;
4131      projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity;
4132      return reset();
4133    };
4134    path.context = function(_) {
4135      if (!arguments.length) return context;
4136      contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_);
4137      if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
4138      return reset();
4139    };
4140    path.pointRadius = function(_) {
4141      if (!arguments.length) return pointRadius;
4142      pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_);
4143      return path;
4144    };
4145    function reset() {
4146      cacheStream = null;
4147      return path;
4148    }
4149    return path.projection(d3.geo.albersUsa()).context(null);
4150  };
4151  function d3_geo_pathProjectStream(project) {
4152    var resample = d3_geo_resample(function(x, y) {
4153      return project([ x * d3_degrees, y * d3_degrees ]);
4154    });
4155    return function(stream) {
4156      return d3_geo_projectionRadians(resample(stream));
4157    };
4158  }
4159  d3.geo.transform = function(methods) {
4160    return {
4161      stream: function(stream) {
4162        var transform = new d3_geo_transform(stream);
4163        for (var k in methods) transform[k] = methods[k];
4164        return transform;
4165      }
4166    };
4167  };
4168  function d3_geo_transform(stream) {
4169    this.stream = stream;
4170  }
4171  d3_geo_transform.prototype = {
4172    point: function(x, y) {
4173      this.stream.point(x, y);
4174    },
4175    sphere: function() {
4176      this.stream.sphere();
4177    },
4178    lineStart: function() {
4179      this.stream.lineStart();
4180    },
4181    lineEnd: function() {
4182      this.stream.lineEnd();
4183    },
4184    polygonStart: function() {
4185      this.stream.polygonStart();
4186    },
4187    polygonEnd: function() {
4188      this.stream.polygonEnd();
4189    }
4190  };
4191  function d3_geo_transformPoint(stream, point) {
4192    return {
4193      point: point,
4194      sphere: function() {
4195        stream.sphere();
4196      },
4197      lineStart: function() {
4198        stream.lineStart();
4199      },
4200      lineEnd: function() {
4201        stream.lineEnd();
4202      },
4203      polygonStart: function() {
4204        stream.polygonStart();
4205      },
4206      polygonEnd: function() {
4207        stream.polygonEnd();
4208      }
4209    };
4210  }
4211  d3.geo.projection = d3_geo_projection;
4212  d3.geo.projectionMutator = d3_geo_projectionMutator;
4213  function d3_geo_projection(project) {
4214    return d3_geo_projectionMutator(function() {
4215      return project;
4216    })();
4217  }
4218  function d3_geo_projectionMutator(projectAt) {
4219    var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) {
4220      x = project(x, y);
4221      return [ x[0] * k + δx, δy - x[1] * k ];
4222    }), k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, preclip = d3_geo_clipAntimeridian, postclip = d3_identity, clipAngle = null, clipExtent = null, stream;
4223    function projection(point) {
4224      point = projectRotate(point[0] * d3_radians, point[1] * d3_radians);
4225      return [ point[0] * k + δx, δy - point[1] * k ];
4226    }
4227    function invert(point) {
4228      point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k);
4229      return point && [ point[0] * d3_degrees, point[1] * d3_degrees ];
4230    }
4231    projection.stream = function(output) {
4232      if (stream) stream.valid = false;
4233      stream = d3_geo_projectionRadians(preclip(rotate, projectResample(postclip(output))));
4234      stream.valid = true;
4235      return stream;
4236    };
4237    projection.clipAngle = function(_) {
4238      if (!arguments.length) return clipAngle;
4239      preclip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle((clipAngle = +_) * d3_radians);
4240      return invalidate();
4241    };
4242    projection.clipExtent = function(_) {
4243      if (!arguments.length) return clipExtent;
4244      clipExtent = _;
4245      postclip = _ ? d3_geo_clipExtent(_[0][0], _[0][1], _[1][0], _[1][1]) : d3_identity;
4246      return invalidate();
4247    };
4248    projection.scale = function(_) {
4249      if (!arguments.length) return k;
4250      k = +_;
4251      return reset();
4252    };
4253    projection.translate = function(_) {
4254      if (!arguments.length) return [ x, y ];
4255      x = +_[0];
4256      y = +_[1];
4257      return reset();
4258    };
4259    projection.center = function(_) {
4260      if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ];
4261      λ = _[0] % 360 * d3_radians;
4262      φ = _[1] % 360 * d3_radians;
4263      return reset();
4264    };
4265    projection.rotate = function(_) {
4266      if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ];
4267      δλ = _[0] % 360 * d3_radians;
4268      δφ = _[1] % 360 * d3_radians;
4269      δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0;
4270      return reset();
4271    };
4272    d3.rebind(projection, projectResample, "precision");
4273    function reset() {
4274      projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project);
4275      var center = project(λ, φ);
4276      δx = x - center[0] * k;
4277      δy = y + center[1] * k;
4278      return invalidate();
4279    }
4280    function invalidate() {
4281      if (stream) stream.valid = false, stream = null;
4282      return projection;
4283    }
4284    return function() {
4285      project = projectAt.apply(this, arguments);
4286      projection.invert = project.invert && invert;
4287      return reset();
4288    };
4289  }
4290  function d3_geo_projectionRadians(stream) {
4291    return d3_geo_transformPoint(stream, function(x, y) {
4292      stream.point(x * d3_radians, y * d3_radians);
4293    });
4294  }
4295  function d3_geo_equirectangular(λ, φ) {
4296    return [ λ, φ ];
4297  }
4298  (d3.geo.equirectangular = function() {
4299    return d3_geo_projection(d3_geo_equirectangular);
4300  }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular;
4301  d3.geo.rotation = function(rotate) {
4302    rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0);
4303    function forward(coordinates) {
4304      coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians);
4305      return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates;
4306    }
4307    forward.invert = function(coordinates) {
4308      coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians);
4309      return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates;
4310    };
4311    return forward;
4312  };
4313  function d3_geo_identityRotation(λ, φ) {
4314    return [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ];
4315  }
4316  d3_geo_identityRotation.invert = d3_geo_equirectangular;
4317  function d3_geo_rotation(δλ, δφ, δγ) {
4318    return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_identityRotation;
4319  }
4320  function d3_geo_forwardRotationλ(δλ) {
4321    return function(λ, φ) {
4322      return λ += δλ, [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ];
4323    };
4324  }
4325  function d3_geo_rotationλ(δλ) {
4326    var rotation = d3_geo_forwardRotationλ(δλ);
4327    rotation.invert = d3_geo_forwardRotationλ(-δλ);
4328    return rotation;
4329  }
4330  function d3_geo_rotationφγ(δφ, δγ) {
4331    var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ);
4332    function rotation(λ, φ) {
4333      var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ;
4334      return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), d3_asin(k * cosδγ + y * sinδγ) ];
4335    }
4336    rotation.invert = function(λ, φ) {
4337      var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ;
4338      return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), d3_asin(k * cosδφ - x * sinδφ) ];
4339    };
4340    return rotation;
4341  }
4342  d3.geo.circle = function() {
4343    var origin = [ 0, 0 ], angle, precision = 6, interpolate;
4344    function circle() {
4345      var center = typeof origin === "function" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = [];
4346      interpolate(null, null, 1, {
4347        point: function(x, y) {
4348          ring.push(x = rotate(x, y));
4349          x[0] *= d3_degrees, x[1] *= d3_degrees;
4350        }
4351      });
4352      return {
4353        type: "Polygon",
4354        coordinates: [ ring ]
4355      };
4356    }
4357    circle.origin = function(x) {
4358      if (!arguments.length) return origin;
4359      origin = x;
4360      return circle;
4361    };
4362    circle.angle = function(x) {
4363      if (!arguments.length) return angle;
4364      interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians);
4365      return circle;
4366    };
4367    circle.precision = function(_) {
4368      if (!arguments.length) return precision;
4369      interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians);
4370      return circle;
4371    };
4372    return circle.angle(90);
4373  };
4374  function d3_geo_circleInterpolate(radius, precision) {
4375    var cr = Math.cos(radius), sr = Math.sin(radius);
4376    return function(from, to, direction, listener) {
4377      var step = direction * precision;
4378      if (from != null) {
4379        from = d3_geo_circleAngle(cr, from);
4380        to = d3_geo_circleAngle(cr, to);
4381        if (direction > 0 ? from < to : from > to) from += direction * τ;
4382      } else {
4383        from = radius + direction * τ;
4384        to = radius - .5 * step;
4385      }
4386      for (var point, t = from; direction > 0 ? t > to : t < to; t -= step) {
4387        listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]);
4388      }
4389    };
4390  }
4391  function d3_geo_circleAngle(cr, point) {
4392    var a = d3_geo_cartesian(point);
4393    a[0] -= cr;
4394    d3_geo_cartesianNormalize(a);
4395    var angle = d3_acos(-a[1]);
4396    return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI);
4397  }
4398  d3.geo.distance = function(a, b) {
4399    var Δλ = (b[0] - a[0]) * d3_radians, φ0 = a[1] * d3_radians, φ1 = b[1] * d3_radians, sinΔλ = Math.sin(Δλ), cosΔλ = Math.cos(Δλ), sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), sinφ1 = Math.sin(φ1), cosφ1 = Math.cos(φ1), t;
4400    return Math.atan2(Math.sqrt((t = cosφ1 * sinΔλ) * t + (t = cosφ0 * sinφ1 - sinφ0 * cosφ1 * cosΔλ) * t), sinφ0 * sinφ1 + cosφ0 * cosφ1 * cosΔλ);
4401  };
4402  d3.geo.graticule = function() {
4403    var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5;
4404    function graticule() {
4405      return {
4406        type: "MultiLineString",
4407        coordinates: lines()
4408      };
4409    }
4410    function lines() {
4411      return d3.range(Math.ceil(X0 / DX) * DX, X1, DX).map(X).concat(d3.range(Math.ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(d3.range(Math.ceil(x0 / dx) * dx, x1, dx).filter(function(x) {
4412        return abs(x % DX) > ε;
4413      }).map(x)).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).filter(function(y) {
4414        return abs(y % DY) > ε;
4415      }).map(y));
4416    }
4417    graticule.lines = function() {
4418      return lines().map(function(coordinates) {
4419        return {
4420          type: "LineString",
4421          coordinates: coordinates
4422        };
4423      });
4424    };
4425    graticule.outline = function() {
4426      return {
4427        type: "Polygon",
4428        coordinates: [ X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ]
4429      };
4430    };
4431    graticule.extent = function(_) {
4432      if (!arguments.length) return graticule.minorExtent();
4433      return graticule.majorExtent(_).minorExtent(_);
4434    };
4435    graticule.majorExtent = function(_) {
4436      if (!arguments.length) return [ [ X0, Y0 ], [ X1, Y1 ] ];
4437      X0 = +_[0][0], X1 = +_[1][0];
4438      Y0 = +_[0][1], Y1 = +_[1][1];
4439      if (X0 > X1) _ = X0, X0 = X1, X1 = _;
4440      if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _;
4441      return graticule.precision(precision);
4442    };
4443    graticule.minorExtent = function(_) {
4444      if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ];
4445      x0 = +_[0][0], x1 = +_[1][0];
4446      y0 = +_[0][1], y1 = +_[1][1];
4447      if (x0 > x1) _ = x0, x0 = x1, x1 = _;
4448      if (y0 > y1) _ = y0, y0 = y1, y1 = _;
4449      return graticule.precision(precision);
4450    };
4451    graticule.step = function(_) {
4452      if (!arguments.length) return graticule.minorStep();
4453      return graticule.majorStep(_).minorStep(_);
4454    };
4455    graticule.majorStep = function(_) {
4456      if (!arguments.length) return [ DX, DY ];
4457      DX = +_[0], DY = +_[1];
4458      return graticule;
4459    };
4460    graticule.minorStep = function(_) {
4461      if (!arguments.length) return [ dx, dy ];
4462      dx = +_[0], dy = +_[1];
4463      return graticule;
4464    };
4465    graticule.precision = function(_) {
4466      if (!arguments.length) return precision;
4467      precision = +_;
4468      x = d3_geo_graticuleX(y0, y1, 90);
4469      y = d3_geo_graticuleY(x0, x1, precision);
4470      X = d3_geo_graticuleX(Y0, Y1, 90);
4471      Y = d3_geo_graticuleY(X0, X1, precision);
4472      return graticule;
4473    };
4474    return graticule.majorExtent([ [ -180, -90 + ε ], [ 180, 90 - ε ] ]).minorExtent([ [ -180, -80 - ε ], [ 180, 80 + ε ] ]);
4475  };
4476  function d3_geo_graticuleX(y0, y1, dy) {
4477    var y = d3.range(y0, y1 - ε, dy).concat(y1);
4478    return function(x) {
4479      return y.map(function(y) {
4480        return [ x, y ];
4481      });
4482    };
4483  }
4484  function d3_geo_graticuleY(x0, x1, dx) {
4485    var x = d3.range(x0, x1 - ε, dx).concat(x1);
4486    return function(y) {
4487      return x.map(function(x) {
4488        return [ x, y ];
4489      });
4490    };
4491  }
4492  function d3_source(d) {
4493    return d.source;
4494  }
4495  function d3_target(d) {
4496    return d.target;
4497  }
4498  d3.geo.greatArc = function() {
4499    var source = d3_source, source_, target = d3_target, target_;
4500    function greatArc() {
4501      return {
4502        type: "LineString",
4503        coordinates: [ source_ || source.apply(this, arguments), target_ || target.apply(this, arguments) ]
4504      };
4505    }
4506    greatArc.distance = function() {
4507      return d3.geo.distance(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments));
4508    };
4509    greatArc.source = function(_) {
4510      if (!arguments.length) return source;
4511      source = _, source_ = typeof _ === "function" ? null : _;
4512      return greatArc;
4513    };
4514    greatArc.target = function(_) {
4515      if (!arguments.length) return target;
4516      target = _, target_ = typeof _ === "function" ? null : _;
4517      return greatArc;
4518    };
4519    greatArc.precision = function() {
4520      return arguments.length ? greatArc : 0;
4521    };
4522    return greatArc;
4523  };
4524  d3.geo.interpolate = function(source, target) {
4525    return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians);
4526  };
4527  function d3_geo_interpolate(x0, y0, x1, y1) {
4528    var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = 2 * Math.asin(Math.sqrt(d3_haversin(y1 - y0) + cy0 * cy1 * d3_haversin(x1 - x0))), k = 1 / Math.sin(d);
4529    var interpolate = d ? function(t) {
4530      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;
4531      return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ];
4532    } : function() {
4533      return [ x0 * d3_degrees, y0 * d3_degrees ];
4534    };
4535    interpolate.distance = d;
4536    return interpolate;
4537  }
4538  d3.geo.length = function(object) {
4539    d3_geo_lengthSum = 0;
4540    d3.geo.stream(object, d3_geo_length);
4541    return d3_geo_lengthSum;
4542  };
4543  var d3_geo_lengthSum;
4544  var d3_geo_length = {
4545    sphere: d3_noop,
4546    point: d3_noop,
4547    lineStart: d3_geo_lengthLineStart,
4548    lineEnd: d3_noop,
4549    polygonStart: d3_noop,
4550    polygonEnd: d3_noop
4551  };
4552  function d3_geo_lengthLineStart() {
4553    var λ0, sinφ0, cosφ0;
4554    d3_geo_length.point = function(λ, φ) {
4555      λ0 = λ * d3_radians, sinφ0 = Math.sin(φ *= d3_radians), cosφ0 = Math.cos(φ);
4556      d3_geo_length.point = nextPoint;
4557    };
4558    d3_geo_length.lineEnd = function() {
4559      d3_geo_length.point = d3_geo_length.lineEnd = d3_noop;
4560    };
4561    function nextPoint(λ, φ) {
4562      var sinφ = Math.sin(φ *= d3_radians), cosφ = Math.cos(φ), t = abs((λ *= d3_radians) - λ0), cosΔλ = Math.cos(t);
4563      d3_geo_lengthSum += Math.atan2(Math.sqrt((t = cosφ * Math.sin(t)) * t + (t = cosφ0 * sinφ - sinφ0 * cosφ * cosΔλ) * t), sinφ0 * sinφ + cosφ0 * cosφ * cosΔλ);
4564      λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ;
4565    }
4566  }
4567  function d3_geo_azimuthal(scale, angle) {
4568    function azimuthal(λ, φ) {
4569      var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ);
4570      return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ];
4571    }
4572    azimuthal.invert = function(x, y) {
4573      var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c);
4574      return [ Math.atan2(x * sinc, ρ * cosc), Math.asin(ρ && y * sinc / ρ) ];
4575    };
4576    return azimuthal;
4577  }
4578  var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) {
4579    return Math.sqrt(2 / (1 + cosλcosφ));
4580  }, function(ρ) {
4581    return 2 * Math.asin(ρ / 2);
4582  });
4583  (d3.geo.azimuthalEqualArea = function() {
4584    return d3_geo_projection(d3_geo_azimuthalEqualArea);
4585  }).raw = d3_geo_azimuthalEqualArea;
4586  var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) {
4587    var c = Math.acos(cosλcosφ);
4588    return c && c / Math.sin(c);
4589  }, d3_identity);
4590  (d3.geo.azimuthalEquidistant = function() {
4591    return d3_geo_projection(d3_geo_azimuthalEquidistant);
4592  }).raw = d3_geo_azimuthalEquidistant;
4593  function d3_geo_conicConformal(φ0, φ1) {
4594    var cosφ0 = Math.cos(φ0), t = function(φ) {
4595      return Math.tan(π / 4 + φ / 2);
4596    }, n = φ0 === φ1 ? Math.sin(φ0) : Math.log(cosφ0 / Math.cos(φ1)) / Math.log(t(φ1) / t(φ0)), F = cosφ0 * Math.pow(t(φ0), n) / n;
4597    if (!n) return d3_geo_mercator;
4598    function forward(λ, φ) {
4599      if (F > 0) {
4600        if (φ < -halfπ + ε) φ = -halfπ + ε;
4601      } else {
4602        if (φ > halfπ - ε) φ = halfπ - ε;
4603      }
4604      var ρ = F / Math.pow(t(φ), n);
4605      return [ ρ * Math.sin(n * λ), F - ρ * Math.cos(n * λ) ];
4606    }
4607    forward.invert = function(x, y) {
4608      var ρ0_y = F - y, ρ = d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y);
4609      return [ Math.atan2(x, ρ0_y) / n, 2 * Math.atan(Math.pow(F / ρ, 1 / n)) - halfπ ];
4610    };
4611    return forward;
4612  }
4613  (d3.geo.conicConformal = function() {
4614    return d3_geo_conic(d3_geo_conicConformal);
4615  }).raw = d3_geo_conicConformal;
4616  function d3_geo_conicEquidistant(φ0, φ1) {
4617    var cosφ0 = Math.cos(φ0), n = φ0 === φ1 ? Math.sin(φ0) : (cosφ0 - Math.cos(φ1)) / (φ1 - φ0), G = cosφ0 / n + φ0;
4618    if (abs(n) < ε) return d3_geo_equirectangular;
4619    function forward(λ, φ) {
4620      var ρ = G - φ;
4621      return [ ρ * Math.sin(n * λ), G - ρ * Math.cos(n * λ) ];
4622    }
4623    forward.invert = function(x, y) {
4624      var ρ0_y = G - y;
4625      return [ Math.atan2(x, ρ0_y) / n, G - d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y) ];
4626    };
4627    return forward;
4628  }
4629  (d3.geo.conicEquidistant = function() {
4630    return d3_geo_conic(d3_geo_conicEquidistant);
4631  }).raw = d3_geo_conicEquidistant;
4632  var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) {
4633    return 1 / cosλcosφ;
4634  }, Math.atan);
4635  (d3.geo.gnomonic = function() {
4636    return d3_geo_projection(d3_geo_gnomonic);
4637  }).raw = d3_geo_gnomonic;
4638  function d3_geo_mercator(λ, φ) {
4639    return [ λ, Math.log(Math.tan(π / 4 + φ / 2)) ];
4640  }
4641  d3_geo_mercator.invert = function(x, y) {
4642    return [ x, 2 * Math.atan(Math.exp(y)) - halfπ ];
4643  };
4644  function d3_geo_mercatorProjection(project) {
4645    var m = d3_geo_projection(project), scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, clipAuto;
4646    m.scale = function() {
4647      var v = scale.apply(m, arguments);
4648      return v === m ? clipAuto ? m.clipExtent(null) : m : v;
4649    };
4650    m.translate = function() {
4651      var v = translate.apply(m, arguments);
4652      return v === m ? clipAuto ? m.clipExtent(null) : m : v;
4653    };
4654    m.clipExtent = function(_) {
4655      var v = clipExtent.apply(m, arguments);
4656      if (v === m) {
4657        if (clipAuto = _ == null) {
4658          var k = π * scale(), t = translate();
4659          clipExtent([ [ t[0] - k, t[1] - k ], [ t[0] + k, t[1] + k ] ]);
4660        }
4661      } else if (clipAuto) {
4662        v = null;
4663      }
4664      return v;
4665    };
4666    return m.clipExtent(null);
4667  }
4668  (d3.geo.mercator = function() {
4669    return d3_geo_mercatorProjection(d3_geo_mercator);
4670  }).raw = d3_geo_mercator;
4671  var d3_geo_orthographic = d3_geo_azimuthal(function() {
4672    return 1;
4673  }, Math.asin);
4674  (d3.geo.orthographic = function() {
4675    return d3_geo_projection(d3_geo_orthographic);
4676  }).raw = d3_geo_orthographic;
4677  var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) {
4678    return 1 / (1 + cosλcosφ);
4679  }, function(ρ) {
4680    return 2 * Math.atan(ρ);
4681  });
4682  (d3.geo.stereographic = function() {
4683    return d3_geo_projection(d3_geo_stereographic);
4684  }).raw = d3_geo_stereographic;
4685  function d3_geo_transverseMercator(λ, φ) {
4686    return [ Math.log(Math.tan(π / 4 + φ / 2)), -λ ];
4687  }
4688  d3_geo_transverseMercator.invert = function(x, y) {
4689    return [ -y, 2 * Math.atan(Math.exp(x)) - halfπ ];
4690  };
4691  (d3.geo.transverseMercator = function() {
4692    var projection = d3_geo_mercatorProjection(d3_geo_transverseMercator), center = projection.center, rotate = projection.rotate;
4693    projection.center = function(_) {
4694      return _ ? center([ -_[1], _[0] ]) : (_ = center(), [ -_[1], _[0] ]);
4695    };
4696    projection.rotate = function(_) {
4697      return _ ? rotate([ _[0], _[1], _.length > 2 ? _[2] + 90 : 90 ]) : (_ = rotate(),
4698      [ _[0], _[1], _[2] - 90 ]);
4699    };
4700    return projection.rotate([ 0, 0 ]);
4701  }).raw = d3_geo_transverseMercator;
4702  d3.geom = {};
4703  function d3_geom_pointX(d) {
4704    return d[0];
4705  }
4706  function d3_geom_pointY(d) {
4707    return d[1];
4708  }
4709  d3.geom.hull = function(vertices) {
4710    var x = d3_geom_pointX, y = d3_geom_pointY;
4711    if (arguments.length) return hull(vertices);
4712    function hull(data) {
4713      if (data.length < 3) return [];
4714      var fx = d3_functor(x), fy = d3_functor(y), i, n = data.length, points = [], flippedPoints = [];
4715      for (i = 0; i < n; i++) {
4716        points.push([ +fx.call(this, data[i], i), +fy.call(this, data[i], i), i ]);
4717      }
4718      points.sort(d3_geom_hullOrder);
4719      for (i = 0; i < n; i++) flippedPoints.push([ points[i][0], -points[i][1] ]);
4720      var upper = d3_geom_hullUpper(points), lower = d3_geom_hullUpper(flippedPoints);
4721      var skipLeft = lower[0] === upper[0], skipRight = lower[lower.length - 1] === upper[upper.length - 1], polygon = [];
4722      for (i = upper.length - 1; i >= 0; --i) polygon.push(data[points[upper[i]][2]]);
4723      for (i = +skipLeft; i < lower.length - skipRight; ++i) polygon.push(data[points[lower[i]][2]]);
4724      return polygon;
4725    }
4726    hull.x = function(_) {
4727      return arguments.length ? (x = _, hull) : x;
4728    };
4729    hull.y = function(_) {
4730      return arguments.length ? (y = _, hull) : y;
4731    };
4732    return hull;
4733  };
4734  function d3_geom_hullUpper(points) {
4735    var n = points.length, hull = [ 0, 1 ], hs = 2;
4736    for (var i = 2; i < n; i++) {
4737      while (hs > 1 && d3_cross2d(points[hull[hs - 2]], points[hull[hs - 1]], points[i]) <= 0) --hs;
4738      hull[hs++] = i;
4739    }
4740    return hull.slice(0, hs);
4741  }
4742  function d3_geom_hullOrder(a, b) {
4743    return a[0] - b[0] || a[1] - b[1];
4744  }
4745  d3.geom.polygon = function(coordinates) {
4746    d3_subclass(coordinates, d3_geom_polygonPrototype);
4747    return coordinates;
4748  };
4749  var d3_geom_polygonPrototype = d3.geom.polygon.prototype = [];
4750  d3_geom_polygonPrototype.area = function() {
4751    var i = -1, n = this.length, a, b = this[n - 1], area = 0;
4752    while (++i < n) {
4753      a = b;
4754      b = this[i];
4755      area += a[1] * b[0] - a[0] * b[1];
4756    }
4757    return area * .5;
4758  };
4759  d3_geom_polygonPrototype.centroid = function(k) {
4760    var i = -1, n = this.length, x = 0, y = 0, a, b = this[n - 1], c;
4761    if (!arguments.length) k = -1 / (6 * this.area());
4762    while (++i < n) {
4763      a = b;
4764      b = this[i];
4765      c = a[0] * b[1] - b[0] * a[1];
4766      x += (a[0] + b[0]) * c;
4767      y += (a[1] + b[1]) * c;
4768    }
4769    return [ x * k, y * k ];
4770  };
4771  d3_geom_polygonPrototype.clip = function(subject) {
4772    var input, closed = d3_geom_polygonClosed(subject), i = -1, n = this.length - d3_geom_polygonClosed(this), j, m, a = this[n - 1], b, c, d;
4773    while (++i < n) {
4774      input = subject.slice();
4775      subject.length = 0;
4776      b = this[i];
4777      c = input[(m = input.length - closed) - 1];
4778      j = -1;
4779      while (++j < m) {
4780        d = input[j];
4781        if (d3_geom_polygonInside(d, a, b)) {
4782          if (!d3_geom_polygonInside(c, a, b)) {
4783            subject.push(d3_geom_polygonIntersect(c, d, a, b));
4784          }
4785          subject.push(d);
4786        } else if (d3_geom_polygonInside(c, a, b)) {
4787          subject.push(d3_geom_polygonIntersect(c, d, a, b));
4788        }
4789        c = d;
4790      }
4791      if (closed) subject.push(subject[0]);
4792      a = b;
4793    }
4794    return subject;
4795  };
4796  function d3_geom_polygonInside(p, a, b) {
4797    return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
4798  }
4799  function d3_geom_polygonIntersect(c, d, a, b) {
4800    var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21);
4801    return [ x1 + ua * x21, y1 + ua * y21 ];
4802  }
4803  function d3_geom_polygonClosed(coordinates) {
4804    var a = coordinates[0], b = coordinates[coordinates.length - 1];
4805    return !(a[0] - b[0] || a[1] - b[1]);
4806  }
4807  var d3_geom_voronoiEdges, d3_geom_voronoiCells, d3_geom_voronoiBeaches, d3_geom_voronoiBeachPool = [], d3_geom_voronoiFirstCircle, d3_geom_voronoiCircles, d3_geom_voronoiCirclePool = [];
4808  function d3_geom_voronoiBeach() {
4809    d3_geom_voronoiRedBlackNode(this);
4810    this.edge = this.site = this.circle = null;
4811  }
4812  function d3_geom_voronoiCreateBeach(site) {
4813    var beach = d3_geom_voronoiBeachPool.pop() || new d3_geom_voronoiBeach();
4814    beach.site = site;
4815    return beach;
4816  }
4817  function d3_geom_voronoiDetachBeach(beach) {
4818    d3_geom_voronoiDetachCircle(beach);
4819    d3_geom_voronoiBeaches.remove(beach);
4820    d3_geom_voronoiBeachPool.push(beach);
4821    d3_geom_voronoiRedBlackNode(beach);
4822  }
4823  function d3_geom_voronoiRemoveBeach(beach) {
4824    var circle = beach.circle, x = circle.x, y = circle.cy, vertex = {
4825      x: x,
4826      y: y
4827    }, previous = beach.P, next = beach.N, disappearing = [ beach ];
4828    d3_geom_voronoiDetachBeach(beach);
4829    var lArc = previous;
4830    while (lArc.circle && abs(x - lArc.circle.x) < ε && abs(y - lArc.circle.cy) < ε) {
4831      previous = lArc.P;
4832      disappearing.unshift(lArc);
4833      d3_geom_voronoiDetachBeach(lArc);
4834      lArc = previous;
4835    }
4836    disappearing.unshift(lArc);
4837    d3_geom_voronoiDetachCircle(lArc);
4838    var rArc = next;
4839    while (rArc.circle && abs(x - rArc.circle.x) < ε && abs(y - rArc.circle.cy) < ε) {
4840      next = rArc.N;
4841      disappearing.push(rArc);
4842      d3_geom_voronoiDetachBeach(rArc);
4843      rArc = next;
4844    }
4845    disappearing.push(rArc);
4846    d3_geom_voronoiDetachCircle(rArc);
4847    var nArcs = disappearing.length, iArc;
4848    for (iArc = 1; iArc < nArcs; ++iArc) {
4849      rArc = disappearing[iArc];
4850      lArc = disappearing[iArc - 1];
4851      d3_geom_voronoiSetEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex);
4852    }
4853    lArc = disappearing[0];
4854    rArc = disappearing[nArcs - 1];
4855    rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, rArc.site, null, vertex);
4856    d3_geom_voronoiAttachCircle(lArc);
4857    d3_geom_voronoiAttachCircle(rArc);
4858  }
4859  function d3_geom_voronoiAddBeach(site) {
4860    var x = site.x, directrix = site.y, lArc, rArc, dxl, dxr, node = d3_geom_voronoiBeaches._;
4861    while (node) {
4862      dxl = d3_geom_voronoiLeftBreakPoint(node, directrix) - x;
4863      if (dxl > ε) node = node.L; else {
4864        dxr = x - d3_geom_voronoiRightBreakPoint(node, directrix);
4865        if (dxr > ε) {
4866          if (!node.R) {
4867            lArc = node;
4868            break;
4869          }
4870          node = node.R;
4871        } else {
4872          if (dxl > -ε) {
4873            lArc = node.P;
4874            rArc = node;
4875          } else if (dxr > -ε) {
4876            lArc = node;
4877            rArc = node.N;
4878          } else {
4879            lArc = rArc = node;
4880          }
4881          break;
4882        }
4883      }
4884    }
4885    var newArc = d3_geom_voronoiCreateBeach(site);
4886    d3_geom_voronoiBeaches.insert(lArc, newArc);
4887    if (!lArc && !rArc) return;
4888    if (lArc === rArc) {
4889      d3_geom_voronoiDetachCircle(lArc);
4890      rArc = d3_geom_voronoiCreateBeach(lArc.site);
4891      d3_geom_voronoiBeaches.insert(newArc, rArc);
4892      newArc.edge = rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site);
4893      d3_geom_voronoiAttachCircle(lArc);
4894      d3_geom_voronoiAttachCircle(rArc);
4895      return;
4896    }
4897    if (!rArc) {
4898      newArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site);
4899      return;
4900    }
4901    d3_geom_voronoiDetachCircle(lArc);
4902    d3_geom_voronoiDetachCircle(rArc);
4903    var lSite = lArc.site, ax = lSite.x, ay = lSite.y, bx = site.x - ax, by = site.y - ay, rSite = rArc.site, cx = rSite.x - ax, cy = rSite.y - ay, d = 2 * (bx * cy - by * cx), hb = bx * bx + by * by, hc = cx * cx + cy * cy, vertex = {
4904      x: (cy * hb - by * hc) / d + ax,
4905      y: (bx * hc - cx * hb) / d + ay
4906    };
4907    d3_geom_voronoiSetEdgeEnd(rArc.edge, lSite, rSite, vertex);
4908    newArc.edge = d3_geom_voronoiCreateEdge(lSite, site, null, vertex);
4909    rArc.edge = d3_geom_voronoiCreateEdge(site, rSite, null, vertex);
4910    d3_geom_voronoiAttachCircle(lArc);
4911    d3_geom_voronoiAttachCircle(rArc);
4912  }
4913  function d3_geom_voronoiLeftBreakPoint(arc, directrix) {
4914    var site = arc.site, rfocx = site.x, rfocy = site.y, pby2 = rfocy - directrix;
4915    if (!pby2) return rfocx;
4916    var lArc = arc.P;
4917    if (!lArc) return -Infinity;
4918    site = lArc.site;
4919    var lfocx = site.x, lfocy = site.y, plby2 = lfocy - directrix;
4920    if (!plby2) return lfocx;
4921    var hl = lfocx - rfocx, aby2 = 1 / pby2 - 1 / plby2, b = hl / plby2;
4922    if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx;
4923    return (rfocx + lfocx) / 2;
4924  }
4925  function d3_geom_voronoiRightBreakPoint(arc, directrix) {
4926    var rArc = arc.N;
4927    if (rArc) return d3_geom_voronoiLeftBreakPoint(rArc, directrix);
4928    var site = arc.site;
4929    return site.y === directrix ? site.x : Infinity;
4930  }
4931  function d3_geom_voronoiCell(site) {
4932    this.site = site;
4933    this.edges = [];
4934  }
4935  d3_geom_voronoiCell.prototype.prepare = function() {
4936    var halfEdges = this.edges, iHalfEdge = halfEdges.length, edge;
4937    while (iHalfEdge--) {
4938      edge = halfEdges[iHalfEdge].edge;
4939      if (!edge.b || !edge.a) halfEdges.splice(iHalfEdge, 1);
4940    }
4941    halfEdges.sort(d3_geom_voronoiHalfEdgeOrder);
4942    return halfEdges.length;
4943  };
4944  function d3_geom_voronoiCloseCells(extent) {
4945    var x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], x2, y2, x3, y3, cells = d3_geom_voronoiCells, iCell = cells.length, cell, iHalfEdge, halfEdges, nHalfEdges, start, end;
4946    while (iCell--) {
4947      cell = cells[iCell];
4948      if (!cell || !cell.prepare()) continue;
4949      halfEdges = cell.edges;
4950      nHalfEdges = halfEdges.length;
4951      iHalfEdge = 0;
4952      while (iHalfEdge < nHalfEdges) {
4953        end = halfEdges[iHalfEdge].end(), x3 = end.x, y3 = end.y;
4954        start = halfEdges[++iHalfEdge % nHalfEdges].start(), x2 = start.x, y2 = start.y;
4955        if (abs(x3 - x2) > ε || abs(y3 - y2) > ε) {
4956          halfEdges.splice(iHalfEdge, 0, new d3_geom_voronoiHalfEdge(d3_geom_voronoiCreateBorderEdge(cell.site, end, abs(x3 - x0) < ε && y1 - y3 > ε ? {
4957            x: x0,
4958            y: abs(x2 - x0) < ε ? y2 : y1
4959          } : abs(y3 - y1) < ε && x1 - x3 > ε ? {
4960            x: abs(y2 - y1) < ε ? x2 : x1,
4961            y: y1
4962          } : abs(x3 - x1) < ε && y3 - y0 > ε ? {
4963            x: x1,
4964            y: abs(x2 - x1) < ε ? y2 : y0
4965          } : abs(y3 - y0) < ε && x3 - x0 > ε ? {
4966            x: abs(y2 - y0) < ε ? x2 : x0,
4967            y: y0
4968          } : null), cell.site, null));
4969          ++nHalfEdges;
4970        }
4971      }
4972    }
4973  }
4974  function d3_geom_voronoiHalfEdgeOrder(a, b) {
4975    return b.angle - a.angle;
4976  }
4977  function d3_geom_voronoiCircle() {
4978    d3_geom_voronoiRedBlackNode(this);
4979    this.x = this.y = this.arc = this.site = this.cy = null;
4980  }
4981  function d3_geom_voronoiAttachCircle(arc) {
4982    var lArc = arc.P, rArc = arc.N;
4983    if (!lArc || !rArc) return;
4984    var lSite = lArc.site, cSite = arc.site, rSite = rArc.site;
4985    if (lSite === rSite) return;
4986    var bx = cSite.x, by = cSite.y, ax = lSite.x - bx, ay = lSite.y - by, cx = rSite.x - bx, cy = rSite.y - by;
4987    var d = 2 * (ax * cy - ay * cx);
4988    if (d >= -ε2) return;
4989    var ha = ax * ax + ay * ay, hc = cx * cx + cy * cy, x = (cy * ha - ay * hc) / d, y = (ax * hc - cx * ha) / d, cy = y + by;
4990    var circle = d3_geom_voronoiCirclePool.pop() || new d3_geom_voronoiCircle();
4991    circle.arc = arc;
4992    circle.site = cSite;
4993    circle.x = x + bx;
4994    circle.y = cy + Math.sqrt(x * x + y * y);
4995    circle.cy = cy;
4996    arc.circle = circle;
4997    var before = null, node = d3_geom_voronoiCircles._;
4998    while (node) {
4999      if (circle.y < node.y || circle.y === node.y && circle.x <= node.x) {
5000        if (node.L) node = node.L; else {
5001          before = node.P;
5002          break;
5003        }
5004      } else {
5005        if (node.R) node = node.R; else {
5006          before = node;
5007          break;
5008        }
5009      }
5010    }
5011    d3_geom_voronoiCircles.insert(before, circle);
5012    if (!before) d3_geom_voronoiFirstCircle = circle;
5013  }
5014  function d3_geom_voronoiDetachCircle(arc) {
5015    var circle = arc.circle;
5016    if (circle) {
5017      if (!circle.P) d3_geom_voronoiFirstCircle = circle.N;
5018      d3_geom_voronoiCircles.remove(circle);
5019      d3_geom_voronoiCirclePool.push(circle);
5020      d3_geom_voronoiRedBlackNode(circle);
5021      arc.circle = null;
5022    }
5023  }
5024  function d3_geom_voronoiClipEdges(extent) {
5025    var edges = d3_geom_voronoiEdges, clip = d3_geom_clipLine(extent[0][0], extent[0][1], extent[1][0], extent[1][1]), i = edges.length, e;
5026    while (i--) {
5027      e = edges[i];
5028      if (!d3_geom_voronoiConnectEdge(e, extent) || !clip(e) || abs(e.a.x - e.b.x) < ε && abs(e.a.y - e.b.y) < ε) {
5029        e.a = e.b = null;
5030        edges.splice(i, 1);
5031      }
5032    }
5033  }
5034  function d3_geom_voronoiConnectEdge(edge, extent) {
5035    var vb = edge.b;
5036    if (vb) return true;
5037    var va = edge.a, x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], lSite = edge.l, rSite = edge.r, lx = lSite.x, ly = lSite.y, rx = rSite.x, ry = rSite.y, fx = (lx + rx) / 2, fy = (ly + ry) / 2, fm, fb;
5038    if (ry === ly) {
5039      if (fx < x0 || fx >= x1) return;
5040      if (lx > rx) {
5041        if (!va) va = {
5042          x: fx,
5043          y: y0
5044        }; else if (va.y >= y1) return;
5045        vb = {
5046          x: fx,
5047          y: y1
5048        };
5049      } else {
5050        if (!va) va = {
5051          x: fx,
5052          y: y1
5053        }; else if (va.y < y0) return;
5054        vb = {
5055          x: fx,
5056          y: y0
5057        };
5058      }
5059    } else {
5060      fm = (lx - rx) / (ry - ly);
5061      fb = fy - fm * fx;
5062      if (fm < -1 || fm > 1) {
5063        if (lx > rx) {
5064          if (!va) va = {
5065            x: (y0 - fb) / fm,
5066            y: y0
5067          }; else if (va.y >= y1) return;
5068          vb = {
5069            x: (y1 - fb) / fm,
5070            y: y1
5071          };
5072        } else {
5073          if (!va) va = {
5074            x: (y1 - fb) / fm,
5075            y: y1
5076          }; else if (va.y < y0) return;
5077          vb = {
5078            x: (y0 - fb) / fm,
5079            y: y0
5080          };
5081        }
5082      } else {
5083        if (ly < ry) {
5084          if (!va) va = {
5085            x: x0,
5086            y: fm * x0 + fb
5087          }; else if (va.x >= x1) return;
5088          vb = {
5089            x: x1,
5090            y: fm * x1 + fb
5091          };
5092        } else {
5093          if (!va) va = {
5094            x: x1,
5095            y: fm * x1 + fb
5096          }; else if (va.x < x0) return;
5097          vb = {
5098            x: x0,
5099            y: fm * x0 + fb
5100          };
5101        }
5102      }
5103    }
5104    edge.a = va;
5105    edge.b = vb;
5106    return true;
5107  }
5108  function d3_geom_voronoiEdge(lSite, rSite) {
5109    this.l = lSite;
5110    this.r = rSite;
5111    this.a = this.b = null;
5112  }
5113  function d3_geom_voronoiCreateEdge(lSite, rSite, va, vb) {
5114    var edge = new d3_geom_voronoiEdge(lSite, rSite);
5115    d3_geom_voronoiEdges.push(edge);
5116    if (va) d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, va);
5117    if (vb) d3_geom_voronoiSetEdgeEnd(edge, rSite, lSite, vb);
5118    d3_geom_voronoiCells[lSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, lSite, rSite));
5119    d3_geom_voronoiCells[rSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, rSite, lSite));
5120    return edge;
5121  }
5122  function d3_geom_voronoiCreateBorderEdge(lSite, va, vb) {
5123    var edge = new d3_geom_voronoiEdge(lSite, null);
5124    edge.a = va;
5125    edge.b = vb;
5126    d3_geom_voronoiEdges.push(edge);
5127    return edge;
5128  }
5129  function d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, vertex) {
5130    if (!edge.a && !edge.b) {
5131      edge.a = vertex;
5132      edge.l = lSite;
5133      edge.r = rSite;
5134    } else if (edge.l === rSite) {
5135      edge.b = vertex;
5136    } else {
5137      edge.a = vertex;
5138    }
5139  }
5140  function d3_geom_voronoiHalfEdge(edge, lSite, rSite) {
5141    var va = edge.a, vb = edge.b;
5142    this.edge = edge;
5143    this.site = lSite;
5144    this.angle = rSite ? Math.atan2(rSite.y - lSite.y, rSite.x - lSite.x) : edge.l === lSite ? Math.atan2(vb.x - va.x, va.y - vb.y) : Math.atan2(va.x - vb.x, vb.y - va.y);
5145  }
5146  d3_geom_voronoiHalfEdge.prototype = {
5147    start: function() {
5148      return this.edge.l === this.site ? this.edge.a : this.edge.b;
5149    },
5150    end: function() {
5151      return this.edge.l === this.site ? this.edge.b : this.edge.a;
5152    }
5153  };
5154  function d3_geom_voronoiRedBlackTree() {
5155    this._ = null;
5156  }
5157  function d3_geom_voronoiRedBlackNode(node) {
5158    node.U = node.C = node.L = node.R = node.P = node.N = null;
5159  }
5160  d3_geom_voronoiRedBlackTree.prototype = {
5161    insert: function(after, node) {
5162      var parent, grandpa, uncle;
5163      if (after) {
5164        node.P = after;
5165        node.N = after.N;
5166        if (after.N) after.N.P = node;
5167        after.N = node;
5168        if (after.R) {
5169          after = after.R;
5170          while (after.L) after = after.L;
5171          after.L = node;
5172        } else {
5173          after.R = node;
5174        }
5175        parent = after;
5176      } else if (this._) {
5177        after = d3_geom_voronoiRedBlackFirst(this._);
5178        node.P = null;
5179        node.N = after;
5180        after.P = after.L = node;
5181        parent = after;
5182      } else {
5183        node.P = node.N = null;
5184        this._ = node;
5185        parent = null;
5186      }
5187      node.L = node.R = null;
5188      node.U = parent;
5189      node.C = true;
5190      after = node;
5191      while (parent && parent.C) {
5192        grandpa = parent.U;
5193        if (parent === grandpa.L) {
5194          uncle = grandpa.R;
5195          if (uncle && uncle.C) {
5196            parent.C = uncle.C = false;
5197            grandpa.C = true;
5198            after = grandpa;
5199          } else {
5200            if (after === parent.R) {
5201              d3_geom_voronoiRedBlackRotateLeft(this, parent);
5202              after = parent;
5203              parent = after.U;
5204            }
5205            parent.C = false;
5206            grandpa.C = true;
5207            d3_geom_voronoiRedBlackRotateRight(this, grandpa);
5208          }
5209        } else {
5210          uncle = grandpa.L;
5211          if (uncle && uncle.C) {
5212            parent.C = uncle.C = false;
5213            grandpa.C = true;
5214            after = grandpa;
5215          } else {
5216            if (after === parent.L) {
5217              d3_geom_voronoiRedBlackRotateRight(this, parent);
5218              after = parent;
5219              parent = after.U;
5220            }
5221            parent.C = false;
5222            grandpa.C = true;
5223            d3_geom_voronoiRedBlackRotateLeft(this, grandpa);
5224          }
5225        }
5226        parent = after.U;
5227      }
5228      this._.C = false;
5229    },
5230    remove: function(node) {
5231      if (node.N) node.N.P = node.P;
5232      if (node.P) node.P.N = node.N;
5233      node.N = node.P = null;
5234      var parent = node.U, sibling, left = node.L, right = node.R, next, red;
5235      if (!left) next = right; else if (!right) next = left; else next = d3_geom_voronoiRedBlackFirst(right);
5236      if (parent) {
5237        if (parent.L === node) parent.L = next; else parent.R = next;
5238      } else {
5239        this._ = next;
5240      }
5241      if (left && right) {
5242        red = next.C;
5243        next.C = node.C;
5244        next.L = left;
5245        left.U = next;
5246        if (next !== right) {
5247          parent = next.U;
5248          next.U = node.U;
5249          node = next.R;
5250          parent.L = node;
5251          next.R = right;
5252          right.U = next;
5253        } else {
5254          next.U = parent;
5255          parent = next;
5256          node = next.R;
5257        }
5258      } else {
5259        red = node.C;
5260        node = next;
5261      }
5262      if (node) node.U = parent;
5263      if (red) return;
5264      if (node && node.C) {
5265        node.C = false;
5266        return;
5267      }
5268      do {
5269        if (node === this._) break;
5270        if (node === parent.L) {
5271          sibling = parent.R;
5272          if (sibling.C) {
5273            sibling.C = false;
5274            parent.C = true;
5275            d3_geom_voronoiRedBlackRotateLeft(this, parent);
5276            sibling = parent.R;
5277          }
5278          if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) {
5279            if (!sibling.R || !sibling.R.C) {
5280              sibling.L.C = false;
5281              sibling.C = true;
5282              d3_geom_voronoiRedBlackRotateRight(this, sibling);
5283              sibling = parent.R;
5284            }
5285            sibling.C = parent.C;
5286            parent.C = sibling.R.C = false;
5287            d3_geom_voronoiRedBlackRotateLeft(this, parent);
5288            node = this._;
5289            break;
5290          }
5291        } else {
5292          sibling = parent.L;
5293          if (sibling.C) {
5294            sibling.C = false;
5295            parent.C = true;
5296            d3_geom_voronoiRedBlackRotateRight(this, parent);
5297            sibling = parent.L;
5298          }
5299          if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) {
5300            if (!sibling.L || !sibling.L.C) {
5301              sibling.R.C = false;
5302              sibling.C = true;
5303              d3_geom_voronoiRedBlackRotateLeft(this, sibling);
5304              sibling = parent.L;
5305            }
5306            sibling.C = parent.C;
5307            parent.C = sibling.L.C = false;
5308            d3_geom_voronoiRedBlackRotateRight(this, parent);
5309            node = this._;
5310            break;
5311          }
5312        }
5313        sibling.C = true;
5314        node = parent;
5315        parent = parent.U;
5316      } while (!node.C);
5317      if (node) node.C = false;
5318    }
5319  };
5320  function d3_geom_voronoiRedBlackRotateLeft(tree, node) {
5321    var p = node, q = node.R, parent = p.U;
5322    if (parent) {
5323      if (parent.L === p) parent.L = q; else parent.R = q;
5324    } else {
5325      tree._ = q;
5326    }
5327    q.U = parent;
5328    p.U = q;
5329    p.R = q.L;
5330    if (p.R) p.R.U = p;
5331    q.L = p;
5332  }
5333  function d3_geom_voronoiRedBlackRotateRight(tree, node) {
5334    var p = node, q = node.L, parent = p.U;
5335    if (parent) {
5336      if (parent.L === p) parent.L = q; else parent.R = q;
5337    } else {
5338      tree._ = q;
5339    }
5340    q.U = parent;
5341    p.U = q;
5342    p.L = q.R;
5343    if (p.L) p.L.U = p;
5344    q.R = p;
5345  }
5346  function d3_geom_voronoiRedBlackFirst(node) {
5347    while (node.L) node = node.L;
5348    return node;
5349  }
5350  function d3_geom_voronoi(sites, bbox) {
5351    var site = sites.sort(d3_geom_voronoiVertexOrder).pop(), x0, y0, circle;
5352    d3_geom_voronoiEdges = [];
5353    d3_geom_voronoiCells = new Array(sites.length);
5354    d3_geom_voronoiBeaches = new d3_geom_voronoiRedBlackTree();
5355    d3_geom_voronoiCircles = new d3_geom_voronoiRedBlackTree();
5356    while (true) {
5357      circle = d3_geom_voronoiFirstCircle;
5358      if (site && (!circle || site.y < circle.y || site.y === circle.y && site.x < circle.x)) {
5359        if (site.x !== x0 || site.y !== y0) {
5360          d3_geom_voronoiCells[site.i] = new d3_geom_voronoiCell(site);
5361          d3_geom_voronoiAddBeach(site);
5362          x0 = site.x, y0 = site.y;
5363        }
5364        site = sites.pop();
5365      } else if (circle) {
5366        d3_geom_voronoiRemoveBeach(circle.arc);
5367      } else {
5368        break;
5369      }
5370    }
5371    if (bbox) d3_geom_voronoiClipEdges(bbox), d3_geom_voronoiCloseCells(bbox);
5372    var diagram = {
5373      cells: d3_geom_voronoiCells,
5374      edges: d3_geom_voronoiEdges
5375    };
5376    d3_geom_voronoiBeaches = d3_geom_voronoiCircles = d3_geom_voronoiEdges = d3_geom_voronoiCells = null;
5377    return diagram;
5378  }
5379  function d3_geom_voronoiVertexOrder(a, b) {
5380    return b.y - a.y || b.x - a.x;
5381  }
5382  d3.geom.voronoi = function(points) {
5383    var x = d3_geom_pointX, y = d3_geom_pointY, fx = x, fy = y, clipExtent = d3_geom_voronoiClipExtent;
5384    if (points) return voronoi(points);
5385    function voronoi(data) {
5386      var polygons = new Array(data.length), x0 = clipExtent[0][0], y0 = clipExtent[0][1], x1 = clipExtent[1][0], y1 = clipExtent[1][1];
5387      d3_geom_voronoi(sites(data), clipExtent).cells.forEach(function(cell, i) {
5388        var edges = cell.edges, site = cell.site, polygon = polygons[i] = edges.length ? edges.map(function(e) {
5389          var s = e.start();
5390          return [ s.x, s.y ];
5391        }) : site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1 ? [ [ x0, y1 ], [ x1, y1 ], [ x1, y0 ], [ x0, y0 ] ] : [];
5392        polygon.point = data[i];
5393      });
5394      return polygons;
5395    }
5396    function sites(data) {
5397      return data.map(function(d, i) {
5398        return {
5399          x: Math.round(fx(d, i) / ε) * ε,
5400          y: Math.round(fy(d, i) / ε) * ε,
5401          i: i
5402        };
5403      });
5404    }
5405    voronoi.links = function(data) {
5406      return d3_geom_voronoi(sites(data)).edges.filter(function(edge) {
5407        return edge.l && edge.r;
5408      }).map(function(edge) {
5409        return {
5410          source: data[edge.l.i],
5411          target: data[edge.r.i]
5412        };
5413      });
5414    };
5415    voronoi.triangles = function(data) {
5416      var triangles = [];
5417      d3_geom_voronoi(sites(data)).cells.forEach(function(cell, i) {
5418        var site = cell.site, edges = cell.edges.sort(d3_geom_voronoiHalfEdgeOrder), j = -1, m = edges.length, e0, s0, e1 = edges[m - 1].edge, s1 = e1.l === site ? e1.r : e1.l;
5419        while (++j < m) {
5420          e0 = e1;
5421          s0 = s1;
5422          e1 = edges[j].edge;
5423          s1 = e1.l === site ? e1.r : e1.l;
5424          if (i < s0.i && i < s1.i && d3_geom_voronoiTriangleArea(site, s0, s1) < 0) {
5425            triangles.push([ data[i], data[s0.i], data[s1.i] ]);
5426          }
5427        }
5428      });
5429      return triangles;
5430    };
5431    voronoi.x = function(_) {
5432      return arguments.length ? (fx = d3_functor(x = _), voronoi) : x;
5433    };
5434    voronoi.y = function(_) {
5435      return arguments.length ? (fy = d3_functor(y = _), voronoi) : y;
5436    };
5437    voronoi.clipExtent = function(_) {
5438      if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent;
5439      clipExtent = _ == null ? d3_geom_voronoiClipExtent : _;
5440      return voronoi;
5441    };
5442    voronoi.size = function(_) {
5443      if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent && clipExtent[1];
5444      return voronoi.clipExtent(_ && [ [ 0, 0 ], _ ]);
5445    };
5446    return voronoi;
5447  };
5448  var d3_geom_voronoiClipExtent = [ [ -1e6, -1e6 ], [ 1e6, 1e6 ] ];
5449  function d3_geom_voronoiTriangleArea(a, b, c) {
5450    return (a.x - c.x) * (b.y - a.y) - (a.x - b.x) * (c.y - a.y);
5451  }
5452  d3.geom.delaunay = function(vertices) {
5453    return d3.geom.voronoi().triangles(vertices);
5454  };
5455  d3.geom.quadtree = function(points, x1, y1, x2, y2) {
5456    var x = d3_geom_pointX, y = d3_geom_pointY, compat;
5457    if (compat = arguments.length) {
5458      x = d3_geom_quadtreeCompatX;
5459      y = d3_geom_quadtreeCompatY;
5460      if (compat === 3) {
5461        y2 = y1;
5462        x2 = x1;
5463        y1 = x1 = 0;
5464      }
5465      return quadtree(points);
5466    }
5467    function quadtree(data) {
5468      var d, fx = d3_functor(x), fy = d3_functor(y), xs, ys, i, n, x1_, y1_, x2_, y2_;
5469      if (x1 != null) {
5470        x1_ = x1, y1_ = y1, x2_ = x2, y2_ = y2;
5471      } else {
5472        x2_ = y2_ = -(x1_ = y1_ = Infinity);
5473        xs = [], ys = [];
5474        n = data.length;
5475        if (compat) for (i = 0; i < n; ++i) {
5476          d = data[i];
5477          if (d.x < x1_) x1_ = d.x;
5478          if (d.y < y1_) y1_ = d.y;
5479          if (d.x > x2_) x2_ = d.x;
5480          if (d.y > y2_) y2_ = d.y;
5481          xs.push(d.x);
5482          ys.push(d.y);
5483        } else for (i = 0; i < n; ++i) {
5484          var x_ = +fx(d = data[i], i), y_ = +fy(d, i);
5485          if (x_ < x1_) x1_ = x_;
5486          if (y_ < y1_) y1_ = y_;
5487          if (x_ > x2_) x2_ = x_;
5488          if (y_ > y2_) y2_ = y_;
5489          xs.push(x_);
5490          ys.push(y_);
5491        }
5492      }
5493      var dx = x2_ - x1_, dy = y2_ - y1_;
5494      if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy;
5495      function insert(n, d, x, y, x1, y1, x2, y2) {
5496        if (isNaN(x) || isNaN(y)) return;
5497        if (n.leaf) {
5498          var nx = n.x, ny = n.y;
5499          if (nx != null) {
5500            if (abs(nx - x) + abs(ny - y) < .01) {
5501              insertChild(n, d, x, y, x1, y1, x2, y2);
5502            } else {
5503              var nPoint = n.point;
5504              n.x = n.y = n.point = null;
5505              insertChild(n, nPoint, nx, ny, x1, y1, x2, y2);
5506              insertChild(n, d, x, y, x1, y1, x2, y2);
5507            }
5508          } else {
5509            n.x = x, n.y = y, n.point = d;
5510          }
5511        } else {
5512          insertChild(n, d, x, y, x1, y1, x2, y2);
5513        }
5514      }
5515      function insertChild(n, d, x, y, x1, y1, x2, y2) {
5516        var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = x >= sx, bottom = y >= sy, i = (bottom << 1) + right;
5517        n.leaf = false;
5518        n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
5519        if (right) x1 = sx; else x2 = sx;
5520        if (bottom) y1 = sy; else y2 = sy;
5521        insert(n, d, x, y, x1, y1, x2, y2);
5522      }
5523      var root = d3_geom_quadtreeNode();
5524      root.add = function(d) {
5525        insert(root, d, +fx(d, ++i), +fy(d, i), x1_, y1_, x2_, y2_);
5526      };
5527      root.visit = function(f) {
5528        d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_);
5529      };
5530      i = -1;
5531      if (x1 == null) {
5532        while (++i < n) {
5533          insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_);
5534        }
5535        --i;
5536      } else data.forEach(root.add);
5537      xs = ys = data = d = null;
5538      return root;
5539    }
5540    quadtree.x = function(_) {
5541      return arguments.length ? (x = _, quadtree) : x;
5542    };
5543    quadtree.y = function(_) {
5544      return arguments.length ? (y = _, quadtree) : y;
5545    };
5546    quadtree.extent = function(_) {
5547      if (!arguments.length) return x1 == null ? null : [ [ x1, y1 ], [ x2, y2 ] ];
5548      if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = +_[0][0], y1 = +_[0][1], x2 = +_[1][0],
5549      y2 = +_[1][1];
5550      return quadtree;
5551    };
5552    quadtree.size = function(_) {
5553      if (!arguments.length) return x1 == null ? null : [ x2 - x1, y2 - y1 ];
5554      if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = y1 = 0, x2 = +_[0], y2 = +_[1];
5555      return quadtree;
5556    };
5557    return quadtree;
5558  };
5559  function d3_geom_quadtreeCompatX(d) {
5560    return d.x;
5561  }
5562  function d3_geom_quadtreeCompatY(d) {
5563    return d.y;
5564  }
5565  function d3_geom_quadtreeNode() {
5566    return {
5567      leaf: true,
5568      nodes: [],
5569      point: null,
5570      x: null,
5571      y: null
5572    };
5573  }
5574  function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
5575    if (!f(node, x1, y1, x2, y2)) {
5576      var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes;
5577      if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
5578      if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
5579      if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
5580      if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
5581    }
5582  }
5583  d3.interpolateRgb = d3_interpolateRgb;
5584  function d3_interpolateRgb(a, b) {
5585    a = d3.rgb(a);
5586    b = d3.rgb(b);
5587    var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;
5588    return function(t) {
5589      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));
5590    };
5591  }
5592  d3.interpolateObject = d3_interpolateObject;
5593  function d3_interpolateObject(a, b) {
5594    var i = {}, c = {}, k;
5595    for (k in a) {
5596      if (k in b) {
5597        i[k] = d3_interpolate(a[k], b[k]);
5598      } else {
5599        c[k] = a[k];
5600      }
5601    }
5602    for (k in b) {
5603      if (!(k in a)) {
5604        c[k] = b[k];
5605      }
5606    }
5607    return function(t) {
5608      for (k in i) c[k] = i[k](t);
5609      return c;
5610    };
5611  }
5612  d3.interpolateNumber = d3_interpolateNumber;
5613  function d3_interpolateNumber(a, b) {
5614    b -= a = +a;
5615    return function(t) {
5616      return a + b * t;
5617    };
5618  }
5619  d3.interpolateString = d3_interpolateString;
5620  function d3_interpolateString(a, b) {
5621    var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o;
5622    a = a + "", b = b + "";
5623    d3_interpolate_number.lastIndex = 0;
5624    for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
5625      if (m.index) s.push(b.substring(s0, s1 = m.index));
5626      q.push({
5627        i: s.length,
5628        x: m[0]
5629      });
5630      s.push(null);
5631      s0 = d3_interpolate_number.lastIndex;
5632    }
5633    if (s0 < b.length) s.push(b.substring(s0));
5634    for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
5635      o = q[i];
5636      if (o.x == m[0]) {
5637        if (o.i) {
5638          if (s[o.i + 1] == null) {
5639            s[o.i - 1] += o.x;
5640            s.splice(o.i, 1);
5641            for (j = i + 1; j < n; ++j) q[j].i--;
5642          } else {
5643            s[o.i - 1] += o.x + s[o.i + 1];
5644            s.splice(o.i, 2);
5645            for (j = i + 1; j < n; ++j) q[j].i -= 2;
5646          }
5647        } else {
5648          if (s[o.i + 1] == null) {
5649            s[o.i] = o.x;
5650          } else {
5651            s[o.i] = o.x + s[o.i + 1];
5652            s.splice(o.i + 1, 1);
5653            for (j = i + 1; j < n; ++j) q[j].i--;
5654          }
5655        }
5656        q.splice(i, 1);
5657        n--;
5658        i--;
5659      } else {
5660        o.x = d3_interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
5661      }
5662    }
5663    while (i < n) {
5664      o = q.pop();
5665      if (s[o.i + 1] == null) {
5666        s[o.i] = o.x;
5667      } else {
5668        s[o.i] = o.x + s[o.i + 1];
5669        s.splice(o.i + 1, 1);
5670      }
5671      n--;
5672    }
5673    if (s.length === 1) {
5674      return s[0] == null ? (o = q[0].x, function(t) {
5675        return o(t) + "";
5676      }) : function() {
5677        return b;
5678      };
5679    }
5680    return function(t) {
5681      for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
5682      return s.join("");
5683    };
5684  }
5685  var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
5686  d3.interpolate = d3_interpolate;
5687  function d3_interpolate(a, b) {
5688    var i = d3.interpolators.length, f;
5689    while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;
5690    return f;
5691  }
5692  d3.interpolators = [ function(a, b) {
5693    var t = typeof b;
5694    return (t === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) ? d3_interpolateRgb : d3_interpolateString : b instanceof d3_Color ? d3_interpolateRgb : Array.isArray(b) ? d3_interpolateArray : t === "object" && isNaN(b) ? d3_interpolateObject : d3_interpolateNumber)(a, b);
5695  } ];
5696  d3.interpolateArray = d3_interpolateArray;
5697  function d3_interpolateArray(a, b) {
5698    var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;
5699    for (i = 0; i < n0; ++i) x.push(d3_interpolate(a[i], b[i]));
5700    for (;i < na; ++i) c[i] = a[i];
5701    for (;i < nb; ++i) c[i] = b[i];
5702    return function(t) {
5703      for (i = 0; i < n0; ++i) c[i] = x[i](t);
5704      return c;
5705    };
5706  }
5707  var d3_ease_default = function() {
5708    return d3_identity;
5709  };
5710  var d3_ease = d3.map({
5711    linear: d3_ease_default,
5712    poly: d3_ease_poly,
5713    quad: function() {
5714      return d3_ease_quad;
5715    },
5716    cubic: function() {
5717      return d3_ease_cubic;
5718    },
5719    sin: function() {
5720      return d3_ease_sin;
5721    },
5722    exp: function() {
5723      return d3_ease_exp;
5724    },
5725    circle: function() {
5726      return d3_ease_circle;
5727    },
5728    elastic: d3_ease_elastic,
5729    back: d3_ease_back,
5730    bounce: function() {
5731      return d3_ease_bounce;
5732    }
5733  });
5734  var d3_ease_mode = d3.map({
5735    "in": d3_identity,
5736    out: d3_ease_reverse,
5737    "in-out": d3_ease_reflect,
5738    "out-in": function(f) {
5739      return d3_ease_reflect(d3_ease_reverse(f));
5740    }
5741  });
5742  d3.ease = function(name) {
5743    var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in";
5744    t = d3_ease.get(t) || d3_ease_default;
5745    m = d3_ease_mode.get(m) || d3_identity;
5746    return d3_ease_clamp(m(t.apply(null, d3_arraySlice.call(arguments, 1))));
5747  };
5748  function d3_ease_clamp(f) {
5749    return function(t) {
5750      return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
5751    };
5752  }
5753  function d3_ease_reverse(f) {
5754    return function(t) {
5755      return 1 - f(1 - t);
5756    };
5757  }
5758  function d3_ease_reflect(f) {
5759    return function(t) {
5760      return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t));
5761    };
5762  }
5763  function d3_ease_quad(t) {
5764    return t * t;
5765  }
5766  function d3_ease_cubic(t) {
5767    return t * t * t;
5768  }
5769  function d3_ease_cubicInOut(t) {
5770    if (t <= 0) return 0;
5771    if (t >= 1) return 1;
5772    var t2 = t * t, t3 = t2 * t;
5773    return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75);
5774  }
5775  function d3_ease_poly(e) {
5776    return function(t) {
5777      return Math.pow(t, e);
5778    };
5779  }
5780  function d3_ease_sin(t) {
5781    return 1 - Math.cos(t * halfπ);
5782  }
5783  function d3_ease_exp(t) {
5784    return Math.pow(2, 10 * (t - 1));
5785  }
5786  function d3_ease_circle(t) {
5787    return 1 - Math.sqrt(1 - t * t);
5788  }
5789  function d3_ease_elastic(a, p) {
5790    var s;
5791    if (arguments.length < 2) p = .45;
5792    if (arguments.length) s = p / τ * Math.asin(1 / a); else a = 1, s = p / 4;
5793    return function(t) {
5794      return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * τ / p);
5795    };
5796  }
5797  function d3_ease_back(s) {
5798    if (!s) s = 1.70158;
5799    return function(t) {
5800      return t * t * ((s + 1) * t - s);
5801    };
5802  }
5803  function d3_ease_bounce(t) {
5804    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;
5805  }
5806  d3.interpolateHcl = d3_interpolateHcl;
5807  function d3_interpolateHcl(a, b) {
5808    a = d3.hcl(a);
5809    b = d3.hcl(b);
5810    var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;
5811    if (isNaN(bc)) bc = 0, ac = isNaN(ac) ? b.c : ac;
5812    if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
5813    return function(t) {
5814      return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";
5815    };
5816  }
5817  d3.interpolateHsl = d3_interpolateHsl;
5818  function d3_interpolateHsl(a, b) {
5819    a = d3.hsl(a);
5820    b = d3.hsl(b);
5821    var ah = a.h, as = a.s, al = a.l, bh = b.h - ah, bs = b.s - as, bl = b.l - al;
5822    if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as;
5823    if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
5824    return function(t) {
5825      return d3_hsl_rgb(ah + bh * t, as + bs * t, al + bl * t) + "";
5826    };
5827  }
5828  d3.interpolateLab = d3_interpolateLab;
5829  function d3_interpolateLab(a, b) {
5830    a = d3.lab(a);
5831    b = d3.lab(b);
5832    var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;
5833    return function(t) {
5834      return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
5835    };
5836  }
5837  d3.interpolateRound = d3_interpolateRound;
5838  function d3_interpolateRound(a, b) {
5839    b -= a;
5840    return function(t) {
5841      return Math.round(a + b * t);
5842    };
5843  }
5844  d3.transform = function(string) {
5845    var g = d3_document.createElementNS(d3.ns.prefix.svg, "g");
5846    return (d3.transform = function(string) {
5847      if (string != null) {
5848        g.setAttribute("transform", string);
5849        var t = g.transform.baseVal.consolidate();
5850      }
5851      return new d3_transform(t ? t.matrix : d3_transformIdentity);
5852    })(string);
5853  };
5854  function d3_transform(m) {
5855    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;
5856    if (r0[0] * r1[1] < r1[0] * r0[1]) {
5857      r0[0] *= -1;
5858      r0[1] *= -1;
5859      kx *= -1;
5860      kz *= -1;
5861    }
5862    this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees;
5863    this.translate = [ m.e, m.f ];
5864    this.scale = [ kx, ky ];
5865    this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0;
5866  }
5867  d3_transform.prototype.toString = function() {
5868    return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
5869  };
5870  function d3_transformDot(a, b) {
5871    return a[0] * b[0] + a[1] * b[1];
5872  }
5873  function d3_transformNormalize(a) {
5874    var k = Math.sqrt(d3_transformDot(a, a));
5875    if (k) {
5876      a[0] /= k;
5877      a[1] /= k;
5878    }
5879    return k;
5880  }
5881  function d3_transformCombine(a, b, k) {
5882    a[0] += k * b[0];
5883    a[1] += k * b[1];
5884    return a;
5885  }
5886  var d3_transformIdentity = {
5887    a: 1,
5888    b: 0,
5889    c: 0,
5890    d: 1,
5891    e: 0,
5892    f: 0
5893  };
5894  d3.interpolateTransform = d3_interpolateTransform;
5895  function d3_interpolateTransform(a, b) {
5896    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;
5897    if (ta[0] != tb[0] || ta[1] != tb[1]) {
5898      s.push("translate(", null, ",", null, ")");
5899      q.push({
5900        i: 1,
5901        x: d3_interpolateNumber(ta[0], tb[0])
5902      }, {
5903        i: 3,
5904        x: d3_interpolateNumber(ta[1], tb[1])
5905      });
5906    } else if (tb[0] || tb[1]) {
5907      s.push("translate(" + tb + ")");
5908    } else {
5909      s.push("");
5910    }
5911    if (ra != rb) {
5912      if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
5913      q.push({
5914        i: s.push(s.pop() + "rotate(", null, ")") - 2,
5915        x: d3_interpolateNumber(ra, rb)
5916      });
5917    } else if (rb) {
5918      s.push(s.pop() + "rotate(" + rb + ")");
5919    }
5920    if (wa != wb) {
5921      q.push({
5922        i: s.push(s.pop() + "skewX(", null, ")") - 2,
5923        x: d3_interpolateNumber(wa, wb)
5924      });
5925    } else if (wb) {
5926      s.push(s.pop() + "skewX(" + wb + ")");
5927    }
5928    if (ka[0] != kb[0] || ka[1] != kb[1]) {
5929      n = s.push(s.pop() + "scale(", null, ",", null, ")");
5930      q.push({
5931        i: n - 4,
5932        x: d3_interpolateNumber(ka[0], kb[0])
5933      }, {
5934        i: n - 2,
5935        x: d3_interpolateNumber(ka[1], kb[1])
5936      });
5937    } else if (kb[0] != 1 || kb[1] != 1) {
5938      s.push(s.pop() + "scale(" + kb + ")");
5939    }
5940    n = q.length;
5941    return function(t) {
5942      var i = -1, o;
5943      while (++i < n) s[(o = q[i]).i] = o.x(t);
5944      return s.join("");
5945    };
5946  }
5947  function d3_uninterpolateNumber(a, b) {
5948    b = b - (a = +a) ? 1 / (b - a) : 0;
5949    return function(x) {
5950      return (x - a) * b;
5951    };
5952  }
5953  function d3_uninterpolateClamp(a, b) {
5954    b = b - (a = +a) ? 1 / (b - a) : 0;
5955    return function(x) {
5956      return Math.max(0, Math.min(1, (x - a) * b));
5957    };
5958  }
5959  d3.layout = {};
5960  d3.layout.bundle = function() {
5961    return function(links) {
5962      var paths = [], i = -1, n = links.length;
5963      while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
5964      return paths;
5965    };
5966  };
5967  function d3_layout_bundlePath(link) {
5968    var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ];
5969    while (start !== lca) {
5970      start = start.parent;
5971      points.push(start);
5972    }
5973    var k = points.length;
5974    while (end !== lca) {
5975      points.splice(k, 0, end);
5976      end = end.parent;
5977    }
5978    return points;
5979  }
5980  function d3_layout_bundleAncestors(node) {
5981    var ancestors = [], parent = node.parent;
5982    while (parent != null) {
5983      ancestors.push(node);
5984      node = parent;
5985      parent = parent.parent;
5986    }
5987    ancestors.push(node);
5988    return ancestors;
5989  }
5990  function d3_layout_bundleLeastCommonAncestor(a, b) {
5991    if (a === b) return a;
5992    var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;
5993    while (aNode === bNode) {
5994      sharedNode = aNode;
5995      aNode = aNodes.pop();
5996      bNode = bNodes.pop();
5997    }
5998    return sharedNode;
5999  }
6000  d3.layout.chord = function() {
6001    var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
6002    function relayout() {
6003      var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;
6004      chords = [];
6005      groups = [];
6006      k = 0, i = -1;
6007      while (++i < n) {
6008        x = 0, j = -1;
6009        while (++j < n) {
6010          x += matrix[i][j];
6011        }
6012        groupSums.push(x);
6013        subgroupIndex.push(d3.range(n));
6014        k += x;
6015      }
6016      if (sortGroups) {
6017        groupIndex.sort(function(a, b) {
6018          return sortGroups(groupSums[a], groupSums[b]);
6019        });
6020      }
6021      if (sortSubgroups) {
6022        subgroupIndex.forEach(function(d, i) {
6023          d.sort(function(a, b) {
6024            return sortSubgroups(matrix[i][a], matrix[i][b]);
6025          });
6026        });
6027      }
6028      k = (τ - padding * n) / k;
6029      x = 0, i = -1;
6030      while (++i < n) {
6031        x0 = x, j = -1;
6032        while (++j < n) {
6033          var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
6034          subgroups[di + "-" + dj] = {
6035            index: di,
6036            subindex: dj,
6037            startAngle: a0,
6038            endAngle: a1,
6039            value: v
6040          };
6041        }
6042        groups[di] = {
6043          index: di,
6044          startAngle: x0,
6045          endAngle: x,
6046          value: (x - x0) / k
6047        };
6048        x += padding;
6049      }
6050      i = -1;
6051      while (++i < n) {
6052        j = i - 1;
6053        while (++j < n) {
6054          var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
6055          if (source.value || target.value) {
6056            chords.push(source.value < target.value ? {
6057              source: target,
6058              target: source
6059            } : {
6060              source: source,
6061              target: target
6062            });
6063          }
6064        }
6065      }
6066      if (sortChords) resort();
6067    }
6068    function resort() {
6069      chords.sort(function(a, b) {
6070        return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);
6071      });
6072    }
6073    chord.matrix = function(x) {
6074      if (!arguments.length) return matrix;
6075      n = (matrix = x) && matrix.length;
6076      chords = groups = null;
6077      return chord;
6078    };
6079    chord.padding = function(x) {
6080      if (!arguments.length) return padding;
6081      padding = x;
6082      chords = groups = null;
6083      return chord;
6084    };
6085    chord.sortGroups = function(x) {
6086      if (!arguments.length) return sortGroups;
6087      sortGroups = x;
6088      chords = groups = null;
6089      return chord;
6090    };
6091    chord.sortSubgroups = function(x) {
6092      if (!arguments.length) return sortSubgroups;
6093      sortSubgroups = x;
6094      chords = null;
6095      return chord;
6096    };
6097    chord.sortChords = function(x) {
6098      if (!arguments.length) return sortChords;
6099      sortChords = x;
6100      if (chords) resort();
6101      return chord;
6102    };
6103    chord.chords = function() {
6104      if (!chords) relayout();
6105      return chords;
6106    };
6107    chord.groups = function() {
6108      if (!groups) relayout();
6109      return groups;
6110    };
6111    return chord;
6112  };
6113  d3.layout.force = function() {
6114    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, chargeDistance2 = d3_layout_forceChargeDistance2, gravity = .1, theta2 = .64, nodes = [], links = [], distances, strengths, charges;
6115    function repulse(node) {
6116      return function(quad, x1, _, x2) {
6117        if (quad.point !== node) {
6118          var dx = quad.cx - node.x, dy = quad.cy - node.y, dw = x2 - x1, dn = dx * dx + dy * dy;
6119          if (dw * dw / theta2 < dn) {
6120            if (dn < chargeDistance2) {
6121              var k = quad.charge / dn;
6122              node.px -= dx * k;
6123              node.py -= dy * k;
6124            }
6125            return true;
6126          }
6127          if (quad.point && dn && dn < chargeDistance2) {
6128            var k = quad.pointCharge / dn;
6129            node.px -= dx * k;
6130            node.py -= dy * k;
6131          }
6132        }
6133        return !quad.charge;
6134      };
6135    }
6136    force.tick = function() {
6137      if ((alpha *= .99) < .005) {
6138        event.end({
6139          type: "end",
6140          alpha: alpha = 0
6141        });
6142        return true;
6143      }
6144      var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;
6145      for (i = 0; i < m; ++i) {
6146        o = links[i];
6147        s = o.source;
6148        t = o.target;
6149        x = t.x - s.x;
6150        y = t.y - s.y;
6151        if (l = x * x + y * y) {
6152          l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
6153          x *= l;
6154          y *= l;
6155          t.x -= x * (k = s.weight / (t.weight + s.weight));
6156          t.y -= y * k;
6157          s.x += x * (k = 1 - k);
6158          s.y += y * k;
6159        }
6160      }
6161      if (k = alpha * gravity) {
6162        x = size[0] / 2;
6163        y = size[1] / 2;
6164        i = -1;
6165        if (k) while (++i < n) {
6166          o = nodes[i];
6167          o.x += (x - o.x) * k;
6168          o.y += (y - o.y) * k;
6169        }
6170      }
6171      if (charge) {
6172        d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
6173        i = -1;
6174        while (++i < n) {
6175          if (!(o = nodes[i]).fixed) {
6176            q.visit(repulse(o));
6177          }
6178        }
6179      }
6180      i = -1;
6181      while (++i < n) {
6182        o = nodes[i];
6183        if (o.fixed) {
6184          o.x = o.px;
6185          o.y = o.py;
6186        } else {
6187          o.x -= (o.px - (o.px = o.x)) * friction;
6188          o.y -= (o.py - (o.py = o.y)) * friction;
6189        }
6190      }
6191      event.tick({
6192        type: "tick",
6193        alpha: alpha
6194      });
6195    };
6196    force.nodes = function(x) {
6197      if (!arguments.length) return nodes;
6198      nodes = x;
6199      return force;
6200    };
6201    force.links = function(x) {
6202      if (!arguments.length) return links;
6203      links = x;
6204      return force;
6205    };
6206    force.size = function(x) {
6207      if (!arguments.length) return size;
6208      size = x;
6209      return force;
6210    };
6211    force.linkDistance = function(x) {
6212      if (!arguments.length) return linkDistance;
6213      linkDistance = typeof x === "function" ? x : +x;
6214      return force;
6215    };
6216    force.distance = force.linkDistance;
6217    force.linkStrength = function(x) {
6218      if (!arguments.length) return linkStrength;
6219      linkStrength = typeof x === "function" ? x : +x;
6220      return force;
6221    };
6222    force.friction = function(x) {
6223      if (!arguments.length) return friction;
6224      friction = +x;
6225      return force;
6226    };
6227    force.charge = function(x) {
6228      if (!arguments.length) return charge;
6229      charge = typeof x === "function" ? x : +x;
6230      return force;
6231    };
6232    force.chargeDistance = function(x) {
6233      if (!arguments.length) return Math.sqrt(chargeDistance2);
6234      chargeDistance2 = x * x;
6235      return force;
6236    };
6237    force.gravity = function(x) {
6238      if (!arguments.length) return gravity;
6239      gravity = +x;
6240      return force;
6241    };
6242    force.theta = function(x) {
6243      if (!arguments.length) return Math.sqrt(theta2);
6244      theta2 = x * x;
6245      return force;
6246    };
6247    force.alpha = function(x) {
6248      if (!arguments.length) return alpha;
6249      x = +x;
6250      if (alpha) {
6251        if (x > 0) alpha = x; else alpha = 0;
6252      } else if (x > 0) {
6253        event.start({
6254          type: "start",
6255          alpha: alpha = x
6256        });
6257        d3.timer(force.tick);
6258      }
6259      return force;
6260    };
6261    force.start = function() {
6262      var i, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;
6263      for (i = 0; i < n; ++i) {
6264        (o = nodes[i]).index = i;
6265        o.weight = 0;
6266      }
6267      for (i = 0; i < m; ++i) {
6268        o = links[i];
6269        if (typeof o.source == "number") o.source = nodes[o.source];
6270        if (typeof o.target == "number") o.target = nodes[o.target];
6271        ++o.source.weight;
6272        ++o.target.weight;
6273      }
6274      for (i = 0; i < n; ++i) {
6275        o = nodes[i];
6276        if (isNaN(o.x)) o.x = position("x", w);
6277        if (isNaN(o.y)) o.y = position("y", h);
6278        if (isNaN(o.px)) o.px = o.x;
6279        if (isNaN(o.py)) o.py = o.y;
6280      }
6281      distances = [];
6282      if (typeof linkDistance === "function") for (i = 0; i < m; ++i) distances[i] = +linkDistance.call(this, links[i], i); else for (i = 0; i < m; ++i) distances[i] = linkDistance;
6283      strengths = [];
6284      if (typeof linkStrength === "function") for (i = 0; i < m; ++i) strengths[i] = +linkStrength.call(this, links[i], i); else for (i = 0; i < m; ++i) strengths[i] = linkStrength;
6285      charges = [];
6286      if (typeof charge === "function") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i); else for (i = 0; i < n; ++i) charges[i] = charge;
6287      function position(dimension, size) {
6288        if (!neighbors) {
6289          neighbors = new Array(n);
6290          for (j = 0; j < n; ++j) {
6291            neighbors[j] = [];
6292          }
6293          for (j = 0; j < m; ++j) {
6294            var o = links[j];
6295            neighbors[o.source.index].push(o.target);
6296            neighbors[o.target.index].push(o.source);
6297          }
6298        }
6299        var candidates = neighbors[i], j = -1, m = candidates.length, x;
6300        while (++j < m) if (!isNaN(x = candidates[j][dimension])) return x;
6301        return Math.random() * size;
6302      }
6303      return force.resume();
6304    };
6305    force.resume = function() {
6306      return force.alpha(.1);
6307    };
6308    force.stop = function() {
6309      return force.alpha(0);
6310    };
6311    force.drag = function() {
6312      if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart.force", d3_layout_forceDragstart).on("drag.force", dragmove).on("dragend.force", d3_layout_forceDragend);
6313      if (!arguments.length) return drag;
6314      this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag);
6315    };
6316    function dragmove(d) {
6317      d.px = d3.event.x, d.py = d3.event.y;
6318      force.resume();
6319    }
6320    return d3.rebind(force, event, "on");
6321  };
6322  function d3_layout_forceDragstart(d) {
6323    d.fixed |= 2;
6324  }
6325  function d3_layout_forceDragend(d) {
6326    d.fixed &= ~6;
6327  }
6328  function d3_layout_forceMouseover(d) {
6329    d.fixed |= 4;
6330    d.px = d.x, d.py = d.y;
6331  }
6332  function d3_layout_forceMouseout(d) {
6333    d.fixed &= ~4;
6334  }
6335  function d3_layout_forceAccumulate(quad, alpha, charges) {
6336    var cx = 0, cy = 0;
6337    quad.charge = 0;
6338    if (!quad.leaf) {
6339      var nodes = quad.nodes, n = nodes.length, i = -1, c;
6340      while (++i < n) {
6341        c = nodes[i];
6342        if (c == null) continue;
6343        d3_layout_forceAccumulate(c, alpha, charges);
6344        quad.charge += c.charge;
6345        cx += c.charge * c.cx;
6346        cy += c.charge * c.cy;
6347      }
6348    }
6349    if (quad.point) {
6350      if (!quad.leaf) {
6351        quad.point.x += Math.random() - .5;
6352        quad.point.y += Math.random() - .5;
6353      }
6354      var k = alpha * charges[quad.point.index];
6355      quad.charge += quad.pointCharge = k;
6356      cx += k * quad.point.x;
6357      cy += k * quad.point.y;
6358    }
6359    quad.cx = cx / quad.charge;
6360    quad.cy = cy / quad.charge;
6361  }
6362  var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1, d3_layout_forceChargeDistance2 = Infinity;
6363  d3.layout.hierarchy = function() {
6364    var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;
6365    function recurse(node, depth, nodes) {
6366      var childs = children.call(hierarchy, node, depth);
6367      node.depth = depth;
6368      nodes.push(node);
6369      if (childs && (n = childs.length)) {
6370        var i = -1, n, c = node.children = new Array(n), v = 0, j = depth + 1, d;
6371        while (++i < n) {
6372          d = c[i] = recurse(childs[i], j, nodes);
6373          d.parent = node;
6374          v += d.value;
6375        }
6376        if (sort) c.sort(sort);
6377        if (value) node.value = v;
6378      } else {
6379        delete node.children;
6380        if (value) {
6381          node.value = +value.call(hierarchy, node, depth) || 0;
6382        }
6383      }
6384      return node;
6385    }
6386    function revalue(node, depth) {
6387      var children = node.children, v = 0;
6388      if (children && (n = children.length)) {
6389        var i = -1, n, j = depth + 1;
6390        while (++i < n) v += revalue(children[i], j);
6391      } else if (value) {
6392        v = +value.call(hierarchy, node, depth) || 0;
6393      }
6394      if (value) node.value = v;
6395      return v;
6396    }
6397    function hierarchy(d) {
6398      var nodes = [];
6399      recurse(d, 0, nodes);
6400      return nodes;
6401    }
6402    hierarchy.sort = function(x) {
6403      if (!arguments.length) return sort;
6404      sort = x;
6405      return hierarchy;
6406    };
6407    hierarchy.children = function(x) {
6408      if (!arguments.length) return children;
6409      children = x;
6410      return hierarchy;
6411    };
6412    hierarchy.value = function(x) {
6413      if (!arguments.length) return value;
6414      value = x;
6415      return hierarchy;
6416    };
6417    hierarchy.revalue = function(root) {
6418      revalue(root, 0);
6419      return root;
6420    };
6421    return hierarchy;
6422  };
6423  function d3_layout_hierarchyRebind(object, hierarchy) {
6424    d3.rebind(object, hierarchy, "sort", "children", "value");
6425    object.nodes = object;
6426    object.links = d3_layout_hierarchyLinks;
6427    return object;
6428  }
6429  function d3_layout_hierarchyChildren(d) {
6430    return d.children;
6431  }
6432  function d3_layout_hierarchyValue(d) {
6433    return d.value;
6434  }
6435  function d3_layout_hierarchySort(a, b) {
6436    return b.value - a.value;
6437  }
6438  function d3_layout_hierarchyLinks(nodes) {
6439    return d3.merge(nodes.map(function(parent) {
6440      return (parent.children || []).map(function(child) {
6441        return {
6442          source: parent,
6443          target: child
6444        };
6445      });
6446    }));
6447  }
6448  d3.layout.partition = function() {
6449    var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];
6450    function position(node, x, dx, dy) {
6451      var children = node.children;
6452      node.x = x;
6453      node.y = node.depth * dy;
6454      node.dx = dx;
6455      node.dy = dy;
6456      if (children && (n = children.length)) {
6457        var i = -1, n, c, d;
6458        dx = node.value ? dx / node.value : 0;
6459        while (++i < n) {
6460          position(c = children[i], x, d = c.value * dx, dy);
6461          x += d;
6462        }
6463      }
6464    }
6465    function depth(node) {
6466      var children = node.children, d = 0;
6467      if (children && (n = children.length)) {
6468        var i = -1, n;
6469        while (++i < n) d = Math.max(d, depth(children[i]));
6470      }
6471      return 1 + d;
6472    }
6473    function partition(d, i) {
6474      var nodes = hierarchy.call(this, d, i);
6475      position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
6476      return nodes;
6477    }
6478    partition.size = function(x) {
6479      if (!arguments.length) return size;
6480      size = x;
6481      return partition;
6482    };
6483    return d3_layout_hierarchyRebind(partition, hierarchy);
6484  };
6485  d3.layout.pie = function() {
6486    var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = τ;
6487    function pie(data) {
6488      var values = data.map(function(d, i) {
6489        return +value.call(pie, d, i);
6490      });
6491      var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle);
6492      var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a) / d3.sum(values);
6493      var index = d3.range(data.length);
6494      if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
6495        return values[j] - values[i];
6496      } : function(i, j) {
6497        return sort(data[i], data[j]);
6498      });
6499      var arcs = [];
6500      index.forEach(function(i) {
6501        var d;
6502        arcs[i] = {
6503          data: data[i],
6504          value: d = values[i],
6505          startAngle: a,
6506          endAngle: a += d * k
6507        };
6508      });
6509      return arcs;
6510    }
6511    pie.value = function(x) {
6512      if (!arguments.length) return value;
6513      value = x;
6514      return pie;
6515    };
6516    pie.sort = function(x) {
6517      if (!arguments.length) return sort;
6518      sort = x;
6519      return pie;
6520    };
6521    pie.startAngle = function(x) {
6522      if (!arguments.length) return startAngle;
6523      startAngle = x;
6524      return pie;
6525    };
6526    pie.endAngle = function(x) {
6527      if (!arguments.length) return endAngle;
6528      endAngle = x;
6529      return pie;
6530    };
6531    return pie;
6532  };
6533  var d3_layout_pieSortByValue = {};
6534  d3.layout.stack = function() {
6535    var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
6536    function stack(data, index) {
6537      var series = data.map(function(d, i) {
6538        return values.call(stack, d, i);
6539      });
6540      var points = series.map(function(d) {
6541        return d.map(function(v, i) {
6542          return [ x.call(stack, v, i), y.call(stack, v, i) ];
6543        });
6544      });
6545      var orders = order.call(stack, points, index);
6546      series = d3.permute(series, orders);
6547      points = d3.permute(points, orders);
6548      var offsets = offset.call(stack, points, index);
6549      var n = series.length, m = series[0].length, i, j, o;
6550      for (j = 0; j < m; ++j) {
6551        out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
6552        for (i = 1; i < n; ++i) {
6553          out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
6554        }
6555      }
6556      return data;
6557    }
6558    stack.values = function(x) {
6559      if (!arguments.length) return values;
6560      values = x;
6561      return stack;
6562    };
6563    stack.order = function(x) {
6564      if (!arguments.length) return order;
6565      order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
6566      return stack;
6567    };
6568    stack.offset = function(x) {
6569      if (!arguments.length) return offset;
6570      offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
6571      return stack;
6572    };
6573    stack.x = function(z) {
6574      if (!arguments.length) return x;
6575      x = z;
6576      return stack;
6577    };
6578    stack.y = function(z) {
6579      if (!arguments.length) return y;
6580      y = z;
6581      return stack;
6582    };
6583    stack.out = function(z) {
6584      if (!arguments.length) return out;
6585      out = z;
6586      return stack;
6587    };
6588    return stack;
6589  };
6590  function d3_layout_stackX(d) {
6591    return d.x;
6592  }
6593  function d3_layout_stackY(d) {
6594    return d.y;
6595  }
6596  function d3_layout_stackOut(d, y0, y) {
6597    d.y0 = y0;
6598    d.y = y;
6599  }
6600  var d3_layout_stackOrders = d3.map({
6601    "inside-out": function(data) {
6602      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) {
6603        return max[a] - max[b];
6604      }), top = 0, bottom = 0, tops = [], bottoms = [];
6605      for (i = 0; i < n; ++i) {
6606        j = index[i];
6607        if (top < bottom) {
6608          top += sums[j];
6609          tops.push(j);
6610        } else {
6611          bottom += sums[j];
6612          bottoms.push(j);
6613        }
6614      }
6615      return bottoms.reverse().concat(tops);
6616    },
6617    reverse: function(data) {
6618      return d3.range(data.length).reverse();
6619    },
6620    "default": d3_layout_stackOrderDefault
6621  });
6622  var d3_layout_stackOffsets = d3.map({
6623    silhouette: function(data) {
6624      var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];
6625      for (j = 0; j < m; ++j) {
6626        for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
6627        if (o > max) max = o;
6628        sums.push(o);
6629      }
6630      for (j = 0; j < m; ++j) {
6631        y0[j] = (max - sums[j]) / 2;
6632      }
6633      return y0;
6634    },
6635    wiggle: function(data) {
6636      var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];
6637      y0[0] = o = o0 = 0;
6638      for (j = 1; j < m; ++j) {
6639        for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
6640        for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
6641          for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
6642            s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
6643          }
6644          s2 += s3 * data[i][j][1];
6645        }
6646        y0[j] = o -= s1 ? s2 / s1 * dx : 0;
6647        if (o < o0) o0 = o;
6648      }
6649      for (j = 0; j < m; ++j) y0[j] -= o0;
6650      return y0;
6651    },
6652    expand: function(data) {
6653      var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];
6654      for (j = 0; j < m; ++j) {
6655        for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
6656        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;
6657      }
6658      for (j = 0; j < m; ++j) y0[j] = 0;
6659      return y0;
6660    },
6661    zero: d3_layout_stackOffsetZero
6662  });
6663  function d3_layout_stackOrderDefault(data) {
6664    return d3.range(data.length);
6665  }
6666  function d3_layout_stackOffsetZero(data) {
6667    var j = -1, m = data[0].length, y0 = [];
6668    while (++j < m) y0[j] = 0;
6669    return y0;
6670  }
6671  function d3_layout_stackMaxIndex(array) {
6672    var i = 1, j = 0, v = array[0][1], k, n = array.length;
6673    for (;i < n; ++i) {
6674      if ((k = array[i][1]) > v) {
6675        j = i;
6676        v = k;
6677      }
6678    }
6679    return j;
6680  }
6681  function d3_layout_stackReduceSum(d) {
6682    return d.reduce(d3_layout_stackSum, 0);
6683  }
6684  function d3_layout_stackSum(p, d) {
6685    return p + d[1];
6686  }
6687  d3.layout.histogram = function() {
6688    var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;
6689    function histogram(data, i) {
6690      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;
6691      while (++i < m) {
6692        bin = bins[i] = [];
6693        bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
6694        bin.y = 0;
6695      }
6696      if (m > 0) {
6697        i = -1;
6698        while (++i < n) {
6699          x = values[i];
6700          if (x >= range[0] && x <= range[1]) {
6701            bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
6702            bin.y += k;
6703            bin.push(data[i]);
6704          }
6705        }
6706      }
6707      return bins;
6708    }
6709    histogram.value = function(x) {
6710      if (!arguments.length) return valuer;
6711      valuer = x;
6712      return histogram;
6713    };
6714    histogram.range = function(x) {
6715      if (!arguments.length) return ranger;
6716      ranger = d3_functor(x);
6717      return histogram;
6718    };
6719    histogram.bins = function(x) {
6720      if (!arguments.length) return binner;
6721      binner = typeof x === "number" ? function(range) {
6722        return d3_layout_histogramBinFixed(range, x);
6723      } : d3_functor(x);
6724      return histogram;
6725    };
6726    histogram.frequency = function(x) {
6727      if (!arguments.length) return frequency;
6728      frequency = !!x;
6729      return histogram;
6730    };
6731    return histogram;
6732  };
6733  function d3_layout_histogramBinSturges(range, values) {
6734    return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
6735  }
6736  function d3_layout_histogramBinFixed(range, n) {
6737    var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];
6738    while (++x <= n) f[x] = m * x + b;
6739    return f;
6740  }
6741  function d3_layout_histogramRange(values) {
6742    return [ d3.min(values), d3.max(values) ];
6743  }
6744  d3.layout.tree = function() {
6745    var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = false;
6746    function tree(d, i) {
6747      var nodes = hierarchy.call(this, d, i), root = nodes[0];
6748      function firstWalk(node, previousSibling) {
6749        var children = node.children, layout = node._tree;
6750        if (children && (n = children.length)) {
6751          var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1;
6752          while (++i < n) {
6753            child = children[i];
6754            firstWalk(child, previousChild);
6755            ancestor = apportion(child, previousChild, ancestor);
6756            previousChild = child;
6757          }
6758          d3_layout_treeShift(node);
6759          var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
6760          if (previousSibling) {
6761            layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
6762            layout.mod = layout.prelim - midpoint;
6763          } else {
6764            layout.prelim = midpoint;
6765          }
6766        } else {
6767          if (previousSibling) {
6768            layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
6769          }
6770        }
6771      }
6772      function secondWalk(node, x) {
6773        node.x = node._tree.prelim + x;
6774        var children = node.children;
6775        if (children && (n = children.length)) {
6776          var i = -1, n;
6777          x += node._tree.mod;
6778          while (++i < n) {
6779            secondWalk(children[i], x);
6780          }
6781        }
6782      }
6783      function apportion(node, previousSibling, ancestor) {
6784        if (previousSibling) {
6785          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;
6786          while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
6787            vom = d3_layout_treeLeft(vom);
6788            vop = d3_layout_treeRight(vop);
6789            vop._tree.ancestor = node;
6790            shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
6791            if (shift > 0) {
6792              d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
6793              sip += shift;
6794              sop += shift;
6795            }
6796            sim += vim._tree.mod;
6797            sip += vip._tree.mod;
6798            som += vom._tree.mod;
6799            sop += vop._tree.mod;
6800          }
6801          if (vim && !d3_layout_treeRight(vop)) {
6802            vop._tree.thread = vim;
6803            vop._tree.mod += sim - sop;
6804          }
6805          if (vip && !d3_layout_treeLeft(vom)) {
6806            vom._tree.thread = vip;
6807            vom._tree.mod += sip - som;
6808            ancestor = node;
6809          }
6810        }
6811        return ancestor;
6812      }
6813      d3_layout_treeVisitAfter(root, function(node, previousSibling) {
6814        node._tree = {
6815          ancestor: node,
6816          prelim: 0,
6817          mod: 0,
6818          change: 0,
6819          shift: 0,
6820          number: previousSibling ? previousSibling._tree.number + 1 : 0
6821        };
6822      });
6823      firstWalk(root);
6824      secondWalk(root, -root._tree.prelim);
6825      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;
6826      d3_layout_treeVisitAfter(root, nodeSize ? function(node) {
6827        node.x *= size[0];
6828        node.y = node.depth * size[1];
6829        delete node._tree;
6830      } : function(node) {
6831        node.x = (node.x - x0) / (x1 - x0) * size[0];
6832        node.y = node.depth / y1 * size[1];
6833        delete node._tree;
6834      });
6835      return nodes;
6836    }
6837    tree.separation = function(x) {
6838      if (!arguments.length) return separation;
6839      separation = x;
6840      return tree;
6841    };
6842    tree.size = function(x) {
6843      if (!arguments.length) return nodeSize ? null : size;
6844      nodeSize = (size = x) == null;
6845      return tree;
6846    };
6847    tree.nodeSize = function(x) {
6848      if (!arguments.length) return nodeSize ? size : null;
6849      nodeSize = (size = x) != null;
6850      return tree;
6851    };
6852    return d3_layout_hierarchyRebind(tree, hierarchy);
6853  };
6854  function d3_layout_treeSeparation(a, b) {
6855    return a.parent == b.parent ? 1 : 2;
6856  }
6857  function d3_layout_treeLeft(node) {
6858    var children = node.children;
6859    return children && children.length ? children[0] : node._tree.thread;
6860  }
6861  function d3_layout_treeRight(node) {
6862    var children = node.children, n;
6863    return children && (n = children.length) ? children[n - 1] : node._tree.thread;
6864  }
6865  function d3_layout_treeSearch(node, compare) {
6866    var children = node.children;
6867    if (children && (n = children.length)) {
6868      var child, n, i = -1;
6869      while (++i < n) {
6870        if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
6871          node = child;
6872        }
6873      }
6874    }
6875    return node;
6876  }
6877  function d3_layout_treeRightmost(a, b) {
6878    return a.x - b.x;
6879  }
6880  function d3_layout_treeLeftmost(a, b) {
6881    return b.x - a.x;
6882  }
6883  function d3_layout_treeDeepest(a, b) {
6884    return a.depth - b.depth;
6885  }
6886  function d3_layout_treeVisitAfter(node, callback) {
6887    function visit(node, previousSibling) {
6888      var children = node.children;
6889      if (children && (n = children.length)) {
6890        var child, previousChild = null, i = -1, n;
6891        while (++i < n) {
6892          child = children[i];
6893          visit(child, previousChild);
6894          previousChild = child;
6895        }
6896      }
6897      callback(node, previousSibling);
6898    }
6899    visit(node, null);
6900  }
6901  function d3_layout_treeShift(node) {
6902    var shift = 0, change = 0, children = node.children, i = children.length, child;
6903    while (--i >= 0) {
6904      child = children[i]._tree;
6905      child.prelim += shift;
6906      child.mod += shift;
6907      shift += child.shift + (change += child.change);
6908    }
6909  }
6910  function d3_layout_treeMove(ancestor, node, shift) {
6911    ancestor = ancestor._tree;
6912    node = node._tree;
6913    var change = shift / (node.number - ancestor.number);
6914    ancestor.change += change;
6915    node.change -= change;
6916    node.shift += shift;
6917    node.prelim += shift;
6918    node.mod += shift;
6919  }
6920  function d3_layout_treeAncestor(vim, node, ancestor) {
6921    return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor;
6922  }
6923  d3.layout.pack = function() {
6924    var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ], radius;
6925    function pack(d, i) {
6926      var nodes = hierarchy.call(this, d, i), root = nodes[0], w = size[0], h = size[1], r = radius == null ? Math.sqrt : typeof radius === "function" ? radius : function() {
6927        return radius;
6928      };
6929      root.x = root.y = 0;
6930      d3_layout_treeVisitAfter(root, function(d) {
6931        d.r = +r(d.value);
6932      });
6933      d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
6934      if (padding) {
6935        var dr = padding * (radius ? 1 : Math.max(2 * root.r / w, 2 * root.r / h)) / 2;
6936        d3_layout_treeVisitAfter(root, function(d) {
6937          d.r += dr;
6938        });
6939        d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
6940        d3_layout_treeVisitAfter(root, function(d) {
6941          d.r -= dr;
6942        });
6943      }
6944      d3_layout_packTransform(root, w / 2, h / 2, radius ? 1 : 1 / Math.max(2 * root.r / w, 2 * root.r / h));
6945      return nodes;
6946    }
6947    pack.size = function(_) {
6948      if (!arguments.length) return size;
6949      size = _;
6950      return pack;
6951    };
6952    pack.radius = function(_) {
6953      if (!arguments.length) return radius;
6954      radius = _ == null || typeof _ === "function" ? _ : +_;
6955      return pack;
6956    };
6957    pack.padding = function(_) {
6958      if (!arguments.length) return padding;
6959      padding = +_;
6960      return pack;
6961    };
6962    return d3_layout_hierarchyRebind(pack, hierarchy);
6963  };
6964  function d3_layout_packSort(a, b) {
6965    return a.value - b.value;
6966  }
6967  function d3_layout_packInsert(a, b) {
6968    var c = a._pack_next;
6969    a._pack_next = b;
6970    b._pack_prev = a;
6971    b._pack_next = c;
6972    c._pack_prev = b;
6973  }
6974  function d3_layout_packSplice(a, b) {
6975    a._pack_next = b;
6976    b._pack_prev = a;
6977  }
6978  function d3_layout_packIntersects(a, b) {
6979    var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;
6980    return .999 * dr * dr > dx * dx + dy * dy;
6981  }
6982  function d3_layout_packSiblings(node) {
6983    if (!(nodes = node.children) || !(n = nodes.length)) return;
6984    var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;
6985    function bound(node) {
6986      xMin = Math.min(node.x - node.r, xMin);
6987      xMax = Math.max(node.x + node.r, xMax);
6988      yMin = Math.min(node.y - node.r, yMin);
6989      yMax = Math.max(node.y + node.r, yMax);
6990    }
6991    nodes.forEach(d3_layout_packLink);
6992    a = nodes[0];
6993    a.x = -a.r;
6994    a.y = 0;
6995    bound(a);
6996    if (n > 1) {
6997      b = nodes[1];
6998      b.x = b.r;
6999      b.y = 0;
7000      bound(b);
7001      if (n > 2) {
7002        c = nodes[2];
7003        d3_layout_packPlace(a, b, c);
7004        bound(c);
7005        d3_layout_packInsert(a, c);
7006        a._pack_prev = c;
7007        d3_layout_packInsert(c, b);
7008        b = a._pack_next;
7009        for (i = 3; i < n; i++) {
7010          d3_layout_packPlace(a, b, c = nodes[i]);
7011          var isect = 0, s1 = 1, s2 = 1;
7012          for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
7013            if (d3_layout_packIntersects(j, c)) {
7014              isect = 1;
7015              break;
7016            }
7017          }
7018          if (isect == 1) {
7019            for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
7020              if (d3_layout_packIntersects(k, c)) {
7021                break;
7022              }
7023            }
7024          }
7025          if (isect) {
7026            if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b);
7027            i--;
7028          } else {
7029            d3_layout_packInsert(a, c);
7030            b = c;
7031            bound(c);
7032          }
7033        }
7034      }
7035    }
7036    var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;
7037    for (i = 0; i < n; i++) {
7038      c = nodes[i];
7039      c.x -= cx;
7040      c.y -= cy;
7041      cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));
7042    }
7043    node.r = cr;
7044    nodes.forEach(d3_layout_packUnlink);
7045  }
7046  function d3_layout_packLink(node) {
7047    node._pack_next = node._pack_prev = node;
7048  }
7049  function d3_layout_packUnlink(node) {
7050    delete node._pack_next;
7051    delete node._pack_prev;
7052  }
7053  function d3_layout_packTransform(node, x, y, k) {
7054    var children = node.children;
7055    node.x = x += k * node.x;
7056    node.y = y += k * node.y;
7057    node.r *= k;
7058    if (children) {
7059      var i = -1, n = children.length;
7060      while (++i < n) d3_layout_packTransform(children[i], x, y, k);
7061    }
7062  }
7063  function d3_layout_packPlace(a, b, c) {
7064    var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;
7065    if (db && (dx || dy)) {
7066      var da = b.r + c.r, dc = dx * dx + dy * dy;
7067      da *= da;
7068      db *= db;
7069      var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
7070      c.x = a.x + x * dx + y * dy;
7071      c.y = a.y + x * dy - y * dx;
7072    } else {
7073      c.x = a.x + db;
7074      c.y = a.y;
7075    }
7076  }
7077  d3.layout.cluster = function() {
7078    var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = false;
7079    function cluster(d, i) {
7080      var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0;
7081      d3_layout_treeVisitAfter(root, function(node) {
7082        var children = node.children;
7083        if (children && children.length) {
7084          node.x = d3_layout_clusterX(children);
7085          node.y = d3_layout_clusterY(children);
7086        } else {
7087          node.x = previousNode ? x += separation(node, previousNode) : 0;
7088          node.y = 0;
7089          previousNode = node;
7090        }
7091      });
7092      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;
7093      d3_layout_treeVisitAfter(root, nodeSize ? function(node) {
7094        node.x = (node.x - root.x) * size[0];
7095        node.y = (root.y - node.y) * size[1];
7096      } : function(node) {
7097        node.x = (node.x - x0) / (x1 - x0) * size[0];
7098        node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
7099      });
7100      return nodes;
7101    }
7102    cluster.separation = function(x) {
7103      if (!arguments.length) return separation;
7104      separation = x;
7105      return cluster;
7106    };
7107    cluster.size = function(x) {
7108      if (!arguments.length) return nodeSize ? null : size;
7109      nodeSize = (size = x) == null;
7110      return cluster;
7111    };
7112    cluster.nodeSize = function(x) {
7113      if (!arguments.length) return nodeSize ? size : null;
7114      nodeSize = (size = x) != null;
7115      return cluster;
7116    };
7117    return d3_layout_hierarchyRebind(cluster, hierarchy);
7118  };
7119  function d3_layout_clusterY(children) {
7120    return 1 + d3.max(children, function(child) {
7121      return child.y;
7122    });
7123  }
7124  function d3_layout_clusterX(children) {
7125    return children.reduce(function(x, child) {
7126      return x + child.x;
7127    }, 0) / children.length;
7128  }
7129  function d3_layout_clusterLeft(node) {
7130    var children = node.children;
7131    return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
7132  }
7133  function d3_layout_clusterRight(node) {
7134    var children = node.children, n;
7135    return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
7136  }
7137  d3.layout.treemap = function() {
7138    var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = .5 * (1 + Math.sqrt(5));
7139    function scale(children, k) {
7140      var i = -1, n = children.length, child, area;
7141      while (++i < n) {
7142        area = (child = children[i]).value * (k < 0 ? 0 : k);
7143        child.area = isNaN(area) || area <= 0 ? 0 : area;
7144      }
7145    }
7146    function squarify(node) {
7147      var children = node.children;
7148      if (children && children.length) {
7149        var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === "slice" ? rect.dx : mode === "dice" ? rect.dy : mode === "slice-dice" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n;
7150        scale(remaining, rect.dx * rect.dy / node.value);
7151        row.area = 0;
7152        while ((n = remaining.length) > 0) {
7153          row.push(child = remaining[n - 1]);
7154          row.area += child.area;
7155          if (mode !== "squarify" || (score = worst(row, u)) <= best) {
7156            remaining.pop();
7157            best = score;
7158          } else {
7159            row.area -= row.pop().area;
7160            position(row, u, rect, false);
7161            u = Math.min(rect.dx, rect.dy);
7162            row.length = row.area = 0;
7163            best = Infinity;
7164          }
7165        }
7166        if (row.length) {
7167          position(row, u, rect, true);
7168          row.length = row.area = 0;
7169        }
7170        children.forEach(squarify);
7171      }
7172    }
7173    function stickify(node) {
7174      var children = node.children;
7175      if (children && children.length) {
7176        var rect = pad(node), remaining = children.slice(), child, row = [];
7177        scale(remaining, rect.dx * rect.dy / node.value);
7178        row.area = 0;
7179        while (child = remaining.pop()) {
7180          row.push(child);
7181          row.area += child.area;
7182          if (child.z != null) {
7183            position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
7184            row.length = row.area = 0;
7185          }
7186        }
7187        children.forEach(stickify);
7188      }
7189    }
7190    function worst(row, u) {
7191      var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;
7192      while (++i < n) {
7193        if (!(r = row[i].area)) continue;
7194        if (r < rmin) rmin = r;
7195        if (r > rmax) rmax = r;
7196      }
7197      s *= s;
7198      u *= u;
7199      return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;
7200    }
7201    function position(row, u, rect, flush) {
7202      var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;
7203      if (u == rect.dx) {
7204        if (flush || v > rect.dy) v = rect.dy;
7205        while (++i < n) {
7206          o = row[i];
7207          o.x = x;
7208          o.y = y;
7209          o.dy = v;
7210          x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
7211        }
7212        o.z = true;
7213        o.dx += rect.x + rect.dx - x;
7214        rect.y += v;
7215        rect.dy -= v;
7216      } else {
7217        if (flush || v > rect.dx) v = rect.dx;
7218        while (++i < n) {
7219          o = row[i];
7220          o.x = x;
7221          o.y = y;
7222          o.dx = v;
7223          y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
7224        }
7225        o.z = false;
7226        o.dy += rect.y + rect.dy - y;
7227        rect.x += v;
7228        rect.dx -= v;
7229      }
7230    }
7231    function treemap(d) {
7232      var nodes = stickies || hierarchy(d), root = nodes[0];
7233      root.x = 0;
7234      root.y = 0;
7235      root.dx = size[0];
7236      root.dy = size[1];
7237      if (stickies) hierarchy.revalue(root);
7238      scale([ root ], root.dx * root.dy / root.value);
7239      (stickies ? stickify : squarify)(root);
7240      if (sticky) stickies = nodes;
7241      return nodes;
7242    }
7243    treemap.size = function(x) {
7244      if (!arguments.length) return size;
7245      size = x;
7246      return treemap;
7247    };
7248    treemap.padding = function(x) {
7249      if (!arguments.length) return padding;
7250      function padFunction(node) {
7251        var p = x.call(treemap, node, node.depth);
7252        return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p);
7253      }
7254      function padConstant(node) {
7255        return d3_layout_treemapPad(node, x);
7256      }
7257      var type;
7258      pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ],
7259      padConstant) : padConstant;
7260      return treemap;
7261    };
7262    treemap.round = function(x) {
7263      if (!arguments.length) return round != Number;
7264      round = x ? Math.round : Number;
7265      return treemap;
7266    };
7267    treemap.sticky = function(x) {
7268      if (!arguments.length) return sticky;
7269      sticky = x;
7270      stickies = null;
7271      return treemap;
7272    };
7273    treemap.ratio = function(x) {
7274      if (!arguments.length) return ratio;
7275      ratio = x;
7276      return treemap;
7277    };
7278    treemap.mode = function(x) {
7279      if (!arguments.length) return mode;
7280      mode = x + "";
7281      return treemap;
7282    };
7283    return d3_layout_hierarchyRebind(treemap, hierarchy);
7284  };
7285  function d3_layout_treemapPadNull(node) {
7286    return {
7287      x: node.x,
7288      y: node.y,
7289      dx: node.dx,
7290      dy: node.dy
7291    };
7292  }
7293  function d3_layout_treemapPad(node, padding) {
7294    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];
7295    if (dx < 0) {
7296      x += dx / 2;
7297      dx = 0;
7298    }
7299    if (dy < 0) {
7300      y += dy / 2;
7301      dy = 0;
7302    }
7303    return {
7304      x: x,
7305      y: y,
7306      dx: dx,
7307      dy: dy
7308    };
7309  }
7310  d3.random = {
7311    normal: function(µ, σ) {
7312      var n = arguments.length;
7313      if (n < 2) σ = 1;
7314      if (n < 1) µ = 0;
7315      return function() {
7316        var x, y, r;
7317        do {
7318          x = Math.random() * 2 - 1;
7319          y = Math.random() * 2 - 1;
7320          r = x * x + y * y;
7321        } while (!r || r > 1);
7322        return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);
7323      };
7324    },
7325    logNormal: function() {
7326      var random = d3.random.normal.apply(d3, arguments);
7327      return function() {
7328        return Math.exp(random());
7329      };
7330    },
7331    bates: function(m) {
7332      var random = d3.random.irwinHall(m);
7333      return function() {
7334        return random() / m;
7335      };
7336    },
7337    irwinHall: function(m) {
7338      return function() {
7339        for (var s = 0, j = 0; j < m; j++) s += Math.random();
7340        return s;
7341      };
7342    }
7343  };
7344  d3.scale = {};
7345  function d3_scaleExtent(domain) {
7346    var start = domain[0], stop = domain[domain.length - 1];
7347    return start < stop ? [ start, stop ] : [ stop, start ];
7348  }
7349  function d3_scaleRange(scale) {
7350    return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
7351  }
7352  function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
7353    var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);
7354    return function(x) {
7355      return i(u(x));
7356    };
7357  }
7358  function d3_scale_nice(domain, nice) {
7359    var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;
7360    if (x1 < x0) {
7361      dx = i0, i0 = i1, i1 = dx;
7362      dx = x0, x0 = x1, x1 = dx;
7363    }
7364    domain[i0] = nice.floor(x0);
7365    domain[i1] = nice.ceil(x1);
7366    return domain;
7367  }
7368  function d3_scale_niceStep(step) {
7369    return step ? {
7370      floor: function(x) {
7371        return Math.floor(x / step) * step;
7372      },
7373      ceil: function(x) {
7374        return Math.ceil(x / step) * step;
7375      }
7376    } : d3_scale_niceIdentity;
7377  }
7378  var d3_scale_niceIdentity = {
7379    floor: d3_identity,
7380    ceil: d3_identity
7381  };
7382  function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
7383    var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;
7384    if (domain[k] < domain[0]) {
7385      domain = domain.slice().reverse();
7386      range = range.slice().reverse();
7387    }
7388    while (++j <= k) {
7389      u.push(uninterpolate(domain[j - 1], domain[j]));
7390      i.push(interpolate(range[j - 1], range[j]));
7391    }
7392    return function(x) {
7393      var j = d3.bisect(domain, x, 1, k) - 1;
7394      return i[j](u[j](x));
7395    };
7396  }
7397  d3.scale.linear = function() {
7398    return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3_interpolate, false);
7399  };
7400  function d3_scale_linear(domain, range, interpolate, clamp) {
7401    var output, input;
7402    function rescale() {
7403      var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
7404      output = linear(domain, range, uninterpolate, interpolate);
7405      input = linear(range, domain, uninterpolate, d3_interpolate);
7406      return scale;
7407    }
7408    function scale(x) {
7409      return output(x);
7410    }
7411    scale.invert = function(y) {
7412      return input(y);
7413    };
7414    scale.domain = function(x) {
7415      if (!arguments.length) return domain;
7416      domain = x.map(Number);
7417      return rescale();
7418    };
7419    scale.range = function(x) {
7420      if (!arguments.length) return range;
7421      range = x;
7422      return rescale();
7423    };
7424    scale.rangeRound = function(x) {
7425      return scale.range(x).interpolate(d3_interpolateRound);
7426    };
7427    scale.clamp = function(x) {
7428      if (!arguments.length) return clamp;
7429      clamp = x;
7430      return rescale();
7431    };
7432    scale.interpolate = function(x) {
7433      if (!arguments.length) return interpolate;
7434      interpolate = x;
7435      return rescale();
7436    };
7437    scale.ticks = function(m) {
7438      return d3_scale_linearTicks(domain, m);
7439    };
7440    scale.tickFormat = function(m, format) {
7441      return d3_scale_linearTickFormat(domain, m, format);
7442    };
7443    scale.nice = function(m) {
7444      d3_scale_linearNice(domain, m);
7445      return rescale();
7446    };
7447    scale.copy = function() {
7448      return d3_scale_linear(domain, range, interpolate, clamp);
7449    };
7450    return rescale();
7451  }
7452  function d3_scale_linearRebind(scale, linear) {
7453    return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
7454  }
7455  function d3_scale_linearNice(domain, m) {
7456    return d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));
7457  }
7458  function d3_scale_linearTickRange(domain, m) {
7459    if (m == null) m = 10;
7460    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;
7461    if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
7462    extent[0] = Math.ceil(extent[0] / step) * step;
7463    extent[1] = Math.floor(extent[1] / step) * step + step * .5;
7464    extent[2] = step;
7465    return extent;
7466  }
7467  function d3_scale_linearTicks(domain, m) {
7468    return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
7469  }
7470  function d3_scale_linearTickFormat(domain, m, format) {
7471    var range = d3_scale_linearTickRange(domain, m);
7472    if (format) {
7473      var match = d3_format_re.exec(format);
7474      match.shift();
7475      if (match[8] === "s") {
7476        var prefix = d3.formatPrefix(Math.max(abs(range[0]), abs(range[1])));
7477        if (!match[7]) match[7] = "." + d3_scale_linearPrecision(prefix.scale(range[2]));
7478        match[8] = "f";
7479        format = d3.format(match.join(""));
7480        return function(d) {
7481          return format(prefix.scale(d)) + prefix.symbol;
7482        };
7483      }
7484      if (!match[7]) match[7] = "." + d3_scale_linearFormatPrecision(match[8], range);
7485      format = match.join("");
7486    } else {
7487      format = ",." + d3_scale_linearPrecision(range[2]) + "f";
7488    }
7489    return d3.format(format);
7490  }
7491  var d3_scale_linearFormatSignificant = {
7492    s: 1,
7493    g: 1,
7494    p: 1,
7495    r: 1,
7496    e: 1
7497  };
7498  function d3_scale_linearPrecision(value) {
7499    return -Math.floor(Math.log(value) / Math.LN10 + .01);
7500  }
7501  function d3_scale_linearFormatPrecision(type, range) {
7502    var p = d3_scale_linearPrecision(range[2]);
7503    return type in d3_scale_linearFormatSignificant ? Math.abs(p - d3_scale_linearPrecision(Math.max(abs(range[0]), abs(range[1])))) + +(type !== "e") : p - (type === "%") * 2;
7504  }
7505  d3.scale.log = function() {
7506    return d3_scale_log(d3.scale.linear().domain([ 0, 1 ]), 10, true, [ 1, 10 ]);
7507  };
7508  function d3_scale_log(linear, base, positive, domain) {
7509    function log(x) {
7510      return (positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(base);
7511    }
7512    function pow(x) {
7513      return positive ? Math.pow(base, x) : -Math.pow(base, -x);
7514    }
7515    function scale(x) {
7516      return linear(log(x));
7517    }
7518    scale.invert = function(x) {
7519      return pow(linear.invert(x));
7520    };
7521    scale.domain = function(x) {
7522      if (!arguments.length) return domain;
7523      positive = x[0] >= 0;
7524      linear.domain((domain = x.map(Number)).map(log));
7525      return scale;
7526    };
7527    scale.base = function(_) {
7528      if (!arguments.length) return base;
7529      base = +_;
7530      linear.domain(domain.map(log));
7531      return scale;
7532    };
7533    scale.nice = function() {
7534      var niced = d3_scale_nice(domain.map(log), positive ? Math : d3_scale_logNiceNegative);
7535      linear.domain(niced);
7536      domain = niced.map(pow);
7537      return scale;
7538    };
7539    scale.ticks = function() {
7540      var extent = d3_scaleExtent(domain), ticks = [], u = extent[0], v = extent[1], i = Math.floor(log(u)), j = Math.ceil(log(v)), n = base % 1 ? 2 : base;
7541      if (isFinite(j - i)) {
7542        if (positive) {
7543          for (;i < j; i++) for (var k = 1; k < n; k++) ticks.push(pow(i) * k);
7544          ticks.push(pow(i));
7545        } else {
7546          ticks.push(pow(i));
7547          for (;i++ < j; ) for (var k = n - 1; k > 0; k--) ticks.push(pow(i) * k);
7548        }
7549        for (i = 0; ticks[i] < u; i++) {}
7550        for (j = ticks.length; ticks[j - 1] > v; j--) {}
7551        ticks = ticks.slice(i, j);
7552      }
7553      return ticks;
7554    };
7555    scale.tickFormat = function(n, format) {
7556      if (!arguments.length) return d3_scale_logFormat;
7557      if (arguments.length < 2) format = d3_scale_logFormat; else if (typeof format !== "function") format = d3.format(format);
7558      var k = Math.max(.1, n / scale.ticks().length), f = positive ? (e = 1e-12, Math.ceil) : (e = -1e-12,
7559      Math.floor), e;
7560      return function(d) {
7561        return d / pow(f(log(d) + e)) <= k ? format(d) : "";
7562      };
7563    };
7564    scale.copy = function() {
7565      return d3_scale_log(linear.copy(), base, positive, domain);
7566    };
7567    return d3_scale_linearRebind(scale, linear);
7568  }
7569  var d3_scale_logFormat = d3.format(".0e"), d3_scale_logNiceNegative = {
7570    floor: function(x) {
7571      return -Math.ceil(-x);
7572    },
7573    ceil: function(x) {
7574      return -Math.floor(-x);
7575    }
7576  };
7577  d3.scale.pow = function() {
7578    return d3_scale_pow(d3.scale.linear(), 1, [ 0, 1 ]);
7579  };
7580  function d3_scale_pow(linear, exponent, domain) {
7581    var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);
7582    function scale(x) {
7583      return linear(powp(x));
7584    }
7585    scale.invert = function(x) {
7586      return powb(linear.invert(x));
7587    };
7588    scale.domain = function(x) {
7589      if (!arguments.length) return domain;
7590      linear.domain((domain = x.map(Number)).map(powp));
7591      return scale;
7592    };
7593    scale.ticks = function(m) {
7594      return d3_scale_linearTicks(domain, m);
7595    };
7596    scale.tickFormat = function(m, format) {
7597      return d3_scale_linearTickFormat(domain, m, format);
7598    };
7599    scale.nice = function(m) {
7600      return scale.domain(d3_scale_linearNice(domain, m));
7601    };
7602    scale.exponent = function(x) {
7603      if (!arguments.length) return exponent;
7604      powp = d3_scale_powPow(exponent = x);
7605      powb = d3_scale_powPow(1 / exponent);
7606      linear.domain(domain.map(powp));
7607      return scale;
7608    };
7609    scale.copy = function() {
7610      return d3_scale_pow(linear.copy(), exponent, domain);
7611    };
7612    return d3_scale_linearRebind(scale, linear);
7613  }
7614  function d3_scale_powPow(e) {
7615    return function(x) {
7616      return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
7617    };
7618  }
7619  d3.scale.sqrt = function() {
7620    return d3.scale.pow().exponent(.5);
7621  };
7622  d3.scale.ordinal = function() {
7623    return d3_scale_ordinal([], {
7624      t: "range",
7625      a: [ [] ]
7626    });
7627  };
7628  function d3_scale_ordinal(domain, ranger) {
7629    var index, range, rangeBand;
7630    function scale(x) {
7631      return range[((index.get(x) || (ranger.t === "range" ? index.set(x, domain.push(x)) : NaN)) - 1) % range.length];
7632    }
7633    function steps(start, step) {
7634      return d3.range(domain.length).map(function(i) {
7635        return start + step * i;
7636      });
7637    }
7638    scale.domain = function(x) {
7639      if (!arguments.length) return domain;
7640      domain = [];
7641      index = new d3_Map();
7642      var i = -1, n = x.length, xi;
7643      while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
7644      return scale[ranger.t].apply(scale, ranger.a);
7645    };
7646    scale.range = function(x) {
7647      if (!arguments.length) return range;
7648      range = x;
7649      rangeBand = 0;
7650      ranger = {
7651        t: "range",
7652        a: arguments
7653      };
7654      return scale;
7655    };
7656    scale.rangePoints = function(x, padding) {
7657      if (arguments.length < 2) padding = 0;
7658      var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding);
7659      range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
7660      rangeBand = 0;
7661      ranger = {
7662        t: "rangePoints",
7663        a: arguments
7664      };
7665      return scale;
7666    };
7667    scale.rangeBands = function(x, padding, outerPadding) {
7668      if (arguments.length < 2) padding = 0;
7669      if (arguments.length < 3) outerPadding = padding;
7670      var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);
7671      range = steps(start + step * outerPadding, step);
7672      if (reverse) range.reverse();
7673      rangeBand = step * (1 - padding);
7674      ranger = {
7675        t: "rangeBands",
7676        a: arguments
7677      };
7678      return scale;
7679    };
7680    scale.rangeRoundBands = function(x, padding, outerPadding) {
7681      if (arguments.length < 2) padding = 0;
7682      if (arguments.length < 3) outerPadding = padding;
7683      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;
7684      range = steps(start + Math.round(error / 2), step);
7685      if (reverse) range.reverse();
7686      rangeBand = Math.round(step * (1 - padding));
7687      ranger = {
7688        t: "rangeRoundBands",
7689        a: arguments
7690      };
7691      return scale;
7692    };
7693    scale.rangeBand = function() {
7694      return rangeBand;
7695    };
7696    scale.rangeExtent = function() {
7697      return d3_scaleExtent(ranger.a[0]);
7698    };
7699    scale.copy = function() {
7700      return d3_scale_ordinal(domain, ranger);
7701    };
7702    return scale.domain(domain);
7703  }
7704  d3.scale.category10 = function() {
7705    return d3.scale.ordinal().range(d3_category10);
7706  };
7707  d3.scale.category20 = function() {
7708    return d3.scale.ordinal().range(d3_category20);
7709  };
7710  d3.scale.category20b = function() {
7711    return d3.scale.ordinal().range(d3_category20b);
7712  };
7713  d3.scale.category20c = function() {
7714    return d3.scale.ordinal().range(d3_category20c);
7715  };
7716  var d3_category10 = [ 2062260, 16744206, 2924588, 14034728, 9725885, 9197131, 14907330, 8355711, 12369186, 1556175 ].map(d3_rgbString);
7717  var d3_category20 = [ 2062260, 11454440, 16744206, 16759672, 2924588, 10018698, 14034728, 16750742, 9725885, 12955861, 9197131, 12885140, 14907330, 16234194, 8355711, 13092807, 12369186, 14408589, 1556175, 10410725 ].map(d3_rgbString);
7718  var d3_category20b = [ 3750777, 5395619, 7040719, 10264286, 6519097, 9216594, 11915115, 13556636, 9202993, 12426809, 15186514, 15190932, 8666169, 11356490, 14049643, 15177372, 8077683, 10834324, 13528509, 14589654 ].map(d3_rgbString);
7719  var d3_category20c = [ 3244733, 7057110, 10406625, 13032431, 15095053, 16616764, 16625259, 16634018, 3253076, 7652470, 10607003, 13101504, 7695281, 10394312, 12369372, 14342891, 6513507, 9868950, 12434877, 14277081 ].map(d3_rgbString);
7720  d3.scale.quantile = function() {
7721    return d3_scale_quantile([], []);
7722  };
7723  function d3_scale_quantile(domain, range) {
7724    var thresholds;
7725    function rescale() {
7726      var k = 0, q = range.length;
7727      thresholds = [];
7728      while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
7729      return scale;
7730    }
7731    function scale(x) {
7732      if (!isNaN(x = +x)) return range[d3.bisect(thresholds, x)];
7733    }
7734    scale.domain = function(x) {
7735      if (!arguments.length) return domain;
7736      domain = x.filter(function(d) {
7737        return !isNaN(d);
7738      }).sort(d3_ascending);
7739      return rescale();
7740    };
7741    scale.range = function(x) {
7742      if (!arguments.length) return range;
7743      range = x;
7744      return rescale();
7745    };
7746    scale.quantiles = function() {
7747      return thresholds;
7748    };
7749    scale.invertExtent = function(y) {
7750      y = range.indexOf(y);
7751      return y < 0 ? [ NaN, NaN ] : [ y > 0 ? thresholds[y - 1] : domain[0], y < thresholds.length ? thresholds[y] : domain[domain.length - 1] ];
7752    };
7753    scale.copy = function() {
7754      return d3_scale_quantile(domain, range);
7755    };
7756    return rescale();
7757  }
7758  d3.scale.quantize = function() {
7759    return d3_scale_quantize(0, 1, [ 0, 1 ]);
7760  };
7761  function d3_scale_quantize(x0, x1, range) {
7762    var kx, i;
7763    function scale(x) {
7764      return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
7765    }
7766    function rescale() {
7767      kx = range.length / (x1 - x0);
7768      i = range.length - 1;
7769      return scale;
7770    }
7771    scale.domain = function(x) {
7772      if (!arguments.length) return [ x0, x1 ];
7773      x0 = +x[0];
7774      x1 = +x[x.length - 1];
7775      return rescale();
7776    };
7777    scale.range = function(x) {
7778      if (!arguments.length) return range;
7779      range = x;
7780      return rescale();
7781    };
7782    scale.invertExtent = function(y) {
7783      y = range.indexOf(y);
7784      y = y < 0 ? NaN : y / kx + x0;
7785      return [ y, y + 1 / kx ];
7786    };
7787    scale.copy = function() {
7788      return d3_scale_quantize(x0, x1, range);
7789    };
7790    return rescale();
7791  }
7792  d3.scale.threshold = function() {
7793    return d3_scale_threshold([ .5 ], [ 0, 1 ]);
7794  };
7795  function d3_scale_threshold(domain, range) {
7796    function scale(x) {
7797      if (x <= x) return range[d3.bisect(domain, x)];
7798    }
7799    scale.domain = function(_) {
7800      if (!arguments.length) return domain;
7801      domain = _;
7802      return scale;
7803    };
7804    scale.range = function(_) {
7805      if (!arguments.length) return range;
7806      range = _;
7807      return scale;
7808    };
7809    scale.invertExtent = function(y) {
7810      y = range.indexOf(y);
7811      return [ domain[y - 1], domain[y] ];
7812    };
7813    scale.copy = function() {
7814      return d3_scale_threshold(domain, range);
7815    };
7816    return scale;
7817  }
7818  d3.scale.identity = function() {
7819    return d3_scale_identity([ 0, 1 ]);
7820  };
7821  function d3_scale_identity(domain) {
7822    function identity(x) {
7823      return +x;
7824    }
7825    identity.invert = identity;
7826    identity.domain = identity.range = function(x) {
7827      if (!arguments.length) return domain;
7828      domain = x.map(identity);
7829      return identity;
7830    };
7831    identity.ticks = function(m) {
7832      return d3_scale_linearTicks(domain, m);
7833    };
7834    identity.tickFormat = function(m, format) {
7835      return d3_scale_linearTickFormat(domain, m, format);
7836    };
7837    identity.copy = function() {
7838      return d3_scale_identity(domain);
7839    };
7840    return identity;
7841  }
7842  d3.svg = {};
7843  d3.svg.arc = function() {
7844    var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
7845    function arc() {
7846      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,
7847      a0 = a1, a1 = da), a1 - a0), df = da < π ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1);
7848      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";
7849    }
7850    arc.innerRadius = function(v) {
7851      if (!arguments.length) return innerRadius;
7852      innerRadius = d3_functor(v);
7853      return arc;
7854    };
7855    arc.outerRadius = function(v) {
7856      if (!arguments.length) return outerRadius;
7857      outerRadius = d3_functor(v);
7858      return arc;
7859    };
7860    arc.startAngle = function(v) {
7861      if (!arguments.length) return startAngle;
7862      startAngle = d3_functor(v);
7863      return arc;
7864    };
7865    arc.endAngle = function(v) {
7866      if (!arguments.length) return endAngle;
7867      endAngle = d3_functor(v);
7868      return arc;
7869    };
7870    arc.centroid = function() {
7871      var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
7872      return [ Math.cos(a) * r, Math.sin(a) * r ];
7873    };
7874    return arc;
7875  };
7876  var d3_svg_arcOffset = -halfπ, d3_svg_arcMax = τ - ε;
7877  function d3_svg_arcInnerRadius(d) {
7878    return d.innerRadius;
7879  }
7880  function d3_svg_arcOuterRadius(d) {
7881    return d.outerRadius;
7882  }
7883  function d3_svg_arcStartAngle(d) {
7884    return d.startAngle;
7885  }
7886  function d3_svg_arcEndAngle(d) {
7887    return d.endAngle;
7888  }
7889  function d3_svg_line(projection) {
7890    var x = d3_geom_pointX, y = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;
7891    function line(data) {
7892      var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);
7893      function segment() {
7894        segments.push("M", interpolate(projection(points), tension));
7895      }
7896      while (++i < n) {
7897        if (defined.call(this, d = data[i], i)) {
7898          points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);
7899        } else if (points.length) {
7900          segment();
7901          points = [];
7902        }
7903      }
7904      if (points.length) segment();
7905      return segments.length ? segments.join("") : null;
7906    }
7907    line.x = function(_) {
7908      if (!arguments.length) return x;
7909      x = _;
7910      return line;
7911    };
7912    line.y = function(_) {
7913      if (!arguments.length) return y;
7914      y = _;
7915      return line;
7916    };
7917    line.defined = function(_) {
7918      if (!arguments.length) return defined;
7919      defined = _;
7920      return line;
7921    };
7922    line.interpolate = function(_) {
7923      if (!arguments.length) return interpolateKey;
7924      if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
7925      return line;
7926    };
7927    line.tension = function(_) {
7928      if (!arguments.length) return tension;
7929      tension = _;
7930      return line;
7931    };
7932    return line;
7933  }
7934  d3.svg.line = function() {
7935    return d3_svg_line(d3_identity);
7936  };
7937  var d3_svg_lineInterpolators = d3.map({
7938    linear: d3_svg_lineLinear,
7939    "linear-closed": d3_svg_lineLinearClosed,
7940    step: d3_svg_lineStep,
7941    "step-before": d3_svg_lineStepBefore,
7942    "step-after": d3_svg_lineStepAfter,
7943    basis: d3_svg_lineBasis,
7944    "basis-open": d3_svg_lineBasisOpen,
7945    "basis-closed": d3_svg_lineBasisClosed,
7946    bundle: d3_svg_lineBundle,
7947    cardinal: d3_svg_lineCardinal,
7948    "cardinal-open": d3_svg_lineCardinalOpen,
7949    "cardinal-closed": d3_svg_lineCardinalClosed,
7950    monotone: d3_svg_lineMonotone
7951  });
7952  d3_svg_lineInterpolators.forEach(function(key, value) {
7953    value.key = key;
7954    value.closed = /-closed$/.test(key);
7955  });
7956  function d3_svg_lineLinear(points) {
7957    return points.join("L");
7958  }
7959  function d3_svg_lineLinearClosed(points) {
7960    return d3_svg_lineLinear(points) + "Z";
7961  }
7962  function d3_svg_lineStep(points) {
7963    var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
7964    while (++i < n) path.push("H", (p[0] + (p = points[i])[0]) / 2, "V", p[1]);
7965    if (n > 1) path.push("H", p[0]);
7966    return path.join("");
7967  }
7968  function d3_svg_lineStepBefore(points) {
7969    var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
7970    while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
7971    return path.join("");
7972  }
7973  function d3_svg_lineStepAfter(points) {
7974    var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
7975    while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
7976    return path.join("");
7977  }
7978  function d3_svg_lineCardinalOpen(points, tension) {
7979    return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension));
7980  }
7981  function d3_svg_lineCardinalClosed(points, tension) {
7982    return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]),
7983    points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
7984  }
7985  function d3_svg_lineCardinal(points, tension) {
7986    return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));
7987  }
7988  function d3_svg_lineHermite(points, tangents) {
7989    if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {
7990      return d3_svg_lineLinear(points);
7991    }
7992    var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;
7993    if (quad) {
7994      path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];
7995      p0 = points[1];
7996      pi = 2;
7997    }
7998    if (tangents.length > 1) {
7999      t = tangents[1];
8000      p = points[pi];
8001      pi++;
8002      path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
8003      for (var i = 2; i < tangents.length; i++, pi++) {
8004        p = points[pi];
8005        t = tangents[i];
8006        path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
8007      }
8008    }
8009    if (quad) {
8010      var lp = points[pi];
8011      path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];
8012    }
8013    return path;
8014  }
8015  function d3_svg_lineCardinalTangents(points, tension) {
8016    var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;
8017    while (++i < n) {
8018      p0 = p1;
8019      p1 = p2;
8020      p2 = points[i];
8021      tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);
8022    }
8023    return tangents;
8024  }
8025  function d3_svg_lineBasis(points) {
8026    if (points.length < 3) return d3_svg_lineLinear(points);
8027    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, "L", d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
8028    points.push(points[n - 1]);
8029    while (++i <= n) {
8030      pi = points[i];
8031      px.shift();
8032      px.push(pi[0]);
8033      py.shift();
8034      py.push(pi[1]);
8035      d3_svg_lineBasisBezier(path, px, py);
8036    }
8037    points.pop();
8038    path.push("L", pi);
8039    return path.join("");
8040  }
8041  function d3_svg_lineBasisOpen(points) {
8042    if (points.length < 4) return d3_svg_lineLinear(points);
8043    var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];
8044    while (++i < 3) {
8045      pi = points[i];
8046      px.push(pi[0]);
8047      py.push(pi[1]);
8048    }
8049    path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
8050    --i;
8051    while (++i < n) {
8052      pi = points[i];
8053      px.shift();
8054      px.push(pi[0]);
8055      py.shift();
8056      py.push(pi[1]);
8057      d3_svg_lineBasisBezier(path, px, py);
8058    }
8059    return path.join("");
8060  }
8061  function d3_svg_lineBasisClosed(points) {
8062    var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];
8063    while (++i < 4) {
8064      pi = points[i % n];
8065      px.push(pi[0]);
8066      py.push(pi[1]);
8067    }
8068    path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
8069    --i;
8070    while (++i < m) {
8071      pi = points[i % n];
8072      px.shift();
8073      px.push(pi[0]);
8074      py.shift();
8075      py.push(pi[1]);
8076      d3_svg_lineBasisBezier(path, px, py);
8077    }
8078    return path.join("");
8079  }
8080  function d3_svg_lineBundle(points, tension) {
8081    var n = points.length - 1;
8082    if (n) {
8083      var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;
8084      while (++i <= n) {
8085        p = points[i];
8086        t = i / n;
8087        p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
8088        p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
8089      }
8090    }
8091    return d3_svg_lineBasis(points);
8092  }
8093  function d3_svg_lineDot4(a, b) {
8094    return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
8095  }
8096  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 ];
8097  function d3_svg_lineBasisBezier(path, x, y) {
8098    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));
8099  }
8100  function d3_svg_lineSlope(p0, p1) {
8101    return (p1[1] - p0[1]) / (p1[0] - p0[0]);
8102  }
8103  function d3_svg_lineFiniteDifferences(points) {
8104    var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);
8105    while (++i < j) {
8106      m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;
8107    }
8108    m[i] = d;
8109    return m;
8110  }
8111  function d3_svg_lineMonotoneTangents(points) {
8112    var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;
8113    while (++i < j) {
8114      d = d3_svg_lineSlope(points[i], points[i + 1]);
8115      if (abs(d) < ε) {
8116        m[i] = m[i + 1] = 0;
8117      } else {
8118        a = m[i] / d;
8119        b = m[i + 1] / d;
8120        s = a * a + b * b;
8121        if (s > 9) {
8122          s = d * 3 / Math.sqrt(s);
8123          m[i] = s * a;
8124          m[i + 1] = s * b;
8125        }
8126      }
8127    }
8128    i = -1;
8129    while (++i <= j) {
8130      s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
8131      tangents.push([ s || 0, m[i] * s || 0 ]);
8132    }
8133    return tangents;
8134  }
8135  function d3_svg_lineMonotone(points) {
8136    return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
8137  }
8138  d3.svg.line.radial = function() {
8139    var line = d3_svg_line(d3_svg_lineRadial);
8140    line.radius = line.x, delete line.x;
8141    line.angle = line.y, delete line.y;
8142    return line;
8143  };
8144  function d3_svg_lineRadial(points) {
8145    var point, i = -1, n = points.length, r, a;
8146    while (++i < n) {
8147      point = points[i];
8148      r = point[0];
8149      a = point[1] + d3_svg_arcOffset;
8150      point[0] = r * Math.cos(a);
8151      point[1] = r * Math.sin(a);
8152    }
8153    return points;
8154  }
8155  function d3_svg_area(projection) {
8156    var x0 = d3_geom_pointX, x1 = d3_geom_pointX, y0 = 0, y1 = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
8157    function area(data) {
8158      var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
8159        return x;
8160      } : d3_functor(x1), fy1 = y0 === y1 ? function() {
8161        return y;
8162      } : d3_functor(y1), x, y;
8163      function segment() {
8164        segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");
8165      }
8166      while (++i < n) {
8167        if (defined.call(this, d = data[i], i)) {
8168          points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);
8169          points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);
8170        } else if (points0.length) {
8171          segment();
8172          points0 = [];
8173          points1 = [];
8174        }
8175      }
8176      if (points0.length) segment();
8177      return segments.length ? segments.join("") : null;
8178    }
8179    area.x = function(_) {
8180      if (!arguments.length) return x1;
8181      x0 = x1 = _;
8182      return area;
8183    };
8184    area.x0 = function(_) {
8185      if (!arguments.length) return x0;
8186      x0 = _;
8187      return area;
8188    };
8189    area.x1 = function(_) {
8190      if (!arguments.length) return x1;
8191      x1 = _;
8192      return area;
8193    };
8194    area.y = function(_) {
8195      if (!arguments.length) return y1;
8196      y0 = y1 = _;
8197      return area;
8198    };
8199    area.y0 = function(_) {
8200      if (!arguments.length) return y0;
8201      y0 = _;
8202      return area;
8203    };
8204    area.y1 = function(_) {
8205      if (!arguments.length) return y1;
8206      y1 = _;
8207      return area;
8208    };
8209    area.defined = function(_) {
8210      if (!arguments.length) return defined;
8211      defined = _;
8212      return area;
8213    };
8214    area.interpolate = function(_) {
8215      if (!arguments.length) return interpolateKey;
8216      if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
8217      interpolateReverse = interpolate.reverse || interpolate;
8218      L = interpolate.closed ? "M" : "L";
8219      return area;
8220    };
8221    area.tension = function(_) {
8222      if (!arguments.length) return tension;
8223      tension = _;
8224      return area;
8225    };
8226    return area;
8227  }
8228  d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
8229  d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
8230  d3.svg.area = function() {
8231    return d3_svg_area(d3_identity);
8232  };
8233  d3.svg.area.radial = function() {
8234    var area = d3_svg_area(d3_svg_lineRadial);
8235    area.radius = area.x, delete area.x;
8236    area.innerRadius = area.x0, delete area.x0;
8237    area.outerRadius = area.x1, delete area.x1;
8238    area.angle = area.y, delete area.y;
8239    area.startAngle = area.y0, delete area.y0;
8240    area.endAngle = area.y1, delete area.y1;
8241    return area;
8242  };
8243  d3.svg.chord = function() {
8244    var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
8245    function chord(d, i) {
8246      var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
8247      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";
8248    }
8249    function subgroup(self, f, d, i) {
8250      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;
8251      return {
8252        r: r,
8253        a0: a0,
8254        a1: a1,
8255        p0: [ r * Math.cos(a0), r * Math.sin(a0) ],
8256        p1: [ r * Math.cos(a1), r * Math.sin(a1) ]
8257      };
8258    }
8259    function equals(a, b) {
8260      return a.a0 == b.a0 && a.a1 == b.a1;
8261    }
8262    function arc(r, p, a) {
8263      return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p;
8264    }
8265    function curve(r0, p0, r1, p1) {
8266      return "Q 0,0 " + p1;
8267    }
8268    chord.radius = function(v) {
8269      if (!arguments.length) return radius;
8270      radius = d3_functor(v);
8271      return chord;
8272    };
8273    chord.source = function(v) {
8274      if (!arguments.length) return source;
8275      source = d3_functor(v);
8276      return chord;
8277    };
8278    chord.target = function(v) {
8279      if (!arguments.length) return target;
8280      target = d3_functor(v);
8281      return chord;
8282    };
8283    chord.startAngle = function(v) {
8284      if (!arguments.length) return startAngle;
8285      startAngle = d3_functor(v);
8286      return chord;
8287    };
8288    chord.endAngle = function(v) {
8289      if (!arguments.length) return endAngle;
8290      endAngle = d3_functor(v);
8291      return chord;
8292    };
8293    return chord;
8294  };
8295  function d3_svg_chordRadius(d) {
8296    return d.radius;
8297  }
8298  d3.svg.diagonal = function() {
8299    var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection;
8300    function diagonal(d, i) {
8301      var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {
8302        x: p0.x,
8303        y: m
8304      }, {
8305        x: p3.x,
8306        y: m
8307      }, p3 ];
8308      p = p.map(projection);
8309      return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
8310    }
8311    diagonal.source = function(x) {
8312      if (!arguments.length) return source;
8313      source = d3_functor(x);
8314      return diagonal;
8315    };
8316    diagonal.target = function(x) {
8317      if (!arguments.length) return target;
8318      target = d3_functor(x);
8319      return diagonal;
8320    };
8321    diagonal.projection = function(x) {
8322      if (!arguments.length) return projection;
8323      projection = x;
8324      return diagonal;
8325    };
8326    return diagonal;
8327  };
8328  function d3_svg_diagonalProjection(d) {
8329    return [ d.x, d.y ];
8330  }
8331  d3.svg.diagonal.radial = function() {
8332    var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;
8333    diagonal.projection = function(x) {
8334      return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;
8335    };
8336    return diagonal;
8337  };
8338  function d3_svg_diagonalRadialProjection(projection) {
8339    return function() {
8340      var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset;
8341      return [ r * Math.cos(a), r * Math.sin(a) ];
8342    };
8343  }
8344  d3.svg.symbol = function() {
8345    var type = d3_svg_symbolType, size = d3_svg_symbolSize;
8346    function symbol(d, i) {
8347      return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));
8348    }
8349    symbol.type = function(x) {
8350      if (!arguments.length) return type;
8351      type = d3_functor(x);
8352      return symbol;
8353    };
8354    symbol.size = function(x) {
8355      if (!arguments.length) return size;
8356      size = d3_functor(x);
8357      return symbol;
8358    };
8359    return symbol;
8360  };
8361  function d3_svg_symbolSize() {
8362    return 64;
8363  }
8364  function d3_svg_symbolType() {
8365    return "circle";
8366  }
8367  function d3_svg_symbolCircle(size) {
8368    var r = Math.sqrt(size / π);
8369    return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
8370  }
8371  var d3_svg_symbols = d3.map({
8372    circle: d3_svg_symbolCircle,
8373    cross: function(size) {
8374      var r = Math.sqrt(size / 5) / 2;
8375      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";
8376    },
8377    diamond: function(size) {
8378      var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;
8379      return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
8380    },
8381    square: function(size) {
8382      var r = Math.sqrt(size) / 2;
8383      return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
8384    },
8385    "triangle-down": function(size) {
8386      var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
8387      return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
8388    },
8389    "triangle-up": function(size) {
8390      var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
8391      return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";
8392    }
8393  });
8394  d3.svg.symbolTypes = d3_svg_symbols.keys();
8395  var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians);
8396  function d3_transition(groups, id) {
8397    d3_subclass(groups, d3_transitionPrototype);
8398    groups.id = id;
8399    return groups;
8400  }
8401  var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit;
8402  d3_transitionPrototype.call = d3_selectionPrototype.call;
8403  d3_transitionPrototype.empty = d3_selectionPrototype.empty;
8404  d3_transitionPrototype.node = d3_selectionPrototype.node;
8405  d3_transitionPrototype.size = d3_selectionPrototype.size;
8406  d3.transition = function(selection) {
8407    return arguments.length ? d3_transitionInheritId ? selection.transition() : selection : d3_selectionRoot.transition();
8408  };
8409  d3.transition.prototype = d3_transitionPrototype;
8410  d3_transitionPrototype.select = function(selector) {
8411    var id = this.id, subgroups = [], subgroup, subnode, node;
8412    selector = d3_selection_selector(selector);
8413    for (var j = -1, m = this.length; ++j < m; ) {
8414      subgroups.push(subgroup = []);
8415      for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
8416        if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i, j))) {
8417          if ("__data__" in node) subnode.__data__ = node.__data__;
8418          d3_transitionNode(subnode, i, id, node.__transition__[id]);
8419          subgroup.push(subnode);
8420        } else {
8421          subgroup.push(null);
8422        }
8423      }
8424    }
8425    return d3_transition(subgroups, id);
8426  };
8427  d3_transitionPrototype.selectAll = function(selector) {
8428    var id = this.id, subgroups = [], subgroup, subnodes, node, subnode, transition;
8429    selector = d3_selection_selectorAll(selector);
8430    for (var j = -1, m = this.length; ++j < m; ) {
8431      for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
8432        if (node = group[i]) {
8433          transition = node.__transition__[id];
8434          subnodes = selector.call(node, node.__data__, i, j);
8435          subgroups.push(subgroup = []);
8436          for (var k = -1, o = subnodes.length; ++k < o; ) {
8437            if (subnode = subnodes[k]) d3_transitionNode(subnode, k, id, transition);
8438            subgroup.push(subnode);
8439          }
8440        }
8441      }
8442    }
8443    return d3_transition(subgroups, id);
8444  };
8445  d3_transitionPrototype.filter = function(filter) {
8446    var subgroups = [], subgroup, group, node;
8447    if (typeof filter !== "function") filter = d3_selection_filter(filter);
8448    for (var j = 0, m = this.length; j < m; j++) {
8449      subgroups.push(subgroup = []);
8450      for (var group = this[j], i = 0, n = group.length; i < n; i++) {
8451        if ((node = group[i]) && filter.call(node, node.__data__, i, j)) {
8452          subgroup.push(node);
8453        }
8454      }
8455    }
8456    return d3_transition(subgroups, this.id);
8457  };
8458  d3_transitionPrototype.tween = function(name, tween) {
8459    var id = this.id;
8460    if (arguments.length < 2) return this.node().__transition__[id].tween.get(name);
8461    return d3_selection_each(this, tween == null ? function(node) {
8462      node.__transition__[id].tween.remove(name);
8463    } : function(node) {
8464      node.__transition__[id].tween.set(name, tween);
8465    });
8466  };
8467  function d3_transition_tween(groups, name, value, tween) {
8468    var id = groups.id;
8469    return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) {
8470      node.__transition__[id].tween.set(name, tween(value.call(node, node.__data__, i, j)));
8471    } : (value = tween(value), function(node) {
8472      node.__transition__[id].tween.set(name, value);
8473    }));
8474  }
8475  d3_transitionPrototype.attr = function(nameNS, value) {
8476    if (arguments.length < 2) {
8477      for (value in nameNS) this.attr(value, nameNS[value]);
8478      return this;
8479    }
8480    var interpolate = nameNS == "transform" ? d3_interpolateTransform : d3_interpolate, name = d3.ns.qualify(nameNS);
8481    function attrNull() {
8482      this.removeAttribute(name);
8483    }
8484    function attrNullNS() {
8485      this.removeAttributeNS(name.space, name.local);
8486    }
8487    function attrTween(b) {
8488      return b == null ? attrNull : (b += "", function() {
8489        var a = this.getAttribute(name), i;
8490        return a !== b && (i = interpolate(a, b), function(t) {
8491          this.setAttribute(name, i(t));
8492        });
8493      });
8494    }
8495    function attrTweenNS(b) {
8496      return b == null ? attrNullNS : (b += "", function() {
8497        var a = this.getAttributeNS(name.space, name.local), i;
8498        return a !== b && (i = interpolate(a, b), function(t) {
8499          this.setAttributeNS(name.space, name.local, i(t));
8500        });
8501      });
8502    }
8503    return d3_transition_tween(this, "attr." + nameNS, value, name.local ? attrTweenNS : attrTween);
8504  };
8505  d3_transitionPrototype.attrTween = function(nameNS, tween) {
8506    var name = d3.ns.qualify(nameNS);
8507    function attrTween(d, i) {
8508      var f = tween.call(this, d, i, this.getAttribute(name));
8509      return f && function(t) {
8510        this.setAttribute(name, f(t));
8511      };
8512    }
8513    function attrTweenNS(d, i) {
8514      var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
8515      return f && function(t) {
8516        this.setAttributeNS(name.space, name.local, f(t));
8517      };
8518    }
8519    return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
8520  };
8521  d3_transitionPrototype.style = function(name, value, priority) {
8522    var n = arguments.length;
8523    if (n < 3) {
8524      if (typeof name !== "string") {
8525        if (n < 2) value = "";
8526        for (priority in name) this.style(priority, name[priority], value);
8527        return this;
8528      }
8529      priority = "";
8530    }
8531    function styleNull() {
8532      this.style.removeProperty(name);
8533    }
8534    function styleString(b) {
8535      return b == null ? styleNull : (b += "", function() {
8536        var a = d3_window.getComputedStyle(this, null).getPropertyValue(name), i;
8537        return a !== b && (i = d3_interpolate(a, b), function(t) {
8538          this.style.setProperty(name, i(t), priority);
8539        });
8540      });
8541    }
8542    return d3_transition_tween(this, "style." + name, value, styleString);
8543  };
8544  d3_transitionPrototype.styleTween = function(name, tween, priority) {
8545    if (arguments.length < 3) priority = "";
8546    function styleTween(d, i) {
8547      var f = tween.call(this, d, i, d3_window.getComputedStyle(this, null).getPropertyValue(name));
8548      return f && function(t) {
8549        this.style.setProperty(name, f(t), priority);
8550      };
8551    }
8552    return this.tween("style." + name, styleTween);
8553  };
8554  d3_transitionPrototype.text = function(value) {
8555    return d3_transition_tween(this, "text", value, d3_transition_text);
8556  };
8557  function d3_transition_text(b) {
8558    if (b == null) b = "";
8559    return function() {
8560      this.textContent = b;
8561    };
8562  }
8563  d3_transitionPrototype.remove = function() {
8564    return this.each("end.transition", function() {
8565      var p;
8566      if (this.__transition__.count < 2 && (p = this.parentNode)) p.removeChild(this);
8567    });
8568  };
8569  d3_transitionPrototype.ease = function(value) {
8570    var id = this.id;
8571    if (arguments.length < 1) return this.node().__transition__[id].ease;
8572    if (typeof value !== "function") value = d3.ease.apply(d3, arguments);
8573    return d3_selection_each(this, function(node) {
8574      node.__transition__[id].ease = value;
8575    });
8576  };
8577  d3_transitionPrototype.delay = function(value) {
8578    var id = this.id;
8579    if (arguments.length < 1) return this.node().__transition__[id].delay;
8580    return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
8581      node.__transition__[id].delay = +value.call(node, node.__data__, i, j);
8582    } : (value = +value, function(node) {
8583      node.__transition__[id].delay = value;
8584    }));
8585  };
8586  d3_transitionPrototype.duration = function(value) {
8587    var id = this.id;
8588    if (arguments.length < 1) return this.node().__transition__[id].duration;
8589    return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
8590      node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j));
8591    } : (value = Math.max(1, value), function(node) {
8592      node.__transition__[id].duration = value;
8593    }));
8594  };
8595  d3_transitionPrototype.each = function(type, listener) {
8596    var id = this.id;
8597    if (arguments.length < 2) {
8598      var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId;
8599      d3_transitionInheritId = id;
8600      d3_selection_each(this, function(node, i, j) {
8601        d3_transitionInherit = node.__transition__[id];
8602        type.call(node, node.__data__, i, j);
8603      });
8604      d3_transitionInherit = inherit;
8605      d3_transitionInheritId = inheritId;
8606    } else {
8607      d3_selection_each(this, function(node) {
8608        var transition = node.__transition__[id];
8609        (transition.event || (transition.event = d3.dispatch("start", "end"))).on(type, listener);
8610      });
8611    }
8612    return this;
8613  };
8614  d3_transitionPrototype.transition = function() {
8615    var id0 = this.id, id1 = ++d3_transitionId, subgroups = [], subgroup, group, node, transition;
8616    for (var j = 0, m = this.length; j < m; j++) {
8617      subgroups.push(subgroup = []);
8618      for (var group = this[j], i = 0, n = group.length; i < n; i++) {
8619        if (node = group[i]) {
8620          transition = Object.create(node.__transition__[id0]);
8621          transition.delay += transition.duration;
8622          d3_transitionNode(node, i, id1, transition);
8623        }
8624        subgroup.push(node);
8625      }
8626    }
8627    return d3_transition(subgroups, id1);
8628  };
8629  function d3_transitionNode(node, i, id, inherit) {
8630    var lock = node.__transition__ || (node.__transition__ = {
8631      active: 0,
8632      count: 0
8633    }), transition = lock[id];
8634    if (!transition) {
8635      var time = inherit.time;
8636      transition = lock[id] = {
8637        tween: new d3_Map(),
8638        time: time,
8639        ease: inherit.ease,
8640        delay: inherit.delay,
8641        duration: inherit.duration
8642      };
8643      ++lock.count;
8644      d3.timer(function(elapsed) {
8645        var d = node.__data__, ease = transition.ease, delay = transition.delay, duration = transition.duration, timer = d3_timer_active, tweened = [];
8646        timer.t = delay + time;
8647        if (delay <= elapsed) return start(elapsed - delay);
8648        timer.c = start;
8649        function start(elapsed) {
8650          if (lock.active > id) return stop();
8651          lock.active = id;
8652          transition.event && transition.event.start.call(node, d, i);
8653          transition.tween.forEach(function(key, value) {
8654            if (value = value.call(node, d, i)) {
8655              tweened.push(value);
8656            }
8657          });
8658          d3.timer(function() {
8659            timer.c = tick(elapsed || 1) ? d3_true : tick;
8660            return 1;
8661          }, 0, time);
8662        }
8663        function tick(elapsed) {
8664          if (lock.active !== id) return stop();
8665          var t = elapsed / duration, e = ease(t), n = tweened.length;
8666          while (n > 0) {
8667            tweened[--n].call(node, e);
8668          }
8669          if (t >= 1) {
8670            transition.event && transition.event.end.call(node, d, i);
8671            return stop();
8672          }
8673        }
8674        function stop() {
8675          if (--lock.count) delete lock[id]; else delete node.__transition__;
8676          return 1;
8677        }
8678      }, 0, time);
8679    }
8680  }
8681  d3.svg.axis = function() {
8682    var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_;
8683    function axis(g) {
8684      g.each(function() {
8685        var g = d3.select(this);
8686        var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy();
8687        var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g.selectAll(".tick").data(ticks, scale1), tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", ε), tickExit = d3.transition(tick.exit()).style("opacity", ε).remove(), tickUpdate = d3.transition(tick.order()).style("opacity", 1), tickTransform;
8688        var range = d3_scaleRange(scale1), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"),
8689        d3.transition(path));
8690        tickEnter.append("line");
8691        tickEnter.append("text");
8692        var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
8693        switch (orient) {
8694         case "bottom":
8695          {
8696            tickTransform = d3_svg_axisX;
8697            lineEnter.attr("y2", innerTickSize);
8698            textEnter.attr("y", Math.max(innerTickSize, 0) + tickPadding);
8699            lineUpdate.attr("x2", 0).attr("y2", innerTickSize);
8700            textUpdate.attr("x", 0).attr("y", Math.max(innerTickSize, 0) + tickPadding);
8701            text.attr("dy", ".71em").style("text-anchor", "middle");
8702            pathUpdate.attr("d", "M" + range[0] + "," + outerTickSize + "V0H" + range[1] + "V" + outerTickSize);
8703            break;
8704          }
8705
8706         case "top":
8707          {
8708            tickTransform = d3_svg_axisX;
8709            lineEnter.attr("y2", -innerTickSize);
8710            textEnter.attr("y", -(Math.max(innerTickSize, 0) + tickPadding));
8711            lineUpdate.attr("x2", 0).attr("y2", -innerTickSize);
8712            textUpdate.attr("x", 0).attr("y", -(Math.max(innerTickSize, 0) + tickPadding));
8713            text.attr("dy", "0em").style("text-anchor", "middle");
8714            pathUpdate.attr("d", "M" + range[0] + "," + -outerTickSize + "V0H" + range[1] + "V" + -outerTickSize);
8715            break;
8716          }
8717
8718         case "left":
8719          {
8720            tickTransform = d3_svg_axisY;
8721            lineEnter.attr("x2", -innerTickSize);
8722            textEnter.attr("x", -(Math.max(innerTickSize, 0) + tickPadding));
8723            lineUpdate.attr("x2", -innerTickSize).attr("y2", 0);
8724            textUpdate.attr("x", -(Math.max(innerTickSize, 0) + tickPadding)).attr("y", 0);
8725            text.attr("dy", ".32em").style("text-anchor", "end");
8726            pathUpdate.attr("d", "M" + -outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + -outerTickSize);
8727            break;
8728          }
8729
8730         case "right":
8731          {
8732            tickTransform = d3_svg_axisY;
8733            lineEnter.attr("x2", innerTickSize);
8734            textEnter.attr("x", Math.max(innerTickSize, 0) + tickPadding);
8735            lineUpdate.attr("x2", innerTickSize).attr("y2", 0);
8736            textUpdate.attr("x", Math.max(innerTickSize, 0) + tickPadding).attr("y", 0);
8737            text.attr("dy", ".32em").style("text-anchor", "start");
8738            pathUpdate.attr("d", "M" + outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + outerTickSize);
8739            break;
8740          }
8741        }
8742        if (scale1.rangeBand) {
8743          var x = scale1, dx = x.rangeBand() / 2;
8744          scale0 = scale1 = function(d) {
8745            return x(d) + dx;
8746          };
8747        } else if (scale0.rangeBand) {
8748          scale0 = scale1;
8749        } else {
8750          tickExit.call(tickTransform, scale1);
8751        }
8752        tickEnter.call(tickTransform, scale0);
8753        tickUpdate.call(tickTransform, scale1);
8754      });
8755    }
8756    axis.scale = function(x) {
8757      if (!arguments.length) return scale;
8758      scale = x;
8759      return axis;
8760    };
8761    axis.orient = function(x) {
8762      if (!arguments.length) return orient;
8763      orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient;
8764      return axis;
8765    };
8766    axis.ticks = function() {
8767      if (!arguments.length) return tickArguments_;
8768      tickArguments_ = arguments;
8769      return axis;
8770    };
8771    axis.tickValues = function(x) {
8772      if (!arguments.length) return tickValues;
8773      tickValues = x;
8774      return axis;
8775    };
8776    axis.tickFormat = function(x) {
8777      if (!arguments.length) return tickFormat_;
8778      tickFormat_ = x;
8779      return axis;
8780    };
8781    axis.tickSize = function(x) {
8782      var n = arguments.length;
8783      if (!n) return innerTickSize;
8784      innerTickSize = +x;
8785      outerTickSize = +arguments[n - 1];
8786      return axis;
8787    };
8788    axis.innerTickSize = function(x) {
8789      if (!arguments.length) return innerTickSize;
8790      innerTickSize = +x;
8791      return axis;
8792    };
8793    axis.outerTickSize = function(x) {
8794      if (!arguments.length) return outerTickSize;
8795      outerTickSize = +x;
8796      return axis;
8797    };
8798    axis.tickPadding = function(x) {
8799      if (!arguments.length) return tickPadding;
8800      tickPadding = +x;
8801      return axis;
8802    };
8803    axis.tickSubdivide = function() {
8804      return arguments.length && axis;
8805    };
8806    return axis;
8807  };
8808  var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = {
8809    top: 1,
8810    right: 1,
8811    bottom: 1,
8812    left: 1
8813  };
8814  function d3_svg_axisX(selection, x) {
8815    selection.attr("transform", function(d) {
8816      return "translate(" + x(d) + ",0)";
8817    });
8818  }
8819  function d3_svg_axisY(selection, y) {
8820    selection.attr("transform", function(d) {
8821      return "translate(0," + y(d) + ")";
8822    });
8823  }
8824  d3.svg.brush = function() {
8825    var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, xExtent = [ 0, 0 ], yExtent = [ 0, 0 ], xExtentDomain, yExtentDomain, xClamp = true, yClamp = true, resizes = d3_svg_brushResizes[0];
8826    function brush(g) {
8827      g.each(function() {
8828        var g = d3.select(this).style("pointer-events", "all").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
8829        var background = g.selectAll(".background").data([ 0 ]);
8830        background.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
8831        g.selectAll(".extent").data([ 0 ]).enter().append("rect").attr("class", "extent").style("cursor", "move");
8832        var resize = g.selectAll(".resize").data(resizes, d3_identity);
8833        resize.exit().remove();
8834        resize.enter().append("g").attr("class", function(d) {
8835          return "resize " + d;
8836        }).style("cursor", function(d) {
8837          return d3_svg_brushCursor[d];
8838        }).append("rect").attr("x", function(d) {
8839          return /[ew]$/.test(d) ? -3 : null;
8840        }).attr("y", function(d) {
8841          return /^[ns]/.test(d) ? -3 : null;
8842        }).attr("width", 6).attr("height", 6).style("visibility", "hidden");
8843        resize.style("display", brush.empty() ? "none" : null);
8844        var gUpdate = d3.transition(g), backgroundUpdate = d3.transition(background), range;
8845        if (x) {
8846          range = d3_scaleRange(x);
8847          backgroundUpdate.attr("x", range[0]).attr("width", range[1] - range[0]);
8848          redrawX(gUpdate);
8849        }
8850        if (y) {
8851          range = d3_scaleRange(y);
8852          backgroundUpdate.attr("y", range[0]).attr("height", range[1] - range[0]);
8853          redrawY(gUpdate);
8854        }
8855        redraw(gUpdate);
8856      });
8857    }
8858    brush.event = function(g) {
8859      g.each(function() {
8860        var event_ = event.of(this, arguments), extent1 = {
8861          x: xExtent,
8862          y: yExtent,
8863          i: xExtentDomain,
8864          j: yExtentDomain
8865        }, extent0 = this.__chart__ || extent1;
8866        this.__chart__ = extent1;
8867        if (d3_transitionInheritId) {
8868          d3.select(this).transition().each("start.brush", function() {
8869            xExtentDomain = extent0.i;
8870            yExtentDomain = extent0.j;
8871            xExtent = extent0.x;
8872            yExtent = extent0.y;
8873            event_({
8874              type: "brushstart"
8875            });
8876          }).tween("brush:brush", function() {
8877            var xi = d3_interpolateArray(xExtent, extent1.x), yi = d3_interpolateArray(yExtent, extent1.y);
8878            xExtentDomain = yExtentDomain = null;
8879            return function(t) {
8880              xExtent = extent1.x = xi(t);
8881              yExtent = extent1.y = yi(t);
8882              event_({
8883                type: "brush",
8884                mode: "resize"
8885              });
8886            };
8887          }).each("end.brush", function() {
8888            xExtentDomain = extent1.i;
8889            yExtentDomain = extent1.j;
8890            event_({
8891              type: "brush",
8892              mode: "resize"
8893            });
8894            event_({
8895              type: "brushend"
8896            });
8897          });
8898        } else {
8899          event_({
8900            type: "brushstart"
8901          });
8902          event_({
8903            type: "brush",
8904            mode: "resize"
8905          });
8906          event_({
8907            type: "brushend"
8908          });
8909        }
8910      });
8911    };
8912    function redraw(g) {
8913      g.selectAll(".resize").attr("transform", function(d) {
8914        return "translate(" + xExtent[+/e$/.test(d)] + "," + yExtent[+/^s/.test(d)] + ")";
8915      });
8916    }
8917    function redrawX(g) {
8918      g.select(".extent").attr("x", xExtent[0]);
8919      g.selectAll(".extent,.n>rect,.s>rect").attr("width", xExtent[1] - xExtent[0]);
8920    }
8921    function redrawY(g) {
8922      g.select(".extent").attr("y", yExtent[0]);
8923      g.selectAll(".extent,.e>rect,.w>rect").attr("height", yExtent[1] - yExtent[0]);
8924    }
8925    function brushstart() {
8926      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"), dragRestore = d3_event_dragSuppress(), center, origin = d3.mouse(target), offset;
8927      var w = d3.select(d3_window).on("keydown.brush", keydown).on("keyup.brush", keyup);
8928      if (d3.event.changedTouches) {
8929        w.on("touchmove.brush", brushmove).on("touchend.brush", brushend);
8930      } else {
8931        w.on("mousemove.brush", brushmove).on("mouseup.brush", brushend);
8932      }
8933      g.interrupt().selectAll("*").interrupt();
8934      if (dragging) {
8935        origin[0] = xExtent[0] - origin[0];
8936        origin[1] = yExtent[0] - origin[1];
8937      } else if (resizing) {
8938        var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);
8939        offset = [ xExtent[1 - ex] - origin[0], yExtent[1 - ey] - origin[1] ];
8940        origin[0] = xExtent[ex];
8941        origin[1] = yExtent[ey];
8942      } else if (d3.event.altKey) center = origin.slice();
8943      g.style("pointer-events", "none").selectAll(".resize").style("display", null);
8944      d3.select("body").style("cursor", eventTarget.style("cursor"));
8945      event_({
8946        type: "brushstart"
8947      });
8948      brushmove();
8949      function keydown() {
8950        if (d3.event.keyCode == 32) {
8951          if (!dragging) {
8952            center = null;
8953            origin[0] -= xExtent[1];
8954            origin[1] -= yExtent[1];
8955            dragging = 2;
8956          }
8957          d3_eventPreventDefault();
8958        }
8959      }
8960      function keyup() {
8961        if (d3.event.keyCode == 32 && dragging == 2) {
8962          origin[0] += xExtent[1];
8963          origin[1] += yExtent[1];
8964          dragging = 0;
8965          d3_eventPreventDefault();
8966        }
8967      }
8968      function brushmove() {
8969        var point = d3.mouse(target), moved = false;
8970        if (offset) {
8971          point[0] += offset[0];
8972          point[1] += offset[1];
8973        }
8974        if (!dragging) {
8975          if (d3.event.altKey) {
8976            if (!center) center = [ (xExtent[0] + xExtent[1]) / 2, (yExtent[0] + yExtent[1]) / 2 ];
8977            origin[0] = xExtent[+(point[0] < center[0])];
8978            origin[1] = yExtent[+(point[1] < center[1])];
8979          } else center = null;
8980        }
8981        if (resizingX && move1(point, x, 0)) {
8982          redrawX(g);
8983          moved = true;
8984        }
8985        if (resizingY && move1(point, y, 1)) {
8986          redrawY(g);
8987          moved = true;
8988        }
8989        if (moved) {
8990          redraw(g);
8991          event_({
8992            type: "brush",
8993            mode: dragging ? "move" : "resize"
8994          });
8995        }
8996      }
8997      function move1(point, scale, i) {
8998        var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], extent = i ? yExtent : xExtent, size = extent[1] - extent[0], min, max;
8999        if (dragging) {
9000          r0 -= position;
9001          r1 -= size + position;
9002        }
9003        min = (i ? yClamp : xClamp) ? Math.max(r0, Math.min(r1, point[i])) : point[i];
9004        if (dragging) {
9005          max = (min += position) + size;
9006        } else {
9007          if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
9008          if (position < min) {
9009            max = min;
9010            min = position;
9011          } else {
9012            max = position;
9013          }
9014        }
9015        if (extent[0] != min || extent[1] != max) {
9016          if (i) yExtentDomain = null; else xExtentDomain = null;
9017          extent[0] = min;
9018          extent[1] = max;
9019          return true;
9020        }
9021      }
9022      function brushend() {
9023        brushmove();
9024        g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
9025        d3.select("body").style("cursor", null);
9026        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);
9027        dragRestore();
9028        event_({
9029          type: "brushend"
9030        });
9031      }
9032    }
9033    brush.x = function(z) {
9034      if (!arguments.length) return x;
9035      x = z;
9036      resizes = d3_svg_brushResizes[!x << 1 | !y];
9037      return brush;
9038    };
9039    brush.y = function(z) {
9040      if (!arguments.length) return y;
9041      y = z;
9042      resizes = d3_svg_brushResizes[!x << 1 | !y];
9043      return brush;
9044    };
9045    brush.clamp = function(z) {
9046      if (!arguments.length) return x && y ? [ xClamp, yClamp ] : x ? xClamp : y ? yClamp : null;
9047      if (x && y) xClamp = !!z[0], yClamp = !!z[1]; else if (x) xClamp = !!z; else if (y) yClamp = !!z;
9048      return brush;
9049    };
9050    brush.extent = function(z) {
9051      var x0, x1, y0, y1, t;
9052      if (!arguments.length) {
9053        if (x) {
9054          if (xExtentDomain) {
9055            x0 = xExtentDomain[0], x1 = xExtentDomain[1];
9056          } else {
9057            x0 = xExtent[0], x1 = xExtent[1];
9058            if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
9059            if (x1 < x0) t = x0, x0 = x1, x1 = t;
9060          }
9061        }
9062        if (y) {
9063          if (yExtentDomain) {
9064            y0 = yExtentDomain[0], y1 = yExtentDomain[1];
9065          } else {
9066            y0 = yExtent[0], y1 = yExtent[1];
9067            if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
9068            if (y1 < y0) t = y0, y0 = y1, y1 = t;
9069          }
9070        }
9071        return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];
9072      }
9073      if (x) {
9074        x0 = z[0], x1 = z[1];
9075        if (y) x0 = x0[0], x1 = x1[0];
9076        xExtentDomain = [ x0, x1 ];
9077        if (x.invert) x0 = x(x0), x1 = x(x1);
9078        if (x1 < x0) t = x0, x0 = x1, x1 = t;
9079        if (x0 != xExtent[0] || x1 != xExtent[1]) xExtent = [ x0, x1 ];
9080      }
9081      if (y) {
9082        y0 = z[0], y1 = z[1];
9083        if (x) y0 = y0[1], y1 = y1[1];
9084        yExtentDomain = [ y0, y1 ];
9085        if (y.invert) y0 = y(y0), y1 = y(y1);
9086        if (y1 < y0) t = y0, y0 = y1, y1 = t;
9087        if (y0 != yExtent[0] || y1 != yExtent[1]) yExtent = [ y0, y1 ];
9088      }
9089      return brush;
9090    };
9091    brush.clear = function() {
9092      if (!brush.empty()) {
9093        xExtent = [ 0, 0 ], yExtent = [ 0, 0 ];
9094        xExtentDomain = yExtentDomain = null;
9095      }
9096      return brush;
9097    };
9098    brush.empty = function() {
9099      return !!x && xExtent[0] == xExtent[1] || !!y && yExtent[0] == yExtent[1];
9100    };
9101    return d3.rebind(brush, event, "on");
9102  };
9103  var d3_svg_brushCursor = {
9104    n: "ns-resize",
9105    e: "ew-resize",
9106    s: "ns-resize",
9107    w: "ew-resize",
9108    nw: "nwse-resize",
9109    ne: "nesw-resize",
9110    se: "nwse-resize",
9111    sw: "nesw-resize"
9112  };
9113  var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ];
9114  var d3_time_format = d3_time.format = d3_locale_enUS.timeFormat;
9115  var d3_time_formatUtc = d3_time_format.utc;
9116  var d3_time_formatIso = d3_time_formatUtc("%Y-%m-%dT%H:%M:%S.%LZ");
9117  d3_time_format.iso = Date.prototype.toISOString && +new Date("2000-01-01T00:00:00.000Z") ? d3_time_formatIsoNative : d3_time_formatIso;
9118  function d3_time_formatIsoNative(date) {
9119    return date.toISOString();
9120  }
9121  d3_time_formatIsoNative.parse = function(string) {
9122    var date = new Date(string);
9123    return isNaN(date) ? null : date;
9124  };
9125  d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
9126  d3_time.second = d3_time_interval(function(date) {
9127    return new d3_date(Math.floor(date / 1e3) * 1e3);
9128  }, function(date, offset) {
9129    date.setTime(date.getTime() + Math.floor(offset) * 1e3);
9130  }, function(date) {
9131    return date.getSeconds();
9132  });
9133  d3_time.seconds = d3_time.second.range;
9134  d3_time.seconds.utc = d3_time.second.utc.range;
9135  d3_time.minute = d3_time_interval(function(date) {
9136    return new d3_date(Math.floor(date / 6e4) * 6e4);
9137  }, function(date, offset) {
9138    date.setTime(date.getTime() + Math.floor(offset) * 6e4);
9139  }, function(date) {
9140    return date.getMinutes();
9141  });
9142  d3_time.minutes = d3_time.minute.range;
9143  d3_time.minutes.utc = d3_time.minute.utc.range;
9144  d3_time.hour = d3_time_interval(function(date) {
9145    var timezone = date.getTimezoneOffset() / 60;
9146    return new d3_date((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
9147  }, function(date, offset) {
9148    date.setTime(date.getTime() + Math.floor(offset) * 36e5);
9149  }, function(date) {
9150    return date.getHours();
9151  });
9152  d3_time.hours = d3_time.hour.range;
9153  d3_time.hours.utc = d3_time.hour.utc.range;
9154  d3_time.month = d3_time_interval(function(date) {
9155    date = d3_time.day(date);
9156    date.setDate(1);
9157    return date;
9158  }, function(date, offset) {
9159    date.setMonth(date.getMonth() + offset);
9160  }, function(date) {
9161    return date.getMonth();
9162  });
9163  d3_time.months = d3_time.month.range;
9164  d3_time.months.utc = d3_time.month.utc.range;
9165  function d3_time_scale(linear, methods, format) {
9166    function scale(x) {
9167      return linear(x);
9168    }
9169    scale.invert = function(x) {
9170      return d3_time_scaleDate(linear.invert(x));
9171    };
9172    scale.domain = function(x) {
9173      if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
9174      linear.domain(x);
9175      return scale;
9176    };
9177    function tickMethod(extent, count) {
9178      var span = extent[1] - extent[0], target = span / count, i = d3.bisect(d3_time_scaleSteps, target);
9179      return i == d3_time_scaleSteps.length ? [ methods.year, d3_scale_linearTickRange(extent.map(function(d) {
9180        return d / 31536e6;
9181      }), count)[2] ] : !i ? [ d3_time_scaleMilliseconds, d3_scale_linearTickRange(extent, count)[2] ] : methods[target / d3_time_scaleSteps[i - 1] < d3_time_scaleSteps[i] / target ? i - 1 : i];
9182    }
9183    scale.nice = function(interval, skip) {
9184      var domain = scale.domain(), extent = d3_scaleExtent(domain), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" && tickMethod(extent, interval);
9185      if (method) interval = method[0], skip = method[1];
9186      function skipped(date) {
9187        return !isNaN(date) && !interval.range(date, d3_time_scaleDate(+date + 1), skip).length;
9188      }
9189      return scale.domain(d3_scale_nice(domain, skip > 1 ? {
9190        floor: function(date) {
9191          while (skipped(date = interval.floor(date))) date = d3_time_scaleDate(date - 1);
9192          return date;
9193        },
9194        ceil: function(date) {
9195          while (skipped(date = interval.ceil(date))) date = d3_time_scaleDate(+date + 1);
9196          return date;
9197        }
9198      } : interval));
9199    };
9200    scale.ticks = function(interval, skip) {
9201      var extent = d3_scaleExtent(scale.domain()), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" ? tickMethod(extent, interval) : !interval.range && [ {
9202        range: interval
9203      }, skip ];
9204      if (method) interval = method[0], skip = method[1];
9205      return interval.range(extent[0], d3_time_scaleDate(+extent[1] + 1), skip < 1 ? 1 : skip);
9206    };
9207    scale.tickFormat = function() {
9208      return format;
9209    };
9210    scale.copy = function() {
9211      return d3_time_scale(linear.copy(), methods, format);
9212    };
9213    return d3_scale_linearRebind(scale, linear);
9214  }
9215  function d3_time_scaleDate(t) {
9216    return new Date(t);
9217  }
9218  var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];
9219  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 ] ];
9220  var d3_time_scaleLocalFormat = d3_time_format.multi([ [ ".%L", function(d) {
9221    return d.getMilliseconds();
9222  } ], [ ":%S", function(d) {
9223    return d.getSeconds();
9224  } ], [ "%I:%M", function(d) {
9225    return d.getMinutes();
9226  } ], [ "%I %p", function(d) {
9227    return d.getHours();
9228  } ], [ "%a %d", function(d) {
9229    return d.getDay() && d.getDate() != 1;
9230  } ], [ "%b %d", function(d) {
9231    return d.getDate() != 1;
9232  } ], [ "%B", function(d) {
9233    return d.getMonth();
9234  } ], [ "%Y", d3_true ] ]);
9235  var d3_time_scaleMilliseconds = {
9236    range: function(start, stop, step) {
9237      return d3.range(Math.ceil(start / step) * step, +stop, step).map(d3_time_scaleDate);
9238    },
9239    floor: d3_identity,
9240    ceil: d3_identity
9241  };
9242  d3_time_scaleLocalMethods.year = d3_time.year;
9243  d3_time.scale = function() {
9244    return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
9245  };
9246  var d3_time_scaleUtcMethods = d3_time_scaleLocalMethods.map(function(m) {
9247    return [ m[0].utc, m[1] ];
9248  });
9249  var d3_time_scaleUtcFormat = d3_time_formatUtc.multi([ [ ".%L", function(d) {
9250    return d.getUTCMilliseconds();
9251  } ], [ ":%S", function(d) {
9252    return d.getUTCSeconds();
9253  } ], [ "%I:%M", function(d) {
9254    return d.getUTCMinutes();
9255  } ], [ "%I %p", function(d) {
9256    return d.getUTCHours();
9257  } ], [ "%a %d", function(d) {
9258    return d.getUTCDay() && d.getUTCDate() != 1;
9259  } ], [ "%b %d", function(d) {
9260    return d.getUTCDate() != 1;
9261  } ], [ "%B", function(d) {
9262    return d.getUTCMonth();
9263  } ], [ "%Y", d3_true ] ]);
9264  d3_time_scaleUtcMethods.year = d3_time.year.utc;
9265  d3_time.scale.utc = function() {
9266    return d3_time_scale(d3.scale.linear(), d3_time_scaleUtcMethods, d3_time_scaleUtcFormat);
9267  };
9268  d3.text = d3_xhrType(function(request) {
9269    return request.responseText;
9270  });
9271  d3.json = function(url, callback) {
9272    return d3_xhr(url, "application/json", d3_json, callback);
9273  };
9274  function d3_json(request) {
9275    return JSON.parse(request.responseText);
9276  }
9277  d3.html = function(url, callback) {
9278    throw "disallowed by chromium security";
9279    return d3_xhr(url, "text/html", d3_html, callback);
9280  };
9281  function d3_html(request) {
9282    throw "disallowed by chromium security";
9283    var range = d3_document.createRange();
9284    range.selectNode(d3_document.body);
9285    return range.createContextualFragment(request.responseText);
9286  }
9287  d3.xml = d3_xhrType(function(request) {
9288    return request.responseXML;
9289  });
9290  if (typeof define === "function" && define.amd) {
9291    define(d3);
9292  } else if (typeof module === "object" && module.exports) {
9293    module.exports = d3;
9294  } else {
9295    this.d3 = d3;
9296  }
9297}();