1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/webaudioeditor/lib/d3.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,9275 @@ 1.4 +!function() { 1.5 + var d3 = { 1.6 + version: "3.4.2" 1.7 + }; 1.8 + if (!Date.now) Date.now = function() { 1.9 + return +new Date(); 1.10 + }; 1.11 + var d3_arraySlice = [].slice, d3_array = function(list) { 1.12 + return d3_arraySlice.call(list); 1.13 + }; 1.14 + var d3_document = document, d3_documentElement = d3_document.documentElement, d3_window = window; 1.15 + try { 1.16 + d3_array(d3_documentElement.childNodes)[0].nodeType; 1.17 + } catch (e) { 1.18 + d3_array = function(list) { 1.19 + var i = list.length, array = new Array(i); 1.20 + while (i--) array[i] = list[i]; 1.21 + return array; 1.22 + }; 1.23 + } 1.24 + try { 1.25 + d3_document.createElement("div").style.setProperty("opacity", 0, ""); 1.26 + } catch (error) { 1.27 + 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; 1.28 + d3_element_prototype.setAttribute = function(name, value) { 1.29 + d3_element_setAttribute.call(this, name, value + ""); 1.30 + }; 1.31 + d3_element_prototype.setAttributeNS = function(space, local, value) { 1.32 + d3_element_setAttributeNS.call(this, space, local, value + ""); 1.33 + }; 1.34 + d3_style_prototype.setProperty = function(name, value, priority) { 1.35 + d3_style_setProperty.call(this, name, value + "", priority); 1.36 + }; 1.37 + } 1.38 + d3.ascending = function(a, b) { 1.39 + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; 1.40 + }; 1.41 + d3.descending = function(a, b) { 1.42 + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; 1.43 + }; 1.44 + d3.min = function(array, f) { 1.45 + var i = -1, n = array.length, a, b; 1.46 + if (arguments.length === 1) { 1.47 + while (++i < n && !((a = array[i]) != null && a <= a)) a = undefined; 1.48 + while (++i < n) if ((b = array[i]) != null && a > b) a = b; 1.49 + } else { 1.50 + while (++i < n && !((a = f.call(array, array[i], i)) != null && a <= a)) a = undefined; 1.51 + while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; 1.52 + } 1.53 + return a; 1.54 + }; 1.55 + d3.max = function(array, f) { 1.56 + var i = -1, n = array.length, a, b; 1.57 + if (arguments.length === 1) { 1.58 + while (++i < n && !((a = array[i]) != null && a <= a)) a = undefined; 1.59 + while (++i < n) if ((b = array[i]) != null && b > a) a = b; 1.60 + } else { 1.61 + while (++i < n && !((a = f.call(array, array[i], i)) != null && a <= a)) a = undefined; 1.62 + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; 1.63 + } 1.64 + return a; 1.65 + }; 1.66 + d3.extent = function(array, f) { 1.67 + var i = -1, n = array.length, a, b, c; 1.68 + if (arguments.length === 1) { 1.69 + while (++i < n && !((a = c = array[i]) != null && a <= a)) a = c = undefined; 1.70 + while (++i < n) if ((b = array[i]) != null) { 1.71 + if (a > b) a = b; 1.72 + if (c < b) c = b; 1.73 + } 1.74 + } else { 1.75 + while (++i < n && !((a = c = f.call(array, array[i], i)) != null && a <= a)) a = undefined; 1.76 + while (++i < n) if ((b = f.call(array, array[i], i)) != null) { 1.77 + if (a > b) a = b; 1.78 + if (c < b) c = b; 1.79 + } 1.80 + } 1.81 + return [ a, c ]; 1.82 + }; 1.83 + d3.sum = function(array, f) { 1.84 + var s = 0, n = array.length, a, i = -1; 1.85 + if (arguments.length === 1) { 1.86 + while (++i < n) if (!isNaN(a = +array[i])) s += a; 1.87 + } else { 1.88 + while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a; 1.89 + } 1.90 + return s; 1.91 + }; 1.92 + function d3_number(x) { 1.93 + return x != null && !isNaN(x); 1.94 + } 1.95 + d3.mean = function(array, f) { 1.96 + var n = array.length, a, m = 0, i = -1, j = 0; 1.97 + if (arguments.length === 1) { 1.98 + while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j; 1.99 + } else { 1.100 + while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j; 1.101 + } 1.102 + return j ? m : undefined; 1.103 + }; 1.104 + d3.quantile = function(values, p) { 1.105 + var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h; 1.106 + return e ? v + e * (values[h] - v) : v; 1.107 + }; 1.108 + d3.median = function(array, f) { 1.109 + if (arguments.length > 1) array = array.map(f); 1.110 + array = array.filter(d3_number); 1.111 + return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined; 1.112 + }; 1.113 + d3.bisector = function(f) { 1.114 + return { 1.115 + left: function(a, x, lo, hi) { 1.116 + if (arguments.length < 3) lo = 0; 1.117 + if (arguments.length < 4) hi = a.length; 1.118 + while (lo < hi) { 1.119 + var mid = lo + hi >>> 1; 1.120 + if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid; 1.121 + } 1.122 + return lo; 1.123 + }, 1.124 + right: function(a, x, lo, hi) { 1.125 + if (arguments.length < 3) lo = 0; 1.126 + if (arguments.length < 4) hi = a.length; 1.127 + while (lo < hi) { 1.128 + var mid = lo + hi >>> 1; 1.129 + if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1; 1.130 + } 1.131 + return lo; 1.132 + } 1.133 + }; 1.134 + }; 1.135 + var d3_bisector = d3.bisector(function(d) { 1.136 + return d; 1.137 + }); 1.138 + d3.bisectLeft = d3_bisector.left; 1.139 + d3.bisect = d3.bisectRight = d3_bisector.right; 1.140 + d3.shuffle = function(array) { 1.141 + var m = array.length, t, i; 1.142 + while (m) { 1.143 + i = Math.random() * m-- | 0; 1.144 + t = array[m], array[m] = array[i], array[i] = t; 1.145 + } 1.146 + return array; 1.147 + }; 1.148 + d3.permute = function(array, indexes) { 1.149 + var i = indexes.length, permutes = new Array(i); 1.150 + while (i--) permutes[i] = array[indexes[i]]; 1.151 + return permutes; 1.152 + }; 1.153 + d3.pairs = function(array) { 1.154 + var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n); 1.155 + while (i < n) pairs[i] = [ p0 = p1, p1 = array[++i] ]; 1.156 + return pairs; 1.157 + }; 1.158 + d3.zip = function() { 1.159 + if (!(n = arguments.length)) return []; 1.160 + for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) { 1.161 + for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) { 1.162 + zip[j] = arguments[j][i]; 1.163 + } 1.164 + } 1.165 + return zips; 1.166 + }; 1.167 + function d3_zipLength(d) { 1.168 + return d.length; 1.169 + } 1.170 + d3.transpose = function(matrix) { 1.171 + return d3.zip.apply(d3, matrix); 1.172 + }; 1.173 + d3.keys = function(map) { 1.174 + var keys = []; 1.175 + for (var key in map) keys.push(key); 1.176 + return keys; 1.177 + }; 1.178 + d3.values = function(map) { 1.179 + var values = []; 1.180 + for (var key in map) values.push(map[key]); 1.181 + return values; 1.182 + }; 1.183 + d3.entries = function(map) { 1.184 + var entries = []; 1.185 + for (var key in map) entries.push({ 1.186 + key: key, 1.187 + value: map[key] 1.188 + }); 1.189 + return entries; 1.190 + }; 1.191 + d3.merge = function(arrays) { 1.192 + var n = arrays.length, m, i = -1, j = 0, merged, array; 1.193 + while (++i < n) j += arrays[i].length; 1.194 + merged = new Array(j); 1.195 + while (--n >= 0) { 1.196 + array = arrays[n]; 1.197 + m = array.length; 1.198 + while (--m >= 0) { 1.199 + merged[--j] = array[m]; 1.200 + } 1.201 + } 1.202 + return merged; 1.203 + }; 1.204 + var abs = Math.abs; 1.205 + d3.range = function(start, stop, step) { 1.206 + if (arguments.length < 3) { 1.207 + step = 1; 1.208 + if (arguments.length < 2) { 1.209 + stop = start; 1.210 + start = 0; 1.211 + } 1.212 + } 1.213 + if ((stop - start) / step === Infinity) throw new Error("infinite range"); 1.214 + var range = [], k = d3_range_integerScale(abs(step)), i = -1, j; 1.215 + start *= k, stop *= k, step *= k; 1.216 + if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k); 1.217 + return range; 1.218 + }; 1.219 + function d3_range_integerScale(x) { 1.220 + var k = 1; 1.221 + while (x * k % 1) k *= 10; 1.222 + return k; 1.223 + } 1.224 + function d3_class(ctor, properties) { 1.225 + try { 1.226 + for (var key in properties) { 1.227 + Object.defineProperty(ctor.prototype, key, { 1.228 + value: properties[key], 1.229 + enumerable: false 1.230 + }); 1.231 + } 1.232 + } catch (e) { 1.233 + ctor.prototype = properties; 1.234 + } 1.235 + } 1.236 + d3.map = function(object) { 1.237 + var map = new d3_Map(); 1.238 + if (object instanceof d3_Map) object.forEach(function(key, value) { 1.239 + map.set(key, value); 1.240 + }); else for (var key in object) map.set(key, object[key]); 1.241 + return map; 1.242 + }; 1.243 + function d3_Map() {} 1.244 + d3_class(d3_Map, { 1.245 + has: d3_map_has, 1.246 + get: function(key) { 1.247 + return this[d3_map_prefix + key]; 1.248 + }, 1.249 + set: function(key, value) { 1.250 + return this[d3_map_prefix + key] = value; 1.251 + }, 1.252 + remove: d3_map_remove, 1.253 + keys: d3_map_keys, 1.254 + values: function() { 1.255 + var values = []; 1.256 + this.forEach(function(key, value) { 1.257 + values.push(value); 1.258 + }); 1.259 + return values; 1.260 + }, 1.261 + entries: function() { 1.262 + var entries = []; 1.263 + this.forEach(function(key, value) { 1.264 + entries.push({ 1.265 + key: key, 1.266 + value: value 1.267 + }); 1.268 + }); 1.269 + return entries; 1.270 + }, 1.271 + size: d3_map_size, 1.272 + empty: d3_map_empty, 1.273 + forEach: function(f) { 1.274 + for (var key in this) if (key.charCodeAt(0) === d3_map_prefixCode) f.call(this, key.substring(1), this[key]); 1.275 + } 1.276 + }); 1.277 + var d3_map_prefix = "\x00", d3_map_prefixCode = d3_map_prefix.charCodeAt(0); 1.278 + function d3_map_has(key) { 1.279 + return d3_map_prefix + key in this; 1.280 + } 1.281 + function d3_map_remove(key) { 1.282 + key = d3_map_prefix + key; 1.283 + return key in this && delete this[key]; 1.284 + } 1.285 + function d3_map_keys() { 1.286 + var keys = []; 1.287 + this.forEach(function(key) { 1.288 + keys.push(key); 1.289 + }); 1.290 + return keys; 1.291 + } 1.292 + function d3_map_size() { 1.293 + var size = 0; 1.294 + for (var key in this) if (key.charCodeAt(0) === d3_map_prefixCode) ++size; 1.295 + return size; 1.296 + } 1.297 + function d3_map_empty() { 1.298 + for (var key in this) if (key.charCodeAt(0) === d3_map_prefixCode) return false; 1.299 + return true; 1.300 + } 1.301 + d3.nest = function() { 1.302 + var nest = {}, keys = [], sortKeys = [], sortValues, rollup; 1.303 + function map(mapType, array, depth) { 1.304 + if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array; 1.305 + var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values; 1.306 + while (++i < n) { 1.307 + if (values = valuesByKey.get(keyValue = key(object = array[i]))) { 1.308 + values.push(object); 1.309 + } else { 1.310 + valuesByKey.set(keyValue, [ object ]); 1.311 + } 1.312 + } 1.313 + if (mapType) { 1.314 + object = mapType(); 1.315 + setter = function(keyValue, values) { 1.316 + object.set(keyValue, map(mapType, values, depth)); 1.317 + }; 1.318 + } else { 1.319 + object = {}; 1.320 + setter = function(keyValue, values) { 1.321 + object[keyValue] = map(mapType, values, depth); 1.322 + }; 1.323 + } 1.324 + valuesByKey.forEach(setter); 1.325 + return object; 1.326 + } 1.327 + function entries(map, depth) { 1.328 + if (depth >= keys.length) return map; 1.329 + var array = [], sortKey = sortKeys[depth++]; 1.330 + map.forEach(function(key, keyMap) { 1.331 + array.push({ 1.332 + key: key, 1.333 + values: entries(keyMap, depth) 1.334 + }); 1.335 + }); 1.336 + return sortKey ? array.sort(function(a, b) { 1.337 + return sortKey(a.key, b.key); 1.338 + }) : array; 1.339 + } 1.340 + nest.map = function(array, mapType) { 1.341 + return map(mapType, array, 0); 1.342 + }; 1.343 + nest.entries = function(array) { 1.344 + return entries(map(d3.map, array, 0), 0); 1.345 + }; 1.346 + nest.key = function(d) { 1.347 + keys.push(d); 1.348 + return nest; 1.349 + }; 1.350 + nest.sortKeys = function(order) { 1.351 + sortKeys[keys.length - 1] = order; 1.352 + return nest; 1.353 + }; 1.354 + nest.sortValues = function(order) { 1.355 + sortValues = order; 1.356 + return nest; 1.357 + }; 1.358 + nest.rollup = function(f) { 1.359 + rollup = f; 1.360 + return nest; 1.361 + }; 1.362 + return nest; 1.363 + }; 1.364 + d3.set = function(array) { 1.365 + var set = new d3_Set(); 1.366 + if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]); 1.367 + return set; 1.368 + }; 1.369 + function d3_Set() {} 1.370 + d3_class(d3_Set, { 1.371 + has: d3_map_has, 1.372 + add: function(value) { 1.373 + this[d3_map_prefix + value] = true; 1.374 + return value; 1.375 + }, 1.376 + remove: function(value) { 1.377 + value = d3_map_prefix + value; 1.378 + return value in this && delete this[value]; 1.379 + }, 1.380 + values: d3_map_keys, 1.381 + size: d3_map_size, 1.382 + empty: d3_map_empty, 1.383 + forEach: function(f) { 1.384 + for (var value in this) if (value.charCodeAt(0) === d3_map_prefixCode) f.call(this, value.substring(1)); 1.385 + } 1.386 + }); 1.387 + d3.behavior = {}; 1.388 + d3.rebind = function(target, source) { 1.389 + var i = 1, n = arguments.length, method; 1.390 + while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); 1.391 + return target; 1.392 + }; 1.393 + function d3_rebind(target, source, method) { 1.394 + return function() { 1.395 + var value = method.apply(source, arguments); 1.396 + return value === source ? target : value; 1.397 + }; 1.398 + } 1.399 + function d3_vendorSymbol(object, name) { 1.400 + if (name in object) return name; 1.401 + name = name.charAt(0).toUpperCase() + name.substring(1); 1.402 + for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) { 1.403 + var prefixName = d3_vendorPrefixes[i] + name; 1.404 + if (prefixName in object) return prefixName; 1.405 + } 1.406 + } 1.407 + var d3_vendorPrefixes = [ "webkit", "ms", "moz", "Moz", "o", "O" ]; 1.408 + function d3_noop() {} 1.409 + d3.dispatch = function() { 1.410 + var dispatch = new d3_dispatch(), i = -1, n = arguments.length; 1.411 + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); 1.412 + return dispatch; 1.413 + }; 1.414 + function d3_dispatch() {} 1.415 + d3_dispatch.prototype.on = function(type, listener) { 1.416 + var i = type.indexOf("."), name = ""; 1.417 + if (i >= 0) { 1.418 + name = type.substring(i + 1); 1.419 + type = type.substring(0, i); 1.420 + } 1.421 + if (type) return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener); 1.422 + if (arguments.length === 2) { 1.423 + if (listener == null) for (type in this) { 1.424 + if (this.hasOwnProperty(type)) this[type].on(name, null); 1.425 + } 1.426 + return this; 1.427 + } 1.428 + }; 1.429 + function d3_dispatch_event(dispatch) { 1.430 + var listeners = [], listenerByName = new d3_Map(); 1.431 + function event() { 1.432 + var z = listeners, i = -1, n = z.length, l; 1.433 + while (++i < n) if (l = z[i].on) l.apply(this, arguments); 1.434 + return dispatch; 1.435 + } 1.436 + event.on = function(name, listener) { 1.437 + var l = listenerByName.get(name), i; 1.438 + if (arguments.length < 2) return l && l.on; 1.439 + if (l) { 1.440 + l.on = null; 1.441 + listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); 1.442 + listenerByName.remove(name); 1.443 + } 1.444 + if (listener) listeners.push(listenerByName.set(name, { 1.445 + on: listener 1.446 + })); 1.447 + return dispatch; 1.448 + }; 1.449 + return event; 1.450 + } 1.451 + d3.event = null; 1.452 + function d3_eventPreventDefault() { 1.453 + d3.event.preventDefault(); 1.454 + } 1.455 + function d3_eventSource() { 1.456 + var e = d3.event, s; 1.457 + while (s = e.sourceEvent) e = s; 1.458 + return e; 1.459 + } 1.460 + function d3_eventDispatch(target) { 1.461 + var dispatch = new d3_dispatch(), i = 0, n = arguments.length; 1.462 + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); 1.463 + dispatch.of = function(thiz, argumentz) { 1.464 + return function(e1) { 1.465 + try { 1.466 + var e0 = e1.sourceEvent = d3.event; 1.467 + e1.target = target; 1.468 + d3.event = e1; 1.469 + dispatch[e1.type].apply(thiz, argumentz); 1.470 + } finally { 1.471 + d3.event = e0; 1.472 + } 1.473 + }; 1.474 + }; 1.475 + return dispatch; 1.476 + } 1.477 + d3.requote = function(s) { 1.478 + return s.replace(d3_requote_re, "\\$&"); 1.479 + }; 1.480 + var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; 1.481 + var d3_subclass = {}.__proto__ ? function(object, prototype) { 1.482 + object.__proto__ = prototype; 1.483 + } : function(object, prototype) { 1.484 + for (var property in prototype) object[property] = prototype[property]; 1.485 + }; 1.486 + function d3_selection(groups) { 1.487 + d3_subclass(groups, d3_selectionPrototype); 1.488 + return groups; 1.489 + } 1.490 + var d3_select = function(s, n) { 1.491 + return n.querySelector(s); 1.492 + }, d3_selectAll = function(s, n) { 1.493 + return n.querySelectorAll(s); 1.494 + }, d3_selectMatcher = d3_documentElement[d3_vendorSymbol(d3_documentElement, "matchesSelector")], d3_selectMatches = function(n, s) { 1.495 + return d3_selectMatcher.call(n, s); 1.496 + }; 1.497 + if (typeof Sizzle === "function") { 1.498 + d3_select = function(s, n) { 1.499 + return Sizzle(s, n)[0] || null; 1.500 + }; 1.501 + d3_selectAll = function(s, n) { 1.502 + return Sizzle.uniqueSort(Sizzle(s, n)); 1.503 + }; 1.504 + d3_selectMatches = Sizzle.matchesSelector; 1.505 + } 1.506 + d3.selection = function() { 1.507 + return d3_selectionRoot; 1.508 + }; 1.509 + var d3_selectionPrototype = d3.selection.prototype = []; 1.510 + d3_selectionPrototype.select = function(selector) { 1.511 + var subgroups = [], subgroup, subnode, group, node; 1.512 + selector = d3_selection_selector(selector); 1.513 + for (var j = -1, m = this.length; ++j < m; ) { 1.514 + subgroups.push(subgroup = []); 1.515 + subgroup.parentNode = (group = this[j]).parentNode; 1.516 + for (var i = -1, n = group.length; ++i < n; ) { 1.517 + if (node = group[i]) { 1.518 + subgroup.push(subnode = selector.call(node, node.__data__, i, j)); 1.519 + if (subnode && "__data__" in node) subnode.__data__ = node.__data__; 1.520 + } else { 1.521 + subgroup.push(null); 1.522 + } 1.523 + } 1.524 + } 1.525 + return d3_selection(subgroups); 1.526 + }; 1.527 + function d3_selection_selector(selector) { 1.528 + return typeof selector === "function" ? selector : function() { 1.529 + return d3_select(selector, this); 1.530 + }; 1.531 + } 1.532 + d3_selectionPrototype.selectAll = function(selector) { 1.533 + var subgroups = [], subgroup, node; 1.534 + selector = d3_selection_selectorAll(selector); 1.535 + for (var j = -1, m = this.length; ++j < m; ) { 1.536 + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { 1.537 + if (node = group[i]) { 1.538 + subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i, j))); 1.539 + subgroup.parentNode = node; 1.540 + } 1.541 + } 1.542 + } 1.543 + return d3_selection(subgroups); 1.544 + }; 1.545 + function d3_selection_selectorAll(selector) { 1.546 + return typeof selector === "function" ? selector : function() { 1.547 + return d3_selectAll(selector, this); 1.548 + }; 1.549 + } 1.550 + var d3_nsPrefix = { 1.551 + svg: "http://www.w3.org/2000/svg", 1.552 + xhtml: "http://www.w3.org/1999/xhtml", 1.553 + xlink: "http://www.w3.org/1999/xlink", 1.554 + xml: "http://www.w3.org/XML/1998/namespace", 1.555 + xmlns: "http://www.w3.org/2000/xmlns/" 1.556 + }; 1.557 + d3.ns = { 1.558 + prefix: d3_nsPrefix, 1.559 + qualify: function(name) { 1.560 + var i = name.indexOf(":"), prefix = name; 1.561 + if (i >= 0) { 1.562 + prefix = name.substring(0, i); 1.563 + name = name.substring(i + 1); 1.564 + } 1.565 + return d3_nsPrefix.hasOwnProperty(prefix) ? { 1.566 + space: d3_nsPrefix[prefix], 1.567 + local: name 1.568 + } : name; 1.569 + } 1.570 + }; 1.571 + d3_selectionPrototype.attr = function(name, value) { 1.572 + if (arguments.length < 2) { 1.573 + if (typeof name === "string") { 1.574 + var node = this.node(); 1.575 + name = d3.ns.qualify(name); 1.576 + return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name); 1.577 + } 1.578 + for (value in name) this.each(d3_selection_attr(value, name[value])); 1.579 + return this; 1.580 + } 1.581 + return this.each(d3_selection_attr(name, value)); 1.582 + }; 1.583 + function d3_selection_attr(name, value) { 1.584 + name = d3.ns.qualify(name); 1.585 + function attrNull() { 1.586 + this.removeAttribute(name); 1.587 + } 1.588 + function attrNullNS() { 1.589 + this.removeAttributeNS(name.space, name.local); 1.590 + } 1.591 + function attrConstant() { 1.592 + this.setAttribute(name, value); 1.593 + } 1.594 + function attrConstantNS() { 1.595 + this.setAttributeNS(name.space, name.local, value); 1.596 + } 1.597 + function attrFunction() { 1.598 + var x = value.apply(this, arguments); 1.599 + if (x == null) this.removeAttribute(name); else this.setAttribute(name, x); 1.600 + } 1.601 + function attrFunctionNS() { 1.602 + var x = value.apply(this, arguments); 1.603 + if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x); 1.604 + } 1.605 + return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant; 1.606 + } 1.607 + function d3_collapse(s) { 1.608 + return s.trim().replace(/\s+/g, " "); 1.609 + } 1.610 + d3_selectionPrototype.classed = function(name, value) { 1.611 + if (arguments.length < 2) { 1.612 + if (typeof name === "string") { 1.613 + var node = this.node(), n = (name = d3_selection_classes(name)).length, i = -1; 1.614 + if (value = node.classList) { 1.615 + while (++i < n) if (!value.contains(name[i])) return false; 1.616 + } else { 1.617 + value = node.getAttribute("class"); 1.618 + while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false; 1.619 + } 1.620 + return true; 1.621 + } 1.622 + for (value in name) this.each(d3_selection_classed(value, name[value])); 1.623 + return this; 1.624 + } 1.625 + return this.each(d3_selection_classed(name, value)); 1.626 + }; 1.627 + function d3_selection_classedRe(name) { 1.628 + return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g"); 1.629 + } 1.630 + function d3_selection_classes(name) { 1.631 + return name.trim().split(/^|\s+/); 1.632 + } 1.633 + function d3_selection_classed(name, value) { 1.634 + name = d3_selection_classes(name).map(d3_selection_classedName); 1.635 + var n = name.length; 1.636 + function classedConstant() { 1.637 + var i = -1; 1.638 + while (++i < n) name[i](this, value); 1.639 + } 1.640 + function classedFunction() { 1.641 + var i = -1, x = value.apply(this, arguments); 1.642 + while (++i < n) name[i](this, x); 1.643 + } 1.644 + return typeof value === "function" ? classedFunction : classedConstant; 1.645 + } 1.646 + function d3_selection_classedName(name) { 1.647 + var re = d3_selection_classedRe(name); 1.648 + return function(node, value) { 1.649 + if (c = node.classList) return value ? c.add(name) : c.remove(name); 1.650 + var c = node.getAttribute("class") || ""; 1.651 + if (value) { 1.652 + re.lastIndex = 0; 1.653 + if (!re.test(c)) node.setAttribute("class", d3_collapse(c + " " + name)); 1.654 + } else { 1.655 + node.setAttribute("class", d3_collapse(c.replace(re, " "))); 1.656 + } 1.657 + }; 1.658 + } 1.659 + d3_selectionPrototype.style = function(name, value, priority) { 1.660 + var n = arguments.length; 1.661 + if (n < 3) { 1.662 + if (typeof name !== "string") { 1.663 + if (n < 2) value = ""; 1.664 + for (priority in name) this.each(d3_selection_style(priority, name[priority], value)); 1.665 + return this; 1.666 + } 1.667 + if (n < 2) return d3_window.getComputedStyle(this.node(), null).getPropertyValue(name); 1.668 + priority = ""; 1.669 + } 1.670 + return this.each(d3_selection_style(name, value, priority)); 1.671 + }; 1.672 + function d3_selection_style(name, value, priority) { 1.673 + function styleNull() { 1.674 + this.style.removeProperty(name); 1.675 + } 1.676 + function styleConstant() { 1.677 + this.style.setProperty(name, value, priority); 1.678 + } 1.679 + function styleFunction() { 1.680 + var x = value.apply(this, arguments); 1.681 + if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority); 1.682 + } 1.683 + return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant; 1.684 + } 1.685 + d3_selectionPrototype.property = function(name, value) { 1.686 + if (arguments.length < 2) { 1.687 + if (typeof name === "string") return this.node()[name]; 1.688 + for (value in name) this.each(d3_selection_property(value, name[value])); 1.689 + return this; 1.690 + } 1.691 + return this.each(d3_selection_property(name, value)); 1.692 + }; 1.693 + function d3_selection_property(name, value) { 1.694 + function propertyNull() { 1.695 + delete this[name]; 1.696 + } 1.697 + function propertyConstant() { 1.698 + this[name] = value; 1.699 + } 1.700 + function propertyFunction() { 1.701 + var x = value.apply(this, arguments); 1.702 + if (x == null) delete this[name]; else this[name] = x; 1.703 + } 1.704 + return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant; 1.705 + } 1.706 + d3_selectionPrototype.text = function(value) { 1.707 + return arguments.length ? this.each(typeof value === "function" ? function() { 1.708 + var v = value.apply(this, arguments); 1.709 + this.textContent = v == null ? "" : v; 1.710 + } : value == null ? function() { 1.711 + this.textContent = ""; 1.712 + } : function() { 1.713 + this.textContent = value; 1.714 + }) : this.node().textContent; 1.715 + }; 1.716 + d3_selectionPrototype.html = function(value) { 1.717 + return arguments.length ? this.each(typeof value === "function" ? function() { 1.718 + var v = value.apply(this, arguments); 1.719 + this.innerHTML = v == null ? "" : v; 1.720 + } : value == null ? function() { 1.721 + this.innerHTML = ""; 1.722 + } : function() { 1.723 + this.innerHTML = value; 1.724 + }) : this.node().innerHTML; 1.725 + }; 1.726 + d3_selectionPrototype.append = function(name) { 1.727 + name = d3_selection_creator(name); 1.728 + return this.select(function() { 1.729 + return this.appendChild(name.apply(this, arguments)); 1.730 + }); 1.731 + }; 1.732 + function d3_selection_creator(name) { 1.733 + return typeof name === "function" ? name : (name = d3.ns.qualify(name)).local ? function() { 1.734 + return this.ownerDocument.createElementNS(name.space, name.local); 1.735 + } : function() { 1.736 + return this.ownerDocument.createElementNS(this.namespaceURI, name); 1.737 + }; 1.738 + } 1.739 + d3_selectionPrototype.insert = function(name, before) { 1.740 + name = d3_selection_creator(name); 1.741 + before = d3_selection_selector(before); 1.742 + return this.select(function() { 1.743 + return this.insertBefore(name.apply(this, arguments), before.apply(this, arguments) || null); 1.744 + }); 1.745 + }; 1.746 + d3_selectionPrototype.remove = function() { 1.747 + return this.each(function() { 1.748 + var parent = this.parentNode; 1.749 + if (parent) parent.removeChild(this); 1.750 + }); 1.751 + }; 1.752 + d3_selectionPrototype.data = function(value, key) { 1.753 + var i = -1, n = this.length, group, node; 1.754 + if (!arguments.length) { 1.755 + value = new Array(n = (group = this[0]).length); 1.756 + while (++i < n) { 1.757 + if (node = group[i]) { 1.758 + value[i] = node.__data__; 1.759 + } 1.760 + } 1.761 + return value; 1.762 + } 1.763 + function bind(group, groupData) { 1.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; 1.765 + if (key) { 1.766 + var nodeByKeyValue = new d3_Map(), dataByKeyValue = new d3_Map(), keyValues = [], keyValue; 1.767 + for (i = -1; ++i < n; ) { 1.768 + keyValue = key.call(node = group[i], node.__data__, i); 1.769 + if (nodeByKeyValue.has(keyValue)) { 1.770 + exitNodes[i] = node; 1.771 + } else { 1.772 + nodeByKeyValue.set(keyValue, node); 1.773 + } 1.774 + keyValues.push(keyValue); 1.775 + } 1.776 + for (i = -1; ++i < m; ) { 1.777 + keyValue = key.call(groupData, nodeData = groupData[i], i); 1.778 + if (node = nodeByKeyValue.get(keyValue)) { 1.779 + updateNodes[i] = node; 1.780 + node.__data__ = nodeData; 1.781 + } else if (!dataByKeyValue.has(keyValue)) { 1.782 + enterNodes[i] = d3_selection_dataNode(nodeData); 1.783 + } 1.784 + dataByKeyValue.set(keyValue, nodeData); 1.785 + nodeByKeyValue.remove(keyValue); 1.786 + } 1.787 + for (i = -1; ++i < n; ) { 1.788 + if (nodeByKeyValue.has(keyValues[i])) { 1.789 + exitNodes[i] = group[i]; 1.790 + } 1.791 + } 1.792 + } else { 1.793 + for (i = -1; ++i < n0; ) { 1.794 + node = group[i]; 1.795 + nodeData = groupData[i]; 1.796 + if (node) { 1.797 + node.__data__ = nodeData; 1.798 + updateNodes[i] = node; 1.799 + } else { 1.800 + enterNodes[i] = d3_selection_dataNode(nodeData); 1.801 + } 1.802 + } 1.803 + for (;i < m; ++i) { 1.804 + enterNodes[i] = d3_selection_dataNode(groupData[i]); 1.805 + } 1.806 + for (;i < n; ++i) { 1.807 + exitNodes[i] = group[i]; 1.808 + } 1.809 + } 1.810 + enterNodes.update = updateNodes; 1.811 + enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode; 1.812 + enter.push(enterNodes); 1.813 + update.push(updateNodes); 1.814 + exit.push(exitNodes); 1.815 + } 1.816 + var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]); 1.817 + if (typeof value === "function") { 1.818 + while (++i < n) { 1.819 + bind(group = this[i], value.call(group, group.parentNode.__data__, i)); 1.820 + } 1.821 + } else { 1.822 + while (++i < n) { 1.823 + bind(group = this[i], value); 1.824 + } 1.825 + } 1.826 + update.enter = function() { 1.827 + return enter; 1.828 + }; 1.829 + update.exit = function() { 1.830 + return exit; 1.831 + }; 1.832 + return update; 1.833 + }; 1.834 + function d3_selection_dataNode(data) { 1.835 + return { 1.836 + __data__: data 1.837 + }; 1.838 + } 1.839 + d3_selectionPrototype.datum = function(value) { 1.840 + return arguments.length ? this.property("__data__", value) : this.property("__data__"); 1.841 + }; 1.842 + d3_selectionPrototype.filter = function(filter) { 1.843 + var subgroups = [], subgroup, group, node; 1.844 + if (typeof filter !== "function") filter = d3_selection_filter(filter); 1.845 + for (var j = 0, m = this.length; j < m; j++) { 1.846 + subgroups.push(subgroup = []); 1.847 + subgroup.parentNode = (group = this[j]).parentNode; 1.848 + for (var i = 0, n = group.length; i < n; i++) { 1.849 + if ((node = group[i]) && filter.call(node, node.__data__, i, j)) { 1.850 + subgroup.push(node); 1.851 + } 1.852 + } 1.853 + } 1.854 + return d3_selection(subgroups); 1.855 + }; 1.856 + function d3_selection_filter(selector) { 1.857 + return function() { 1.858 + return d3_selectMatches(this, selector); 1.859 + }; 1.860 + } 1.861 + d3_selectionPrototype.order = function() { 1.862 + for (var j = -1, m = this.length; ++j < m; ) { 1.863 + for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) { 1.864 + if (node = group[i]) { 1.865 + if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); 1.866 + next = node; 1.867 + } 1.868 + } 1.869 + } 1.870 + return this; 1.871 + }; 1.872 + d3_selectionPrototype.sort = function(comparator) { 1.873 + comparator = d3_selection_sortComparator.apply(this, arguments); 1.874 + for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator); 1.875 + return this.order(); 1.876 + }; 1.877 + function d3_selection_sortComparator(comparator) { 1.878 + if (!arguments.length) comparator = d3.ascending; 1.879 + return function(a, b) { 1.880 + return a && b ? comparator(a.__data__, b.__data__) : !a - !b; 1.881 + }; 1.882 + } 1.883 + d3_selectionPrototype.each = function(callback) { 1.884 + return d3_selection_each(this, function(node, i, j) { 1.885 + callback.call(node, node.__data__, i, j); 1.886 + }); 1.887 + }; 1.888 + function d3_selection_each(groups, callback) { 1.889 + for (var j = 0, m = groups.length; j < m; j++) { 1.890 + for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) { 1.891 + if (node = group[i]) callback(node, i, j); 1.892 + } 1.893 + } 1.894 + return groups; 1.895 + } 1.896 + d3_selectionPrototype.call = function(callback) { 1.897 + var args = d3_array(arguments); 1.898 + callback.apply(args[0] = this, args); 1.899 + return this; 1.900 + }; 1.901 + d3_selectionPrototype.empty = function() { 1.902 + return !this.node(); 1.903 + }; 1.904 + d3_selectionPrototype.node = function() { 1.905 + for (var j = 0, m = this.length; j < m; j++) { 1.906 + for (var group = this[j], i = 0, n = group.length; i < n; i++) { 1.907 + var node = group[i]; 1.908 + if (node) return node; 1.909 + } 1.910 + } 1.911 + return null; 1.912 + }; 1.913 + d3_selectionPrototype.size = function() { 1.914 + var n = 0; 1.915 + this.each(function() { 1.916 + ++n; 1.917 + }); 1.918 + return n; 1.919 + }; 1.920 + function d3_selection_enter(selection) { 1.921 + d3_subclass(selection, d3_selection_enterPrototype); 1.922 + return selection; 1.923 + } 1.924 + var d3_selection_enterPrototype = []; 1.925 + d3.selection.enter = d3_selection_enter; 1.926 + d3.selection.enter.prototype = d3_selection_enterPrototype; 1.927 + d3_selection_enterPrototype.append = d3_selectionPrototype.append; 1.928 + d3_selection_enterPrototype.empty = d3_selectionPrototype.empty; 1.929 + d3_selection_enterPrototype.node = d3_selectionPrototype.node; 1.930 + d3_selection_enterPrototype.call = d3_selectionPrototype.call; 1.931 + d3_selection_enterPrototype.size = d3_selectionPrototype.size; 1.932 + d3_selection_enterPrototype.select = function(selector) { 1.933 + var subgroups = [], subgroup, subnode, upgroup, group, node; 1.934 + for (var j = -1, m = this.length; ++j < m; ) { 1.935 + upgroup = (group = this[j]).update; 1.936 + subgroups.push(subgroup = []); 1.937 + subgroup.parentNode = group.parentNode; 1.938 + for (var i = -1, n = group.length; ++i < n; ) { 1.939 + if (node = group[i]) { 1.940 + subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i, j)); 1.941 + subnode.__data__ = node.__data__; 1.942 + } else { 1.943 + subgroup.push(null); 1.944 + } 1.945 + } 1.946 + } 1.947 + return d3_selection(subgroups); 1.948 + }; 1.949 + d3_selection_enterPrototype.insert = function(name, before) { 1.950 + if (arguments.length < 2) before = d3_selection_enterInsertBefore(this); 1.951 + return d3_selectionPrototype.insert.call(this, name, before); 1.952 + }; 1.953 + function d3_selection_enterInsertBefore(enter) { 1.954 + var i0, j0; 1.955 + return function(d, i, j) { 1.956 + var group = enter[j].update, n = group.length, node; 1.957 + if (j != j0) j0 = j, i0 = 0; 1.958 + if (i >= i0) i0 = i + 1; 1.959 + while (!(node = group[i0]) && ++i0 < n) ; 1.960 + return node; 1.961 + }; 1.962 + } 1.963 + d3_selectionPrototype.transition = function() { 1.964 + var id = d3_transitionInheritId || ++d3_transitionId, subgroups = [], subgroup, node, transition = d3_transitionInherit || { 1.965 + time: Date.now(), 1.966 + ease: d3_ease_cubicInOut, 1.967 + delay: 0, 1.968 + duration: 250 1.969 + }; 1.970 + for (var j = -1, m = this.length; ++j < m; ) { 1.971 + subgroups.push(subgroup = []); 1.972 + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { 1.973 + if (node = group[i]) d3_transitionNode(node, i, id, transition); 1.974 + subgroup.push(node); 1.975 + } 1.976 + } 1.977 + return d3_transition(subgroups, id); 1.978 + }; 1.979 + d3_selectionPrototype.interrupt = function() { 1.980 + return this.each(d3_selection_interrupt); 1.981 + }; 1.982 + function d3_selection_interrupt() { 1.983 + var lock = this.__transition__; 1.984 + if (lock) ++lock.active; 1.985 + } 1.986 + d3.select = function(node) { 1.987 + var group = [ typeof node === "string" ? d3_select(node, d3_document) : node ]; 1.988 + group.parentNode = d3_documentElement; 1.989 + return d3_selection([ group ]); 1.990 + }; 1.991 + d3.selectAll = function(nodes) { 1.992 + var group = d3_array(typeof nodes === "string" ? d3_selectAll(nodes, d3_document) : nodes); 1.993 + group.parentNode = d3_documentElement; 1.994 + return d3_selection([ group ]); 1.995 + }; 1.996 + var d3_selectionRoot = d3.select(d3_documentElement); 1.997 + d3_selectionPrototype.on = function(type, listener, capture) { 1.998 + var n = arguments.length; 1.999 + if (n < 3) { 1.1000 + if (typeof type !== "string") { 1.1001 + if (n < 2) listener = false; 1.1002 + for (capture in type) this.each(d3_selection_on(capture, type[capture], listener)); 1.1003 + return this; 1.1004 + } 1.1005 + if (n < 2) return (n = this.node()["__on" + type]) && n._; 1.1006 + capture = false; 1.1007 + } 1.1008 + return this.each(d3_selection_on(type, listener, capture)); 1.1009 + }; 1.1010 + function d3_selection_on(type, listener, capture) { 1.1011 + var name = "__on" + type, i = type.indexOf("."), wrap = d3_selection_onListener; 1.1012 + if (i > 0) type = type.substring(0, i); 1.1013 + var filter = d3_selection_onFilters.get(type); 1.1014 + if (filter) type = filter, wrap = d3_selection_onFilter; 1.1015 + function onRemove() { 1.1016 + var l = this[name]; 1.1017 + if (l) { 1.1018 + this.removeEventListener(type, l, l.$); 1.1019 + delete this[name]; 1.1020 + } 1.1021 + } 1.1022 + function onAdd() { 1.1023 + var l = wrap(listener, d3_array(arguments)); 1.1024 + onRemove.call(this); 1.1025 + this.addEventListener(type, this[name] = l, l.$ = capture); 1.1026 + l._ = listener; 1.1027 + } 1.1028 + function removeAll() { 1.1029 + var re = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match; 1.1030 + for (var name in this) { 1.1031 + if (match = name.match(re)) { 1.1032 + var l = this[name]; 1.1033 + this.removeEventListener(match[1], l, l.$); 1.1034 + delete this[name]; 1.1035 + } 1.1036 + } 1.1037 + } 1.1038 + return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll; 1.1039 + } 1.1040 + var d3_selection_onFilters = d3.map({ 1.1041 + mouseenter: "mouseover", 1.1042 + mouseleave: "mouseout" 1.1043 + }); 1.1044 + d3_selection_onFilters.forEach(function(k) { 1.1045 + if ("on" + k in d3_document) d3_selection_onFilters.remove(k); 1.1046 + }); 1.1047 + function d3_selection_onListener(listener, argumentz) { 1.1048 + return function(e) { 1.1049 + var o = d3.event; 1.1050 + d3.event = e; 1.1051 + argumentz[0] = this.__data__; 1.1052 + try { 1.1053 + listener.apply(this, argumentz); 1.1054 + } finally { 1.1055 + d3.event = o; 1.1056 + } 1.1057 + }; 1.1058 + } 1.1059 + function d3_selection_onFilter(listener, argumentz) { 1.1060 + var l = d3_selection_onListener(listener, argumentz); 1.1061 + return function(e) { 1.1062 + var target = this, related = e.relatedTarget; 1.1063 + if (!related || related !== target && !(related.compareDocumentPosition(target) & 8)) { 1.1064 + l.call(target, e); 1.1065 + } 1.1066 + }; 1.1067 + } 1.1068 + var d3_event_dragSelect = "onselectstart" in d3_document ? null : d3_vendorSymbol(d3_documentElement.style, "userSelect"), d3_event_dragId = 0; 1.1069 + function d3_event_dragSuppress() { 1.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); 1.1071 + if (d3_event_dragSelect) { 1.1072 + var style = d3_documentElement.style, select = style[d3_event_dragSelect]; 1.1073 + style[d3_event_dragSelect] = "none"; 1.1074 + } 1.1075 + return function(suppressClick) { 1.1076 + w.on(name, null); 1.1077 + if (d3_event_dragSelect) style[d3_event_dragSelect] = select; 1.1078 + if (suppressClick) { 1.1079 + function off() { 1.1080 + w.on(click, null); 1.1081 + } 1.1082 + w.on(click, function() { 1.1083 + d3_eventPreventDefault(); 1.1084 + off(); 1.1085 + }, true); 1.1086 + setTimeout(off, 0); 1.1087 + } 1.1088 + }; 1.1089 + } 1.1090 + d3.mouse = function(container) { 1.1091 + return d3_mousePoint(container, d3_eventSource()); 1.1092 + }; 1.1093 + var d3_mouse_bug44083 = /WebKit/.test(d3_window.navigator.userAgent) ? -1 : 0; 1.1094 + function d3_mousePoint(container, e) { 1.1095 + if (e.changedTouches) e = e.changedTouches[0]; 1.1096 + var svg = container.ownerSVGElement || container; 1.1097 + if (svg.createSVGPoint) { 1.1098 + var point = svg.createSVGPoint(); 1.1099 + if (d3_mouse_bug44083 < 0 && (d3_window.scrollX || d3_window.scrollY)) { 1.1100 + svg = d3.select("body").append("svg").style({ 1.1101 + position: "absolute", 1.1102 + top: 0, 1.1103 + left: 0, 1.1104 + margin: 0, 1.1105 + padding: 0, 1.1106 + border: "none" 1.1107 + }, "important"); 1.1108 + var ctm = svg[0][0].getScreenCTM(); 1.1109 + d3_mouse_bug44083 = !(ctm.f || ctm.e); 1.1110 + svg.remove(); 1.1111 + } 1.1112 + if (d3_mouse_bug44083) point.x = e.pageX, point.y = e.pageY; else point.x = e.clientX, 1.1113 + point.y = e.clientY; 1.1114 + point = point.matrixTransform(container.getScreenCTM().inverse()); 1.1115 + return [ point.x, point.y ]; 1.1116 + } 1.1117 + var rect = container.getBoundingClientRect(); 1.1118 + return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ]; 1.1119 + } 1.1120 + d3.touches = function(container, touches) { 1.1121 + if (arguments.length < 2) touches = d3_eventSource().touches; 1.1122 + return touches ? d3_array(touches).map(function(touch) { 1.1123 + var point = d3_mousePoint(container, touch); 1.1124 + point.identifier = touch.identifier; 1.1125 + return point; 1.1126 + }) : []; 1.1127 + }; 1.1128 + d3.behavior.drag = function() { 1.1129 + var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null, mousedown = dragstart(d3_noop, d3.mouse, "mousemove", "mouseup"), touchstart = dragstart(touchid, touchposition, "touchmove", "touchend"); 1.1130 + function drag() { 1.1131 + this.on("mousedown.drag", mousedown).on("touchstart.drag", touchstart); 1.1132 + } 1.1133 + function touchid() { 1.1134 + return d3.event.changedTouches[0].identifier; 1.1135 + } 1.1136 + function touchposition(parent, id) { 1.1137 + return d3.touches(parent).filter(function(p) { 1.1138 + return p.identifier === id; 1.1139 + })[0]; 1.1140 + } 1.1141 + function dragstart(id, position, move, end) { 1.1142 + return function() { 1.1143 + var target = this, parent = target.parentNode, event_ = event.of(target, arguments), eventTarget = d3.event.target, eventId = id(), drag = eventId == null ? "drag" : "drag-" + eventId, origin_ = position(parent, eventId), dragged = 0, offset, w = d3.select(d3_window).on(move + "." + drag, moved).on(end + "." + drag, ended), dragRestore = d3_event_dragSuppress(); 1.1144 + if (origin) { 1.1145 + offset = origin.apply(target, arguments); 1.1146 + offset = [ offset.x - origin_[0], offset.y - origin_[1] ]; 1.1147 + } else { 1.1148 + offset = [ 0, 0 ]; 1.1149 + } 1.1150 + event_({ 1.1151 + type: "dragstart" 1.1152 + }); 1.1153 + function moved() { 1.1154 + var p = position(parent, eventId), dx = p[0] - origin_[0], dy = p[1] - origin_[1]; 1.1155 + dragged |= dx | dy; 1.1156 + origin_ = p; 1.1157 + event_({ 1.1158 + type: "drag", 1.1159 + x: p[0] + offset[0], 1.1160 + y: p[1] + offset[1], 1.1161 + dx: dx, 1.1162 + dy: dy 1.1163 + }); 1.1164 + } 1.1165 + function ended() { 1.1166 + w.on(move + "." + drag, null).on(end + "." + drag, null); 1.1167 + dragRestore(dragged && d3.event.target === eventTarget); 1.1168 + event_({ 1.1169 + type: "dragend" 1.1170 + }); 1.1171 + } 1.1172 + }; 1.1173 + } 1.1174 + drag.origin = function(x) { 1.1175 + if (!arguments.length) return origin; 1.1176 + origin = x; 1.1177 + return drag; 1.1178 + }; 1.1179 + return d3.rebind(drag, event, "on"); 1.1180 + }; 1.1181 + var π = Math.PI, τ = 2 * π, halfπ = π / 2, ε = 1e-6, ε2 = ε * ε, d3_radians = π / 180, d3_degrees = 180 / π; 1.1182 + function d3_sgn(x) { 1.1183 + return x > 0 ? 1 : x < 0 ? -1 : 0; 1.1184 + } 1.1185 + function d3_cross2d(a, b, c) { 1.1186 + return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]); 1.1187 + } 1.1188 + function d3_acos(x) { 1.1189 + return x > 1 ? 0 : x < -1 ? π : Math.acos(x); 1.1190 + } 1.1191 + function d3_asin(x) { 1.1192 + return x > 1 ? halfπ : x < -1 ? -halfπ : Math.asin(x); 1.1193 + } 1.1194 + function d3_sinh(x) { 1.1195 + return ((x = Math.exp(x)) - 1 / x) / 2; 1.1196 + } 1.1197 + function d3_cosh(x) { 1.1198 + return ((x = Math.exp(x)) + 1 / x) / 2; 1.1199 + } 1.1200 + function d3_tanh(x) { 1.1201 + return ((x = Math.exp(2 * x)) - 1) / (x + 1); 1.1202 + } 1.1203 + function d3_haversin(x) { 1.1204 + return (x = Math.sin(x / 2)) * x; 1.1205 + } 1.1206 + var ρ = Math.SQRT2, ρ2 = 2, ρ4 = 4; 1.1207 + d3.interpolateZoom = function(p0, p1) { 1.1208 + var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2]; 1.1209 + 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)) / ρ; 1.1210 + function interpolate(t) { 1.1211 + var s = t * S; 1.1212 + if (dr) { 1.1213 + var coshr0 = d3_cosh(r0), u = w0 / (ρ2 * d1) * (coshr0 * d3_tanh(ρ * s + r0) - d3_sinh(r0)); 1.1214 + return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / d3_cosh(ρ * s + r0) ]; 1.1215 + } 1.1216 + return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(ρ * s) ]; 1.1217 + } 1.1218 + interpolate.duration = S * 1e3; 1.1219 + return interpolate; 1.1220 + }; 1.1221 + d3.behavior.zoom = function() { 1.1222 + var view = { 1.1223 + x: 0, 1.1224 + y: 0, 1.1225 + k: 1 1.1226 + }, 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; 1.1227 + function zoom(g) { 1.1228 + g.on(mousedown, mousedowned).on(d3_behavior_zoomWheel + ".zoom", mousewheeled).on(mousemove, mousewheelreset).on("dblclick.zoom", dblclicked).on(touchstart, touchstarted); 1.1229 + } 1.1230 + zoom.event = function(g) { 1.1231 + g.each(function() { 1.1232 + var event_ = event.of(this, arguments), view1 = view; 1.1233 + if (d3_transitionInheritId) { 1.1234 + d3.select(this).transition().each("start.zoom", function() { 1.1235 + view = this.__chart__ || { 1.1236 + x: 0, 1.1237 + y: 0, 1.1238 + k: 1 1.1239 + }; 1.1240 + zoomstarted(event_); 1.1241 + }).tween("zoom:zoom", function() { 1.1242 + 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 ]); 1.1243 + return function(t) { 1.1244 + var l = i(t), k = dx / l[2]; 1.1245 + this.__chart__ = view = { 1.1246 + x: cx - l[0] * k, 1.1247 + y: cy - l[1] * k, 1.1248 + k: k 1.1249 + }; 1.1250 + zoomed(event_); 1.1251 + }; 1.1252 + }).each("end.zoom", function() { 1.1253 + zoomended(event_); 1.1254 + }); 1.1255 + } else { 1.1256 + this.__chart__ = view; 1.1257 + zoomstarted(event_); 1.1258 + zoomed(event_); 1.1259 + zoomended(event_); 1.1260 + } 1.1261 + }); 1.1262 + }; 1.1263 + zoom.translate = function(_) { 1.1264 + if (!arguments.length) return [ view.x, view.y ]; 1.1265 + view = { 1.1266 + x: +_[0], 1.1267 + y: +_[1], 1.1268 + k: view.k 1.1269 + }; 1.1270 + rescale(); 1.1271 + return zoom; 1.1272 + }; 1.1273 + zoom.scale = function(_) { 1.1274 + if (!arguments.length) return view.k; 1.1275 + view = { 1.1276 + x: view.x, 1.1277 + y: view.y, 1.1278 + k: +_ 1.1279 + }; 1.1280 + rescale(); 1.1281 + return zoom; 1.1282 + }; 1.1283 + zoom.scaleExtent = function(_) { 1.1284 + if (!arguments.length) return scaleExtent; 1.1285 + scaleExtent = _ == null ? d3_behavior_zoomInfinity : [ +_[0], +_[1] ]; 1.1286 + return zoom; 1.1287 + }; 1.1288 + zoom.center = function(_) { 1.1289 + if (!arguments.length) return center; 1.1290 + center = _ && [ +_[0], +_[1] ]; 1.1291 + return zoom; 1.1292 + }; 1.1293 + zoom.size = function(_) { 1.1294 + if (!arguments.length) return size; 1.1295 + size = _ && [ +_[0], +_[1] ]; 1.1296 + return zoom; 1.1297 + }; 1.1298 + zoom.x = function(z) { 1.1299 + if (!arguments.length) return x1; 1.1300 + x1 = z; 1.1301 + x0 = z.copy(); 1.1302 + view = { 1.1303 + x: 0, 1.1304 + y: 0, 1.1305 + k: 1 1.1306 + }; 1.1307 + return zoom; 1.1308 + }; 1.1309 + zoom.y = function(z) { 1.1310 + if (!arguments.length) return y1; 1.1311 + y1 = z; 1.1312 + y0 = z.copy(); 1.1313 + view = { 1.1314 + x: 0, 1.1315 + y: 0, 1.1316 + k: 1 1.1317 + }; 1.1318 + return zoom; 1.1319 + }; 1.1320 + function location(p) { 1.1321 + return [ (p[0] - view.x) / view.k, (p[1] - view.y) / view.k ]; 1.1322 + } 1.1323 + function point(l) { 1.1324 + return [ l[0] * view.k + view.x, l[1] * view.k + view.y ]; 1.1325 + } 1.1326 + function scaleTo(s) { 1.1327 + view.k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s)); 1.1328 + } 1.1329 + function translateTo(p, l) { 1.1330 + l = point(l); 1.1331 + view.x += p[0] - l[0]; 1.1332 + view.y += p[1] - l[1]; 1.1333 + } 1.1334 + function rescale() { 1.1335 + if (x1) x1.domain(x0.range().map(function(x) { 1.1336 + return (x - view.x) / view.k; 1.1337 + }).map(x0.invert)); 1.1338 + if (y1) y1.domain(y0.range().map(function(y) { 1.1339 + return (y - view.y) / view.k; 1.1340 + }).map(y0.invert)); 1.1341 + } 1.1342 + function zoomstarted(event) { 1.1343 + event({ 1.1344 + type: "zoomstart" 1.1345 + }); 1.1346 + } 1.1347 + function zoomed(event) { 1.1348 + rescale(); 1.1349 + event({ 1.1350 + type: "zoom", 1.1351 + scale: view.k, 1.1352 + translate: [ view.x, view.y ] 1.1353 + }); 1.1354 + } 1.1355 + function zoomended(event) { 1.1356 + event({ 1.1357 + type: "zoomend" 1.1358 + }); 1.1359 + } 1.1360 + function mousedowned() { 1.1361 + var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, dragged = 0, w = d3.select(d3_window).on(mousemove, moved).on(mouseup, ended), l = location(d3.mouse(target)), dragRestore = d3_event_dragSuppress(); 1.1362 + d3_selection_interrupt.call(target); 1.1363 + zoomstarted(event_); 1.1364 + function moved() { 1.1365 + dragged = 1; 1.1366 + translateTo(d3.mouse(target), l); 1.1367 + zoomed(event_); 1.1368 + } 1.1369 + function ended() { 1.1370 + w.on(mousemove, d3_window === target ? mousewheelreset : null).on(mouseup, null); 1.1371 + dragRestore(dragged && d3.event.target === eventTarget); 1.1372 + zoomended(event_); 1.1373 + } 1.1374 + } 1.1375 + function touchstarted() { 1.1376 + var target = this, event_ = event.of(target, arguments), locations0 = {}, distance0 = 0, scale0, eventId = d3.event.changedTouches[0].identifier, touchmove = "touchmove.zoom-" + eventId, touchend = "touchend.zoom-" + eventId, w = d3.select(d3_window).on(touchmove, moved).on(touchend, ended), t = d3.select(target).on(mousedown, null).on(touchstart, started), dragRestore = d3_event_dragSuppress(); 1.1377 + d3_selection_interrupt.call(target); 1.1378 + started(); 1.1379 + zoomstarted(event_); 1.1380 + function relocate() { 1.1381 + var touches = d3.touches(target); 1.1382 + scale0 = view.k; 1.1383 + touches.forEach(function(t) { 1.1384 + if (t.identifier in locations0) locations0[t.identifier] = location(t); 1.1385 + }); 1.1386 + return touches; 1.1387 + } 1.1388 + function started() { 1.1389 + var changed = d3.event.changedTouches; 1.1390 + for (var i = 0, n = changed.length; i < n; ++i) { 1.1391 + locations0[changed[i].identifier] = null; 1.1392 + } 1.1393 + var touches = relocate(), now = Date.now(); 1.1394 + if (touches.length === 1) { 1.1395 + if (now - touchtime < 500) { 1.1396 + var p = touches[0], l = locations0[p.identifier]; 1.1397 + scaleTo(view.k * 2); 1.1398 + translateTo(p, l); 1.1399 + d3_eventPreventDefault(); 1.1400 + zoomed(event_); 1.1401 + } 1.1402 + touchtime = now; 1.1403 + } else if (touches.length > 1) { 1.1404 + var p = touches[0], q = touches[1], dx = p[0] - q[0], dy = p[1] - q[1]; 1.1405 + distance0 = dx * dx + dy * dy; 1.1406 + } 1.1407 + } 1.1408 + function moved() { 1.1409 + var touches = d3.touches(target), p0, l0, p1, l1; 1.1410 + for (var i = 0, n = touches.length; i < n; ++i, l1 = null) { 1.1411 + p1 = touches[i]; 1.1412 + if (l1 = locations0[p1.identifier]) { 1.1413 + if (l0) break; 1.1414 + p0 = p1, l0 = l1; 1.1415 + } 1.1416 + } 1.1417 + if (l1) { 1.1418 + var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1, scale1 = distance0 && Math.sqrt(distance1 / distance0); 1.1419 + p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ]; 1.1420 + l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ]; 1.1421 + scaleTo(scale1 * scale0); 1.1422 + } 1.1423 + touchtime = null; 1.1424 + translateTo(p0, l0); 1.1425 + zoomed(event_); 1.1426 + } 1.1427 + function ended() { 1.1428 + if (d3.event.touches.length) { 1.1429 + var changed = d3.event.changedTouches; 1.1430 + for (var i = 0, n = changed.length; i < n; ++i) { 1.1431 + delete locations0[changed[i].identifier]; 1.1432 + } 1.1433 + for (var identifier in locations0) { 1.1434 + return void relocate(); 1.1435 + } 1.1436 + } 1.1437 + w.on(touchmove, null).on(touchend, null); 1.1438 + t.on(mousedown, mousedowned).on(touchstart, touchstarted); 1.1439 + dragRestore(); 1.1440 + zoomended(event_); 1.1441 + } 1.1442 + } 1.1443 + function mousewheeled() { 1.1444 + var event_ = event.of(this, arguments); 1.1445 + if (mousewheelTimer) clearTimeout(mousewheelTimer); else d3_selection_interrupt.call(this), 1.1446 + zoomstarted(event_); 1.1447 + mousewheelTimer = setTimeout(function() { 1.1448 + mousewheelTimer = null; 1.1449 + zoomended(event_); 1.1450 + }, 50); 1.1451 + d3_eventPreventDefault(); 1.1452 + var point = center || d3.mouse(this); 1.1453 + if (!translate0) translate0 = location(point); 1.1454 + scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * view.k); 1.1455 + translateTo(point, translate0); 1.1456 + zoomed(event_); 1.1457 + } 1.1458 + function mousewheelreset() { 1.1459 + translate0 = null; 1.1460 + } 1.1461 + function dblclicked() { 1.1462 + var event_ = event.of(this, arguments), p = d3.mouse(this), l = location(p), k = Math.log(view.k) / Math.LN2; 1.1463 + zoomstarted(event_); 1.1464 + scaleTo(Math.pow(2, d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1)); 1.1465 + translateTo(p, l); 1.1466 + zoomed(event_); 1.1467 + zoomended(event_); 1.1468 + } 1.1469 + return d3.rebind(zoom, event, "on"); 1.1470 + }; 1.1471 + var d3_behavior_zoomInfinity = [ 0, Infinity ]; 1.1472 + var d3_behavior_zoomDelta, d3_behavior_zoomWheel = "onwheel" in d3_document ? (d3_behavior_zoomDelta = function() { 1.1473 + return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1); 1.1474 + }, "wheel") : "onmousewheel" in d3_document ? (d3_behavior_zoomDelta = function() { 1.1475 + return d3.event.wheelDelta; 1.1476 + }, "mousewheel") : (d3_behavior_zoomDelta = function() { 1.1477 + return -d3.event.detail; 1.1478 + }, "MozMousePixelScroll"); 1.1479 + function d3_Color() {} 1.1480 + d3_Color.prototype.toString = function() { 1.1481 + return this.rgb() + ""; 1.1482 + }; 1.1483 + d3.hsl = function(h, s, l) { 1.1484 + 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); 1.1485 + }; 1.1486 + function d3_hsl(h, s, l) { 1.1487 + return new d3_Hsl(h, s, l); 1.1488 + } 1.1489 + function d3_Hsl(h, s, l) { 1.1490 + this.h = h; 1.1491 + this.s = s; 1.1492 + this.l = l; 1.1493 + } 1.1494 + var d3_hslPrototype = d3_Hsl.prototype = new d3_Color(); 1.1495 + d3_hslPrototype.brighter = function(k) { 1.1496 + k = Math.pow(.7, arguments.length ? k : 1); 1.1497 + return d3_hsl(this.h, this.s, this.l / k); 1.1498 + }; 1.1499 + d3_hslPrototype.darker = function(k) { 1.1500 + k = Math.pow(.7, arguments.length ? k : 1); 1.1501 + return d3_hsl(this.h, this.s, k * this.l); 1.1502 + }; 1.1503 + d3_hslPrototype.rgb = function() { 1.1504 + return d3_hsl_rgb(this.h, this.s, this.l); 1.1505 + }; 1.1506 + function d3_hsl_rgb(h, s, l) { 1.1507 + var m1, m2; 1.1508 + h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h; 1.1509 + s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s; 1.1510 + l = l < 0 ? 0 : l > 1 ? 1 : l; 1.1511 + m2 = l <= .5 ? l * (1 + s) : l + s - l * s; 1.1512 + m1 = 2 * l - m2; 1.1513 + function v(h) { 1.1514 + if (h > 360) h -= 360; else if (h < 0) h += 360; 1.1515 + if (h < 60) return m1 + (m2 - m1) * h / 60; 1.1516 + if (h < 180) return m2; 1.1517 + if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; 1.1518 + return m1; 1.1519 + } 1.1520 + function vv(h) { 1.1521 + return Math.round(v(h) * 255); 1.1522 + } 1.1523 + return d3_rgb(vv(h + 120), vv(h), vv(h - 120)); 1.1524 + } 1.1525 + d3.hcl = function(h, c, l) { 1.1526 + 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); 1.1527 + }; 1.1528 + function d3_hcl(h, c, l) { 1.1529 + return new d3_Hcl(h, c, l); 1.1530 + } 1.1531 + function d3_Hcl(h, c, l) { 1.1532 + this.h = h; 1.1533 + this.c = c; 1.1534 + this.l = l; 1.1535 + } 1.1536 + var d3_hclPrototype = d3_Hcl.prototype = new d3_Color(); 1.1537 + d3_hclPrototype.brighter = function(k) { 1.1538 + return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1))); 1.1539 + }; 1.1540 + d3_hclPrototype.darker = function(k) { 1.1541 + return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1))); 1.1542 + }; 1.1543 + d3_hclPrototype.rgb = function() { 1.1544 + return d3_hcl_lab(this.h, this.c, this.l).rgb(); 1.1545 + }; 1.1546 + function d3_hcl_lab(h, c, l) { 1.1547 + if (isNaN(h)) h = 0; 1.1548 + if (isNaN(c)) c = 0; 1.1549 + return d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c); 1.1550 + } 1.1551 + d3.lab = function(l, a, b) { 1.1552 + 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); 1.1553 + }; 1.1554 + function d3_lab(l, a, b) { 1.1555 + return new d3_Lab(l, a, b); 1.1556 + } 1.1557 + function d3_Lab(l, a, b) { 1.1558 + this.l = l; 1.1559 + this.a = a; 1.1560 + this.b = b; 1.1561 + } 1.1562 + var d3_lab_K = 18; 1.1563 + var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883; 1.1564 + var d3_labPrototype = d3_Lab.prototype = new d3_Color(); 1.1565 + d3_labPrototype.brighter = function(k) { 1.1566 + return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); 1.1567 + }; 1.1568 + d3_labPrototype.darker = function(k) { 1.1569 + return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); 1.1570 + }; 1.1571 + d3_labPrototype.rgb = function() { 1.1572 + return d3_lab_rgb(this.l, this.a, this.b); 1.1573 + }; 1.1574 + function d3_lab_rgb(l, a, b) { 1.1575 + var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200; 1.1576 + x = d3_lab_xyz(x) * d3_lab_X; 1.1577 + y = d3_lab_xyz(y) * d3_lab_Y; 1.1578 + z = d3_lab_xyz(z) * d3_lab_Z; 1.1579 + 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)); 1.1580 + } 1.1581 + function d3_lab_hcl(l, a, b) { 1.1582 + return l > 0 ? d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l) : d3_hcl(NaN, NaN, l); 1.1583 + } 1.1584 + function d3_lab_xyz(x) { 1.1585 + return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037; 1.1586 + } 1.1587 + function d3_xyz_lab(x) { 1.1588 + return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; 1.1589 + } 1.1590 + function d3_xyz_rgb(r) { 1.1591 + return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055)); 1.1592 + } 1.1593 + d3.rgb = function(r, g, b) { 1.1594 + 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); 1.1595 + }; 1.1596 + function d3_rgbNumber(value) { 1.1597 + return d3_rgb(value >> 16, value >> 8 & 255, value & 255); 1.1598 + } 1.1599 + function d3_rgbString(value) { 1.1600 + return d3_rgbNumber(value) + ""; 1.1601 + } 1.1602 + function d3_rgb(r, g, b) { 1.1603 + return new d3_Rgb(r, g, b); 1.1604 + } 1.1605 + function d3_Rgb(r, g, b) { 1.1606 + this.r = r; 1.1607 + this.g = g; 1.1608 + this.b = b; 1.1609 + } 1.1610 + var d3_rgbPrototype = d3_Rgb.prototype = new d3_Color(); 1.1611 + d3_rgbPrototype.brighter = function(k) { 1.1612 + k = Math.pow(.7, arguments.length ? k : 1); 1.1613 + var r = this.r, g = this.g, b = this.b, i = 30; 1.1614 + if (!r && !g && !b) return d3_rgb(i, i, i); 1.1615 + if (r && r < i) r = i; 1.1616 + if (g && g < i) g = i; 1.1617 + if (b && b < i) b = i; 1.1618 + return d3_rgb(Math.min(255, ~~(r / k)), Math.min(255, ~~(g / k)), Math.min(255, ~~(b / k))); 1.1619 + }; 1.1620 + d3_rgbPrototype.darker = function(k) { 1.1621 + k = Math.pow(.7, arguments.length ? k : 1); 1.1622 + return d3_rgb(~~(k * this.r), ~~(k * this.g), ~~(k * this.b)); 1.1623 + }; 1.1624 + d3_rgbPrototype.hsl = function() { 1.1625 + return d3_rgb_hsl(this.r, this.g, this.b); 1.1626 + }; 1.1627 + d3_rgbPrototype.toString = function() { 1.1628 + return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); 1.1629 + }; 1.1630 + function d3_rgb_hex(v) { 1.1631 + return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16); 1.1632 + } 1.1633 + function d3_rgb_parse(format, rgb, hsl) { 1.1634 + var r = 0, g = 0, b = 0, m1, m2, name; 1.1635 + m1 = /([a-z]+)\((.*)\)/i.exec(format); 1.1636 + if (m1) { 1.1637 + m2 = m1[2].split(","); 1.1638 + switch (m1[1]) { 1.1639 + case "hsl": 1.1640 + { 1.1641 + return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100); 1.1642 + } 1.1643 + 1.1644 + case "rgb": 1.1645 + { 1.1646 + return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2])); 1.1647 + } 1.1648 + } 1.1649 + } 1.1650 + if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b); 1.1651 + if (format != null && format.charAt(0) === "#") { 1.1652 + if (format.length === 4) { 1.1653 + r = format.charAt(1); 1.1654 + r += r; 1.1655 + g = format.charAt(2); 1.1656 + g += g; 1.1657 + b = format.charAt(3); 1.1658 + b += b; 1.1659 + } else if (format.length === 7) { 1.1660 + r = format.substring(1, 3); 1.1661 + g = format.substring(3, 5); 1.1662 + b = format.substring(5, 7); 1.1663 + } 1.1664 + r = parseInt(r, 16); 1.1665 + g = parseInt(g, 16); 1.1666 + b = parseInt(b, 16); 1.1667 + } 1.1668 + return rgb(r, g, b); 1.1669 + } 1.1670 + function d3_rgb_hsl(r, g, b) { 1.1671 + 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; 1.1672 + if (d) { 1.1673 + s = l < .5 ? d / (max + min) : d / (2 - max - min); 1.1674 + 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; 1.1675 + h *= 60; 1.1676 + } else { 1.1677 + h = NaN; 1.1678 + s = l > 0 && l < 1 ? 0 : h; 1.1679 + } 1.1680 + return d3_hsl(h, s, l); 1.1681 + } 1.1682 + function d3_rgb_lab(r, g, b) { 1.1683 + r = d3_rgb_xyz(r); 1.1684 + g = d3_rgb_xyz(g); 1.1685 + b = d3_rgb_xyz(b); 1.1686 + 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); 1.1687 + return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z)); 1.1688 + } 1.1689 + function d3_rgb_xyz(r) { 1.1690 + return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4); 1.1691 + } 1.1692 + function d3_rgb_parseNumber(c) { 1.1693 + var f = parseFloat(c); 1.1694 + return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; 1.1695 + } 1.1696 + var d3_rgb_names = d3.map({ 1.1697 + aliceblue: 15792383, 1.1698 + antiquewhite: 16444375, 1.1699 + aqua: 65535, 1.1700 + aquamarine: 8388564, 1.1701 + azure: 15794175, 1.1702 + beige: 16119260, 1.1703 + bisque: 16770244, 1.1704 + black: 0, 1.1705 + blanchedalmond: 16772045, 1.1706 + blue: 255, 1.1707 + blueviolet: 9055202, 1.1708 + brown: 10824234, 1.1709 + burlywood: 14596231, 1.1710 + cadetblue: 6266528, 1.1711 + chartreuse: 8388352, 1.1712 + chocolate: 13789470, 1.1713 + coral: 16744272, 1.1714 + cornflowerblue: 6591981, 1.1715 + cornsilk: 16775388, 1.1716 + crimson: 14423100, 1.1717 + cyan: 65535, 1.1718 + darkblue: 139, 1.1719 + darkcyan: 35723, 1.1720 + darkgoldenrod: 12092939, 1.1721 + darkgray: 11119017, 1.1722 + darkgreen: 25600, 1.1723 + darkgrey: 11119017, 1.1724 + darkkhaki: 12433259, 1.1725 + darkmagenta: 9109643, 1.1726 + darkolivegreen: 5597999, 1.1727 + darkorange: 16747520, 1.1728 + darkorchid: 10040012, 1.1729 + darkred: 9109504, 1.1730 + darksalmon: 15308410, 1.1731 + darkseagreen: 9419919, 1.1732 + darkslateblue: 4734347, 1.1733 + darkslategray: 3100495, 1.1734 + darkslategrey: 3100495, 1.1735 + darkturquoise: 52945, 1.1736 + darkviolet: 9699539, 1.1737 + deeppink: 16716947, 1.1738 + deepskyblue: 49151, 1.1739 + dimgray: 6908265, 1.1740 + dimgrey: 6908265, 1.1741 + dodgerblue: 2003199, 1.1742 + firebrick: 11674146, 1.1743 + floralwhite: 16775920, 1.1744 + forestgreen: 2263842, 1.1745 + fuchsia: 16711935, 1.1746 + gainsboro: 14474460, 1.1747 + ghostwhite: 16316671, 1.1748 + gold: 16766720, 1.1749 + goldenrod: 14329120, 1.1750 + gray: 8421504, 1.1751 + green: 32768, 1.1752 + greenyellow: 11403055, 1.1753 + grey: 8421504, 1.1754 + honeydew: 15794160, 1.1755 + hotpink: 16738740, 1.1756 + indianred: 13458524, 1.1757 + indigo: 4915330, 1.1758 + ivory: 16777200, 1.1759 + khaki: 15787660, 1.1760 + lavender: 15132410, 1.1761 + lavenderblush: 16773365, 1.1762 + lawngreen: 8190976, 1.1763 + lemonchiffon: 16775885, 1.1764 + lightblue: 11393254, 1.1765 + lightcoral: 15761536, 1.1766 + lightcyan: 14745599, 1.1767 + lightgoldenrodyellow: 16448210, 1.1768 + lightgray: 13882323, 1.1769 + lightgreen: 9498256, 1.1770 + lightgrey: 13882323, 1.1771 + lightpink: 16758465, 1.1772 + lightsalmon: 16752762, 1.1773 + lightseagreen: 2142890, 1.1774 + lightskyblue: 8900346, 1.1775 + lightslategray: 7833753, 1.1776 + lightslategrey: 7833753, 1.1777 + lightsteelblue: 11584734, 1.1778 + lightyellow: 16777184, 1.1779 + lime: 65280, 1.1780 + limegreen: 3329330, 1.1781 + linen: 16445670, 1.1782 + magenta: 16711935, 1.1783 + maroon: 8388608, 1.1784 + mediumaquamarine: 6737322, 1.1785 + mediumblue: 205, 1.1786 + mediumorchid: 12211667, 1.1787 + mediumpurple: 9662683, 1.1788 + mediumseagreen: 3978097, 1.1789 + mediumslateblue: 8087790, 1.1790 + mediumspringgreen: 64154, 1.1791 + mediumturquoise: 4772300, 1.1792 + mediumvioletred: 13047173, 1.1793 + midnightblue: 1644912, 1.1794 + mintcream: 16121850, 1.1795 + mistyrose: 16770273, 1.1796 + moccasin: 16770229, 1.1797 + navajowhite: 16768685, 1.1798 + navy: 128, 1.1799 + oldlace: 16643558, 1.1800 + olive: 8421376, 1.1801 + olivedrab: 7048739, 1.1802 + orange: 16753920, 1.1803 + orangered: 16729344, 1.1804 + orchid: 14315734, 1.1805 + palegoldenrod: 15657130, 1.1806 + palegreen: 10025880, 1.1807 + paleturquoise: 11529966, 1.1808 + palevioletred: 14381203, 1.1809 + papayawhip: 16773077, 1.1810 + peachpuff: 16767673, 1.1811 + peru: 13468991, 1.1812 + pink: 16761035, 1.1813 + plum: 14524637, 1.1814 + powderblue: 11591910, 1.1815 + purple: 8388736, 1.1816 + red: 16711680, 1.1817 + rosybrown: 12357519, 1.1818 + royalblue: 4286945, 1.1819 + saddlebrown: 9127187, 1.1820 + salmon: 16416882, 1.1821 + sandybrown: 16032864, 1.1822 + seagreen: 3050327, 1.1823 + seashell: 16774638, 1.1824 + sienna: 10506797, 1.1825 + silver: 12632256, 1.1826 + skyblue: 8900331, 1.1827 + slateblue: 6970061, 1.1828 + slategray: 7372944, 1.1829 + slategrey: 7372944, 1.1830 + snow: 16775930, 1.1831 + springgreen: 65407, 1.1832 + steelblue: 4620980, 1.1833 + tan: 13808780, 1.1834 + teal: 32896, 1.1835 + thistle: 14204888, 1.1836 + tomato: 16737095, 1.1837 + turquoise: 4251856, 1.1838 + violet: 15631086, 1.1839 + wheat: 16113331, 1.1840 + white: 16777215, 1.1841 + whitesmoke: 16119285, 1.1842 + yellow: 16776960, 1.1843 + yellowgreen: 10145074 1.1844 + }); 1.1845 + d3_rgb_names.forEach(function(key, value) { 1.1846 + d3_rgb_names.set(key, d3_rgbNumber(value)); 1.1847 + }); 1.1848 + function d3_functor(v) { 1.1849 + return typeof v === "function" ? v : function() { 1.1850 + return v; 1.1851 + }; 1.1852 + } 1.1853 + d3.functor = d3_functor; 1.1854 + function d3_identity(d) { 1.1855 + return d; 1.1856 + } 1.1857 + d3.xhr = d3_xhrType(d3_identity); 1.1858 + function d3_xhrType(response) { 1.1859 + return function(url, mimeType, callback) { 1.1860 + if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType, 1.1861 + mimeType = null; 1.1862 + return d3_xhr(url, mimeType, response, callback); 1.1863 + }; 1.1864 + } 1.1865 + function d3_xhr(url, mimeType, response, callback) { 1.1866 + var xhr = {}, dispatch = d3.dispatch("beforesend", "progress", "load", "error"), headers = {}, request = new XMLHttpRequest(), responseType = null; 1.1867 + if (d3_window.XDomainRequest && !("withCredentials" in request) && /^(http(s)?:)?\/\//.test(url)) request = new XDomainRequest(); 1.1868 + "onload" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() { 1.1869 + request.readyState > 3 && respond(); 1.1870 + }; 1.1871 + function respond() { 1.1872 + var status = request.status, result; 1.1873 + if (!status && request.responseText || status >= 200 && status < 300 || status === 304) { 1.1874 + try { 1.1875 + result = response.call(xhr, request); 1.1876 + } catch (e) { 1.1877 + dispatch.error.call(xhr, e); 1.1878 + return; 1.1879 + } 1.1880 + dispatch.load.call(xhr, result); 1.1881 + } else { 1.1882 + dispatch.error.call(xhr, request); 1.1883 + } 1.1884 + } 1.1885 + request.onprogress = function(event) { 1.1886 + var o = d3.event; 1.1887 + d3.event = event; 1.1888 + try { 1.1889 + dispatch.progress.call(xhr, request); 1.1890 + } finally { 1.1891 + d3.event = o; 1.1892 + } 1.1893 + }; 1.1894 + xhr.header = function(name, value) { 1.1895 + name = (name + "").toLowerCase(); 1.1896 + if (arguments.length < 2) return headers[name]; 1.1897 + if (value == null) delete headers[name]; else headers[name] = value + ""; 1.1898 + return xhr; 1.1899 + }; 1.1900 + xhr.mimeType = function(value) { 1.1901 + if (!arguments.length) return mimeType; 1.1902 + mimeType = value == null ? null : value + ""; 1.1903 + return xhr; 1.1904 + }; 1.1905 + xhr.responseType = function(value) { 1.1906 + if (!arguments.length) return responseType; 1.1907 + responseType = value; 1.1908 + return xhr; 1.1909 + }; 1.1910 + xhr.response = function(value) { 1.1911 + response = value; 1.1912 + return xhr; 1.1913 + }; 1.1914 + [ "get", "post" ].forEach(function(method) { 1.1915 + xhr[method] = function() { 1.1916 + return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments))); 1.1917 + }; 1.1918 + }); 1.1919 + xhr.send = function(method, data, callback) { 1.1920 + if (arguments.length === 2 && typeof data === "function") callback = data, data = null; 1.1921 + request.open(method, url, true); 1.1922 + if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*"; 1.1923 + if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]); 1.1924 + if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType); 1.1925 + if (responseType != null) request.responseType = responseType; 1.1926 + if (callback != null) xhr.on("error", callback).on("load", function(request) { 1.1927 + callback(null, request); 1.1928 + }); 1.1929 + dispatch.beforesend.call(xhr, request); 1.1930 + request.send(data == null ? null : data); 1.1931 + return xhr; 1.1932 + }; 1.1933 + xhr.abort = function() { 1.1934 + request.abort(); 1.1935 + return xhr; 1.1936 + }; 1.1937 + d3.rebind(xhr, dispatch, "on"); 1.1938 + return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback)); 1.1939 + } 1.1940 + function d3_xhr_fixCallback(callback) { 1.1941 + return callback.length === 1 ? function(error, request) { 1.1942 + callback(error == null ? request : null); 1.1943 + } : callback; 1.1944 + } 1.1945 + d3.dsv = function(delimiter, mimeType) { 1.1946 + var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0); 1.1947 + function dsv(url, row, callback) { 1.1948 + if (arguments.length < 3) callback = row, row = null; 1.1949 + var xhr = d3_xhr(url, mimeType, row == null ? response : typedResponse(row), callback); 1.1950 + xhr.row = function(_) { 1.1951 + return arguments.length ? xhr.response((row = _) == null ? response : typedResponse(_)) : row; 1.1952 + }; 1.1953 + return xhr; 1.1954 + } 1.1955 + function response(request) { 1.1956 + return dsv.parse(request.responseText); 1.1957 + } 1.1958 + function typedResponse(f) { 1.1959 + return function(request) { 1.1960 + return dsv.parse(request.responseText, f); 1.1961 + }; 1.1962 + } 1.1963 + dsv.parse = function(text, f) { 1.1964 + var o; 1.1965 + return dsv.parseRows(text, function(row, i) { 1.1966 + if (o) return o(row, i - 1); 1.1967 + var a = new Function("d", "return {" + row.map(function(name, i) { 1.1968 + return JSON.stringify(name) + ": d[" + i + "]"; 1.1969 + }).join(",") + "}"); 1.1970 + o = f ? function(row, i) { 1.1971 + return f(a(row), i); 1.1972 + } : a; 1.1973 + }); 1.1974 + }; 1.1975 + dsv.parseRows = function(text, f) { 1.1976 + var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol; 1.1977 + function token() { 1.1978 + if (I >= N) return EOF; 1.1979 + if (eol) return eol = false, EOL; 1.1980 + var j = I; 1.1981 + if (text.charCodeAt(j) === 34) { 1.1982 + var i = j; 1.1983 + while (i++ < N) { 1.1984 + if (text.charCodeAt(i) === 34) { 1.1985 + if (text.charCodeAt(i + 1) !== 34) break; 1.1986 + ++i; 1.1987 + } 1.1988 + } 1.1989 + I = i + 2; 1.1990 + var c = text.charCodeAt(i + 1); 1.1991 + if (c === 13) { 1.1992 + eol = true; 1.1993 + if (text.charCodeAt(i + 2) === 10) ++I; 1.1994 + } else if (c === 10) { 1.1995 + eol = true; 1.1996 + } 1.1997 + return text.substring(j + 1, i).replace(/""/g, '"'); 1.1998 + } 1.1999 + while (I < N) { 1.2000 + var c = text.charCodeAt(I++), k = 1; 1.2001 + if (c === 10) eol = true; else if (c === 13) { 1.2002 + eol = true; 1.2003 + if (text.charCodeAt(I) === 10) ++I, ++k; 1.2004 + } else if (c !== delimiterCode) continue; 1.2005 + return text.substring(j, I - k); 1.2006 + } 1.2007 + return text.substring(j); 1.2008 + } 1.2009 + while ((t = token()) !== EOF) { 1.2010 + var a = []; 1.2011 + while (t !== EOL && t !== EOF) { 1.2012 + a.push(t); 1.2013 + t = token(); 1.2014 + } 1.2015 + if (f && !(a = f(a, n++))) continue; 1.2016 + rows.push(a); 1.2017 + } 1.2018 + return rows; 1.2019 + }; 1.2020 + dsv.format = function(rows) { 1.2021 + if (Array.isArray(rows[0])) return dsv.formatRows(rows); 1.2022 + var fieldSet = new d3_Set(), fields = []; 1.2023 + rows.forEach(function(row) { 1.2024 + for (var field in row) { 1.2025 + if (!fieldSet.has(field)) { 1.2026 + fields.push(fieldSet.add(field)); 1.2027 + } 1.2028 + } 1.2029 + }); 1.2030 + return [ fields.map(formatValue).join(delimiter) ].concat(rows.map(function(row) { 1.2031 + return fields.map(function(field) { 1.2032 + return formatValue(row[field]); 1.2033 + }).join(delimiter); 1.2034 + })).join("\n"); 1.2035 + }; 1.2036 + dsv.formatRows = function(rows) { 1.2037 + return rows.map(formatRow).join("\n"); 1.2038 + }; 1.2039 + function formatRow(row) { 1.2040 + return row.map(formatValue).join(delimiter); 1.2041 + } 1.2042 + function formatValue(text) { 1.2043 + return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text; 1.2044 + } 1.2045 + return dsv; 1.2046 + }; 1.2047 + d3.csv = d3.dsv(",", "text/csv"); 1.2048 + d3.tsv = d3.dsv(" ", "text/tab-separated-values"); 1.2049 + 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) { 1.2050 + setTimeout(callback, 17); 1.2051 + }; 1.2052 + d3.timer = function(callback, delay, then) { 1.2053 + var n = arguments.length; 1.2054 + if (n < 2) delay = 0; 1.2055 + if (n < 3) then = Date.now(); 1.2056 + var time = then + delay, timer = { 1.2057 + c: callback, 1.2058 + t: time, 1.2059 + f: false, 1.2060 + n: null 1.2061 + }; 1.2062 + if (d3_timer_queueTail) d3_timer_queueTail.n = timer; else d3_timer_queueHead = timer; 1.2063 + d3_timer_queueTail = timer; 1.2064 + if (!d3_timer_interval) { 1.2065 + d3_timer_timeout = clearTimeout(d3_timer_timeout); 1.2066 + d3_timer_interval = 1; 1.2067 + d3_timer_frame(d3_timer_step); 1.2068 + } 1.2069 + }; 1.2070 + function d3_timer_step() { 1.2071 + var now = d3_timer_mark(), delay = d3_timer_sweep() - now; 1.2072 + if (delay > 24) { 1.2073 + if (isFinite(delay)) { 1.2074 + clearTimeout(d3_timer_timeout); 1.2075 + d3_timer_timeout = setTimeout(d3_timer_step, delay); 1.2076 + } 1.2077 + d3_timer_interval = 0; 1.2078 + } else { 1.2079 + d3_timer_interval = 1; 1.2080 + d3_timer_frame(d3_timer_step); 1.2081 + } 1.2082 + } 1.2083 + d3.timer.flush = function() { 1.2084 + d3_timer_mark(); 1.2085 + d3_timer_sweep(); 1.2086 + }; 1.2087 + function d3_timer_mark() { 1.2088 + var now = Date.now(); 1.2089 + d3_timer_active = d3_timer_queueHead; 1.2090 + while (d3_timer_active) { 1.2091 + if (now >= d3_timer_active.t) d3_timer_active.f = d3_timer_active.c(now - d3_timer_active.t); 1.2092 + d3_timer_active = d3_timer_active.n; 1.2093 + } 1.2094 + return now; 1.2095 + } 1.2096 + function d3_timer_sweep() { 1.2097 + var t0, t1 = d3_timer_queueHead, time = Infinity; 1.2098 + while (t1) { 1.2099 + if (t1.f) { 1.2100 + t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n; 1.2101 + } else { 1.2102 + if (t1.t < time) time = t1.t; 1.2103 + t1 = (t0 = t1).n; 1.2104 + } 1.2105 + } 1.2106 + d3_timer_queueTail = t0; 1.2107 + return time; 1.2108 + } 1.2109 + function d3_format_precision(x, p) { 1.2110 + return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1); 1.2111 + } 1.2112 + d3.round = function(x, n) { 1.2113 + return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x); 1.2114 + }; 1.2115 + var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix); 1.2116 + d3.formatPrefix = function(value, precision) { 1.2117 + var i = 0; 1.2118 + if (value) { 1.2119 + if (value < 0) value *= -1; 1.2120 + if (precision) value = d3.round(value, d3_format_precision(value, precision)); 1.2121 + i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); 1.2122 + i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3)); 1.2123 + } 1.2124 + return d3_formatPrefixes[8 + i / 3]; 1.2125 + }; 1.2126 + function d3_formatPrefix(d, i) { 1.2127 + var k = Math.pow(10, abs(8 - i) * 3); 1.2128 + return { 1.2129 + scale: i > 8 ? function(d) { 1.2130 + return d / k; 1.2131 + } : function(d) { 1.2132 + return d * k; 1.2133 + }, 1.2134 + symbol: d 1.2135 + }; 1.2136 + } 1.2137 + function d3_locale_numberFormat(locale) { 1.2138 + var locale_decimal = locale.decimal, locale_thousands = locale.thousands, locale_grouping = locale.grouping, locale_currency = locale.currency, formatGroup = locale_grouping ? function(value) { 1.2139 + var i = value.length, t = [], j = 0, g = locale_grouping[0]; 1.2140 + while (i > 0 && g > 0) { 1.2141 + t.push(value.substring(i -= g, i + g)); 1.2142 + g = locale_grouping[j = (j + 1) % locale_grouping.length]; 1.2143 + } 1.2144 + return t.reverse().join(locale_thousands); 1.2145 + } : d3_identity; 1.2146 + return function(specifier) { 1.2147 + 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; 1.2148 + if (precision) precision = +precision.substring(1); 1.2149 + if (zfill || fill === "0" && align === "=") { 1.2150 + zfill = fill = "0"; 1.2151 + align = "="; 1.2152 + if (comma) width -= Math.floor((width - 1) / 4); 1.2153 + } 1.2154 + switch (type) { 1.2155 + case "n": 1.2156 + comma = true; 1.2157 + type = "g"; 1.2158 + break; 1.2159 + 1.2160 + case "%": 1.2161 + scale = 100; 1.2162 + suffix = "%"; 1.2163 + type = "f"; 1.2164 + break; 1.2165 + 1.2166 + case "p": 1.2167 + scale = 100; 1.2168 + suffix = "%"; 1.2169 + type = "r"; 1.2170 + break; 1.2171 + 1.2172 + case "b": 1.2173 + case "o": 1.2174 + case "x": 1.2175 + case "X": 1.2176 + if (symbol === "#") prefix = "0" + type.toLowerCase(); 1.2177 + 1.2178 + case "c": 1.2179 + case "d": 1.2180 + integer = true; 1.2181 + precision = 0; 1.2182 + break; 1.2183 + 1.2184 + case "s": 1.2185 + scale = -1; 1.2186 + type = "r"; 1.2187 + break; 1.2188 + } 1.2189 + if (symbol === "$") prefix = locale_currency[0], suffix = locale_currency[1]; 1.2190 + if (type == "r" && !precision) type = "g"; 1.2191 + if (precision != null) { 1.2192 + 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)); 1.2193 + } 1.2194 + type = d3_format_types.get(type) || d3_format_typeDefault; 1.2195 + var zcomma = zfill && comma; 1.2196 + return function(value) { 1.2197 + var fullSuffix = suffix; 1.2198 + if (integer && value % 1) return ""; 1.2199 + var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign; 1.2200 + if (scale < 0) { 1.2201 + var unit = d3.formatPrefix(value, precision); 1.2202 + value = unit.scale(value); 1.2203 + fullSuffix = unit.symbol + suffix; 1.2204 + } else { 1.2205 + value *= scale; 1.2206 + } 1.2207 + value = type(value, precision); 1.2208 + var i = value.lastIndexOf("."), before = i < 0 ? value : value.substring(0, i), after = i < 0 ? "" : locale_decimal + value.substring(i + 1); 1.2209 + if (!zfill && comma) before = formatGroup(before); 1.2210 + var length = prefix.length + before.length + after.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : ""; 1.2211 + if (zcomma) before = formatGroup(padding + before); 1.2212 + negative += prefix; 1.2213 + value = before + after; 1.2214 + 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; 1.2215 + }; 1.2216 + }; 1.2217 + } 1.2218 + var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i; 1.2219 + var d3_format_types = d3.map({ 1.2220 + b: function(x) { 1.2221 + return x.toString(2); 1.2222 + }, 1.2223 + c: function(x) { 1.2224 + return String.fromCharCode(x); 1.2225 + }, 1.2226 + o: function(x) { 1.2227 + return x.toString(8); 1.2228 + }, 1.2229 + x: function(x) { 1.2230 + return x.toString(16); 1.2231 + }, 1.2232 + X: function(x) { 1.2233 + return x.toString(16).toUpperCase(); 1.2234 + }, 1.2235 + g: function(x, p) { 1.2236 + return x.toPrecision(p); 1.2237 + }, 1.2238 + e: function(x, p) { 1.2239 + return x.toExponential(p); 1.2240 + }, 1.2241 + f: function(x, p) { 1.2242 + return x.toFixed(p); 1.2243 + }, 1.2244 + r: function(x, p) { 1.2245 + 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)))); 1.2246 + } 1.2247 + }); 1.2248 + function d3_format_typeDefault(x) { 1.2249 + return x + ""; 1.2250 + } 1.2251 + var d3_time = d3.time = {}, d3_date = Date; 1.2252 + function d3_date_utc() { 1.2253 + this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]); 1.2254 + } 1.2255 + d3_date_utc.prototype = { 1.2256 + getDate: function() { 1.2257 + return this._.getUTCDate(); 1.2258 + }, 1.2259 + getDay: function() { 1.2260 + return this._.getUTCDay(); 1.2261 + }, 1.2262 + getFullYear: function() { 1.2263 + return this._.getUTCFullYear(); 1.2264 + }, 1.2265 + getHours: function() { 1.2266 + return this._.getUTCHours(); 1.2267 + }, 1.2268 + getMilliseconds: function() { 1.2269 + return this._.getUTCMilliseconds(); 1.2270 + }, 1.2271 + getMinutes: function() { 1.2272 + return this._.getUTCMinutes(); 1.2273 + }, 1.2274 + getMonth: function() { 1.2275 + return this._.getUTCMonth(); 1.2276 + }, 1.2277 + getSeconds: function() { 1.2278 + return this._.getUTCSeconds(); 1.2279 + }, 1.2280 + getTime: function() { 1.2281 + return this._.getTime(); 1.2282 + }, 1.2283 + getTimezoneOffset: function() { 1.2284 + return 0; 1.2285 + }, 1.2286 + valueOf: function() { 1.2287 + return this._.valueOf(); 1.2288 + }, 1.2289 + setDate: function() { 1.2290 + d3_time_prototype.setUTCDate.apply(this._, arguments); 1.2291 + }, 1.2292 + setDay: function() { 1.2293 + d3_time_prototype.setUTCDay.apply(this._, arguments); 1.2294 + }, 1.2295 + setFullYear: function() { 1.2296 + d3_time_prototype.setUTCFullYear.apply(this._, arguments); 1.2297 + }, 1.2298 + setHours: function() { 1.2299 + d3_time_prototype.setUTCHours.apply(this._, arguments); 1.2300 + }, 1.2301 + setMilliseconds: function() { 1.2302 + d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); 1.2303 + }, 1.2304 + setMinutes: function() { 1.2305 + d3_time_prototype.setUTCMinutes.apply(this._, arguments); 1.2306 + }, 1.2307 + setMonth: function() { 1.2308 + d3_time_prototype.setUTCMonth.apply(this._, arguments); 1.2309 + }, 1.2310 + setSeconds: function() { 1.2311 + d3_time_prototype.setUTCSeconds.apply(this._, arguments); 1.2312 + }, 1.2313 + setTime: function() { 1.2314 + d3_time_prototype.setTime.apply(this._, arguments); 1.2315 + } 1.2316 + }; 1.2317 + var d3_time_prototype = Date.prototype; 1.2318 + function d3_time_interval(local, step, number) { 1.2319 + function round(date) { 1.2320 + var d0 = local(date), d1 = offset(d0, 1); 1.2321 + return date - d0 < d1 - date ? d0 : d1; 1.2322 + } 1.2323 + function ceil(date) { 1.2324 + step(date = local(new d3_date(date - 1)), 1); 1.2325 + return date; 1.2326 + } 1.2327 + function offset(date, k) { 1.2328 + step(date = new d3_date(+date), k); 1.2329 + return date; 1.2330 + } 1.2331 + function range(t0, t1, dt) { 1.2332 + var time = ceil(t0), times = []; 1.2333 + if (dt > 1) { 1.2334 + while (time < t1) { 1.2335 + if (!(number(time) % dt)) times.push(new Date(+time)); 1.2336 + step(time, 1); 1.2337 + } 1.2338 + } else { 1.2339 + while (time < t1) times.push(new Date(+time)), step(time, 1); 1.2340 + } 1.2341 + return times; 1.2342 + } 1.2343 + function range_utc(t0, t1, dt) { 1.2344 + try { 1.2345 + d3_date = d3_date_utc; 1.2346 + var utc = new d3_date_utc(); 1.2347 + utc._ = t0; 1.2348 + return range(utc, t1, dt); 1.2349 + } finally { 1.2350 + d3_date = Date; 1.2351 + } 1.2352 + } 1.2353 + local.floor = local; 1.2354 + local.round = round; 1.2355 + local.ceil = ceil; 1.2356 + local.offset = offset; 1.2357 + local.range = range; 1.2358 + var utc = local.utc = d3_time_interval_utc(local); 1.2359 + utc.floor = utc; 1.2360 + utc.round = d3_time_interval_utc(round); 1.2361 + utc.ceil = d3_time_interval_utc(ceil); 1.2362 + utc.offset = d3_time_interval_utc(offset); 1.2363 + utc.range = range_utc; 1.2364 + return local; 1.2365 + } 1.2366 + function d3_time_interval_utc(method) { 1.2367 + return function(date, k) { 1.2368 + try { 1.2369 + d3_date = d3_date_utc; 1.2370 + var utc = new d3_date_utc(); 1.2371 + utc._ = date; 1.2372 + return method(utc, k)._; 1.2373 + } finally { 1.2374 + d3_date = Date; 1.2375 + } 1.2376 + }; 1.2377 + } 1.2378 + d3_time.year = d3_time_interval(function(date) { 1.2379 + date = d3_time.day(date); 1.2380 + date.setMonth(0, 1); 1.2381 + return date; 1.2382 + }, function(date, offset) { 1.2383 + date.setFullYear(date.getFullYear() + offset); 1.2384 + }, function(date) { 1.2385 + return date.getFullYear(); 1.2386 + }); 1.2387 + d3_time.years = d3_time.year.range; 1.2388 + d3_time.years.utc = d3_time.year.utc.range; 1.2389 + d3_time.day = d3_time_interval(function(date) { 1.2390 + var day = new d3_date(2e3, 0); 1.2391 + day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); 1.2392 + return day; 1.2393 + }, function(date, offset) { 1.2394 + date.setDate(date.getDate() + offset); 1.2395 + }, function(date) { 1.2396 + return date.getDate() - 1; 1.2397 + }); 1.2398 + d3_time.days = d3_time.day.range; 1.2399 + d3_time.days.utc = d3_time.day.utc.range; 1.2400 + d3_time.dayOfYear = function(date) { 1.2401 + var year = d3_time.year(date); 1.2402 + return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5); 1.2403 + }; 1.2404 + [ "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" ].forEach(function(day, i) { 1.2405 + i = 7 - i; 1.2406 + var interval = d3_time[day] = d3_time_interval(function(date) { 1.2407 + (date = d3_time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7); 1.2408 + return date; 1.2409 + }, function(date, offset) { 1.2410 + date.setDate(date.getDate() + Math.floor(offset) * 7); 1.2411 + }, function(date) { 1.2412 + var day = d3_time.year(date).getDay(); 1.2413 + return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i); 1.2414 + }); 1.2415 + d3_time[day + "s"] = interval.range; 1.2416 + d3_time[day + "s"].utc = interval.utc.range; 1.2417 + d3_time[day + "OfYear"] = function(date) { 1.2418 + var day = d3_time.year(date).getDay(); 1.2419 + return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7); 1.2420 + }; 1.2421 + }); 1.2422 + d3_time.week = d3_time.sunday; 1.2423 + d3_time.weeks = d3_time.sunday.range; 1.2424 + d3_time.weeks.utc = d3_time.sunday.utc.range; 1.2425 + d3_time.weekOfYear = d3_time.sundayOfYear; 1.2426 + function d3_locale_timeFormat(locale) { 1.2427 + 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; 1.2428 + function d3_time_format(template) { 1.2429 + var n = template.length; 1.2430 + function format(date) { 1.2431 + var string = [], i = -1, j = 0, c, p, f; 1.2432 + while (++i < n) { 1.2433 + if (template.charCodeAt(i) === 37) { 1.2434 + string.push(template.substring(j, i)); 1.2435 + if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i); 1.2436 + if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p); 1.2437 + string.push(c); 1.2438 + j = i + 1; 1.2439 + } 1.2440 + } 1.2441 + string.push(template.substring(j, i)); 1.2442 + return string.join(""); 1.2443 + } 1.2444 + format.parse = function(string) { 1.2445 + var d = { 1.2446 + y: 1900, 1.2447 + m: 0, 1.2448 + d: 1, 1.2449 + H: 0, 1.2450 + M: 0, 1.2451 + S: 0, 1.2452 + L: 0, 1.2453 + Z: null 1.2454 + }, i = d3_time_parse(d, template, string, 0); 1.2455 + if (i != string.length) return null; 1.2456 + if ("p" in d) d.H = d.H % 12 + d.p * 12; 1.2457 + var localZ = d.Z != null && d3_date !== d3_date_utc, date = new (localZ ? d3_date_utc : d3_date)(); 1.2458 + if ("j" in d) date.setFullYear(d.y, 0, d.j); else if ("w" in d && ("W" in d || "U" in d)) { 1.2459 + date.setFullYear(d.y, 0, 1); 1.2460 + 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); 1.2461 + } else date.setFullYear(d.y, d.m, d.d); 1.2462 + date.setHours(d.H + Math.floor(d.Z / 100), d.M + d.Z % 100, d.S, d.L); 1.2463 + return localZ ? date._ : date; 1.2464 + }; 1.2465 + format.toString = function() { 1.2466 + return template; 1.2467 + }; 1.2468 + return format; 1.2469 + } 1.2470 + function d3_time_parse(date, template, string, j) { 1.2471 + var c, p, t, i = 0, n = template.length, m = string.length; 1.2472 + while (i < n) { 1.2473 + if (j >= m) return -1; 1.2474 + c = template.charCodeAt(i++); 1.2475 + if (c === 37) { 1.2476 + t = template.charAt(i++); 1.2477 + p = d3_time_parsers[t in d3_time_formatPads ? template.charAt(i++) : t]; 1.2478 + if (!p || (j = p(date, string, j)) < 0) return -1; 1.2479 + } else if (c != string.charCodeAt(j++)) { 1.2480 + return -1; 1.2481 + } 1.2482 + } 1.2483 + return j; 1.2484 + } 1.2485 + d3_time_format.utc = function(template) { 1.2486 + var local = d3_time_format(template); 1.2487 + function format(date) { 1.2488 + try { 1.2489 + d3_date = d3_date_utc; 1.2490 + var utc = new d3_date(); 1.2491 + utc._ = date; 1.2492 + return local(utc); 1.2493 + } finally { 1.2494 + d3_date = Date; 1.2495 + } 1.2496 + } 1.2497 + format.parse = function(string) { 1.2498 + try { 1.2499 + d3_date = d3_date_utc; 1.2500 + var date = local.parse(string); 1.2501 + return date && date._; 1.2502 + } finally { 1.2503 + d3_date = Date; 1.2504 + } 1.2505 + }; 1.2506 + format.toString = local.toString; 1.2507 + return format; 1.2508 + }; 1.2509 + d3_time_format.multi = d3_time_format.utc.multi = d3_time_formatMulti; 1.2510 + 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); 1.2511 + locale_periods.forEach(function(p, i) { 1.2512 + d3_time_periodLookup.set(p.toLowerCase(), i); 1.2513 + }); 1.2514 + var d3_time_formats = { 1.2515 + a: function(d) { 1.2516 + return locale_shortDays[d.getDay()]; 1.2517 + }, 1.2518 + A: function(d) { 1.2519 + return locale_days[d.getDay()]; 1.2520 + }, 1.2521 + b: function(d) { 1.2522 + return locale_shortMonths[d.getMonth()]; 1.2523 + }, 1.2524 + B: function(d) { 1.2525 + return locale_months[d.getMonth()]; 1.2526 + }, 1.2527 + c: d3_time_format(locale_dateTime), 1.2528 + d: function(d, p) { 1.2529 + return d3_time_formatPad(d.getDate(), p, 2); 1.2530 + }, 1.2531 + e: function(d, p) { 1.2532 + return d3_time_formatPad(d.getDate(), p, 2); 1.2533 + }, 1.2534 + H: function(d, p) { 1.2535 + return d3_time_formatPad(d.getHours(), p, 2); 1.2536 + }, 1.2537 + I: function(d, p) { 1.2538 + return d3_time_formatPad(d.getHours() % 12 || 12, p, 2); 1.2539 + }, 1.2540 + j: function(d, p) { 1.2541 + return d3_time_formatPad(1 + d3_time.dayOfYear(d), p, 3); 1.2542 + }, 1.2543 + L: function(d, p) { 1.2544 + return d3_time_formatPad(d.getMilliseconds(), p, 3); 1.2545 + }, 1.2546 + m: function(d, p) { 1.2547 + return d3_time_formatPad(d.getMonth() + 1, p, 2); 1.2548 + }, 1.2549 + M: function(d, p) { 1.2550 + return d3_time_formatPad(d.getMinutes(), p, 2); 1.2551 + }, 1.2552 + p: function(d) { 1.2553 + return locale_periods[+(d.getHours() >= 12)]; 1.2554 + }, 1.2555 + S: function(d, p) { 1.2556 + return d3_time_formatPad(d.getSeconds(), p, 2); 1.2557 + }, 1.2558 + U: function(d, p) { 1.2559 + return d3_time_formatPad(d3_time.sundayOfYear(d), p, 2); 1.2560 + }, 1.2561 + w: function(d) { 1.2562 + return d.getDay(); 1.2563 + }, 1.2564 + W: function(d, p) { 1.2565 + return d3_time_formatPad(d3_time.mondayOfYear(d), p, 2); 1.2566 + }, 1.2567 + x: d3_time_format(locale_date), 1.2568 + X: d3_time_format(locale_time), 1.2569 + y: function(d, p) { 1.2570 + return d3_time_formatPad(d.getFullYear() % 100, p, 2); 1.2571 + }, 1.2572 + Y: function(d, p) { 1.2573 + return d3_time_formatPad(d.getFullYear() % 1e4, p, 4); 1.2574 + }, 1.2575 + Z: d3_time_zone, 1.2576 + "%": function() { 1.2577 + return "%"; 1.2578 + } 1.2579 + }; 1.2580 + var d3_time_parsers = { 1.2581 + a: d3_time_parseWeekdayAbbrev, 1.2582 + A: d3_time_parseWeekday, 1.2583 + b: d3_time_parseMonthAbbrev, 1.2584 + B: d3_time_parseMonth, 1.2585 + c: d3_time_parseLocaleFull, 1.2586 + d: d3_time_parseDay, 1.2587 + e: d3_time_parseDay, 1.2588 + H: d3_time_parseHour24, 1.2589 + I: d3_time_parseHour24, 1.2590 + j: d3_time_parseDayOfYear, 1.2591 + L: d3_time_parseMilliseconds, 1.2592 + m: d3_time_parseMonthNumber, 1.2593 + M: d3_time_parseMinutes, 1.2594 + p: d3_time_parseAmPm, 1.2595 + S: d3_time_parseSeconds, 1.2596 + U: d3_time_parseWeekNumberSunday, 1.2597 + w: d3_time_parseWeekdayNumber, 1.2598 + W: d3_time_parseWeekNumberMonday, 1.2599 + x: d3_time_parseLocaleDate, 1.2600 + X: d3_time_parseLocaleTime, 1.2601 + y: d3_time_parseYear, 1.2602 + Y: d3_time_parseFullYear, 1.2603 + Z: d3_time_parseZone, 1.2604 + "%": d3_time_parseLiteralPercent 1.2605 + }; 1.2606 + function d3_time_parseWeekdayAbbrev(date, string, i) { 1.2607 + d3_time_dayAbbrevRe.lastIndex = 0; 1.2608 + var n = d3_time_dayAbbrevRe.exec(string.substring(i)); 1.2609 + return n ? (date.w = d3_time_dayAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; 1.2610 + } 1.2611 + function d3_time_parseWeekday(date, string, i) { 1.2612 + d3_time_dayRe.lastIndex = 0; 1.2613 + var n = d3_time_dayRe.exec(string.substring(i)); 1.2614 + return n ? (date.w = d3_time_dayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; 1.2615 + } 1.2616 + function d3_time_parseMonthAbbrev(date, string, i) { 1.2617 + d3_time_monthAbbrevRe.lastIndex = 0; 1.2618 + var n = d3_time_monthAbbrevRe.exec(string.substring(i)); 1.2619 + return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; 1.2620 + } 1.2621 + function d3_time_parseMonth(date, string, i) { 1.2622 + d3_time_monthRe.lastIndex = 0; 1.2623 + var n = d3_time_monthRe.exec(string.substring(i)); 1.2624 + return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; 1.2625 + } 1.2626 + function d3_time_parseLocaleFull(date, string, i) { 1.2627 + return d3_time_parse(date, d3_time_formats.c.toString(), string, i); 1.2628 + } 1.2629 + function d3_time_parseLocaleDate(date, string, i) { 1.2630 + return d3_time_parse(date, d3_time_formats.x.toString(), string, i); 1.2631 + } 1.2632 + function d3_time_parseLocaleTime(date, string, i) { 1.2633 + return d3_time_parse(date, d3_time_formats.X.toString(), string, i); 1.2634 + } 1.2635 + function d3_time_parseAmPm(date, string, i) { 1.2636 + var n = d3_time_periodLookup.get(string.substring(i, i += 2).toLowerCase()); 1.2637 + return n == null ? -1 : (date.p = n, i); 1.2638 + } 1.2639 + return d3_time_format; 1.2640 + } 1.2641 + var d3_time_formatPads = { 1.2642 + "-": "", 1.2643 + _: " ", 1.2644 + "0": "0" 1.2645 + }, d3_time_numberRe = /^\s*\d+/, d3_time_percentRe = /^%/; 1.2646 + function d3_time_formatPad(value, fill, width) { 1.2647 + var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; 1.2648 + return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); 1.2649 + } 1.2650 + function d3_time_formatRe(names) { 1.2651 + return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i"); 1.2652 + } 1.2653 + function d3_time_formatLookup(names) { 1.2654 + var map = new d3_Map(), i = -1, n = names.length; 1.2655 + while (++i < n) map.set(names[i].toLowerCase(), i); 1.2656 + return map; 1.2657 + } 1.2658 + function d3_time_parseWeekdayNumber(date, string, i) { 1.2659 + d3_time_numberRe.lastIndex = 0; 1.2660 + var n = d3_time_numberRe.exec(string.substring(i, i + 1)); 1.2661 + return n ? (date.w = +n[0], i + n[0].length) : -1; 1.2662 + } 1.2663 + function d3_time_parseWeekNumberSunday(date, string, i) { 1.2664 + d3_time_numberRe.lastIndex = 0; 1.2665 + var n = d3_time_numberRe.exec(string.substring(i)); 1.2666 + return n ? (date.U = +n[0], i + n[0].length) : -1; 1.2667 + } 1.2668 + function d3_time_parseWeekNumberMonday(date, string, i) { 1.2669 + d3_time_numberRe.lastIndex = 0; 1.2670 + var n = d3_time_numberRe.exec(string.substring(i)); 1.2671 + return n ? (date.W = +n[0], i + n[0].length) : -1; 1.2672 + } 1.2673 + function d3_time_parseFullYear(date, string, i) { 1.2674 + d3_time_numberRe.lastIndex = 0; 1.2675 + var n = d3_time_numberRe.exec(string.substring(i, i + 4)); 1.2676 + return n ? (date.y = +n[0], i + n[0].length) : -1; 1.2677 + } 1.2678 + function d3_time_parseYear(date, string, i) { 1.2679 + d3_time_numberRe.lastIndex = 0; 1.2680 + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); 1.2681 + return n ? (date.y = d3_time_expandYear(+n[0]), i + n[0].length) : -1; 1.2682 + } 1.2683 + function d3_time_parseZone(date, string, i) { 1.2684 + return /^[+-]\d{4}$/.test(string = string.substring(i, i + 5)) ? (date.Z = +string, 1.2685 + i + 5) : -1; 1.2686 + } 1.2687 + function d3_time_expandYear(d) { 1.2688 + return d + (d > 68 ? 1900 : 2e3); 1.2689 + } 1.2690 + function d3_time_parseMonthNumber(date, string, i) { 1.2691 + d3_time_numberRe.lastIndex = 0; 1.2692 + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); 1.2693 + return n ? (date.m = n[0] - 1, i + n[0].length) : -1; 1.2694 + } 1.2695 + function d3_time_parseDay(date, string, i) { 1.2696 + d3_time_numberRe.lastIndex = 0; 1.2697 + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); 1.2698 + return n ? (date.d = +n[0], i + n[0].length) : -1; 1.2699 + } 1.2700 + function d3_time_parseDayOfYear(date, string, i) { 1.2701 + d3_time_numberRe.lastIndex = 0; 1.2702 + var n = d3_time_numberRe.exec(string.substring(i, i + 3)); 1.2703 + return n ? (date.j = +n[0], i + n[0].length) : -1; 1.2704 + } 1.2705 + function d3_time_parseHour24(date, string, i) { 1.2706 + d3_time_numberRe.lastIndex = 0; 1.2707 + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); 1.2708 + return n ? (date.H = +n[0], i + n[0].length) : -1; 1.2709 + } 1.2710 + function d3_time_parseMinutes(date, string, i) { 1.2711 + d3_time_numberRe.lastIndex = 0; 1.2712 + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); 1.2713 + return n ? (date.M = +n[0], i + n[0].length) : -1; 1.2714 + } 1.2715 + function d3_time_parseSeconds(date, string, i) { 1.2716 + d3_time_numberRe.lastIndex = 0; 1.2717 + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); 1.2718 + return n ? (date.S = +n[0], i + n[0].length) : -1; 1.2719 + } 1.2720 + function d3_time_parseMilliseconds(date, string, i) { 1.2721 + d3_time_numberRe.lastIndex = 0; 1.2722 + var n = d3_time_numberRe.exec(string.substring(i, i + 3)); 1.2723 + return n ? (date.L = +n[0], i + n[0].length) : -1; 1.2724 + } 1.2725 + function d3_time_zone(d) { 1.2726 + var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(abs(z) / 60), zm = abs(z) % 60; 1.2727 + return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2); 1.2728 + } 1.2729 + function d3_time_parseLiteralPercent(date, string, i) { 1.2730 + d3_time_percentRe.lastIndex = 0; 1.2731 + var n = d3_time_percentRe.exec(string.substring(i, i + 1)); 1.2732 + return n ? i + n[0].length : -1; 1.2733 + } 1.2734 + function d3_time_formatMulti(formats) { 1.2735 + var n = formats.length, i = -1; 1.2736 + while (++i < n) formats[i][0] = this(formats[i][0]); 1.2737 + return function(date) { 1.2738 + var i = 0, f = formats[i]; 1.2739 + while (!f[1](date)) f = formats[++i]; 1.2740 + return f[0](date); 1.2741 + }; 1.2742 + } 1.2743 + d3.locale = function(locale) { 1.2744 + return { 1.2745 + numberFormat: d3_locale_numberFormat(locale), 1.2746 + timeFormat: d3_locale_timeFormat(locale) 1.2747 + }; 1.2748 + }; 1.2749 + var d3_locale_enUS = d3.locale({ 1.2750 + decimal: ".", 1.2751 + thousands: ",", 1.2752 + grouping: [ 3 ], 1.2753 + currency: [ "$", "" ], 1.2754 + dateTime: "%a %b %e %X %Y", 1.2755 + date: "%m/%d/%Y", 1.2756 + time: "%H:%M:%S", 1.2757 + periods: [ "AM", "PM" ], 1.2758 + days: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], 1.2759 + shortDays: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], 1.2760 + months: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], 1.2761 + shortMonths: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] 1.2762 + }); 1.2763 + d3.format = d3_locale_enUS.numberFormat; 1.2764 + d3.geo = {}; 1.2765 + function d3_adder() {} 1.2766 + d3_adder.prototype = { 1.2767 + s: 0, 1.2768 + t: 0, 1.2769 + add: function(y) { 1.2770 + d3_adderSum(y, this.t, d3_adderTemp); 1.2771 + d3_adderSum(d3_adderTemp.s, this.s, this); 1.2772 + if (this.s) this.t += d3_adderTemp.t; else this.s = d3_adderTemp.t; 1.2773 + }, 1.2774 + reset: function() { 1.2775 + this.s = this.t = 0; 1.2776 + }, 1.2777 + valueOf: function() { 1.2778 + return this.s; 1.2779 + } 1.2780 + }; 1.2781 + var d3_adderTemp = new d3_adder(); 1.2782 + function d3_adderSum(a, b, o) { 1.2783 + var x = o.s = a + b, bv = x - a, av = x - bv; 1.2784 + o.t = a - av + (b - bv); 1.2785 + } 1.2786 + d3.geo.stream = function(object, listener) { 1.2787 + if (object && d3_geo_streamObjectType.hasOwnProperty(object.type)) { 1.2788 + d3_geo_streamObjectType[object.type](object, listener); 1.2789 + } else { 1.2790 + d3_geo_streamGeometry(object, listener); 1.2791 + } 1.2792 + }; 1.2793 + function d3_geo_streamGeometry(geometry, listener) { 1.2794 + if (geometry && d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) { 1.2795 + d3_geo_streamGeometryType[geometry.type](geometry, listener); 1.2796 + } 1.2797 + } 1.2798 + var d3_geo_streamObjectType = { 1.2799 + Feature: function(feature, listener) { 1.2800 + d3_geo_streamGeometry(feature.geometry, listener); 1.2801 + }, 1.2802 + FeatureCollection: function(object, listener) { 1.2803 + var features = object.features, i = -1, n = features.length; 1.2804 + while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener); 1.2805 + } 1.2806 + }; 1.2807 + var d3_geo_streamGeometryType = { 1.2808 + Sphere: function(object, listener) { 1.2809 + listener.sphere(); 1.2810 + }, 1.2811 + Point: function(object, listener) { 1.2812 + object = object.coordinates; 1.2813 + listener.point(object[0], object[1], object[2]); 1.2814 + }, 1.2815 + MultiPoint: function(object, listener) { 1.2816 + var coordinates = object.coordinates, i = -1, n = coordinates.length; 1.2817 + while (++i < n) object = coordinates[i], listener.point(object[0], object[1], object[2]); 1.2818 + }, 1.2819 + LineString: function(object, listener) { 1.2820 + d3_geo_streamLine(object.coordinates, listener, 0); 1.2821 + }, 1.2822 + MultiLineString: function(object, listener) { 1.2823 + var coordinates = object.coordinates, i = -1, n = coordinates.length; 1.2824 + while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0); 1.2825 + }, 1.2826 + Polygon: function(object, listener) { 1.2827 + d3_geo_streamPolygon(object.coordinates, listener); 1.2828 + }, 1.2829 + MultiPolygon: function(object, listener) { 1.2830 + var coordinates = object.coordinates, i = -1, n = coordinates.length; 1.2831 + while (++i < n) d3_geo_streamPolygon(coordinates[i], listener); 1.2832 + }, 1.2833 + GeometryCollection: function(object, listener) { 1.2834 + var geometries = object.geometries, i = -1, n = geometries.length; 1.2835 + while (++i < n) d3_geo_streamGeometry(geometries[i], listener); 1.2836 + } 1.2837 + }; 1.2838 + function d3_geo_streamLine(coordinates, listener, closed) { 1.2839 + var i = -1, n = coordinates.length - closed, coordinate; 1.2840 + listener.lineStart(); 1.2841 + while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1], coordinate[2]); 1.2842 + listener.lineEnd(); 1.2843 + } 1.2844 + function d3_geo_streamPolygon(coordinates, listener) { 1.2845 + var i = -1, n = coordinates.length; 1.2846 + listener.polygonStart(); 1.2847 + while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1); 1.2848 + listener.polygonEnd(); 1.2849 + } 1.2850 + d3.geo.area = function(object) { 1.2851 + d3_geo_areaSum = 0; 1.2852 + d3.geo.stream(object, d3_geo_area); 1.2853 + return d3_geo_areaSum; 1.2854 + }; 1.2855 + var d3_geo_areaSum, d3_geo_areaRingSum = new d3_adder(); 1.2856 + var d3_geo_area = { 1.2857 + sphere: function() { 1.2858 + d3_geo_areaSum += 4 * π; 1.2859 + }, 1.2860 + point: d3_noop, 1.2861 + lineStart: d3_noop, 1.2862 + lineEnd: d3_noop, 1.2863 + polygonStart: function() { 1.2864 + d3_geo_areaRingSum.reset(); 1.2865 + d3_geo_area.lineStart = d3_geo_areaRingStart; 1.2866 + }, 1.2867 + polygonEnd: function() { 1.2868 + var area = 2 * d3_geo_areaRingSum; 1.2869 + d3_geo_areaSum += area < 0 ? 4 * π + area : area; 1.2870 + d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop; 1.2871 + } 1.2872 + }; 1.2873 + function d3_geo_areaRingStart() { 1.2874 + var λ00, φ00, λ0, cosφ0, sinφ0; 1.2875 + d3_geo_area.point = function(λ, φ) { 1.2876 + d3_geo_area.point = nextPoint; 1.2877 + λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4), 1.2878 + sinφ0 = Math.sin(φ); 1.2879 + }; 1.2880 + function nextPoint(λ, φ) { 1.2881 + λ *= d3_radians; 1.2882 + φ = φ * d3_radians / 2 + π / 4; 1.2883 + var dλ = λ - λ0, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u = cosφ0 * cosφ + k * Math.cos(dλ), v = k * Math.sin(dλ); 1.2884 + d3_geo_areaRingSum.add(Math.atan2(v, u)); 1.2885 + λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ; 1.2886 + } 1.2887 + d3_geo_area.lineEnd = function() { 1.2888 + nextPoint(λ00, φ00); 1.2889 + }; 1.2890 + } 1.2891 + function d3_geo_cartesian(spherical) { 1.2892 + var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ); 1.2893 + return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ]; 1.2894 + } 1.2895 + function d3_geo_cartesianDot(a, b) { 1.2896 + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; 1.2897 + } 1.2898 + function d3_geo_cartesianCross(a, b) { 1.2899 + 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] ]; 1.2900 + } 1.2901 + function d3_geo_cartesianAdd(a, b) { 1.2902 + a[0] += b[0]; 1.2903 + a[1] += b[1]; 1.2904 + a[2] += b[2]; 1.2905 + } 1.2906 + function d3_geo_cartesianScale(vector, k) { 1.2907 + return [ vector[0] * k, vector[1] * k, vector[2] * k ]; 1.2908 + } 1.2909 + function d3_geo_cartesianNormalize(d) { 1.2910 + var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); 1.2911 + d[0] /= l; 1.2912 + d[1] /= l; 1.2913 + d[2] /= l; 1.2914 + } 1.2915 + function d3_geo_spherical(cartesian) { 1.2916 + return [ Math.atan2(cartesian[1], cartesian[0]), d3_asin(cartesian[2]) ]; 1.2917 + } 1.2918 + function d3_geo_sphericalEqual(a, b) { 1.2919 + return abs(a[0] - b[0]) < ε && abs(a[1] - b[1]) < ε; 1.2920 + } 1.2921 + d3.geo.bounds = function() { 1.2922 + var λ0, φ0, λ1, φ1, λ_, λ__, φ__, p0, dλSum, ranges, range; 1.2923 + var bound = { 1.2924 + point: point, 1.2925 + lineStart: lineStart, 1.2926 + lineEnd: lineEnd, 1.2927 + polygonStart: function() { 1.2928 + bound.point = ringPoint; 1.2929 + bound.lineStart = ringStart; 1.2930 + bound.lineEnd = ringEnd; 1.2931 + dλSum = 0; 1.2932 + d3_geo_area.polygonStart(); 1.2933 + }, 1.2934 + polygonEnd: function() { 1.2935 + d3_geo_area.polygonEnd(); 1.2936 + bound.point = point; 1.2937 + bound.lineStart = lineStart; 1.2938 + bound.lineEnd = lineEnd; 1.2939 + if (d3_geo_areaRingSum < 0) λ0 = -(λ1 = 180), φ0 = -(φ1 = 90); else if (dλSum > ε) φ1 = 90; else if (dλSum < -ε) φ0 = -90; 1.2940 + range[0] = λ0, range[1] = λ1; 1.2941 + } 1.2942 + }; 1.2943 + function point(λ, φ) { 1.2944 + ranges.push(range = [ λ0 = λ, λ1 = λ ]); 1.2945 + if (φ < φ0) φ0 = φ; 1.2946 + if (φ > φ1) φ1 = φ; 1.2947 + } 1.2948 + function linePoint(λ, φ) { 1.2949 + var p = d3_geo_cartesian([ λ * d3_radians, φ * d3_radians ]); 1.2950 + if (p0) { 1.2951 + var normal = d3_geo_cartesianCross(p0, p), equatorial = [ normal[1], -normal[0], 0 ], inflection = d3_geo_cartesianCross(equatorial, normal); 1.2952 + d3_geo_cartesianNormalize(inflection); 1.2953 + inflection = d3_geo_spherical(inflection); 1.2954 + var dλ = λ - λ_, s = dλ > 0 ? 1 : -1, λi = inflection[0] * d3_degrees * s, antimeridian = abs(dλ) > 180; 1.2955 + if (antimeridian ^ (s * λ_ < λi && λi < s * λ)) { 1.2956 + var φi = inflection[1] * d3_degrees; 1.2957 + if (φi > φ1) φ1 = φi; 1.2958 + } else if (λi = (λi + 360) % 360 - 180, antimeridian ^ (s * λ_ < λi && λi < s * λ)) { 1.2959 + var φi = -inflection[1] * d3_degrees; 1.2960 + if (φi < φ0) φ0 = φi; 1.2961 + } else { 1.2962 + if (φ < φ0) φ0 = φ; 1.2963 + if (φ > φ1) φ1 = φ; 1.2964 + } 1.2965 + if (antimeridian) { 1.2966 + if (λ < λ_) { 1.2967 + if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ; 1.2968 + } else { 1.2969 + if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ; 1.2970 + } 1.2971 + } else { 1.2972 + if (λ1 >= λ0) { 1.2973 + if (λ < λ0) λ0 = λ; 1.2974 + if (λ > λ1) λ1 = λ; 1.2975 + } else { 1.2976 + if (λ > λ_) { 1.2977 + if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ; 1.2978 + } else { 1.2979 + if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ; 1.2980 + } 1.2981 + } 1.2982 + } 1.2983 + } else { 1.2984 + point(λ, φ); 1.2985 + } 1.2986 + p0 = p, λ_ = λ; 1.2987 + } 1.2988 + function lineStart() { 1.2989 + bound.point = linePoint; 1.2990 + } 1.2991 + function lineEnd() { 1.2992 + range[0] = λ0, range[1] = λ1; 1.2993 + bound.point = point; 1.2994 + p0 = null; 1.2995 + } 1.2996 + function ringPoint(λ, φ) { 1.2997 + if (p0) { 1.2998 + var dλ = λ - λ_; 1.2999 + dλSum += abs(dλ) > 180 ? dλ + (dλ > 0 ? 360 : -360) : dλ; 1.3000 + } else λ__ = λ, φ__ = φ; 1.3001 + d3_geo_area.point(λ, φ); 1.3002 + linePoint(λ, φ); 1.3003 + } 1.3004 + function ringStart() { 1.3005 + d3_geo_area.lineStart(); 1.3006 + } 1.3007 + function ringEnd() { 1.3008 + ringPoint(λ__, φ__); 1.3009 + d3_geo_area.lineEnd(); 1.3010 + if (abs(dλSum) > ε) λ0 = -(λ1 = 180); 1.3011 + range[0] = λ0, range[1] = λ1; 1.3012 + p0 = null; 1.3013 + } 1.3014 + function angle(λ0, λ1) { 1.3015 + return (λ1 -= λ0) < 0 ? λ1 + 360 : λ1; 1.3016 + } 1.3017 + function compareRanges(a, b) { 1.3018 + return a[0] - b[0]; 1.3019 + } 1.3020 + function withinRange(x, range) { 1.3021 + return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; 1.3022 + } 1.3023 + return function(feature) { 1.3024 + φ1 = λ1 = -(λ0 = φ0 = Infinity); 1.3025 + ranges = []; 1.3026 + d3.geo.stream(feature, bound); 1.3027 + var n = ranges.length; 1.3028 + if (n) { 1.3029 + ranges.sort(compareRanges); 1.3030 + for (var i = 1, a = ranges[0], b, merged = [ a ]; i < n; ++i) { 1.3031 + b = ranges[i]; 1.3032 + if (withinRange(b[0], a) || withinRange(b[1], a)) { 1.3033 + if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1]; 1.3034 + if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0]; 1.3035 + } else { 1.3036 + merged.push(a = b); 1.3037 + } 1.3038 + } 1.3039 + var best = -Infinity, dλ; 1.3040 + for (var n = merged.length - 1, i = 0, a = merged[n], b; i <= n; a = b, ++i) { 1.3041 + b = merged[i]; 1.3042 + if ((dλ = angle(a[1], b[0])) > best) best = dλ, λ0 = b[0], λ1 = a[1]; 1.3043 + } 1.3044 + } 1.3045 + ranges = range = null; 1.3046 + return λ0 === Infinity || φ0 === Infinity ? [ [ NaN, NaN ], [ NaN, NaN ] ] : [ [ λ0, φ0 ], [ λ1, φ1 ] ]; 1.3047 + }; 1.3048 + }(); 1.3049 + d3.geo.centroid = function(object) { 1.3050 + 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; 1.3051 + d3.geo.stream(object, d3_geo_centroid); 1.3052 + var x = d3_geo_centroidX2, y = d3_geo_centroidY2, z = d3_geo_centroidZ2, m = x * x + y * y + z * z; 1.3053 + if (m < ε2) { 1.3054 + x = d3_geo_centroidX1, y = d3_geo_centroidY1, z = d3_geo_centroidZ1; 1.3055 + if (d3_geo_centroidW1 < ε) x = d3_geo_centroidX0, y = d3_geo_centroidY0, z = d3_geo_centroidZ0; 1.3056 + m = x * x + y * y + z * z; 1.3057 + if (m < ε2) return [ NaN, NaN ]; 1.3058 + } 1.3059 + return [ Math.atan2(y, x) * d3_degrees, d3_asin(z / Math.sqrt(m)) * d3_degrees ]; 1.3060 + }; 1.3061 + 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; 1.3062 + var d3_geo_centroid = { 1.3063 + sphere: d3_noop, 1.3064 + point: d3_geo_centroidPoint, 1.3065 + lineStart: d3_geo_centroidLineStart, 1.3066 + lineEnd: d3_geo_centroidLineEnd, 1.3067 + polygonStart: function() { 1.3068 + d3_geo_centroid.lineStart = d3_geo_centroidRingStart; 1.3069 + }, 1.3070 + polygonEnd: function() { 1.3071 + d3_geo_centroid.lineStart = d3_geo_centroidLineStart; 1.3072 + } 1.3073 + }; 1.3074 + function d3_geo_centroidPoint(λ, φ) { 1.3075 + λ *= d3_radians; 1.3076 + var cosφ = Math.cos(φ *= d3_radians); 1.3077 + d3_geo_centroidPointXYZ(cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ)); 1.3078 + } 1.3079 + function d3_geo_centroidPointXYZ(x, y, z) { 1.3080 + ++d3_geo_centroidW0; 1.3081 + d3_geo_centroidX0 += (x - d3_geo_centroidX0) / d3_geo_centroidW0; 1.3082 + d3_geo_centroidY0 += (y - d3_geo_centroidY0) / d3_geo_centroidW0; 1.3083 + d3_geo_centroidZ0 += (z - d3_geo_centroidZ0) / d3_geo_centroidW0; 1.3084 + } 1.3085 + function d3_geo_centroidLineStart() { 1.3086 + var x0, y0, z0; 1.3087 + d3_geo_centroid.point = function(λ, φ) { 1.3088 + λ *= d3_radians; 1.3089 + var cosφ = Math.cos(φ *= d3_radians); 1.3090 + x0 = cosφ * Math.cos(λ); 1.3091 + y0 = cosφ * Math.sin(λ); 1.3092 + z0 = Math.sin(φ); 1.3093 + d3_geo_centroid.point = nextPoint; 1.3094 + d3_geo_centroidPointXYZ(x0, y0, z0); 1.3095 + }; 1.3096 + function nextPoint(λ, φ) { 1.3097 + λ *= d3_radians; 1.3098 + 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); 1.3099 + d3_geo_centroidW1 += w; 1.3100 + d3_geo_centroidX1 += w * (x0 + (x0 = x)); 1.3101 + d3_geo_centroidY1 += w * (y0 + (y0 = y)); 1.3102 + d3_geo_centroidZ1 += w * (z0 + (z0 = z)); 1.3103 + d3_geo_centroidPointXYZ(x0, y0, z0); 1.3104 + } 1.3105 + } 1.3106 + function d3_geo_centroidLineEnd() { 1.3107 + d3_geo_centroid.point = d3_geo_centroidPoint; 1.3108 + } 1.3109 + function d3_geo_centroidRingStart() { 1.3110 + var λ00, φ00, x0, y0, z0; 1.3111 + d3_geo_centroid.point = function(λ, φ) { 1.3112 + λ00 = λ, φ00 = φ; 1.3113 + d3_geo_centroid.point = nextPoint; 1.3114 + λ *= d3_radians; 1.3115 + var cosφ = Math.cos(φ *= d3_radians); 1.3116 + x0 = cosφ * Math.cos(λ); 1.3117 + y0 = cosφ * Math.sin(λ); 1.3118 + z0 = Math.sin(φ); 1.3119 + d3_geo_centroidPointXYZ(x0, y0, z0); 1.3120 + }; 1.3121 + d3_geo_centroid.lineEnd = function() { 1.3122 + nextPoint(λ00, φ00); 1.3123 + d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd; 1.3124 + d3_geo_centroid.point = d3_geo_centroidPoint; 1.3125 + }; 1.3126 + function nextPoint(λ, φ) { 1.3127 + λ *= d3_radians; 1.3128 + 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); 1.3129 + d3_geo_centroidX2 += v * cx; 1.3130 + d3_geo_centroidY2 += v * cy; 1.3131 + d3_geo_centroidZ2 += v * cz; 1.3132 + d3_geo_centroidW1 += w; 1.3133 + d3_geo_centroidX1 += w * (x0 + (x0 = x)); 1.3134 + d3_geo_centroidY1 += w * (y0 + (y0 = y)); 1.3135 + d3_geo_centroidZ1 += w * (z0 + (z0 = z)); 1.3136 + d3_geo_centroidPointXYZ(x0, y0, z0); 1.3137 + } 1.3138 + } 1.3139 + function d3_true() { 1.3140 + return true; 1.3141 + } 1.3142 + function d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener) { 1.3143 + var subject = [], clip = []; 1.3144 + segments.forEach(function(segment) { 1.3145 + if ((n = segment.length - 1) <= 0) return; 1.3146 + var n, p0 = segment[0], p1 = segment[n]; 1.3147 + if (d3_geo_sphericalEqual(p0, p1)) { 1.3148 + listener.lineStart(); 1.3149 + for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]); 1.3150 + listener.lineEnd(); 1.3151 + return; 1.3152 + } 1.3153 + var a = new d3_geo_clipPolygonIntersection(p0, segment, null, true), b = new d3_geo_clipPolygonIntersection(p0, null, a, false); 1.3154 + a.o = b; 1.3155 + subject.push(a); 1.3156 + clip.push(b); 1.3157 + a = new d3_geo_clipPolygonIntersection(p1, segment, null, false); 1.3158 + b = new d3_geo_clipPolygonIntersection(p1, null, a, true); 1.3159 + a.o = b; 1.3160 + subject.push(a); 1.3161 + clip.push(b); 1.3162 + }); 1.3163 + clip.sort(compare); 1.3164 + d3_geo_clipPolygonLinkCircular(subject); 1.3165 + d3_geo_clipPolygonLinkCircular(clip); 1.3166 + if (!subject.length) return; 1.3167 + for (var i = 0, entry = clipStartInside, n = clip.length; i < n; ++i) { 1.3168 + clip[i].e = entry = !entry; 1.3169 + } 1.3170 + var start = subject[0], points, point; 1.3171 + while (1) { 1.3172 + var current = start, isSubject = true; 1.3173 + while (current.v) if ((current = current.n) === start) return; 1.3174 + points = current.z; 1.3175 + listener.lineStart(); 1.3176 + do { 1.3177 + current.v = current.o.v = true; 1.3178 + if (current.e) { 1.3179 + if (isSubject) { 1.3180 + for (var i = 0, n = points.length; i < n; ++i) listener.point((point = points[i])[0], point[1]); 1.3181 + } else { 1.3182 + interpolate(current.x, current.n.x, 1, listener); 1.3183 + } 1.3184 + current = current.n; 1.3185 + } else { 1.3186 + if (isSubject) { 1.3187 + points = current.p.z; 1.3188 + for (var i = points.length - 1; i >= 0; --i) listener.point((point = points[i])[0], point[1]); 1.3189 + } else { 1.3190 + interpolate(current.x, current.p.x, -1, listener); 1.3191 + } 1.3192 + current = current.p; 1.3193 + } 1.3194 + current = current.o; 1.3195 + points = current.z; 1.3196 + isSubject = !isSubject; 1.3197 + } while (!current.v); 1.3198 + listener.lineEnd(); 1.3199 + } 1.3200 + } 1.3201 + function d3_geo_clipPolygonLinkCircular(array) { 1.3202 + if (!(n = array.length)) return; 1.3203 + var n, i = 0, a = array[0], b; 1.3204 + while (++i < n) { 1.3205 + a.n = b = array[i]; 1.3206 + b.p = a; 1.3207 + a = b; 1.3208 + } 1.3209 + a.n = b = array[0]; 1.3210 + b.p = a; 1.3211 + } 1.3212 + function d3_geo_clipPolygonIntersection(point, points, other, entry) { 1.3213 + this.x = point; 1.3214 + this.z = points; 1.3215 + this.o = other; 1.3216 + this.e = entry; 1.3217 + this.v = false; 1.3218 + this.n = this.p = null; 1.3219 + } 1.3220 + function d3_geo_clip(pointVisible, clipLine, interpolate, clipStart) { 1.3221 + return function(rotate, listener) { 1.3222 + var line = clipLine(listener), rotatedClipStart = rotate.invert(clipStart[0], clipStart[1]); 1.3223 + var clip = { 1.3224 + point: point, 1.3225 + lineStart: lineStart, 1.3226 + lineEnd: lineEnd, 1.3227 + polygonStart: function() { 1.3228 + clip.point = pointRing; 1.3229 + clip.lineStart = ringStart; 1.3230 + clip.lineEnd = ringEnd; 1.3231 + segments = []; 1.3232 + polygon = []; 1.3233 + listener.polygonStart(); 1.3234 + }, 1.3235 + polygonEnd: function() { 1.3236 + clip.point = point; 1.3237 + clip.lineStart = lineStart; 1.3238 + clip.lineEnd = lineEnd; 1.3239 + segments = d3.merge(segments); 1.3240 + var clipStartInside = d3_geo_pointInPolygon(rotatedClipStart, polygon); 1.3241 + if (segments.length) { 1.3242 + d3_geo_clipPolygon(segments, d3_geo_clipSort, clipStartInside, interpolate, listener); 1.3243 + } else if (clipStartInside) { 1.3244 + listener.lineStart(); 1.3245 + interpolate(null, null, 1, listener); 1.3246 + listener.lineEnd(); 1.3247 + } 1.3248 + listener.polygonEnd(); 1.3249 + segments = polygon = null; 1.3250 + }, 1.3251 + sphere: function() { 1.3252 + listener.polygonStart(); 1.3253 + listener.lineStart(); 1.3254 + interpolate(null, null, 1, listener); 1.3255 + listener.lineEnd(); 1.3256 + listener.polygonEnd(); 1.3257 + } 1.3258 + }; 1.3259 + function point(λ, φ) { 1.3260 + var point = rotate(λ, φ); 1.3261 + if (pointVisible(λ = point[0], φ = point[1])) listener.point(λ, φ); 1.3262 + } 1.3263 + function pointLine(λ, φ) { 1.3264 + var point = rotate(λ, φ); 1.3265 + line.point(point[0], point[1]); 1.3266 + } 1.3267 + function lineStart() { 1.3268 + clip.point = pointLine; 1.3269 + line.lineStart(); 1.3270 + } 1.3271 + function lineEnd() { 1.3272 + clip.point = point; 1.3273 + line.lineEnd(); 1.3274 + } 1.3275 + var segments; 1.3276 + var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), polygon, ring; 1.3277 + function pointRing(λ, φ) { 1.3278 + ring.push([ λ, φ ]); 1.3279 + var point = rotate(λ, φ); 1.3280 + ringListener.point(point[0], point[1]); 1.3281 + } 1.3282 + function ringStart() { 1.3283 + ringListener.lineStart(); 1.3284 + ring = []; 1.3285 + } 1.3286 + function ringEnd() { 1.3287 + pointRing(ring[0][0], ring[0][1]); 1.3288 + ringListener.lineEnd(); 1.3289 + var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length; 1.3290 + ring.pop(); 1.3291 + polygon.push(ring); 1.3292 + ring = null; 1.3293 + if (!n) return; 1.3294 + if (clean & 1) { 1.3295 + segment = ringSegments[0]; 1.3296 + var n = segment.length - 1, i = -1, point; 1.3297 + listener.lineStart(); 1.3298 + while (++i < n) listener.point((point = segment[i])[0], point[1]); 1.3299 + listener.lineEnd(); 1.3300 + return; 1.3301 + } 1.3302 + if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); 1.3303 + segments.push(ringSegments.filter(d3_geo_clipSegmentLength1)); 1.3304 + } 1.3305 + return clip; 1.3306 + }; 1.3307 + } 1.3308 + function d3_geo_clipSegmentLength1(segment) { 1.3309 + return segment.length > 1; 1.3310 + } 1.3311 + function d3_geo_clipBufferListener() { 1.3312 + var lines = [], line; 1.3313 + return { 1.3314 + lineStart: function() { 1.3315 + lines.push(line = []); 1.3316 + }, 1.3317 + point: function(λ, φ) { 1.3318 + line.push([ λ, φ ]); 1.3319 + }, 1.3320 + lineEnd: d3_noop, 1.3321 + buffer: function() { 1.3322 + var buffer = lines; 1.3323 + lines = []; 1.3324 + line = null; 1.3325 + return buffer; 1.3326 + }, 1.3327 + rejoin: function() { 1.3328 + if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); 1.3329 + } 1.3330 + }; 1.3331 + } 1.3332 + function d3_geo_clipSort(a, b) { 1.3333 + return ((a = a.x)[0] < 0 ? a[1] - halfπ - ε : halfπ - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfπ - ε : halfπ - b[1]); 1.3334 + } 1.3335 + function d3_geo_pointInPolygon(point, polygon) { 1.3336 + var meridian = point[0], parallel = point[1], meridianNormal = [ Math.sin(meridian), -Math.cos(meridian), 0 ], polarAngle = 0, winding = 0; 1.3337 + d3_geo_areaRingSum.reset(); 1.3338 + for (var i = 0, n = polygon.length; i < n; ++i) { 1.3339 + var ring = polygon[i], m = ring.length; 1.3340 + if (!m) continue; 1.3341 + var point0 = ring[0], λ0 = point0[0], φ0 = point0[1] / 2 + π / 4, sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), j = 1; 1.3342 + while (true) { 1.3343 + if (j === m) j = 0; 1.3344 + point = ring[j]; 1.3345 + var λ = point[0], φ = point[1] / 2 + π / 4, sinφ = Math.sin(φ), cosφ = Math.cos(φ), dλ = λ - λ0, antimeridian = abs(dλ) > π, k = sinφ0 * sinφ; 1.3346 + d3_geo_areaRingSum.add(Math.atan2(k * Math.sin(dλ), cosφ0 * cosφ + k * Math.cos(dλ))); 1.3347 + polarAngle += antimeridian ? dλ + (dλ >= 0 ? τ : -τ) : dλ; 1.3348 + if (antimeridian ^ λ0 >= meridian ^ λ >= meridian) { 1.3349 + var arc = d3_geo_cartesianCross(d3_geo_cartesian(point0), d3_geo_cartesian(point)); 1.3350 + d3_geo_cartesianNormalize(arc); 1.3351 + var intersection = d3_geo_cartesianCross(meridianNormal, arc); 1.3352 + d3_geo_cartesianNormalize(intersection); 1.3353 + var φarc = (antimeridian ^ dλ >= 0 ? -1 : 1) * d3_asin(intersection[2]); 1.3354 + if (parallel > φarc || parallel === φarc && (arc[0] || arc[1])) { 1.3355 + winding += antimeridian ^ dλ >= 0 ? 1 : -1; 1.3356 + } 1.3357 + } 1.3358 + if (!j++) break; 1.3359 + λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ, point0 = point; 1.3360 + } 1.3361 + } 1.3362 + return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < 0) ^ winding & 1; 1.3363 + } 1.3364 + var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate, [ -π, -π / 2 ]); 1.3365 + function d3_geo_clipAntimeridianLine(listener) { 1.3366 + var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean; 1.3367 + return { 1.3368 + lineStart: function() { 1.3369 + listener.lineStart(); 1.3370 + clean = 1; 1.3371 + }, 1.3372 + point: function(λ1, φ1) { 1.3373 + var sλ1 = λ1 > 0 ? π : -π, dλ = abs(λ1 - λ0); 1.3374 + if (abs(dλ - π) < ε) { 1.3375 + listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? halfπ : -halfπ); 1.3376 + listener.point(sλ0, φ0); 1.3377 + listener.lineEnd(); 1.3378 + listener.lineStart(); 1.3379 + listener.point(sλ1, φ0); 1.3380 + listener.point(λ1, φ0); 1.3381 + clean = 0; 1.3382 + } else if (sλ0 !== sλ1 && dλ >= π) { 1.3383 + if (abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε; 1.3384 + if (abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε; 1.3385 + φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1); 1.3386 + listener.point(sλ0, φ0); 1.3387 + listener.lineEnd(); 1.3388 + listener.lineStart(); 1.3389 + listener.point(sλ1, φ0); 1.3390 + clean = 0; 1.3391 + } 1.3392 + listener.point(λ0 = λ1, φ0 = φ1); 1.3393 + sλ0 = sλ1; 1.3394 + }, 1.3395 + lineEnd: function() { 1.3396 + listener.lineEnd(); 1.3397 + λ0 = φ0 = NaN; 1.3398 + }, 1.3399 + clean: function() { 1.3400 + return 2 - clean; 1.3401 + } 1.3402 + }; 1.3403 + } 1.3404 + function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) { 1.3405 + var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1); 1.3406 + 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; 1.3407 + } 1.3408 + function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) { 1.3409 + var φ; 1.3410 + if (from == null) { 1.3411 + φ = direction * halfπ; 1.3412 + listener.point(-π, φ); 1.3413 + listener.point(0, φ); 1.3414 + listener.point(π, φ); 1.3415 + listener.point(π, 0); 1.3416 + listener.point(π, -φ); 1.3417 + listener.point(0, -φ); 1.3418 + listener.point(-π, -φ); 1.3419 + listener.point(-π, 0); 1.3420 + listener.point(-π, φ); 1.3421 + } else if (abs(from[0] - to[0]) > ε) { 1.3422 + var s = from[0] < to[0] ? π : -π; 1.3423 + φ = direction * s / 2; 1.3424 + listener.point(-s, φ); 1.3425 + listener.point(0, φ); 1.3426 + listener.point(s, φ); 1.3427 + } else { 1.3428 + listener.point(to[0], to[1]); 1.3429 + } 1.3430 + } 1.3431 + function d3_geo_clipCircle(radius) { 1.3432 + var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = abs(cr) > ε, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians); 1.3433 + return d3_geo_clip(visible, clipLine, interpolate, smallRadius ? [ 0, -radius ] : [ -π, radius - π ]); 1.3434 + function visible(λ, φ) { 1.3435 + return Math.cos(λ) * Math.cos(φ) > cr; 1.3436 + } 1.3437 + function clipLine(listener) { 1.3438 + var point0, c0, v0, v00, clean; 1.3439 + return { 1.3440 + lineStart: function() { 1.3441 + v00 = v0 = false; 1.3442 + clean = 1; 1.3443 + }, 1.3444 + point: function(λ, φ) { 1.3445 + var point1 = [ λ, φ ], point2, v = visible(λ, φ), c = smallRadius ? v ? 0 : code(λ, φ) : v ? code(λ + (λ < 0 ? π : -π), φ) : 0; 1.3446 + if (!point0 && (v00 = v0 = v)) listener.lineStart(); 1.3447 + if (v !== v0) { 1.3448 + point2 = intersect(point0, point1); 1.3449 + if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) { 1.3450 + point1[0] += ε; 1.3451 + point1[1] += ε; 1.3452 + v = visible(point1[0], point1[1]); 1.3453 + } 1.3454 + } 1.3455 + if (v !== v0) { 1.3456 + clean = 0; 1.3457 + if (v) { 1.3458 + listener.lineStart(); 1.3459 + point2 = intersect(point1, point0); 1.3460 + listener.point(point2[0], point2[1]); 1.3461 + } else { 1.3462 + point2 = intersect(point0, point1); 1.3463 + listener.point(point2[0], point2[1]); 1.3464 + listener.lineEnd(); 1.3465 + } 1.3466 + point0 = point2; 1.3467 + } else if (notHemisphere && point0 && smallRadius ^ v) { 1.3468 + var t; 1.3469 + if (!(c & c0) && (t = intersect(point1, point0, true))) { 1.3470 + clean = 0; 1.3471 + if (smallRadius) { 1.3472 + listener.lineStart(); 1.3473 + listener.point(t[0][0], t[0][1]); 1.3474 + listener.point(t[1][0], t[1][1]); 1.3475 + listener.lineEnd(); 1.3476 + } else { 1.3477 + listener.point(t[1][0], t[1][1]); 1.3478 + listener.lineEnd(); 1.3479 + listener.lineStart(); 1.3480 + listener.point(t[0][0], t[0][1]); 1.3481 + } 1.3482 + } 1.3483 + } 1.3484 + if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) { 1.3485 + listener.point(point1[0], point1[1]); 1.3486 + } 1.3487 + point0 = point1, v0 = v, c0 = c; 1.3488 + }, 1.3489 + lineEnd: function() { 1.3490 + if (v0) listener.lineEnd(); 1.3491 + point0 = null; 1.3492 + }, 1.3493 + clean: function() { 1.3494 + return clean | (v00 && v0) << 1; 1.3495 + } 1.3496 + }; 1.3497 + } 1.3498 + function intersect(a, b, two) { 1.3499 + var pa = d3_geo_cartesian(a), pb = d3_geo_cartesian(b); 1.3500 + var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; 1.3501 + if (!determinant) return !two && a; 1.3502 + 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); 1.3503 + d3_geo_cartesianAdd(A, B); 1.3504 + 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); 1.3505 + if (t2 < 0) return; 1.3506 + var t = Math.sqrt(t2), q = d3_geo_cartesianScale(u, (-w - t) / uu); 1.3507 + d3_geo_cartesianAdd(q, A); 1.3508 + q = d3_geo_spherical(q); 1.3509 + if (!two) return q; 1.3510 + var λ0 = a[0], λ1 = b[0], φ0 = a[1], φ1 = b[1], z; 1.3511 + if (λ1 < λ0) z = λ0, λ0 = λ1, λ1 = z; 1.3512 + var δλ = λ1 - λ0, polar = abs(δλ - π) < ε, meridian = polar || δλ < ε; 1.3513 + if (!polar && φ1 < φ0) z = φ0, φ0 = φ1, φ1 = z; 1.3514 + 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)) { 1.3515 + var q1 = d3_geo_cartesianScale(u, (-w + t) / uu); 1.3516 + d3_geo_cartesianAdd(q1, A); 1.3517 + return [ q, d3_geo_spherical(q1) ]; 1.3518 + } 1.3519 + } 1.3520 + function code(λ, φ) { 1.3521 + var r = smallRadius ? radius : π - radius, code = 0; 1.3522 + if (λ < -r) code |= 1; else if (λ > r) code |= 2; 1.3523 + if (φ < -r) code |= 4; else if (φ > r) code |= 8; 1.3524 + return code; 1.3525 + } 1.3526 + } 1.3527 + function d3_geom_clipLine(x0, y0, x1, y1) { 1.3528 + return function(line) { 1.3529 + 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; 1.3530 + r = x0 - ax; 1.3531 + if (!dx && r > 0) return; 1.3532 + r /= dx; 1.3533 + if (dx < 0) { 1.3534 + if (r < t0) return; 1.3535 + if (r < t1) t1 = r; 1.3536 + } else if (dx > 0) { 1.3537 + if (r > t1) return; 1.3538 + if (r > t0) t0 = r; 1.3539 + } 1.3540 + r = x1 - ax; 1.3541 + if (!dx && r < 0) return; 1.3542 + r /= dx; 1.3543 + if (dx < 0) { 1.3544 + if (r > t1) return; 1.3545 + if (r > t0) t0 = r; 1.3546 + } else if (dx > 0) { 1.3547 + if (r < t0) return; 1.3548 + if (r < t1) t1 = r; 1.3549 + } 1.3550 + r = y0 - ay; 1.3551 + if (!dy && r > 0) return; 1.3552 + r /= dy; 1.3553 + if (dy < 0) { 1.3554 + if (r < t0) return; 1.3555 + if (r < t1) t1 = r; 1.3556 + } else if (dy > 0) { 1.3557 + if (r > t1) return; 1.3558 + if (r > t0) t0 = r; 1.3559 + } 1.3560 + r = y1 - ay; 1.3561 + if (!dy && r < 0) return; 1.3562 + r /= dy; 1.3563 + if (dy < 0) { 1.3564 + if (r > t1) return; 1.3565 + if (r > t0) t0 = r; 1.3566 + } else if (dy > 0) { 1.3567 + if (r < t0) return; 1.3568 + if (r < t1) t1 = r; 1.3569 + } 1.3570 + if (t0 > 0) line.a = { 1.3571 + x: ax + t0 * dx, 1.3572 + y: ay + t0 * dy 1.3573 + }; 1.3574 + if (t1 < 1) line.b = { 1.3575 + x: ax + t1 * dx, 1.3576 + y: ay + t1 * dy 1.3577 + }; 1.3578 + return line; 1.3579 + }; 1.3580 + } 1.3581 + var d3_geo_clipExtentMAX = 1e9; 1.3582 + d3.geo.clipExtent = function() { 1.3583 + var x0, y0, x1, y1, stream, clip, clipExtent = { 1.3584 + stream: function(output) { 1.3585 + if (stream) stream.valid = false; 1.3586 + stream = clip(output); 1.3587 + stream.valid = true; 1.3588 + return stream; 1.3589 + }, 1.3590 + extent: function(_) { 1.3591 + if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; 1.3592 + clip = d3_geo_clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]); 1.3593 + if (stream) stream.valid = false, stream = null; 1.3594 + return clipExtent; 1.3595 + } 1.3596 + }; 1.3597 + return clipExtent.extent([ [ 0, 0 ], [ 960, 500 ] ]); 1.3598 + }; 1.3599 + function d3_geo_clipExtent(x0, y0, x1, y1) { 1.3600 + return function(listener) { 1.3601 + var listener_ = listener, bufferListener = d3_geo_clipBufferListener(), clipLine = d3_geom_clipLine(x0, y0, x1, y1), segments, polygon, ring; 1.3602 + var clip = { 1.3603 + point: point, 1.3604 + lineStart: lineStart, 1.3605 + lineEnd: lineEnd, 1.3606 + polygonStart: function() { 1.3607 + listener = bufferListener; 1.3608 + segments = []; 1.3609 + polygon = []; 1.3610 + clean = true; 1.3611 + }, 1.3612 + polygonEnd: function() { 1.3613 + listener = listener_; 1.3614 + segments = d3.merge(segments); 1.3615 + var clipStartInside = insidePolygon([ x0, y1 ]), inside = clean && clipStartInside, visible = segments.length; 1.3616 + if (inside || visible) { 1.3617 + listener.polygonStart(); 1.3618 + if (inside) { 1.3619 + listener.lineStart(); 1.3620 + interpolate(null, null, 1, listener); 1.3621 + listener.lineEnd(); 1.3622 + } 1.3623 + if (visible) { 1.3624 + d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener); 1.3625 + } 1.3626 + listener.polygonEnd(); 1.3627 + } 1.3628 + segments = polygon = ring = null; 1.3629 + } 1.3630 + }; 1.3631 + function insidePolygon(p) { 1.3632 + var wn = 0, n = polygon.length, y = p[1]; 1.3633 + for (var i = 0; i < n; ++i) { 1.3634 + for (var j = 1, v = polygon[i], m = v.length, a = v[0], b; j < m; ++j) { 1.3635 + b = v[j]; 1.3636 + if (a[1] <= y) { 1.3637 + if (b[1] > y && d3_cross2d(a, b, p) > 0) ++wn; 1.3638 + } else { 1.3639 + if (b[1] <= y && d3_cross2d(a, b, p) < 0) --wn; 1.3640 + } 1.3641 + a = b; 1.3642 + } 1.3643 + } 1.3644 + return wn !== 0; 1.3645 + } 1.3646 + function interpolate(from, to, direction, listener) { 1.3647 + var a = 0, a1 = 0; 1.3648 + if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoints(from, to) < 0 ^ direction > 0) { 1.3649 + do { 1.3650 + listener.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); 1.3651 + } while ((a = (a + direction + 4) % 4) !== a1); 1.3652 + } else { 1.3653 + listener.point(to[0], to[1]); 1.3654 + } 1.3655 + } 1.3656 + function pointVisible(x, y) { 1.3657 + return x0 <= x && x <= x1 && y0 <= y && y <= y1; 1.3658 + } 1.3659 + function point(x, y) { 1.3660 + if (pointVisible(x, y)) listener.point(x, y); 1.3661 + } 1.3662 + var x__, y__, v__, x_, y_, v_, first, clean; 1.3663 + function lineStart() { 1.3664 + clip.point = linePoint; 1.3665 + if (polygon) polygon.push(ring = []); 1.3666 + first = true; 1.3667 + v_ = false; 1.3668 + x_ = y_ = NaN; 1.3669 + } 1.3670 + function lineEnd() { 1.3671 + if (segments) { 1.3672 + linePoint(x__, y__); 1.3673 + if (v__ && v_) bufferListener.rejoin(); 1.3674 + segments.push(bufferListener.buffer()); 1.3675 + } 1.3676 + clip.point = point; 1.3677 + if (v_) listener.lineEnd(); 1.3678 + } 1.3679 + function linePoint(x, y) { 1.3680 + x = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, x)); 1.3681 + y = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, y)); 1.3682 + var v = pointVisible(x, y); 1.3683 + if (polygon) ring.push([ x, y ]); 1.3684 + if (first) { 1.3685 + x__ = x, y__ = y, v__ = v; 1.3686 + first = false; 1.3687 + if (v) { 1.3688 + listener.lineStart(); 1.3689 + listener.point(x, y); 1.3690 + } 1.3691 + } else { 1.3692 + if (v && v_) listener.point(x, y); else { 1.3693 + var l = { 1.3694 + a: { 1.3695 + x: x_, 1.3696 + y: y_ 1.3697 + }, 1.3698 + b: { 1.3699 + x: x, 1.3700 + y: y 1.3701 + } 1.3702 + }; 1.3703 + if (clipLine(l)) { 1.3704 + if (!v_) { 1.3705 + listener.lineStart(); 1.3706 + listener.point(l.a.x, l.a.y); 1.3707 + } 1.3708 + listener.point(l.b.x, l.b.y); 1.3709 + if (!v) listener.lineEnd(); 1.3710 + clean = false; 1.3711 + } else if (v) { 1.3712 + listener.lineStart(); 1.3713 + listener.point(x, y); 1.3714 + clean = false; 1.3715 + } 1.3716 + } 1.3717 + } 1.3718 + x_ = x, y_ = y, v_ = v; 1.3719 + } 1.3720 + return clip; 1.3721 + }; 1.3722 + function corner(p, direction) { 1.3723 + 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; 1.3724 + } 1.3725 + function compare(a, b) { 1.3726 + return comparePoints(a.x, b.x); 1.3727 + } 1.3728 + function comparePoints(a, b) { 1.3729 + var ca = corner(a, 1), cb = corner(b, 1); 1.3730 + 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]; 1.3731 + } 1.3732 + } 1.3733 + function d3_geo_compose(a, b) { 1.3734 + function compose(x, y) { 1.3735 + return x = a(x, y), b(x[0], x[1]); 1.3736 + } 1.3737 + if (a.invert && b.invert) compose.invert = function(x, y) { 1.3738 + return x = b.invert(x, y), x && a.invert(x[0], x[1]); 1.3739 + }; 1.3740 + return compose; 1.3741 + } 1.3742 + function d3_geo_conic(projectAt) { 1.3743 + var φ0 = 0, φ1 = π / 3, m = d3_geo_projectionMutator(projectAt), p = m(φ0, φ1); 1.3744 + p.parallels = function(_) { 1.3745 + if (!arguments.length) return [ φ0 / π * 180, φ1 / π * 180 ]; 1.3746 + return m(φ0 = _[0] * π / 180, φ1 = _[1] * π / 180); 1.3747 + }; 1.3748 + return p; 1.3749 + } 1.3750 + function d3_geo_conicEqualArea(φ0, φ1) { 1.3751 + 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; 1.3752 + function forward(λ, φ) { 1.3753 + var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n; 1.3754 + return [ ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ) ]; 1.3755 + } 1.3756 + forward.invert = function(x, y) { 1.3757 + var ρ0_y = ρ0 - y; 1.3758 + return [ Math.atan2(x, ρ0_y) / n, d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ]; 1.3759 + }; 1.3760 + return forward; 1.3761 + } 1.3762 + (d3.geo.conicEqualArea = function() { 1.3763 + return d3_geo_conic(d3_geo_conicEqualArea); 1.3764 + }).raw = d3_geo_conicEqualArea; 1.3765 + d3.geo.albers = function() { 1.3766 + return d3.geo.conicEqualArea().rotate([ 96, 0 ]).center([ -.6, 38.7 ]).parallels([ 29.5, 45.5 ]).scale(1070); 1.3767 + }; 1.3768 + d3.geo.albersUsa = function() { 1.3769 + var lower48 = d3.geo.albers(); 1.3770 + var alaska = d3.geo.conicEqualArea().rotate([ 154, 0 ]).center([ -2, 58.5 ]).parallels([ 55, 65 ]); 1.3771 + var hawaii = d3.geo.conicEqualArea().rotate([ 157, 0 ]).center([ -3, 19.9 ]).parallels([ 8, 18 ]); 1.3772 + var point, pointStream = { 1.3773 + point: function(x, y) { 1.3774 + point = [ x, y ]; 1.3775 + } 1.3776 + }, lower48Point, alaskaPoint, hawaiiPoint; 1.3777 + function albersUsa(coordinates) { 1.3778 + var x = coordinates[0], y = coordinates[1]; 1.3779 + point = null; 1.3780 + (lower48Point(x, y), point) || (alaskaPoint(x, y), point) || hawaiiPoint(x, y); 1.3781 + return point; 1.3782 + } 1.3783 + albersUsa.invert = function(coordinates) { 1.3784 + var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k; 1.3785 + return (y >= .12 && y < .234 && x >= -.425 && x < -.214 ? alaska : y >= .166 && y < .234 && x >= -.214 && x < -.115 ? hawaii : lower48).invert(coordinates); 1.3786 + }; 1.3787 + albersUsa.stream = function(stream) { 1.3788 + var lower48Stream = lower48.stream(stream), alaskaStream = alaska.stream(stream), hawaiiStream = hawaii.stream(stream); 1.3789 + return { 1.3790 + point: function(x, y) { 1.3791 + lower48Stream.point(x, y); 1.3792 + alaskaStream.point(x, y); 1.3793 + hawaiiStream.point(x, y); 1.3794 + }, 1.3795 + sphere: function() { 1.3796 + lower48Stream.sphere(); 1.3797 + alaskaStream.sphere(); 1.3798 + hawaiiStream.sphere(); 1.3799 + }, 1.3800 + lineStart: function() { 1.3801 + lower48Stream.lineStart(); 1.3802 + alaskaStream.lineStart(); 1.3803 + hawaiiStream.lineStart(); 1.3804 + }, 1.3805 + lineEnd: function() { 1.3806 + lower48Stream.lineEnd(); 1.3807 + alaskaStream.lineEnd(); 1.3808 + hawaiiStream.lineEnd(); 1.3809 + }, 1.3810 + polygonStart: function() { 1.3811 + lower48Stream.polygonStart(); 1.3812 + alaskaStream.polygonStart(); 1.3813 + hawaiiStream.polygonStart(); 1.3814 + }, 1.3815 + polygonEnd: function() { 1.3816 + lower48Stream.polygonEnd(); 1.3817 + alaskaStream.polygonEnd(); 1.3818 + hawaiiStream.polygonEnd(); 1.3819 + } 1.3820 + }; 1.3821 + }; 1.3822 + albersUsa.precision = function(_) { 1.3823 + if (!arguments.length) return lower48.precision(); 1.3824 + lower48.precision(_); 1.3825 + alaska.precision(_); 1.3826 + hawaii.precision(_); 1.3827 + return albersUsa; 1.3828 + }; 1.3829 + albersUsa.scale = function(_) { 1.3830 + if (!arguments.length) return lower48.scale(); 1.3831 + lower48.scale(_); 1.3832 + alaska.scale(_ * .35); 1.3833 + hawaii.scale(_); 1.3834 + return albersUsa.translate(lower48.translate()); 1.3835 + }; 1.3836 + albersUsa.translate = function(_) { 1.3837 + if (!arguments.length) return lower48.translate(); 1.3838 + var k = lower48.scale(), x = +_[0], y = +_[1]; 1.3839 + lower48Point = lower48.translate(_).clipExtent([ [ x - .455 * k, y - .238 * k ], [ x + .455 * k, y + .238 * k ] ]).stream(pointStream).point; 1.3840 + 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; 1.3841 + 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; 1.3842 + return albersUsa; 1.3843 + }; 1.3844 + return albersUsa.scale(1070); 1.3845 + }; 1.3846 + var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = { 1.3847 + point: d3_noop, 1.3848 + lineStart: d3_noop, 1.3849 + lineEnd: d3_noop, 1.3850 + polygonStart: function() { 1.3851 + d3_geo_pathAreaPolygon = 0; 1.3852 + d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart; 1.3853 + }, 1.3854 + polygonEnd: function() { 1.3855 + d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop; 1.3856 + d3_geo_pathAreaSum += abs(d3_geo_pathAreaPolygon / 2); 1.3857 + } 1.3858 + }; 1.3859 + function d3_geo_pathAreaRingStart() { 1.3860 + var x00, y00, x0, y0; 1.3861 + d3_geo_pathArea.point = function(x, y) { 1.3862 + d3_geo_pathArea.point = nextPoint; 1.3863 + x00 = x0 = x, y00 = y0 = y; 1.3864 + }; 1.3865 + function nextPoint(x, y) { 1.3866 + d3_geo_pathAreaPolygon += y0 * x - x0 * y; 1.3867 + x0 = x, y0 = y; 1.3868 + } 1.3869 + d3_geo_pathArea.lineEnd = function() { 1.3870 + nextPoint(x00, y00); 1.3871 + }; 1.3872 + } 1.3873 + var d3_geo_pathBoundsX0, d3_geo_pathBoundsY0, d3_geo_pathBoundsX1, d3_geo_pathBoundsY1; 1.3874 + var d3_geo_pathBounds = { 1.3875 + point: d3_geo_pathBoundsPoint, 1.3876 + lineStart: d3_noop, 1.3877 + lineEnd: d3_noop, 1.3878 + polygonStart: d3_noop, 1.3879 + polygonEnd: d3_noop 1.3880 + }; 1.3881 + function d3_geo_pathBoundsPoint(x, y) { 1.3882 + if (x < d3_geo_pathBoundsX0) d3_geo_pathBoundsX0 = x; 1.3883 + if (x > d3_geo_pathBoundsX1) d3_geo_pathBoundsX1 = x; 1.3884 + if (y < d3_geo_pathBoundsY0) d3_geo_pathBoundsY0 = y; 1.3885 + if (y > d3_geo_pathBoundsY1) d3_geo_pathBoundsY1 = y; 1.3886 + } 1.3887 + function d3_geo_pathBuffer() { 1.3888 + var pointCircle = d3_geo_pathBufferCircle(4.5), buffer = []; 1.3889 + var stream = { 1.3890 + point: point, 1.3891 + lineStart: function() { 1.3892 + stream.point = pointLineStart; 1.3893 + }, 1.3894 + lineEnd: lineEnd, 1.3895 + polygonStart: function() { 1.3896 + stream.lineEnd = lineEndPolygon; 1.3897 + }, 1.3898 + polygonEnd: function() { 1.3899 + stream.lineEnd = lineEnd; 1.3900 + stream.point = point; 1.3901 + }, 1.3902 + pointRadius: function(_) { 1.3903 + pointCircle = d3_geo_pathBufferCircle(_); 1.3904 + return stream; 1.3905 + }, 1.3906 + result: function() { 1.3907 + if (buffer.length) { 1.3908 + var result = buffer.join(""); 1.3909 + buffer = []; 1.3910 + return result; 1.3911 + } 1.3912 + } 1.3913 + }; 1.3914 + function point(x, y) { 1.3915 + buffer.push("M", x, ",", y, pointCircle); 1.3916 + } 1.3917 + function pointLineStart(x, y) { 1.3918 + buffer.push("M", x, ",", y); 1.3919 + stream.point = pointLine; 1.3920 + } 1.3921 + function pointLine(x, y) { 1.3922 + buffer.push("L", x, ",", y); 1.3923 + } 1.3924 + function lineEnd() { 1.3925 + stream.point = point; 1.3926 + } 1.3927 + function lineEndPolygon() { 1.3928 + buffer.push("Z"); 1.3929 + } 1.3930 + return stream; 1.3931 + } 1.3932 + function d3_geo_pathBufferCircle(radius) { 1.3933 + return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z"; 1.3934 + } 1.3935 + var d3_geo_pathCentroid = { 1.3936 + point: d3_geo_pathCentroidPoint, 1.3937 + lineStart: d3_geo_pathCentroidLineStart, 1.3938 + lineEnd: d3_geo_pathCentroidLineEnd, 1.3939 + polygonStart: function() { 1.3940 + d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart; 1.3941 + }, 1.3942 + polygonEnd: function() { 1.3943 + d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; 1.3944 + d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart; 1.3945 + d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd; 1.3946 + } 1.3947 + }; 1.3948 + function d3_geo_pathCentroidPoint(x, y) { 1.3949 + d3_geo_centroidX0 += x; 1.3950 + d3_geo_centroidY0 += y; 1.3951 + ++d3_geo_centroidZ0; 1.3952 + } 1.3953 + function d3_geo_pathCentroidLineStart() { 1.3954 + var x0, y0; 1.3955 + d3_geo_pathCentroid.point = function(x, y) { 1.3956 + d3_geo_pathCentroid.point = nextPoint; 1.3957 + d3_geo_pathCentroidPoint(x0 = x, y0 = y); 1.3958 + }; 1.3959 + function nextPoint(x, y) { 1.3960 + var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); 1.3961 + d3_geo_centroidX1 += z * (x0 + x) / 2; 1.3962 + d3_geo_centroidY1 += z * (y0 + y) / 2; 1.3963 + d3_geo_centroidZ1 += z; 1.3964 + d3_geo_pathCentroidPoint(x0 = x, y0 = y); 1.3965 + } 1.3966 + } 1.3967 + function d3_geo_pathCentroidLineEnd() { 1.3968 + d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; 1.3969 + } 1.3970 + function d3_geo_pathCentroidRingStart() { 1.3971 + var x00, y00, x0, y0; 1.3972 + d3_geo_pathCentroid.point = function(x, y) { 1.3973 + d3_geo_pathCentroid.point = nextPoint; 1.3974 + d3_geo_pathCentroidPoint(x00 = x0 = x, y00 = y0 = y); 1.3975 + }; 1.3976 + function nextPoint(x, y) { 1.3977 + var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); 1.3978 + d3_geo_centroidX1 += z * (x0 + x) / 2; 1.3979 + d3_geo_centroidY1 += z * (y0 + y) / 2; 1.3980 + d3_geo_centroidZ1 += z; 1.3981 + z = y0 * x - x0 * y; 1.3982 + d3_geo_centroidX2 += z * (x0 + x); 1.3983 + d3_geo_centroidY2 += z * (y0 + y); 1.3984 + d3_geo_centroidZ2 += z * 3; 1.3985 + d3_geo_pathCentroidPoint(x0 = x, y0 = y); 1.3986 + } 1.3987 + d3_geo_pathCentroid.lineEnd = function() { 1.3988 + nextPoint(x00, y00); 1.3989 + }; 1.3990 + } 1.3991 + function d3_geo_pathContext(context) { 1.3992 + var pointRadius = 4.5; 1.3993 + var stream = { 1.3994 + point: point, 1.3995 + lineStart: function() { 1.3996 + stream.point = pointLineStart; 1.3997 + }, 1.3998 + lineEnd: lineEnd, 1.3999 + polygonStart: function() { 1.4000 + stream.lineEnd = lineEndPolygon; 1.4001 + }, 1.4002 + polygonEnd: function() { 1.4003 + stream.lineEnd = lineEnd; 1.4004 + stream.point = point; 1.4005 + }, 1.4006 + pointRadius: function(_) { 1.4007 + pointRadius = _; 1.4008 + return stream; 1.4009 + }, 1.4010 + result: d3_noop 1.4011 + }; 1.4012 + function point(x, y) { 1.4013 + context.moveTo(x, y); 1.4014 + context.arc(x, y, pointRadius, 0, τ); 1.4015 + } 1.4016 + function pointLineStart(x, y) { 1.4017 + context.moveTo(x, y); 1.4018 + stream.point = pointLine; 1.4019 + } 1.4020 + function pointLine(x, y) { 1.4021 + context.lineTo(x, y); 1.4022 + } 1.4023 + function lineEnd() { 1.4024 + stream.point = point; 1.4025 + } 1.4026 + function lineEndPolygon() { 1.4027 + context.closePath(); 1.4028 + } 1.4029 + return stream; 1.4030 + } 1.4031 + function d3_geo_resample(project) { 1.4032 + var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16; 1.4033 + function resample(stream) { 1.4034 + return (maxDepth ? resampleRecursive : resampleNone)(stream); 1.4035 + } 1.4036 + function resampleNone(stream) { 1.4037 + return d3_geo_transformPoint(stream, function(x, y) { 1.4038 + x = project(x, y); 1.4039 + stream.point(x[0], x[1]); 1.4040 + }); 1.4041 + } 1.4042 + function resampleRecursive(stream) { 1.4043 + var λ00, φ00, x00, y00, a00, b00, c00, λ0, x0, y0, a0, b0, c0; 1.4044 + var resample = { 1.4045 + point: point, 1.4046 + lineStart: lineStart, 1.4047 + lineEnd: lineEnd, 1.4048 + polygonStart: function() { 1.4049 + stream.polygonStart(); 1.4050 + resample.lineStart = ringStart; 1.4051 + }, 1.4052 + polygonEnd: function() { 1.4053 + stream.polygonEnd(); 1.4054 + resample.lineStart = lineStart; 1.4055 + } 1.4056 + }; 1.4057 + function point(x, y) { 1.4058 + x = project(x, y); 1.4059 + stream.point(x[0], x[1]); 1.4060 + } 1.4061 + function lineStart() { 1.4062 + x0 = NaN; 1.4063 + resample.point = linePoint; 1.4064 + stream.lineStart(); 1.4065 + } 1.4066 + function linePoint(λ, φ) { 1.4067 + var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ); 1.4068 + 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); 1.4069 + stream.point(x0, y0); 1.4070 + } 1.4071 + function lineEnd() { 1.4072 + resample.point = point; 1.4073 + stream.lineEnd(); 1.4074 + } 1.4075 + function ringStart() { 1.4076 + lineStart(); 1.4077 + resample.point = ringPoint; 1.4078 + resample.lineEnd = ringEnd; 1.4079 + } 1.4080 + function ringPoint(λ, φ) { 1.4081 + linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; 1.4082 + resample.point = linePoint; 1.4083 + } 1.4084 + function ringEnd() { 1.4085 + resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream); 1.4086 + resample.lineEnd = lineEnd; 1.4087 + lineEnd(); 1.4088 + } 1.4089 + return resample; 1.4090 + } 1.4091 + function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) { 1.4092 + var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy; 1.4093 + if (d2 > 4 * δ2 && depth--) { 1.4094 + 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; 1.4095 + if (dz * dz / d2 > δ2 || abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { 1.4096 + resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream); 1.4097 + stream.point(x2, y2); 1.4098 + resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream); 1.4099 + } 1.4100 + } 1.4101 + } 1.4102 + resample.precision = function(_) { 1.4103 + if (!arguments.length) return Math.sqrt(δ2); 1.4104 + maxDepth = (δ2 = _ * _) > 0 && 16; 1.4105 + return resample; 1.4106 + }; 1.4107 + return resample; 1.4108 + } 1.4109 + d3.geo.path = function() { 1.4110 + var pointRadius = 4.5, projection, context, projectStream, contextStream, cacheStream; 1.4111 + function path(object) { 1.4112 + if (object) { 1.4113 + if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); 1.4114 + if (!cacheStream || !cacheStream.valid) cacheStream = projectStream(contextStream); 1.4115 + d3.geo.stream(object, cacheStream); 1.4116 + } 1.4117 + return contextStream.result(); 1.4118 + } 1.4119 + path.area = function(object) { 1.4120 + d3_geo_pathAreaSum = 0; 1.4121 + d3.geo.stream(object, projectStream(d3_geo_pathArea)); 1.4122 + return d3_geo_pathAreaSum; 1.4123 + }; 1.4124 + path.centroid = function(object) { 1.4125 + 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; 1.4126 + d3.geo.stream(object, projectStream(d3_geo_pathCentroid)); 1.4127 + 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 ]; 1.4128 + }; 1.4129 + path.bounds = function(object) { 1.4130 + d3_geo_pathBoundsX1 = d3_geo_pathBoundsY1 = -(d3_geo_pathBoundsX0 = d3_geo_pathBoundsY0 = Infinity); 1.4131 + d3.geo.stream(object, projectStream(d3_geo_pathBounds)); 1.4132 + return [ [ d3_geo_pathBoundsX0, d3_geo_pathBoundsY0 ], [ d3_geo_pathBoundsX1, d3_geo_pathBoundsY1 ] ]; 1.4133 + }; 1.4134 + path.projection = function(_) { 1.4135 + if (!arguments.length) return projection; 1.4136 + projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity; 1.4137 + return reset(); 1.4138 + }; 1.4139 + path.context = function(_) { 1.4140 + if (!arguments.length) return context; 1.4141 + contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_); 1.4142 + if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); 1.4143 + return reset(); 1.4144 + }; 1.4145 + path.pointRadius = function(_) { 1.4146 + if (!arguments.length) return pointRadius; 1.4147 + pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); 1.4148 + return path; 1.4149 + }; 1.4150 + function reset() { 1.4151 + cacheStream = null; 1.4152 + return path; 1.4153 + } 1.4154 + return path.projection(d3.geo.albersUsa()).context(null); 1.4155 + }; 1.4156 + function d3_geo_pathProjectStream(project) { 1.4157 + var resample = d3_geo_resample(function(x, y) { 1.4158 + return project([ x * d3_degrees, y * d3_degrees ]); 1.4159 + }); 1.4160 + return function(stream) { 1.4161 + return d3_geo_projectionRadians(resample(stream)); 1.4162 + }; 1.4163 + } 1.4164 + d3.geo.transform = function(methods) { 1.4165 + return { 1.4166 + stream: function(stream) { 1.4167 + var transform = new d3_geo_transform(stream); 1.4168 + for (var k in methods) transform[k] = methods[k]; 1.4169 + return transform; 1.4170 + } 1.4171 + }; 1.4172 + }; 1.4173 + function d3_geo_transform(stream) { 1.4174 + this.stream = stream; 1.4175 + } 1.4176 + d3_geo_transform.prototype = { 1.4177 + point: function(x, y) { 1.4178 + this.stream.point(x, y); 1.4179 + }, 1.4180 + sphere: function() { 1.4181 + this.stream.sphere(); 1.4182 + }, 1.4183 + lineStart: function() { 1.4184 + this.stream.lineStart(); 1.4185 + }, 1.4186 + lineEnd: function() { 1.4187 + this.stream.lineEnd(); 1.4188 + }, 1.4189 + polygonStart: function() { 1.4190 + this.stream.polygonStart(); 1.4191 + }, 1.4192 + polygonEnd: function() { 1.4193 + this.stream.polygonEnd(); 1.4194 + } 1.4195 + }; 1.4196 + function d3_geo_transformPoint(stream, point) { 1.4197 + return { 1.4198 + point: point, 1.4199 + sphere: function() { 1.4200 + stream.sphere(); 1.4201 + }, 1.4202 + lineStart: function() { 1.4203 + stream.lineStart(); 1.4204 + }, 1.4205 + lineEnd: function() { 1.4206 + stream.lineEnd(); 1.4207 + }, 1.4208 + polygonStart: function() { 1.4209 + stream.polygonStart(); 1.4210 + }, 1.4211 + polygonEnd: function() { 1.4212 + stream.polygonEnd(); 1.4213 + } 1.4214 + }; 1.4215 + } 1.4216 + d3.geo.projection = d3_geo_projection; 1.4217 + d3.geo.projectionMutator = d3_geo_projectionMutator; 1.4218 + function d3_geo_projection(project) { 1.4219 + return d3_geo_projectionMutator(function() { 1.4220 + return project; 1.4221 + })(); 1.4222 + } 1.4223 + function d3_geo_projectionMutator(projectAt) { 1.4224 + var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) { 1.4225 + x = project(x, y); 1.4226 + return [ x[0] * k + δx, δy - x[1] * k ]; 1.4227 + }), 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; 1.4228 + function projection(point) { 1.4229 + point = projectRotate(point[0] * d3_radians, point[1] * d3_radians); 1.4230 + return [ point[0] * k + δx, δy - point[1] * k ]; 1.4231 + } 1.4232 + function invert(point) { 1.4233 + point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k); 1.4234 + return point && [ point[0] * d3_degrees, point[1] * d3_degrees ]; 1.4235 + } 1.4236 + projection.stream = function(output) { 1.4237 + if (stream) stream.valid = false; 1.4238 + stream = d3_geo_projectionRadians(preclip(rotate, projectResample(postclip(output)))); 1.4239 + stream.valid = true; 1.4240 + return stream; 1.4241 + }; 1.4242 + projection.clipAngle = function(_) { 1.4243 + if (!arguments.length) return clipAngle; 1.4244 + preclip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle((clipAngle = +_) * d3_radians); 1.4245 + return invalidate(); 1.4246 + }; 1.4247 + projection.clipExtent = function(_) { 1.4248 + if (!arguments.length) return clipExtent; 1.4249 + clipExtent = _; 1.4250 + postclip = _ ? d3_geo_clipExtent(_[0][0], _[0][1], _[1][0], _[1][1]) : d3_identity; 1.4251 + return invalidate(); 1.4252 + }; 1.4253 + projection.scale = function(_) { 1.4254 + if (!arguments.length) return k; 1.4255 + k = +_; 1.4256 + return reset(); 1.4257 + }; 1.4258 + projection.translate = function(_) { 1.4259 + if (!arguments.length) return [ x, y ]; 1.4260 + x = +_[0]; 1.4261 + y = +_[1]; 1.4262 + return reset(); 1.4263 + }; 1.4264 + projection.center = function(_) { 1.4265 + if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ]; 1.4266 + λ = _[0] % 360 * d3_radians; 1.4267 + φ = _[1] % 360 * d3_radians; 1.4268 + return reset(); 1.4269 + }; 1.4270 + projection.rotate = function(_) { 1.4271 + if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ]; 1.4272 + δλ = _[0] % 360 * d3_radians; 1.4273 + δφ = _[1] % 360 * d3_radians; 1.4274 + δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0; 1.4275 + return reset(); 1.4276 + }; 1.4277 + d3.rebind(projection, projectResample, "precision"); 1.4278 + function reset() { 1.4279 + projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project); 1.4280 + var center = project(λ, φ); 1.4281 + δx = x - center[0] * k; 1.4282 + δy = y + center[1] * k; 1.4283 + return invalidate(); 1.4284 + } 1.4285 + function invalidate() { 1.4286 + if (stream) stream.valid = false, stream = null; 1.4287 + return projection; 1.4288 + } 1.4289 + return function() { 1.4290 + project = projectAt.apply(this, arguments); 1.4291 + projection.invert = project.invert && invert; 1.4292 + return reset(); 1.4293 + }; 1.4294 + } 1.4295 + function d3_geo_projectionRadians(stream) { 1.4296 + return d3_geo_transformPoint(stream, function(x, y) { 1.4297 + stream.point(x * d3_radians, y * d3_radians); 1.4298 + }); 1.4299 + } 1.4300 + function d3_geo_equirectangular(λ, φ) { 1.4301 + return [ λ, φ ]; 1.4302 + } 1.4303 + (d3.geo.equirectangular = function() { 1.4304 + return d3_geo_projection(d3_geo_equirectangular); 1.4305 + }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular; 1.4306 + d3.geo.rotation = function(rotate) { 1.4307 + rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0); 1.4308 + function forward(coordinates) { 1.4309 + coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians); 1.4310 + return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; 1.4311 + } 1.4312 + forward.invert = function(coordinates) { 1.4313 + coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians); 1.4314 + return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; 1.4315 + }; 1.4316 + return forward; 1.4317 + }; 1.4318 + function d3_geo_identityRotation(λ, φ) { 1.4319 + return [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ]; 1.4320 + } 1.4321 + d3_geo_identityRotation.invert = d3_geo_equirectangular; 1.4322 + function d3_geo_rotation(δλ, δφ, δγ) { 1.4323 + return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_identityRotation; 1.4324 + } 1.4325 + function d3_geo_forwardRotationλ(δλ) { 1.4326 + return function(λ, φ) { 1.4327 + return λ += δλ, [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ]; 1.4328 + }; 1.4329 + } 1.4330 + function d3_geo_rotationλ(δλ) { 1.4331 + var rotation = d3_geo_forwardRotationλ(δλ); 1.4332 + rotation.invert = d3_geo_forwardRotationλ(-δλ); 1.4333 + return rotation; 1.4334 + } 1.4335 + function d3_geo_rotationφγ(δφ, δγ) { 1.4336 + var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ); 1.4337 + function rotation(λ, φ) { 1.4338 + var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ; 1.4339 + return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), d3_asin(k * cosδγ + y * sinδγ) ]; 1.4340 + } 1.4341 + rotation.invert = function(λ, φ) { 1.4342 + var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ; 1.4343 + return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), d3_asin(k * cosδφ - x * sinδφ) ]; 1.4344 + }; 1.4345 + return rotation; 1.4346 + } 1.4347 + d3.geo.circle = function() { 1.4348 + var origin = [ 0, 0 ], angle, precision = 6, interpolate; 1.4349 + function circle() { 1.4350 + 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 = []; 1.4351 + interpolate(null, null, 1, { 1.4352 + point: function(x, y) { 1.4353 + ring.push(x = rotate(x, y)); 1.4354 + x[0] *= d3_degrees, x[1] *= d3_degrees; 1.4355 + } 1.4356 + }); 1.4357 + return { 1.4358 + type: "Polygon", 1.4359 + coordinates: [ ring ] 1.4360 + }; 1.4361 + } 1.4362 + circle.origin = function(x) { 1.4363 + if (!arguments.length) return origin; 1.4364 + origin = x; 1.4365 + return circle; 1.4366 + }; 1.4367 + circle.angle = function(x) { 1.4368 + if (!arguments.length) return angle; 1.4369 + interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians); 1.4370 + return circle; 1.4371 + }; 1.4372 + circle.precision = function(_) { 1.4373 + if (!arguments.length) return precision; 1.4374 + interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians); 1.4375 + return circle; 1.4376 + }; 1.4377 + return circle.angle(90); 1.4378 + }; 1.4379 + function d3_geo_circleInterpolate(radius, precision) { 1.4380 + var cr = Math.cos(radius), sr = Math.sin(radius); 1.4381 + return function(from, to, direction, listener) { 1.4382 + var step = direction * precision; 1.4383 + if (from != null) { 1.4384 + from = d3_geo_circleAngle(cr, from); 1.4385 + to = d3_geo_circleAngle(cr, to); 1.4386 + if (direction > 0 ? from < to : from > to) from += direction * τ; 1.4387 + } else { 1.4388 + from = radius + direction * τ; 1.4389 + to = radius - .5 * step; 1.4390 + } 1.4391 + for (var point, t = from; direction > 0 ? t > to : t < to; t -= step) { 1.4392 + listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]); 1.4393 + } 1.4394 + }; 1.4395 + } 1.4396 + function d3_geo_circleAngle(cr, point) { 1.4397 + var a = d3_geo_cartesian(point); 1.4398 + a[0] -= cr; 1.4399 + d3_geo_cartesianNormalize(a); 1.4400 + var angle = d3_acos(-a[1]); 1.4401 + return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI); 1.4402 + } 1.4403 + d3.geo.distance = function(a, b) { 1.4404 + 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; 1.4405 + 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Δλ); 1.4406 + }; 1.4407 + d3.geo.graticule = function() { 1.4408 + var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5; 1.4409 + function graticule() { 1.4410 + return { 1.4411 + type: "MultiLineString", 1.4412 + coordinates: lines() 1.4413 + }; 1.4414 + } 1.4415 + function lines() { 1.4416 + 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) { 1.4417 + return abs(x % DX) > ε; 1.4418 + }).map(x)).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).filter(function(y) { 1.4419 + return abs(y % DY) > ε; 1.4420 + }).map(y)); 1.4421 + } 1.4422 + graticule.lines = function() { 1.4423 + return lines().map(function(coordinates) { 1.4424 + return { 1.4425 + type: "LineString", 1.4426 + coordinates: coordinates 1.4427 + }; 1.4428 + }); 1.4429 + }; 1.4430 + graticule.outline = function() { 1.4431 + return { 1.4432 + type: "Polygon", 1.4433 + coordinates: [ X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ] 1.4434 + }; 1.4435 + }; 1.4436 + graticule.extent = function(_) { 1.4437 + if (!arguments.length) return graticule.minorExtent(); 1.4438 + return graticule.majorExtent(_).minorExtent(_); 1.4439 + }; 1.4440 + graticule.majorExtent = function(_) { 1.4441 + if (!arguments.length) return [ [ X0, Y0 ], [ X1, Y1 ] ]; 1.4442 + X0 = +_[0][0], X1 = +_[1][0]; 1.4443 + Y0 = +_[0][1], Y1 = +_[1][1]; 1.4444 + if (X0 > X1) _ = X0, X0 = X1, X1 = _; 1.4445 + if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; 1.4446 + return graticule.precision(precision); 1.4447 + }; 1.4448 + graticule.minorExtent = function(_) { 1.4449 + if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; 1.4450 + x0 = +_[0][0], x1 = +_[1][0]; 1.4451 + y0 = +_[0][1], y1 = +_[1][1]; 1.4452 + if (x0 > x1) _ = x0, x0 = x1, x1 = _; 1.4453 + if (y0 > y1) _ = y0, y0 = y1, y1 = _; 1.4454 + return graticule.precision(precision); 1.4455 + }; 1.4456 + graticule.step = function(_) { 1.4457 + if (!arguments.length) return graticule.minorStep(); 1.4458 + return graticule.majorStep(_).minorStep(_); 1.4459 + }; 1.4460 + graticule.majorStep = function(_) { 1.4461 + if (!arguments.length) return [ DX, DY ]; 1.4462 + DX = +_[0], DY = +_[1]; 1.4463 + return graticule; 1.4464 + }; 1.4465 + graticule.minorStep = function(_) { 1.4466 + if (!arguments.length) return [ dx, dy ]; 1.4467 + dx = +_[0], dy = +_[1]; 1.4468 + return graticule; 1.4469 + }; 1.4470 + graticule.precision = function(_) { 1.4471 + if (!arguments.length) return precision; 1.4472 + precision = +_; 1.4473 + x = d3_geo_graticuleX(y0, y1, 90); 1.4474 + y = d3_geo_graticuleY(x0, x1, precision); 1.4475 + X = d3_geo_graticuleX(Y0, Y1, 90); 1.4476 + Y = d3_geo_graticuleY(X0, X1, precision); 1.4477 + return graticule; 1.4478 + }; 1.4479 + return graticule.majorExtent([ [ -180, -90 + ε ], [ 180, 90 - ε ] ]).minorExtent([ [ -180, -80 - ε ], [ 180, 80 + ε ] ]); 1.4480 + }; 1.4481 + function d3_geo_graticuleX(y0, y1, dy) { 1.4482 + var y = d3.range(y0, y1 - ε, dy).concat(y1); 1.4483 + return function(x) { 1.4484 + return y.map(function(y) { 1.4485 + return [ x, y ]; 1.4486 + }); 1.4487 + }; 1.4488 + } 1.4489 + function d3_geo_graticuleY(x0, x1, dx) { 1.4490 + var x = d3.range(x0, x1 - ε, dx).concat(x1); 1.4491 + return function(y) { 1.4492 + return x.map(function(x) { 1.4493 + return [ x, y ]; 1.4494 + }); 1.4495 + }; 1.4496 + } 1.4497 + function d3_source(d) { 1.4498 + return d.source; 1.4499 + } 1.4500 + function d3_target(d) { 1.4501 + return d.target; 1.4502 + } 1.4503 + d3.geo.greatArc = function() { 1.4504 + var source = d3_source, source_, target = d3_target, target_; 1.4505 + function greatArc() { 1.4506 + return { 1.4507 + type: "LineString", 1.4508 + coordinates: [ source_ || source.apply(this, arguments), target_ || target.apply(this, arguments) ] 1.4509 + }; 1.4510 + } 1.4511 + greatArc.distance = function() { 1.4512 + return d3.geo.distance(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments)); 1.4513 + }; 1.4514 + greatArc.source = function(_) { 1.4515 + if (!arguments.length) return source; 1.4516 + source = _, source_ = typeof _ === "function" ? null : _; 1.4517 + return greatArc; 1.4518 + }; 1.4519 + greatArc.target = function(_) { 1.4520 + if (!arguments.length) return target; 1.4521 + target = _, target_ = typeof _ === "function" ? null : _; 1.4522 + return greatArc; 1.4523 + }; 1.4524 + greatArc.precision = function() { 1.4525 + return arguments.length ? greatArc : 0; 1.4526 + }; 1.4527 + return greatArc; 1.4528 + }; 1.4529 + d3.geo.interpolate = function(source, target) { 1.4530 + return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians); 1.4531 + }; 1.4532 + function d3_geo_interpolate(x0, y0, x1, y1) { 1.4533 + 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); 1.4534 + var interpolate = d ? function(t) { 1.4535 + 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; 1.4536 + return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ]; 1.4537 + } : function() { 1.4538 + return [ x0 * d3_degrees, y0 * d3_degrees ]; 1.4539 + }; 1.4540 + interpolate.distance = d; 1.4541 + return interpolate; 1.4542 + } 1.4543 + d3.geo.length = function(object) { 1.4544 + d3_geo_lengthSum = 0; 1.4545 + d3.geo.stream(object, d3_geo_length); 1.4546 + return d3_geo_lengthSum; 1.4547 + }; 1.4548 + var d3_geo_lengthSum; 1.4549 + var d3_geo_length = { 1.4550 + sphere: d3_noop, 1.4551 + point: d3_noop, 1.4552 + lineStart: d3_geo_lengthLineStart, 1.4553 + lineEnd: d3_noop, 1.4554 + polygonStart: d3_noop, 1.4555 + polygonEnd: d3_noop 1.4556 + }; 1.4557 + function d3_geo_lengthLineStart() { 1.4558 + var λ0, sinφ0, cosφ0; 1.4559 + d3_geo_length.point = function(λ, φ) { 1.4560 + λ0 = λ * d3_radians, sinφ0 = Math.sin(φ *= d3_radians), cosφ0 = Math.cos(φ); 1.4561 + d3_geo_length.point = nextPoint; 1.4562 + }; 1.4563 + d3_geo_length.lineEnd = function() { 1.4564 + d3_geo_length.point = d3_geo_length.lineEnd = d3_noop; 1.4565 + }; 1.4566 + function nextPoint(λ, φ) { 1.4567 + var sinφ = Math.sin(φ *= d3_radians), cosφ = Math.cos(φ), t = abs((λ *= d3_radians) - λ0), cosΔλ = Math.cos(t); 1.4568 + 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Δλ); 1.4569 + λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ; 1.4570 + } 1.4571 + } 1.4572 + function d3_geo_azimuthal(scale, angle) { 1.4573 + function azimuthal(λ, φ) { 1.4574 + var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ); 1.4575 + return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ]; 1.4576 + } 1.4577 + azimuthal.invert = function(x, y) { 1.4578 + var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c); 1.4579 + return [ Math.atan2(x * sinc, ρ * cosc), Math.asin(ρ && y * sinc / ρ) ]; 1.4580 + }; 1.4581 + return azimuthal; 1.4582 + } 1.4583 + var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) { 1.4584 + return Math.sqrt(2 / (1 + cosλcosφ)); 1.4585 + }, function(ρ) { 1.4586 + return 2 * Math.asin(ρ / 2); 1.4587 + }); 1.4588 + (d3.geo.azimuthalEqualArea = function() { 1.4589 + return d3_geo_projection(d3_geo_azimuthalEqualArea); 1.4590 + }).raw = d3_geo_azimuthalEqualArea; 1.4591 + var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) { 1.4592 + var c = Math.acos(cosλcosφ); 1.4593 + return c && c / Math.sin(c); 1.4594 + }, d3_identity); 1.4595 + (d3.geo.azimuthalEquidistant = function() { 1.4596 + return d3_geo_projection(d3_geo_azimuthalEquidistant); 1.4597 + }).raw = d3_geo_azimuthalEquidistant; 1.4598 + function d3_geo_conicConformal(φ0, φ1) { 1.4599 + var cosφ0 = Math.cos(φ0), t = function(φ) { 1.4600 + return Math.tan(π / 4 + φ / 2); 1.4601 + }, 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; 1.4602 + if (!n) return d3_geo_mercator; 1.4603 + function forward(λ, φ) { 1.4604 + var ρ = abs(abs(φ) - halfπ) < ε ? 0 : F / Math.pow(t(φ), n); 1.4605 + return [ ρ * Math.sin(n * λ), F - ρ * Math.cos(n * λ) ]; 1.4606 + } 1.4607 + forward.invert = function(x, y) { 1.4608 + var ρ0_y = F - y, ρ = d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y); 1.4609 + return [ Math.atan2(x, ρ0_y) / n, 2 * Math.atan(Math.pow(F / ρ, 1 / n)) - halfπ ]; 1.4610 + }; 1.4611 + return forward; 1.4612 + } 1.4613 + (d3.geo.conicConformal = function() { 1.4614 + return d3_geo_conic(d3_geo_conicConformal); 1.4615 + }).raw = d3_geo_conicConformal; 1.4616 + function d3_geo_conicEquidistant(φ0, φ1) { 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; 1.4618 + if (abs(n) < ε) return d3_geo_equirectangular; 1.4619 + function forward(λ, φ) { 1.4620 + var ρ = G - φ; 1.4621 + return [ ρ * Math.sin(n * λ), G - ρ * Math.cos(n * λ) ]; 1.4622 + } 1.4623 + forward.invert = function(x, y) { 1.4624 + var ρ0_y = G - y; 1.4625 + return [ Math.atan2(x, ρ0_y) / n, G - d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y) ]; 1.4626 + }; 1.4627 + return forward; 1.4628 + } 1.4629 + (d3.geo.conicEquidistant = function() { 1.4630 + return d3_geo_conic(d3_geo_conicEquidistant); 1.4631 + }).raw = d3_geo_conicEquidistant; 1.4632 + var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) { 1.4633 + return 1 / cosλcosφ; 1.4634 + }, Math.atan); 1.4635 + (d3.geo.gnomonic = function() { 1.4636 + return d3_geo_projection(d3_geo_gnomonic); 1.4637 + }).raw = d3_geo_gnomonic; 1.4638 + function d3_geo_mercator(λ, φ) { 1.4639 + return [ λ, Math.log(Math.tan(π / 4 + φ / 2)) ]; 1.4640 + } 1.4641 + d3_geo_mercator.invert = function(x, y) { 1.4642 + return [ x, 2 * Math.atan(Math.exp(y)) - halfπ ]; 1.4643 + }; 1.4644 + function d3_geo_mercatorProjection(project) { 1.4645 + var m = d3_geo_projection(project), scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, clipAuto; 1.4646 + m.scale = function() { 1.4647 + var v = scale.apply(m, arguments); 1.4648 + return v === m ? clipAuto ? m.clipExtent(null) : m : v; 1.4649 + }; 1.4650 + m.translate = function() { 1.4651 + var v = translate.apply(m, arguments); 1.4652 + return v === m ? clipAuto ? m.clipExtent(null) : m : v; 1.4653 + }; 1.4654 + m.clipExtent = function(_) { 1.4655 + var v = clipExtent.apply(m, arguments); 1.4656 + if (v === m) { 1.4657 + if (clipAuto = _ == null) { 1.4658 + var k = π * scale(), t = translate(); 1.4659 + clipExtent([ [ t[0] - k, t[1] - k ], [ t[0] + k, t[1] + k ] ]); 1.4660 + } 1.4661 + } else if (clipAuto) { 1.4662 + v = null; 1.4663 + } 1.4664 + return v; 1.4665 + }; 1.4666 + return m.clipExtent(null); 1.4667 + } 1.4668 + (d3.geo.mercator = function() { 1.4669 + return d3_geo_mercatorProjection(d3_geo_mercator); 1.4670 + }).raw = d3_geo_mercator; 1.4671 + var d3_geo_orthographic = d3_geo_azimuthal(function() { 1.4672 + return 1; 1.4673 + }, Math.asin); 1.4674 + (d3.geo.orthographic = function() { 1.4675 + return d3_geo_projection(d3_geo_orthographic); 1.4676 + }).raw = d3_geo_orthographic; 1.4677 + var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) { 1.4678 + return 1 / (1 + cosλcosφ); 1.4679 + }, function(ρ) { 1.4680 + return 2 * Math.atan(ρ); 1.4681 + }); 1.4682 + (d3.geo.stereographic = function() { 1.4683 + return d3_geo_projection(d3_geo_stereographic); 1.4684 + }).raw = d3_geo_stereographic; 1.4685 + function d3_geo_transverseMercator(λ, φ) { 1.4686 + return [ Math.log(Math.tan(π / 4 + φ / 2)), -λ ]; 1.4687 + } 1.4688 + d3_geo_transverseMercator.invert = function(x, y) { 1.4689 + return [ -y, 2 * Math.atan(Math.exp(x)) - halfπ ]; 1.4690 + }; 1.4691 + (d3.geo.transverseMercator = function() { 1.4692 + var projection = d3_geo_mercatorProjection(d3_geo_transverseMercator), center = projection.center, rotate = projection.rotate; 1.4693 + projection.center = function(_) { 1.4694 + return _ ? center([ -_[1], _[0] ]) : (_ = center(), [ -_[1], _[0] ]); 1.4695 + }; 1.4696 + projection.rotate = function(_) { 1.4697 + return _ ? rotate([ _[0], _[1], _.length > 2 ? _[2] + 90 : 90 ]) : (_ = rotate(), 1.4698 + [ _[0], _[1], _[2] - 90 ]); 1.4699 + }; 1.4700 + return projection.rotate([ 0, 0 ]); 1.4701 + }).raw = d3_geo_transverseMercator; 1.4702 + d3.geom = {}; 1.4703 + function d3_geom_pointX(d) { 1.4704 + return d[0]; 1.4705 + } 1.4706 + function d3_geom_pointY(d) { 1.4707 + return d[1]; 1.4708 + } 1.4709 + d3.geom.hull = function(vertices) { 1.4710 + var x = d3_geom_pointX, y = d3_geom_pointY; 1.4711 + if (arguments.length) return hull(vertices); 1.4712 + function hull(data) { 1.4713 + if (data.length < 3) return []; 1.4714 + var fx = d3_functor(x), fy = d3_functor(y), i, n = data.length, points = [], flippedPoints = []; 1.4715 + for (i = 0; i < n; i++) { 1.4716 + points.push([ +fx.call(this, data[i], i), +fy.call(this, data[i], i), i ]); 1.4717 + } 1.4718 + points.sort(d3_geom_hullOrder); 1.4719 + for (i = 0; i < n; i++) flippedPoints.push([ points[i][0], -points[i][1] ]); 1.4720 + var upper = d3_geom_hullUpper(points), lower = d3_geom_hullUpper(flippedPoints); 1.4721 + var skipLeft = lower[0] === upper[0], skipRight = lower[lower.length - 1] === upper[upper.length - 1], polygon = []; 1.4722 + for (i = upper.length - 1; i >= 0; --i) polygon.push(data[points[upper[i]][2]]); 1.4723 + for (i = +skipLeft; i < lower.length - skipRight; ++i) polygon.push(data[points[lower[i]][2]]); 1.4724 + return polygon; 1.4725 + } 1.4726 + hull.x = function(_) { 1.4727 + return arguments.length ? (x = _, hull) : x; 1.4728 + }; 1.4729 + hull.y = function(_) { 1.4730 + return arguments.length ? (y = _, hull) : y; 1.4731 + }; 1.4732 + return hull; 1.4733 + }; 1.4734 + function d3_geom_hullUpper(points) { 1.4735 + var n = points.length, hull = [ 0, 1 ], hs = 2; 1.4736 + for (var i = 2; i < n; i++) { 1.4737 + while (hs > 1 && d3_cross2d(points[hull[hs - 2]], points[hull[hs - 1]], points[i]) <= 0) --hs; 1.4738 + hull[hs++] = i; 1.4739 + } 1.4740 + return hull.slice(0, hs); 1.4741 + } 1.4742 + function d3_geom_hullOrder(a, b) { 1.4743 + return a[0] - b[0] || a[1] - b[1]; 1.4744 + } 1.4745 + d3.geom.polygon = function(coordinates) { 1.4746 + d3_subclass(coordinates, d3_geom_polygonPrototype); 1.4747 + return coordinates; 1.4748 + }; 1.4749 + var d3_geom_polygonPrototype = d3.geom.polygon.prototype = []; 1.4750 + d3_geom_polygonPrototype.area = function() { 1.4751 + var i = -1, n = this.length, a, b = this[n - 1], area = 0; 1.4752 + while (++i < n) { 1.4753 + a = b; 1.4754 + b = this[i]; 1.4755 + area += a[1] * b[0] - a[0] * b[1]; 1.4756 + } 1.4757 + return area * .5; 1.4758 + }; 1.4759 + d3_geom_polygonPrototype.centroid = function(k) { 1.4760 + var i = -1, n = this.length, x = 0, y = 0, a, b = this[n - 1], c; 1.4761 + if (!arguments.length) k = -1 / (6 * this.area()); 1.4762 + while (++i < n) { 1.4763 + a = b; 1.4764 + b = this[i]; 1.4765 + c = a[0] * b[1] - b[0] * a[1]; 1.4766 + x += (a[0] + b[0]) * c; 1.4767 + y += (a[1] + b[1]) * c; 1.4768 + } 1.4769 + return [ x * k, y * k ]; 1.4770 + }; 1.4771 + d3_geom_polygonPrototype.clip = function(subject) { 1.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; 1.4773 + while (++i < n) { 1.4774 + input = subject.slice(); 1.4775 + subject.length = 0; 1.4776 + b = this[i]; 1.4777 + c = input[(m = input.length - closed) - 1]; 1.4778 + j = -1; 1.4779 + while (++j < m) { 1.4780 + d = input[j]; 1.4781 + if (d3_geom_polygonInside(d, a, b)) { 1.4782 + if (!d3_geom_polygonInside(c, a, b)) { 1.4783 + subject.push(d3_geom_polygonIntersect(c, d, a, b)); 1.4784 + } 1.4785 + subject.push(d); 1.4786 + } else if (d3_geom_polygonInside(c, a, b)) { 1.4787 + subject.push(d3_geom_polygonIntersect(c, d, a, b)); 1.4788 + } 1.4789 + c = d; 1.4790 + } 1.4791 + if (closed) subject.push(subject[0]); 1.4792 + a = b; 1.4793 + } 1.4794 + return subject; 1.4795 + }; 1.4796 + function d3_geom_polygonInside(p, a, b) { 1.4797 + return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); 1.4798 + } 1.4799 + function d3_geom_polygonIntersect(c, d, a, b) { 1.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); 1.4801 + return [ x1 + ua * x21, y1 + ua * y21 ]; 1.4802 + } 1.4803 + function d3_geom_polygonClosed(coordinates) { 1.4804 + var a = coordinates[0], b = coordinates[coordinates.length - 1]; 1.4805 + return !(a[0] - b[0] || a[1] - b[1]); 1.4806 + } 1.4807 + var d3_geom_voronoiEdges, d3_geom_voronoiCells, d3_geom_voronoiBeaches, d3_geom_voronoiBeachPool = [], d3_geom_voronoiFirstCircle, d3_geom_voronoiCircles, d3_geom_voronoiCirclePool = []; 1.4808 + function d3_geom_voronoiBeach() { 1.4809 + d3_geom_voronoiRedBlackNode(this); 1.4810 + this.edge = this.site = this.circle = null; 1.4811 + } 1.4812 + function d3_geom_voronoiCreateBeach(site) { 1.4813 + var beach = d3_geom_voronoiBeachPool.pop() || new d3_geom_voronoiBeach(); 1.4814 + beach.site = site; 1.4815 + return beach; 1.4816 + } 1.4817 + function d3_geom_voronoiDetachBeach(beach) { 1.4818 + d3_geom_voronoiDetachCircle(beach); 1.4819 + d3_geom_voronoiBeaches.remove(beach); 1.4820 + d3_geom_voronoiBeachPool.push(beach); 1.4821 + d3_geom_voronoiRedBlackNode(beach); 1.4822 + } 1.4823 + function d3_geom_voronoiRemoveBeach(beach) { 1.4824 + var circle = beach.circle, x = circle.x, y = circle.cy, vertex = { 1.4825 + x: x, 1.4826 + y: y 1.4827 + }, previous = beach.P, next = beach.N, disappearing = [ beach ]; 1.4828 + d3_geom_voronoiDetachBeach(beach); 1.4829 + var lArc = previous; 1.4830 + while (lArc.circle && abs(x - lArc.circle.x) < ε && abs(y - lArc.circle.cy) < ε) { 1.4831 + previous = lArc.P; 1.4832 + disappearing.unshift(lArc); 1.4833 + d3_geom_voronoiDetachBeach(lArc); 1.4834 + lArc = previous; 1.4835 + } 1.4836 + disappearing.unshift(lArc); 1.4837 + d3_geom_voronoiDetachCircle(lArc); 1.4838 + var rArc = next; 1.4839 + while (rArc.circle && abs(x - rArc.circle.x) < ε && abs(y - rArc.circle.cy) < ε) { 1.4840 + next = rArc.N; 1.4841 + disappearing.push(rArc); 1.4842 + d3_geom_voronoiDetachBeach(rArc); 1.4843 + rArc = next; 1.4844 + } 1.4845 + disappearing.push(rArc); 1.4846 + d3_geom_voronoiDetachCircle(rArc); 1.4847 + var nArcs = disappearing.length, iArc; 1.4848 + for (iArc = 1; iArc < nArcs; ++iArc) { 1.4849 + rArc = disappearing[iArc]; 1.4850 + lArc = disappearing[iArc - 1]; 1.4851 + d3_geom_voronoiSetEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex); 1.4852 + } 1.4853 + lArc = disappearing[0]; 1.4854 + rArc = disappearing[nArcs - 1]; 1.4855 + rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, rArc.site, null, vertex); 1.4856 + d3_geom_voronoiAttachCircle(lArc); 1.4857 + d3_geom_voronoiAttachCircle(rArc); 1.4858 + } 1.4859 + function d3_geom_voronoiAddBeach(site) { 1.4860 + var x = site.x, directrix = site.y, lArc, rArc, dxl, dxr, node = d3_geom_voronoiBeaches._; 1.4861 + while (node) { 1.4862 + dxl = d3_geom_voronoiLeftBreakPoint(node, directrix) - x; 1.4863 + if (dxl > ε) node = node.L; else { 1.4864 + dxr = x - d3_geom_voronoiRightBreakPoint(node, directrix); 1.4865 + if (dxr > ε) { 1.4866 + if (!node.R) { 1.4867 + lArc = node; 1.4868 + break; 1.4869 + } 1.4870 + node = node.R; 1.4871 + } else { 1.4872 + if (dxl > -ε) { 1.4873 + lArc = node.P; 1.4874 + rArc = node; 1.4875 + } else if (dxr > -ε) { 1.4876 + lArc = node; 1.4877 + rArc = node.N; 1.4878 + } else { 1.4879 + lArc = rArc = node; 1.4880 + } 1.4881 + break; 1.4882 + } 1.4883 + } 1.4884 + } 1.4885 + var newArc = d3_geom_voronoiCreateBeach(site); 1.4886 + d3_geom_voronoiBeaches.insert(lArc, newArc); 1.4887 + if (!lArc && !rArc) return; 1.4888 + if (lArc === rArc) { 1.4889 + d3_geom_voronoiDetachCircle(lArc); 1.4890 + rArc = d3_geom_voronoiCreateBeach(lArc.site); 1.4891 + d3_geom_voronoiBeaches.insert(newArc, rArc); 1.4892 + newArc.edge = rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site); 1.4893 + d3_geom_voronoiAttachCircle(lArc); 1.4894 + d3_geom_voronoiAttachCircle(rArc); 1.4895 + return; 1.4896 + } 1.4897 + if (!rArc) { 1.4898 + newArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site); 1.4899 + return; 1.4900 + } 1.4901 + d3_geom_voronoiDetachCircle(lArc); 1.4902 + d3_geom_voronoiDetachCircle(rArc); 1.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 = { 1.4904 + x: (cy * hb - by * hc) / d + ax, 1.4905 + y: (bx * hc - cx * hb) / d + ay 1.4906 + }; 1.4907 + d3_geom_voronoiSetEdgeEnd(rArc.edge, lSite, rSite, vertex); 1.4908 + newArc.edge = d3_geom_voronoiCreateEdge(lSite, site, null, vertex); 1.4909 + rArc.edge = d3_geom_voronoiCreateEdge(site, rSite, null, vertex); 1.4910 + d3_geom_voronoiAttachCircle(lArc); 1.4911 + d3_geom_voronoiAttachCircle(rArc); 1.4912 + } 1.4913 + function d3_geom_voronoiLeftBreakPoint(arc, directrix) { 1.4914 + var site = arc.site, rfocx = site.x, rfocy = site.y, pby2 = rfocy - directrix; 1.4915 + if (!pby2) return rfocx; 1.4916 + var lArc = arc.P; 1.4917 + if (!lArc) return -Infinity; 1.4918 + site = lArc.site; 1.4919 + var lfocx = site.x, lfocy = site.y, plby2 = lfocy - directrix; 1.4920 + if (!plby2) return lfocx; 1.4921 + var hl = lfocx - rfocx, aby2 = 1 / pby2 - 1 / plby2, b = hl / plby2; 1.4922 + if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx; 1.4923 + return (rfocx + lfocx) / 2; 1.4924 + } 1.4925 + function d3_geom_voronoiRightBreakPoint(arc, directrix) { 1.4926 + var rArc = arc.N; 1.4927 + if (rArc) return d3_geom_voronoiLeftBreakPoint(rArc, directrix); 1.4928 + var site = arc.site; 1.4929 + return site.y === directrix ? site.x : Infinity; 1.4930 + } 1.4931 + function d3_geom_voronoiCell(site) { 1.4932 + this.site = site; 1.4933 + this.edges = []; 1.4934 + } 1.4935 + d3_geom_voronoiCell.prototype.prepare = function() { 1.4936 + var halfEdges = this.edges, iHalfEdge = halfEdges.length, edge; 1.4937 + while (iHalfEdge--) { 1.4938 + edge = halfEdges[iHalfEdge].edge; 1.4939 + if (!edge.b || !edge.a) halfEdges.splice(iHalfEdge, 1); 1.4940 + } 1.4941 + halfEdges.sort(d3_geom_voronoiHalfEdgeOrder); 1.4942 + return halfEdges.length; 1.4943 + }; 1.4944 + function d3_geom_voronoiCloseCells(extent) { 1.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; 1.4946 + while (iCell--) { 1.4947 + cell = cells[iCell]; 1.4948 + if (!cell || !cell.prepare()) continue; 1.4949 + halfEdges = cell.edges; 1.4950 + nHalfEdges = halfEdges.length; 1.4951 + iHalfEdge = 0; 1.4952 + while (iHalfEdge < nHalfEdges) { 1.4953 + end = halfEdges[iHalfEdge].end(), x3 = end.x, y3 = end.y; 1.4954 + start = halfEdges[++iHalfEdge % nHalfEdges].start(), x2 = start.x, y2 = start.y; 1.4955 + if (abs(x3 - x2) > ε || abs(y3 - y2) > ε) { 1.4956 + halfEdges.splice(iHalfEdge, 0, new d3_geom_voronoiHalfEdge(d3_geom_voronoiCreateBorderEdge(cell.site, end, abs(x3 - x0) < ε && y1 - y3 > ε ? { 1.4957 + x: x0, 1.4958 + y: abs(x2 - x0) < ε ? y2 : y1 1.4959 + } : abs(y3 - y1) < ε && x1 - x3 > ε ? { 1.4960 + x: abs(y2 - y1) < ε ? x2 : x1, 1.4961 + y: y1 1.4962 + } : abs(x3 - x1) < ε && y3 - y0 > ε ? { 1.4963 + x: x1, 1.4964 + y: abs(x2 - x1) < ε ? y2 : y0 1.4965 + } : abs(y3 - y0) < ε && x3 - x0 > ε ? { 1.4966 + x: abs(y2 - y0) < ε ? x2 : x0, 1.4967 + y: y0 1.4968 + } : null), cell.site, null)); 1.4969 + ++nHalfEdges; 1.4970 + } 1.4971 + } 1.4972 + } 1.4973 + } 1.4974 + function d3_geom_voronoiHalfEdgeOrder(a, b) { 1.4975 + return b.angle - a.angle; 1.4976 + } 1.4977 + function d3_geom_voronoiCircle() { 1.4978 + d3_geom_voronoiRedBlackNode(this); 1.4979 + this.x = this.y = this.arc = this.site = this.cy = null; 1.4980 + } 1.4981 + function d3_geom_voronoiAttachCircle(arc) { 1.4982 + var lArc = arc.P, rArc = arc.N; 1.4983 + if (!lArc || !rArc) return; 1.4984 + var lSite = lArc.site, cSite = arc.site, rSite = rArc.site; 1.4985 + if (lSite === rSite) return; 1.4986 + var bx = cSite.x, by = cSite.y, ax = lSite.x - bx, ay = lSite.y - by, cx = rSite.x - bx, cy = rSite.y - by; 1.4987 + var d = 2 * (ax * cy - ay * cx); 1.4988 + if (d >= -ε2) return; 1.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; 1.4990 + var circle = d3_geom_voronoiCirclePool.pop() || new d3_geom_voronoiCircle(); 1.4991 + circle.arc = arc; 1.4992 + circle.site = cSite; 1.4993 + circle.x = x + bx; 1.4994 + circle.y = cy + Math.sqrt(x * x + y * y); 1.4995 + circle.cy = cy; 1.4996 + arc.circle = circle; 1.4997 + var before = null, node = d3_geom_voronoiCircles._; 1.4998 + while (node) { 1.4999 + if (circle.y < node.y || circle.y === node.y && circle.x <= node.x) { 1.5000 + if (node.L) node = node.L; else { 1.5001 + before = node.P; 1.5002 + break; 1.5003 + } 1.5004 + } else { 1.5005 + if (node.R) node = node.R; else { 1.5006 + before = node; 1.5007 + break; 1.5008 + } 1.5009 + } 1.5010 + } 1.5011 + d3_geom_voronoiCircles.insert(before, circle); 1.5012 + if (!before) d3_geom_voronoiFirstCircle = circle; 1.5013 + } 1.5014 + function d3_geom_voronoiDetachCircle(arc) { 1.5015 + var circle = arc.circle; 1.5016 + if (circle) { 1.5017 + if (!circle.P) d3_geom_voronoiFirstCircle = circle.N; 1.5018 + d3_geom_voronoiCircles.remove(circle); 1.5019 + d3_geom_voronoiCirclePool.push(circle); 1.5020 + d3_geom_voronoiRedBlackNode(circle); 1.5021 + arc.circle = null; 1.5022 + } 1.5023 + } 1.5024 + function d3_geom_voronoiClipEdges(extent) { 1.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; 1.5026 + while (i--) { 1.5027 + e = edges[i]; 1.5028 + if (!d3_geom_voronoiConnectEdge(e, extent) || !clip(e) || abs(e.a.x - e.b.x) < ε && abs(e.a.y - e.b.y) < ε) { 1.5029 + e.a = e.b = null; 1.5030 + edges.splice(i, 1); 1.5031 + } 1.5032 + } 1.5033 + } 1.5034 + function d3_geom_voronoiConnectEdge(edge, extent) { 1.5035 + var vb = edge.b; 1.5036 + if (vb) return true; 1.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; 1.5038 + if (ry === ly) { 1.5039 + if (fx < x0 || fx >= x1) return; 1.5040 + if (lx > rx) { 1.5041 + if (!va) va = { 1.5042 + x: fx, 1.5043 + y: y0 1.5044 + }; else if (va.y >= y1) return; 1.5045 + vb = { 1.5046 + x: fx, 1.5047 + y: y1 1.5048 + }; 1.5049 + } else { 1.5050 + if (!va) va = { 1.5051 + x: fx, 1.5052 + y: y1 1.5053 + }; else if (va.y < y0) return; 1.5054 + vb = { 1.5055 + x: fx, 1.5056 + y: y0 1.5057 + }; 1.5058 + } 1.5059 + } else { 1.5060 + fm = (lx - rx) / (ry - ly); 1.5061 + fb = fy - fm * fx; 1.5062 + if (fm < -1 || fm > 1) { 1.5063 + if (lx > rx) { 1.5064 + if (!va) va = { 1.5065 + x: (y0 - fb) / fm, 1.5066 + y: y0 1.5067 + }; else if (va.y >= y1) return; 1.5068 + vb = { 1.5069 + x: (y1 - fb) / fm, 1.5070 + y: y1 1.5071 + }; 1.5072 + } else { 1.5073 + if (!va) va = { 1.5074 + x: (y1 - fb) / fm, 1.5075 + y: y1 1.5076 + }; else if (va.y < y0) return; 1.5077 + vb = { 1.5078 + x: (y0 - fb) / fm, 1.5079 + y: y0 1.5080 + }; 1.5081 + } 1.5082 + } else { 1.5083 + if (ly < ry) { 1.5084 + if (!va) va = { 1.5085 + x: x0, 1.5086 + y: fm * x0 + fb 1.5087 + }; else if (va.x >= x1) return; 1.5088 + vb = { 1.5089 + x: x1, 1.5090 + y: fm * x1 + fb 1.5091 + }; 1.5092 + } else { 1.5093 + if (!va) va = { 1.5094 + x: x1, 1.5095 + y: fm * x1 + fb 1.5096 + }; else if (va.x < x0) return; 1.5097 + vb = { 1.5098 + x: x0, 1.5099 + y: fm * x0 + fb 1.5100 + }; 1.5101 + } 1.5102 + } 1.5103 + } 1.5104 + edge.a = va; 1.5105 + edge.b = vb; 1.5106 + return true; 1.5107 + } 1.5108 + function d3_geom_voronoiEdge(lSite, rSite) { 1.5109 + this.l = lSite; 1.5110 + this.r = rSite; 1.5111 + this.a = this.b = null; 1.5112 + } 1.5113 + function d3_geom_voronoiCreateEdge(lSite, rSite, va, vb) { 1.5114 + var edge = new d3_geom_voronoiEdge(lSite, rSite); 1.5115 + d3_geom_voronoiEdges.push(edge); 1.5116 + if (va) d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, va); 1.5117 + if (vb) d3_geom_voronoiSetEdgeEnd(edge, rSite, lSite, vb); 1.5118 + d3_geom_voronoiCells[lSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, lSite, rSite)); 1.5119 + d3_geom_voronoiCells[rSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, rSite, lSite)); 1.5120 + return edge; 1.5121 + } 1.5122 + function d3_geom_voronoiCreateBorderEdge(lSite, va, vb) { 1.5123 + var edge = new d3_geom_voronoiEdge(lSite, null); 1.5124 + edge.a = va; 1.5125 + edge.b = vb; 1.5126 + d3_geom_voronoiEdges.push(edge); 1.5127 + return edge; 1.5128 + } 1.5129 + function d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, vertex) { 1.5130 + if (!edge.a && !edge.b) { 1.5131 + edge.a = vertex; 1.5132 + edge.l = lSite; 1.5133 + edge.r = rSite; 1.5134 + } else if (edge.l === rSite) { 1.5135 + edge.b = vertex; 1.5136 + } else { 1.5137 + edge.a = vertex; 1.5138 + } 1.5139 + } 1.5140 + function d3_geom_voronoiHalfEdge(edge, lSite, rSite) { 1.5141 + var va = edge.a, vb = edge.b; 1.5142 + this.edge = edge; 1.5143 + this.site = lSite; 1.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); 1.5145 + } 1.5146 + d3_geom_voronoiHalfEdge.prototype = { 1.5147 + start: function() { 1.5148 + return this.edge.l === this.site ? this.edge.a : this.edge.b; 1.5149 + }, 1.5150 + end: function() { 1.5151 + return this.edge.l === this.site ? this.edge.b : this.edge.a; 1.5152 + } 1.5153 + }; 1.5154 + function d3_geom_voronoiRedBlackTree() { 1.5155 + this._ = null; 1.5156 + } 1.5157 + function d3_geom_voronoiRedBlackNode(node) { 1.5158 + node.U = node.C = node.L = node.R = node.P = node.N = null; 1.5159 + } 1.5160 + d3_geom_voronoiRedBlackTree.prototype = { 1.5161 + insert: function(after, node) { 1.5162 + var parent, grandpa, uncle; 1.5163 + if (after) { 1.5164 + node.P = after; 1.5165 + node.N = after.N; 1.5166 + if (after.N) after.N.P = node; 1.5167 + after.N = node; 1.5168 + if (after.R) { 1.5169 + after = after.R; 1.5170 + while (after.L) after = after.L; 1.5171 + after.L = node; 1.5172 + } else { 1.5173 + after.R = node; 1.5174 + } 1.5175 + parent = after; 1.5176 + } else if (this._) { 1.5177 + after = d3_geom_voronoiRedBlackFirst(this._); 1.5178 + node.P = null; 1.5179 + node.N = after; 1.5180 + after.P = after.L = node; 1.5181 + parent = after; 1.5182 + } else { 1.5183 + node.P = node.N = null; 1.5184 + this._ = node; 1.5185 + parent = null; 1.5186 + } 1.5187 + node.L = node.R = null; 1.5188 + node.U = parent; 1.5189 + node.C = true; 1.5190 + after = node; 1.5191 + while (parent && parent.C) { 1.5192 + grandpa = parent.U; 1.5193 + if (parent === grandpa.L) { 1.5194 + uncle = grandpa.R; 1.5195 + if (uncle && uncle.C) { 1.5196 + parent.C = uncle.C = false; 1.5197 + grandpa.C = true; 1.5198 + after = grandpa; 1.5199 + } else { 1.5200 + if (after === parent.R) { 1.5201 + d3_geom_voronoiRedBlackRotateLeft(this, parent); 1.5202 + after = parent; 1.5203 + parent = after.U; 1.5204 + } 1.5205 + parent.C = false; 1.5206 + grandpa.C = true; 1.5207 + d3_geom_voronoiRedBlackRotateRight(this, grandpa); 1.5208 + } 1.5209 + } else { 1.5210 + uncle = grandpa.L; 1.5211 + if (uncle && uncle.C) { 1.5212 + parent.C = uncle.C = false; 1.5213 + grandpa.C = true; 1.5214 + after = grandpa; 1.5215 + } else { 1.5216 + if (after === parent.L) { 1.5217 + d3_geom_voronoiRedBlackRotateRight(this, parent); 1.5218 + after = parent; 1.5219 + parent = after.U; 1.5220 + } 1.5221 + parent.C = false; 1.5222 + grandpa.C = true; 1.5223 + d3_geom_voronoiRedBlackRotateLeft(this, grandpa); 1.5224 + } 1.5225 + } 1.5226 + parent = after.U; 1.5227 + } 1.5228 + this._.C = false; 1.5229 + }, 1.5230 + remove: function(node) { 1.5231 + if (node.N) node.N.P = node.P; 1.5232 + if (node.P) node.P.N = node.N; 1.5233 + node.N = node.P = null; 1.5234 + var parent = node.U, sibling, left = node.L, right = node.R, next, red; 1.5235 + if (!left) next = right; else if (!right) next = left; else next = d3_geom_voronoiRedBlackFirst(right); 1.5236 + if (parent) { 1.5237 + if (parent.L === node) parent.L = next; else parent.R = next; 1.5238 + } else { 1.5239 + this._ = next; 1.5240 + } 1.5241 + if (left && right) { 1.5242 + red = next.C; 1.5243 + next.C = node.C; 1.5244 + next.L = left; 1.5245 + left.U = next; 1.5246 + if (next !== right) { 1.5247 + parent = next.U; 1.5248 + next.U = node.U; 1.5249 + node = next.R; 1.5250 + parent.L = node; 1.5251 + next.R = right; 1.5252 + right.U = next; 1.5253 + } else { 1.5254 + next.U = parent; 1.5255 + parent = next; 1.5256 + node = next.R; 1.5257 + } 1.5258 + } else { 1.5259 + red = node.C; 1.5260 + node = next; 1.5261 + } 1.5262 + if (node) node.U = parent; 1.5263 + if (red) return; 1.5264 + if (node && node.C) { 1.5265 + node.C = false; 1.5266 + return; 1.5267 + } 1.5268 + do { 1.5269 + if (node === this._) break; 1.5270 + if (node === parent.L) { 1.5271 + sibling = parent.R; 1.5272 + if (sibling.C) { 1.5273 + sibling.C = false; 1.5274 + parent.C = true; 1.5275 + d3_geom_voronoiRedBlackRotateLeft(this, parent); 1.5276 + sibling = parent.R; 1.5277 + } 1.5278 + if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) { 1.5279 + if (!sibling.R || !sibling.R.C) { 1.5280 + sibling.L.C = false; 1.5281 + sibling.C = true; 1.5282 + d3_geom_voronoiRedBlackRotateRight(this, sibling); 1.5283 + sibling = parent.R; 1.5284 + } 1.5285 + sibling.C = parent.C; 1.5286 + parent.C = sibling.R.C = false; 1.5287 + d3_geom_voronoiRedBlackRotateLeft(this, parent); 1.5288 + node = this._; 1.5289 + break; 1.5290 + } 1.5291 + } else { 1.5292 + sibling = parent.L; 1.5293 + if (sibling.C) { 1.5294 + sibling.C = false; 1.5295 + parent.C = true; 1.5296 + d3_geom_voronoiRedBlackRotateRight(this, parent); 1.5297 + sibling = parent.L; 1.5298 + } 1.5299 + if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) { 1.5300 + if (!sibling.L || !sibling.L.C) { 1.5301 + sibling.R.C = false; 1.5302 + sibling.C = true; 1.5303 + d3_geom_voronoiRedBlackRotateLeft(this, sibling); 1.5304 + sibling = parent.L; 1.5305 + } 1.5306 + sibling.C = parent.C; 1.5307 + parent.C = sibling.L.C = false; 1.5308 + d3_geom_voronoiRedBlackRotateRight(this, parent); 1.5309 + node = this._; 1.5310 + break; 1.5311 + } 1.5312 + } 1.5313 + sibling.C = true; 1.5314 + node = parent; 1.5315 + parent = parent.U; 1.5316 + } while (!node.C); 1.5317 + if (node) node.C = false; 1.5318 + } 1.5319 + }; 1.5320 + function d3_geom_voronoiRedBlackRotateLeft(tree, node) { 1.5321 + var p = node, q = node.R, parent = p.U; 1.5322 + if (parent) { 1.5323 + if (parent.L === p) parent.L = q; else parent.R = q; 1.5324 + } else { 1.5325 + tree._ = q; 1.5326 + } 1.5327 + q.U = parent; 1.5328 + p.U = q; 1.5329 + p.R = q.L; 1.5330 + if (p.R) p.R.U = p; 1.5331 + q.L = p; 1.5332 + } 1.5333 + function d3_geom_voronoiRedBlackRotateRight(tree, node) { 1.5334 + var p = node, q = node.L, parent = p.U; 1.5335 + if (parent) { 1.5336 + if (parent.L === p) parent.L = q; else parent.R = q; 1.5337 + } else { 1.5338 + tree._ = q; 1.5339 + } 1.5340 + q.U = parent; 1.5341 + p.U = q; 1.5342 + p.L = q.R; 1.5343 + if (p.L) p.L.U = p; 1.5344 + q.R = p; 1.5345 + } 1.5346 + function d3_geom_voronoiRedBlackFirst(node) { 1.5347 + while (node.L) node = node.L; 1.5348 + return node; 1.5349 + } 1.5350 + function d3_geom_voronoi(sites, bbox) { 1.5351 + var site = sites.sort(d3_geom_voronoiVertexOrder).pop(), x0, y0, circle; 1.5352 + d3_geom_voronoiEdges = []; 1.5353 + d3_geom_voronoiCells = new Array(sites.length); 1.5354 + d3_geom_voronoiBeaches = new d3_geom_voronoiRedBlackTree(); 1.5355 + d3_geom_voronoiCircles = new d3_geom_voronoiRedBlackTree(); 1.5356 + while (true) { 1.5357 + circle = d3_geom_voronoiFirstCircle; 1.5358 + if (site && (!circle || site.y < circle.y || site.y === circle.y && site.x < circle.x)) { 1.5359 + if (site.x !== x0 || site.y !== y0) { 1.5360 + d3_geom_voronoiCells[site.i] = new d3_geom_voronoiCell(site); 1.5361 + d3_geom_voronoiAddBeach(site); 1.5362 + x0 = site.x, y0 = site.y; 1.5363 + } 1.5364 + site = sites.pop(); 1.5365 + } else if (circle) { 1.5366 + d3_geom_voronoiRemoveBeach(circle.arc); 1.5367 + } else { 1.5368 + break; 1.5369 + } 1.5370 + } 1.5371 + if (bbox) d3_geom_voronoiClipEdges(bbox), d3_geom_voronoiCloseCells(bbox); 1.5372 + var diagram = { 1.5373 + cells: d3_geom_voronoiCells, 1.5374 + edges: d3_geom_voronoiEdges 1.5375 + }; 1.5376 + d3_geom_voronoiBeaches = d3_geom_voronoiCircles = d3_geom_voronoiEdges = d3_geom_voronoiCells = null; 1.5377 + return diagram; 1.5378 + } 1.5379 + function d3_geom_voronoiVertexOrder(a, b) { 1.5380 + return b.y - a.y || b.x - a.x; 1.5381 + } 1.5382 + d3.geom.voronoi = function(points) { 1.5383 + var x = d3_geom_pointX, y = d3_geom_pointY, fx = x, fy = y, clipExtent = d3_geom_voronoiClipExtent; 1.5384 + if (points) return voronoi(points); 1.5385 + function voronoi(data) { 1.5386 + var polygons = new Array(data.length), x0 = clipExtent[0][0], y0 = clipExtent[0][1], x1 = clipExtent[1][0], y1 = clipExtent[1][1]; 1.5387 + d3_geom_voronoi(sites(data), clipExtent).cells.forEach(function(cell, i) { 1.5388 + var edges = cell.edges, site = cell.site, polygon = polygons[i] = edges.length ? edges.map(function(e) { 1.5389 + var s = e.start(); 1.5390 + return [ s.x, s.y ]; 1.5391 + }) : site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1 ? [ [ x0, y1 ], [ x1, y1 ], [ x1, y0 ], [ x0, y0 ] ] : []; 1.5392 + polygon.point = data[i]; 1.5393 + }); 1.5394 + return polygons; 1.5395 + } 1.5396 + function sites(data) { 1.5397 + return data.map(function(d, i) { 1.5398 + return { 1.5399 + x: Math.round(fx(d, i) / ε) * ε, 1.5400 + y: Math.round(fy(d, i) / ε) * ε, 1.5401 + i: i 1.5402 + }; 1.5403 + }); 1.5404 + } 1.5405 + voronoi.links = function(data) { 1.5406 + return d3_geom_voronoi(sites(data)).edges.filter(function(edge) { 1.5407 + return edge.l && edge.r; 1.5408 + }).map(function(edge) { 1.5409 + return { 1.5410 + source: data[edge.l.i], 1.5411 + target: data[edge.r.i] 1.5412 + }; 1.5413 + }); 1.5414 + }; 1.5415 + voronoi.triangles = function(data) { 1.5416 + var triangles = []; 1.5417 + d3_geom_voronoi(sites(data)).cells.forEach(function(cell, i) { 1.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; 1.5419 + while (++j < m) { 1.5420 + e0 = e1; 1.5421 + s0 = s1; 1.5422 + e1 = edges[j].edge; 1.5423 + s1 = e1.l === site ? e1.r : e1.l; 1.5424 + if (i < s0.i && i < s1.i && d3_geom_voronoiTriangleArea(site, s0, s1) < 0) { 1.5425 + triangles.push([ data[i], data[s0.i], data[s1.i] ]); 1.5426 + } 1.5427 + } 1.5428 + }); 1.5429 + return triangles; 1.5430 + }; 1.5431 + voronoi.x = function(_) { 1.5432 + return arguments.length ? (fx = d3_functor(x = _), voronoi) : x; 1.5433 + }; 1.5434 + voronoi.y = function(_) { 1.5435 + return arguments.length ? (fy = d3_functor(y = _), voronoi) : y; 1.5436 + }; 1.5437 + voronoi.clipExtent = function(_) { 1.5438 + if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent; 1.5439 + clipExtent = _ == null ? d3_geom_voronoiClipExtent : _; 1.5440 + return voronoi; 1.5441 + }; 1.5442 + voronoi.size = function(_) { 1.5443 + if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent && clipExtent[1]; 1.5444 + return voronoi.clipExtent(_ && [ [ 0, 0 ], _ ]); 1.5445 + }; 1.5446 + return voronoi; 1.5447 + }; 1.5448 + var d3_geom_voronoiClipExtent = [ [ -1e6, -1e6 ], [ 1e6, 1e6 ] ]; 1.5449 + function d3_geom_voronoiTriangleArea(a, b, c) { 1.5450 + return (a.x - c.x) * (b.y - a.y) - (a.x - b.x) * (c.y - a.y); 1.5451 + } 1.5452 + d3.geom.delaunay = function(vertices) { 1.5453 + return d3.geom.voronoi().triangles(vertices); 1.5454 + }; 1.5455 + d3.geom.quadtree = function(points, x1, y1, x2, y2) { 1.5456 + var x = d3_geom_pointX, y = d3_geom_pointY, compat; 1.5457 + if (compat = arguments.length) { 1.5458 + x = d3_geom_quadtreeCompatX; 1.5459 + y = d3_geom_quadtreeCompatY; 1.5460 + if (compat === 3) { 1.5461 + y2 = y1; 1.5462 + x2 = x1; 1.5463 + y1 = x1 = 0; 1.5464 + } 1.5465 + return quadtree(points); 1.5466 + } 1.5467 + function quadtree(data) { 1.5468 + var d, fx = d3_functor(x), fy = d3_functor(y), xs, ys, i, n, x1_, y1_, x2_, y2_; 1.5469 + if (x1 != null) { 1.5470 + x1_ = x1, y1_ = y1, x2_ = x2, y2_ = y2; 1.5471 + } else { 1.5472 + x2_ = y2_ = -(x1_ = y1_ = Infinity); 1.5473 + xs = [], ys = []; 1.5474 + n = data.length; 1.5475 + if (compat) for (i = 0; i < n; ++i) { 1.5476 + d = data[i]; 1.5477 + if (d.x < x1_) x1_ = d.x; 1.5478 + if (d.y < y1_) y1_ = d.y; 1.5479 + if (d.x > x2_) x2_ = d.x; 1.5480 + if (d.y > y2_) y2_ = d.y; 1.5481 + xs.push(d.x); 1.5482 + ys.push(d.y); 1.5483 + } else for (i = 0; i < n; ++i) { 1.5484 + var x_ = +fx(d = data[i], i), y_ = +fy(d, i); 1.5485 + if (x_ < x1_) x1_ = x_; 1.5486 + if (y_ < y1_) y1_ = y_; 1.5487 + if (x_ > x2_) x2_ = x_; 1.5488 + if (y_ > y2_) y2_ = y_; 1.5489 + xs.push(x_); 1.5490 + ys.push(y_); 1.5491 + } 1.5492 + } 1.5493 + var dx = x2_ - x1_, dy = y2_ - y1_; 1.5494 + if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy; 1.5495 + function insert(n, d, x, y, x1, y1, x2, y2) { 1.5496 + if (isNaN(x) || isNaN(y)) return; 1.5497 + if (n.leaf) { 1.5498 + var nx = n.x, ny = n.y; 1.5499 + if (nx != null) { 1.5500 + if (abs(nx - x) + abs(ny - y) < .01) { 1.5501 + insertChild(n, d, x, y, x1, y1, x2, y2); 1.5502 + } else { 1.5503 + var nPoint = n.point; 1.5504 + n.x = n.y = n.point = null; 1.5505 + insertChild(n, nPoint, nx, ny, x1, y1, x2, y2); 1.5506 + insertChild(n, d, x, y, x1, y1, x2, y2); 1.5507 + } 1.5508 + } else { 1.5509 + n.x = x, n.y = y, n.point = d; 1.5510 + } 1.5511 + } else { 1.5512 + insertChild(n, d, x, y, x1, y1, x2, y2); 1.5513 + } 1.5514 + } 1.5515 + function insertChild(n, d, x, y, x1, y1, x2, y2) { 1.5516 + var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = x >= sx, bottom = y >= sy, i = (bottom << 1) + right; 1.5517 + n.leaf = false; 1.5518 + n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); 1.5519 + if (right) x1 = sx; else x2 = sx; 1.5520 + if (bottom) y1 = sy; else y2 = sy; 1.5521 + insert(n, d, x, y, x1, y1, x2, y2); 1.5522 + } 1.5523 + var root = d3_geom_quadtreeNode(); 1.5524 + root.add = function(d) { 1.5525 + insert(root, d, +fx(d, ++i), +fy(d, i), x1_, y1_, x2_, y2_); 1.5526 + }; 1.5527 + root.visit = function(f) { 1.5528 + d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_); 1.5529 + }; 1.5530 + i = -1; 1.5531 + if (x1 == null) { 1.5532 + while (++i < n) { 1.5533 + insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_); 1.5534 + } 1.5535 + --i; 1.5536 + } else data.forEach(root.add); 1.5537 + xs = ys = data = d = null; 1.5538 + return root; 1.5539 + } 1.5540 + quadtree.x = function(_) { 1.5541 + return arguments.length ? (x = _, quadtree) : x; 1.5542 + }; 1.5543 + quadtree.y = function(_) { 1.5544 + return arguments.length ? (y = _, quadtree) : y; 1.5545 + }; 1.5546 + quadtree.extent = function(_) { 1.5547 + if (!arguments.length) return x1 == null ? null : [ [ x1, y1 ], [ x2, y2 ] ]; 1.5548 + if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = +_[0][0], y1 = +_[0][1], x2 = +_[1][0], 1.5549 + y2 = +_[1][1]; 1.5550 + return quadtree; 1.5551 + }; 1.5552 + quadtree.size = function(_) { 1.5553 + if (!arguments.length) return x1 == null ? null : [ x2 - x1, y2 - y1 ]; 1.5554 + if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = y1 = 0, x2 = +_[0], y2 = +_[1]; 1.5555 + return quadtree; 1.5556 + }; 1.5557 + return quadtree; 1.5558 + }; 1.5559 + function d3_geom_quadtreeCompatX(d) { 1.5560 + return d.x; 1.5561 + } 1.5562 + function d3_geom_quadtreeCompatY(d) { 1.5563 + return d.y; 1.5564 + } 1.5565 + function d3_geom_quadtreeNode() { 1.5566 + return { 1.5567 + leaf: true, 1.5568 + nodes: [], 1.5569 + point: null, 1.5570 + x: null, 1.5571 + y: null 1.5572 + }; 1.5573 + } 1.5574 + function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { 1.5575 + if (!f(node, x1, y1, x2, y2)) { 1.5576 + var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes; 1.5577 + if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); 1.5578 + if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); 1.5579 + if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); 1.5580 + if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); 1.5581 + } 1.5582 + } 1.5583 + d3.interpolateRgb = d3_interpolateRgb; 1.5584 + function d3_interpolateRgb(a, b) { 1.5585 + a = d3.rgb(a); 1.5586 + b = d3.rgb(b); 1.5587 + var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab; 1.5588 + return function(t) { 1.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)); 1.5590 + }; 1.5591 + } 1.5592 + d3.interpolateObject = d3_interpolateObject; 1.5593 + function d3_interpolateObject(a, b) { 1.5594 + var i = {}, c = {}, k; 1.5595 + for (k in a) { 1.5596 + if (k in b) { 1.5597 + i[k] = d3_interpolate(a[k], b[k]); 1.5598 + } else { 1.5599 + c[k] = a[k]; 1.5600 + } 1.5601 + } 1.5602 + for (k in b) { 1.5603 + if (!(k in a)) { 1.5604 + c[k] = b[k]; 1.5605 + } 1.5606 + } 1.5607 + return function(t) { 1.5608 + for (k in i) c[k] = i[k](t); 1.5609 + return c; 1.5610 + }; 1.5611 + } 1.5612 + d3.interpolateNumber = d3_interpolateNumber; 1.5613 + function d3_interpolateNumber(a, b) { 1.5614 + b -= a = +a; 1.5615 + return function(t) { 1.5616 + return a + b * t; 1.5617 + }; 1.5618 + } 1.5619 + d3.interpolateString = d3_interpolateString; 1.5620 + function d3_interpolateString(a, b) { 1.5621 + var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o; 1.5622 + a = a + "", b = b + ""; 1.5623 + d3_interpolate_number.lastIndex = 0; 1.5624 + for (i = 0; m = d3_interpolate_number.exec(b); ++i) { 1.5625 + if (m.index) s.push(b.substring(s0, s1 = m.index)); 1.5626 + q.push({ 1.5627 + i: s.length, 1.5628 + x: m[0] 1.5629 + }); 1.5630 + s.push(null); 1.5631 + s0 = d3_interpolate_number.lastIndex; 1.5632 + } 1.5633 + if (s0 < b.length) s.push(b.substring(s0)); 1.5634 + for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) { 1.5635 + o = q[i]; 1.5636 + if (o.x == m[0]) { 1.5637 + if (o.i) { 1.5638 + if (s[o.i + 1] == null) { 1.5639 + s[o.i - 1] += o.x; 1.5640 + s.splice(o.i, 1); 1.5641 + for (j = i + 1; j < n; ++j) q[j].i--; 1.5642 + } else { 1.5643 + s[o.i - 1] += o.x + s[o.i + 1]; 1.5644 + s.splice(o.i, 2); 1.5645 + for (j = i + 1; j < n; ++j) q[j].i -= 2; 1.5646 + } 1.5647 + } else { 1.5648 + if (s[o.i + 1] == null) { 1.5649 + s[o.i] = o.x; 1.5650 + } else { 1.5651 + s[o.i] = o.x + s[o.i + 1]; 1.5652 + s.splice(o.i + 1, 1); 1.5653 + for (j = i + 1; j < n; ++j) q[j].i--; 1.5654 + } 1.5655 + } 1.5656 + q.splice(i, 1); 1.5657 + n--; 1.5658 + i--; 1.5659 + } else { 1.5660 + o.x = d3_interpolateNumber(parseFloat(m[0]), parseFloat(o.x)); 1.5661 + } 1.5662 + } 1.5663 + while (i < n) { 1.5664 + o = q.pop(); 1.5665 + if (s[o.i + 1] == null) { 1.5666 + s[o.i] = o.x; 1.5667 + } else { 1.5668 + s[o.i] = o.x + s[o.i + 1]; 1.5669 + s.splice(o.i + 1, 1); 1.5670 + } 1.5671 + n--; 1.5672 + } 1.5673 + if (s.length === 1) { 1.5674 + return s[0] == null ? (o = q[0].x, function(t) { 1.5675 + return o(t) + ""; 1.5676 + }) : function() { 1.5677 + return b; 1.5678 + }; 1.5679 + } 1.5680 + return function(t) { 1.5681 + for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t); 1.5682 + return s.join(""); 1.5683 + }; 1.5684 + } 1.5685 + var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g; 1.5686 + d3.interpolate = d3_interpolate; 1.5687 + function d3_interpolate(a, b) { 1.5688 + var i = d3.interpolators.length, f; 1.5689 + while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ; 1.5690 + return f; 1.5691 + } 1.5692 + d3.interpolators = [ function(a, b) { 1.5693 + var t = typeof b; 1.5694 + return (t === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) ? d3_interpolateRgb : d3_interpolateString : b instanceof d3_Color ? d3_interpolateRgb : t === "object" ? Array.isArray(b) ? d3_interpolateArray : d3_interpolateObject : d3_interpolateNumber)(a, b); 1.5695 + } ]; 1.5696 + d3.interpolateArray = d3_interpolateArray; 1.5697 + function d3_interpolateArray(a, b) { 1.5698 + var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i; 1.5699 + for (i = 0; i < n0; ++i) x.push(d3_interpolate(a[i], b[i])); 1.5700 + for (;i < na; ++i) c[i] = a[i]; 1.5701 + for (;i < nb; ++i) c[i] = b[i]; 1.5702 + return function(t) { 1.5703 + for (i = 0; i < n0; ++i) c[i] = x[i](t); 1.5704 + return c; 1.5705 + }; 1.5706 + } 1.5707 + var d3_ease_default = function() { 1.5708 + return d3_identity; 1.5709 + }; 1.5710 + var d3_ease = d3.map({ 1.5711 + linear: d3_ease_default, 1.5712 + poly: d3_ease_poly, 1.5713 + quad: function() { 1.5714 + return d3_ease_quad; 1.5715 + }, 1.5716 + cubic: function() { 1.5717 + return d3_ease_cubic; 1.5718 + }, 1.5719 + sin: function() { 1.5720 + return d3_ease_sin; 1.5721 + }, 1.5722 + exp: function() { 1.5723 + return d3_ease_exp; 1.5724 + }, 1.5725 + circle: function() { 1.5726 + return d3_ease_circle; 1.5727 + }, 1.5728 + elastic: d3_ease_elastic, 1.5729 + back: d3_ease_back, 1.5730 + bounce: function() { 1.5731 + return d3_ease_bounce; 1.5732 + } 1.5733 + }); 1.5734 + var d3_ease_mode = d3.map({ 1.5735 + "in": d3_identity, 1.5736 + out: d3_ease_reverse, 1.5737 + "in-out": d3_ease_reflect, 1.5738 + "out-in": function(f) { 1.5739 + return d3_ease_reflect(d3_ease_reverse(f)); 1.5740 + } 1.5741 + }); 1.5742 + d3.ease = function(name) { 1.5743 + var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in"; 1.5744 + t = d3_ease.get(t) || d3_ease_default; 1.5745 + m = d3_ease_mode.get(m) || d3_identity; 1.5746 + return d3_ease_clamp(m(t.apply(null, d3_arraySlice.call(arguments, 1)))); 1.5747 + }; 1.5748 + function d3_ease_clamp(f) { 1.5749 + return function(t) { 1.5750 + return t <= 0 ? 0 : t >= 1 ? 1 : f(t); 1.5751 + }; 1.5752 + } 1.5753 + function d3_ease_reverse(f) { 1.5754 + return function(t) { 1.5755 + return 1 - f(1 - t); 1.5756 + }; 1.5757 + } 1.5758 + function d3_ease_reflect(f) { 1.5759 + return function(t) { 1.5760 + return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t)); 1.5761 + }; 1.5762 + } 1.5763 + function d3_ease_quad(t) { 1.5764 + return t * t; 1.5765 + } 1.5766 + function d3_ease_cubic(t) { 1.5767 + return t * t * t; 1.5768 + } 1.5769 + function d3_ease_cubicInOut(t) { 1.5770 + if (t <= 0) return 0; 1.5771 + if (t >= 1) return 1; 1.5772 + var t2 = t * t, t3 = t2 * t; 1.5773 + return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75); 1.5774 + } 1.5775 + function d3_ease_poly(e) { 1.5776 + return function(t) { 1.5777 + return Math.pow(t, e); 1.5778 + }; 1.5779 + } 1.5780 + function d3_ease_sin(t) { 1.5781 + return 1 - Math.cos(t * halfπ); 1.5782 + } 1.5783 + function d3_ease_exp(t) { 1.5784 + return Math.pow(2, 10 * (t - 1)); 1.5785 + } 1.5786 + function d3_ease_circle(t) { 1.5787 + return 1 - Math.sqrt(1 - t * t); 1.5788 + } 1.5789 + function d3_ease_elastic(a, p) { 1.5790 + var s; 1.5791 + if (arguments.length < 2) p = .45; 1.5792 + if (arguments.length) s = p / τ * Math.asin(1 / a); else a = 1, s = p / 4; 1.5793 + return function(t) { 1.5794 + return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * τ / p); 1.5795 + }; 1.5796 + } 1.5797 + function d3_ease_back(s) { 1.5798 + if (!s) s = 1.70158; 1.5799 + return function(t) { 1.5800 + return t * t * ((s + 1) * t - s); 1.5801 + }; 1.5802 + } 1.5803 + function d3_ease_bounce(t) { 1.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; 1.5805 + } 1.5806 + d3.interpolateHcl = d3_interpolateHcl; 1.5807 + function d3_interpolateHcl(a, b) { 1.5808 + a = d3.hcl(a); 1.5809 + b = d3.hcl(b); 1.5810 + var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al; 1.5811 + if (isNaN(bc)) bc = 0, ac = isNaN(ac) ? b.c : ac; 1.5812 + if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; 1.5813 + return function(t) { 1.5814 + return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + ""; 1.5815 + }; 1.5816 + } 1.5817 + d3.interpolateHsl = d3_interpolateHsl; 1.5818 + function d3_interpolateHsl(a, b) { 1.5819 + a = d3.hsl(a); 1.5820 + b = d3.hsl(b); 1.5821 + var ah = a.h, as = a.s, al = a.l, bh = b.h - ah, bs = b.s - as, bl = b.l - al; 1.5822 + if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as; 1.5823 + if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; 1.5824 + return function(t) { 1.5825 + return d3_hsl_rgb(ah + bh * t, as + bs * t, al + bl * t) + ""; 1.5826 + }; 1.5827 + } 1.5828 + d3.interpolateLab = d3_interpolateLab; 1.5829 + function d3_interpolateLab(a, b) { 1.5830 + a = d3.lab(a); 1.5831 + b = d3.lab(b); 1.5832 + var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab; 1.5833 + return function(t) { 1.5834 + return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + ""; 1.5835 + }; 1.5836 + } 1.5837 + d3.interpolateRound = d3_interpolateRound; 1.5838 + function d3_interpolateRound(a, b) { 1.5839 + b -= a; 1.5840 + return function(t) { 1.5841 + return Math.round(a + b * t); 1.5842 + }; 1.5843 + } 1.5844 + d3.transform = function(string) { 1.5845 + var g = d3_document.createElementNS(d3.ns.prefix.svg, "g"); 1.5846 + return (d3.transform = function(string) { 1.5847 + if (string != null) { 1.5848 + g.setAttribute("transform", string); 1.5849 + var t = g.transform.baseVal.consolidate(); 1.5850 + } 1.5851 + return new d3_transform(t ? t.matrix : d3_transformIdentity); 1.5852 + })(string); 1.5853 + }; 1.5854 + function d3_transform(m) { 1.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; 1.5856 + if (r0[0] * r1[1] < r1[0] * r0[1]) { 1.5857 + r0[0] *= -1; 1.5858 + r0[1] *= -1; 1.5859 + kx *= -1; 1.5860 + kz *= -1; 1.5861 + } 1.5862 + this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees; 1.5863 + this.translate = [ m.e, m.f ]; 1.5864 + this.scale = [ kx, ky ]; 1.5865 + this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0; 1.5866 + } 1.5867 + d3_transform.prototype.toString = function() { 1.5868 + return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")"; 1.5869 + }; 1.5870 + function d3_transformDot(a, b) { 1.5871 + return a[0] * b[0] + a[1] * b[1]; 1.5872 + } 1.5873 + function d3_transformNormalize(a) { 1.5874 + var k = Math.sqrt(d3_transformDot(a, a)); 1.5875 + if (k) { 1.5876 + a[0] /= k; 1.5877 + a[1] /= k; 1.5878 + } 1.5879 + return k; 1.5880 + } 1.5881 + function d3_transformCombine(a, b, k) { 1.5882 + a[0] += k * b[0]; 1.5883 + a[1] += k * b[1]; 1.5884 + return a; 1.5885 + } 1.5886 + var d3_transformIdentity = { 1.5887 + a: 1, 1.5888 + b: 0, 1.5889 + c: 0, 1.5890 + d: 1, 1.5891 + e: 0, 1.5892 + f: 0 1.5893 + }; 1.5894 + d3.interpolateTransform = d3_interpolateTransform; 1.5895 + function d3_interpolateTransform(a, b) { 1.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; 1.5897 + if (ta[0] != tb[0] || ta[1] != tb[1]) { 1.5898 + s.push("translate(", null, ",", null, ")"); 1.5899 + q.push({ 1.5900 + i: 1, 1.5901 + x: d3_interpolateNumber(ta[0], tb[0]) 1.5902 + }, { 1.5903 + i: 3, 1.5904 + x: d3_interpolateNumber(ta[1], tb[1]) 1.5905 + }); 1.5906 + } else if (tb[0] || tb[1]) { 1.5907 + s.push("translate(" + tb + ")"); 1.5908 + } else { 1.5909 + s.push(""); 1.5910 + } 1.5911 + if (ra != rb) { 1.5912 + if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360; 1.5913 + q.push({ 1.5914 + i: s.push(s.pop() + "rotate(", null, ")") - 2, 1.5915 + x: d3_interpolateNumber(ra, rb) 1.5916 + }); 1.5917 + } else if (rb) { 1.5918 + s.push(s.pop() + "rotate(" + rb + ")"); 1.5919 + } 1.5920 + if (wa != wb) { 1.5921 + q.push({ 1.5922 + i: s.push(s.pop() + "skewX(", null, ")") - 2, 1.5923 + x: d3_interpolateNumber(wa, wb) 1.5924 + }); 1.5925 + } else if (wb) { 1.5926 + s.push(s.pop() + "skewX(" + wb + ")"); 1.5927 + } 1.5928 + if (ka[0] != kb[0] || ka[1] != kb[1]) { 1.5929 + n = s.push(s.pop() + "scale(", null, ",", null, ")"); 1.5930 + q.push({ 1.5931 + i: n - 4, 1.5932 + x: d3_interpolateNumber(ka[0], kb[0]) 1.5933 + }, { 1.5934 + i: n - 2, 1.5935 + x: d3_interpolateNumber(ka[1], kb[1]) 1.5936 + }); 1.5937 + } else if (kb[0] != 1 || kb[1] != 1) { 1.5938 + s.push(s.pop() + "scale(" + kb + ")"); 1.5939 + } 1.5940 + n = q.length; 1.5941 + return function(t) { 1.5942 + var i = -1, o; 1.5943 + while (++i < n) s[(o = q[i]).i] = o.x(t); 1.5944 + return s.join(""); 1.5945 + }; 1.5946 + } 1.5947 + function d3_uninterpolateNumber(a, b) { 1.5948 + b = b - (a = +a) ? 1 / (b - a) : 0; 1.5949 + return function(x) { 1.5950 + return (x - a) * b; 1.5951 + }; 1.5952 + } 1.5953 + function d3_uninterpolateClamp(a, b) { 1.5954 + b = b - (a = +a) ? 1 / (b - a) : 0; 1.5955 + return function(x) { 1.5956 + return Math.max(0, Math.min(1, (x - a) * b)); 1.5957 + }; 1.5958 + } 1.5959 + d3.layout = {}; 1.5960 + d3.layout.bundle = function() { 1.5961 + return function(links) { 1.5962 + var paths = [], i = -1, n = links.length; 1.5963 + while (++i < n) paths.push(d3_layout_bundlePath(links[i])); 1.5964 + return paths; 1.5965 + }; 1.5966 + }; 1.5967 + function d3_layout_bundlePath(link) { 1.5968 + var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ]; 1.5969 + while (start !== lca) { 1.5970 + start = start.parent; 1.5971 + points.push(start); 1.5972 + } 1.5973 + var k = points.length; 1.5974 + while (end !== lca) { 1.5975 + points.splice(k, 0, end); 1.5976 + end = end.parent; 1.5977 + } 1.5978 + return points; 1.5979 + } 1.5980 + function d3_layout_bundleAncestors(node) { 1.5981 + var ancestors = [], parent = node.parent; 1.5982 + while (parent != null) { 1.5983 + ancestors.push(node); 1.5984 + node = parent; 1.5985 + parent = parent.parent; 1.5986 + } 1.5987 + ancestors.push(node); 1.5988 + return ancestors; 1.5989 + } 1.5990 + function d3_layout_bundleLeastCommonAncestor(a, b) { 1.5991 + if (a === b) return a; 1.5992 + var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null; 1.5993 + while (aNode === bNode) { 1.5994 + sharedNode = aNode; 1.5995 + aNode = aNodes.pop(); 1.5996 + bNode = bNodes.pop(); 1.5997 + } 1.5998 + return sharedNode; 1.5999 + } 1.6000 + d3.layout.chord = function() { 1.6001 + var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords; 1.6002 + function relayout() { 1.6003 + var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j; 1.6004 + chords = []; 1.6005 + groups = []; 1.6006 + k = 0, i = -1; 1.6007 + while (++i < n) { 1.6008 + x = 0, j = -1; 1.6009 + while (++j < n) { 1.6010 + x += matrix[i][j]; 1.6011 + } 1.6012 + groupSums.push(x); 1.6013 + subgroupIndex.push(d3.range(n)); 1.6014 + k += x; 1.6015 + } 1.6016 + if (sortGroups) { 1.6017 + groupIndex.sort(function(a, b) { 1.6018 + return sortGroups(groupSums[a], groupSums[b]); 1.6019 + }); 1.6020 + } 1.6021 + if (sortSubgroups) { 1.6022 + subgroupIndex.forEach(function(d, i) { 1.6023 + d.sort(function(a, b) { 1.6024 + return sortSubgroups(matrix[i][a], matrix[i][b]); 1.6025 + }); 1.6026 + }); 1.6027 + } 1.6028 + k = (τ - padding * n) / k; 1.6029 + x = 0, i = -1; 1.6030 + while (++i < n) { 1.6031 + x0 = x, j = -1; 1.6032 + while (++j < n) { 1.6033 + var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k; 1.6034 + subgroups[di + "-" + dj] = { 1.6035 + index: di, 1.6036 + subindex: dj, 1.6037 + startAngle: a0, 1.6038 + endAngle: a1, 1.6039 + value: v 1.6040 + }; 1.6041 + } 1.6042 + groups[di] = { 1.6043 + index: di, 1.6044 + startAngle: x0, 1.6045 + endAngle: x, 1.6046 + value: (x - x0) / k 1.6047 + }; 1.6048 + x += padding; 1.6049 + } 1.6050 + i = -1; 1.6051 + while (++i < n) { 1.6052 + j = i - 1; 1.6053 + while (++j < n) { 1.6054 + var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i]; 1.6055 + if (source.value || target.value) { 1.6056 + chords.push(source.value < target.value ? { 1.6057 + source: target, 1.6058 + target: source 1.6059 + } : { 1.6060 + source: source, 1.6061 + target: target 1.6062 + }); 1.6063 + } 1.6064 + } 1.6065 + } 1.6066 + if (sortChords) resort(); 1.6067 + } 1.6068 + function resort() { 1.6069 + chords.sort(function(a, b) { 1.6070 + return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2); 1.6071 + }); 1.6072 + } 1.6073 + chord.matrix = function(x) { 1.6074 + if (!arguments.length) return matrix; 1.6075 + n = (matrix = x) && matrix.length; 1.6076 + chords = groups = null; 1.6077 + return chord; 1.6078 + }; 1.6079 + chord.padding = function(x) { 1.6080 + if (!arguments.length) return padding; 1.6081 + padding = x; 1.6082 + chords = groups = null; 1.6083 + return chord; 1.6084 + }; 1.6085 + chord.sortGroups = function(x) { 1.6086 + if (!arguments.length) return sortGroups; 1.6087 + sortGroups = x; 1.6088 + chords = groups = null; 1.6089 + return chord; 1.6090 + }; 1.6091 + chord.sortSubgroups = function(x) { 1.6092 + if (!arguments.length) return sortSubgroups; 1.6093 + sortSubgroups = x; 1.6094 + chords = null; 1.6095 + return chord; 1.6096 + }; 1.6097 + chord.sortChords = function(x) { 1.6098 + if (!arguments.length) return sortChords; 1.6099 + sortChords = x; 1.6100 + if (chords) resort(); 1.6101 + return chord; 1.6102 + }; 1.6103 + chord.chords = function() { 1.6104 + if (!chords) relayout(); 1.6105 + return chords; 1.6106 + }; 1.6107 + chord.groups = function() { 1.6108 + if (!groups) relayout(); 1.6109 + return groups; 1.6110 + }; 1.6111 + return chord; 1.6112 + }; 1.6113 + d3.layout.force = function() { 1.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; 1.6115 + function repulse(node) { 1.6116 + return function(quad, x1, _, x2) { 1.6117 + if (quad.point !== node) { 1.6118 + var dx = quad.cx - node.x, dy = quad.cy - node.y, dw = x2 - x1, dn = dx * dx + dy * dy; 1.6119 + if (dw * dw / theta2 < dn) { 1.6120 + if (dn < chargeDistance2) { 1.6121 + var k = quad.charge / dn; 1.6122 + node.px -= dx * k; 1.6123 + node.py -= dy * k; 1.6124 + } 1.6125 + return true; 1.6126 + } 1.6127 + if (quad.point && dn && dn < chargeDistance2) { 1.6128 + var k = quad.pointCharge / dn; 1.6129 + node.px -= dx * k; 1.6130 + node.py -= dy * k; 1.6131 + } 1.6132 + } 1.6133 + return !quad.charge; 1.6134 + }; 1.6135 + } 1.6136 + force.tick = function() { 1.6137 + if ((alpha *= .99) < .005) { 1.6138 + event.end({ 1.6139 + type: "end", 1.6140 + alpha: alpha = 0 1.6141 + }); 1.6142 + return true; 1.6143 + } 1.6144 + var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y; 1.6145 + for (i = 0; i < m; ++i) { 1.6146 + o = links[i]; 1.6147 + s = o.source; 1.6148 + t = o.target; 1.6149 + x = t.x - s.x; 1.6150 + y = t.y - s.y; 1.6151 + if (l = x * x + y * y) { 1.6152 + l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l; 1.6153 + x *= l; 1.6154 + y *= l; 1.6155 + t.x -= x * (k = s.weight / (t.weight + s.weight)); 1.6156 + t.y -= y * k; 1.6157 + s.x += x * (k = 1 - k); 1.6158 + s.y += y * k; 1.6159 + } 1.6160 + } 1.6161 + if (k = alpha * gravity) { 1.6162 + x = size[0] / 2; 1.6163 + y = size[1] / 2; 1.6164 + i = -1; 1.6165 + if (k) while (++i < n) { 1.6166 + o = nodes[i]; 1.6167 + o.x += (x - o.x) * k; 1.6168 + o.y += (y - o.y) * k; 1.6169 + } 1.6170 + } 1.6171 + if (charge) { 1.6172 + d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges); 1.6173 + i = -1; 1.6174 + while (++i < n) { 1.6175 + if (!(o = nodes[i]).fixed) { 1.6176 + q.visit(repulse(o)); 1.6177 + } 1.6178 + } 1.6179 + } 1.6180 + i = -1; 1.6181 + while (++i < n) { 1.6182 + o = nodes[i]; 1.6183 + if (o.fixed) { 1.6184 + o.x = o.px; 1.6185 + o.y = o.py; 1.6186 + } else { 1.6187 + o.x -= (o.px - (o.px = o.x)) * friction; 1.6188 + o.y -= (o.py - (o.py = o.y)) * friction; 1.6189 + } 1.6190 + } 1.6191 + event.tick({ 1.6192 + type: "tick", 1.6193 + alpha: alpha 1.6194 + }); 1.6195 + }; 1.6196 + force.nodes = function(x) { 1.6197 + if (!arguments.length) return nodes; 1.6198 + nodes = x; 1.6199 + return force; 1.6200 + }; 1.6201 + force.links = function(x) { 1.6202 + if (!arguments.length) return links; 1.6203 + links = x; 1.6204 + return force; 1.6205 + }; 1.6206 + force.size = function(x) { 1.6207 + if (!arguments.length) return size; 1.6208 + size = x; 1.6209 + return force; 1.6210 + }; 1.6211 + force.linkDistance = function(x) { 1.6212 + if (!arguments.length) return linkDistance; 1.6213 + linkDistance = typeof x === "function" ? x : +x; 1.6214 + return force; 1.6215 + }; 1.6216 + force.distance = force.linkDistance; 1.6217 + force.linkStrength = function(x) { 1.6218 + if (!arguments.length) return linkStrength; 1.6219 + linkStrength = typeof x === "function" ? x : +x; 1.6220 + return force; 1.6221 + }; 1.6222 + force.friction = function(x) { 1.6223 + if (!arguments.length) return friction; 1.6224 + friction = +x; 1.6225 + return force; 1.6226 + }; 1.6227 + force.charge = function(x) { 1.6228 + if (!arguments.length) return charge; 1.6229 + charge = typeof x === "function" ? x : +x; 1.6230 + return force; 1.6231 + }; 1.6232 + force.chargeDistance = function(x) { 1.6233 + if (!arguments.length) return Math.sqrt(chargeDistance2); 1.6234 + chargeDistance2 = x * x; 1.6235 + return force; 1.6236 + }; 1.6237 + force.gravity = function(x) { 1.6238 + if (!arguments.length) return gravity; 1.6239 + gravity = +x; 1.6240 + return force; 1.6241 + }; 1.6242 + force.theta = function(x) { 1.6243 + if (!arguments.length) return Math.sqrt(theta2); 1.6244 + theta2 = x * x; 1.6245 + return force; 1.6246 + }; 1.6247 + force.alpha = function(x) { 1.6248 + if (!arguments.length) return alpha; 1.6249 + x = +x; 1.6250 + if (alpha) { 1.6251 + if (x > 0) alpha = x; else alpha = 0; 1.6252 + } else if (x > 0) { 1.6253 + event.start({ 1.6254 + type: "start", 1.6255 + alpha: alpha = x 1.6256 + }); 1.6257 + d3.timer(force.tick); 1.6258 + } 1.6259 + return force; 1.6260 + }; 1.6261 + force.start = function() { 1.6262 + var i, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o; 1.6263 + for (i = 0; i < n; ++i) { 1.6264 + (o = nodes[i]).index = i; 1.6265 + o.weight = 0; 1.6266 + } 1.6267 + for (i = 0; i < m; ++i) { 1.6268 + o = links[i]; 1.6269 + if (typeof o.source == "number") o.source = nodes[o.source]; 1.6270 + if (typeof o.target == "number") o.target = nodes[o.target]; 1.6271 + ++o.source.weight; 1.6272 + ++o.target.weight; 1.6273 + } 1.6274 + for (i = 0; i < n; ++i) { 1.6275 + o = nodes[i]; 1.6276 + if (isNaN(o.x)) o.x = position("x", w); 1.6277 + if (isNaN(o.y)) o.y = position("y", h); 1.6278 + if (isNaN(o.px)) o.px = o.x; 1.6279 + if (isNaN(o.py)) o.py = o.y; 1.6280 + } 1.6281 + distances = []; 1.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; 1.6283 + strengths = []; 1.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; 1.6285 + charges = []; 1.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; 1.6287 + function position(dimension, size) { 1.6288 + if (!neighbors) { 1.6289 + neighbors = new Array(n); 1.6290 + for (j = 0; j < n; ++j) { 1.6291 + neighbors[j] = []; 1.6292 + } 1.6293 + for (j = 0; j < m; ++j) { 1.6294 + var o = links[j]; 1.6295 + neighbors[o.source.index].push(o.target); 1.6296 + neighbors[o.target.index].push(o.source); 1.6297 + } 1.6298 + } 1.6299 + var candidates = neighbors[i], j = -1, m = candidates.length, x; 1.6300 + while (++j < m) if (!isNaN(x = candidates[j][dimension])) return x; 1.6301 + return Math.random() * size; 1.6302 + } 1.6303 + return force.resume(); 1.6304 + }; 1.6305 + force.resume = function() { 1.6306 + return force.alpha(.1); 1.6307 + }; 1.6308 + force.stop = function() { 1.6309 + return force.alpha(0); 1.6310 + }; 1.6311 + force.drag = function() { 1.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); 1.6313 + if (!arguments.length) return drag; 1.6314 + this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag); 1.6315 + }; 1.6316 + function dragmove(d) { 1.6317 + d.px = d3.event.x, d.py = d3.event.y; 1.6318 + force.resume(); 1.6319 + } 1.6320 + return d3.rebind(force, event, "on"); 1.6321 + }; 1.6322 + function d3_layout_forceDragstart(d) { 1.6323 + d.fixed |= 2; 1.6324 + } 1.6325 + function d3_layout_forceDragend(d) { 1.6326 + d.fixed &= ~6; 1.6327 + } 1.6328 + function d3_layout_forceMouseover(d) { 1.6329 + d.fixed |= 4; 1.6330 + d.px = d.x, d.py = d.y; 1.6331 + } 1.6332 + function d3_layout_forceMouseout(d) { 1.6333 + d.fixed &= ~4; 1.6334 + } 1.6335 + function d3_layout_forceAccumulate(quad, alpha, charges) { 1.6336 + var cx = 0, cy = 0; 1.6337 + quad.charge = 0; 1.6338 + if (!quad.leaf) { 1.6339 + var nodes = quad.nodes, n = nodes.length, i = -1, c; 1.6340 + while (++i < n) { 1.6341 + c = nodes[i]; 1.6342 + if (c == null) continue; 1.6343 + d3_layout_forceAccumulate(c, alpha, charges); 1.6344 + quad.charge += c.charge; 1.6345 + cx += c.charge * c.cx; 1.6346 + cy += c.charge * c.cy; 1.6347 + } 1.6348 + } 1.6349 + if (quad.point) { 1.6350 + if (!quad.leaf) { 1.6351 + quad.point.x += Math.random() - .5; 1.6352 + quad.point.y += Math.random() - .5; 1.6353 + } 1.6354 + var k = alpha * charges[quad.point.index]; 1.6355 + quad.charge += quad.pointCharge = k; 1.6356 + cx += k * quad.point.x; 1.6357 + cy += k * quad.point.y; 1.6358 + } 1.6359 + quad.cx = cx / quad.charge; 1.6360 + quad.cy = cy / quad.charge; 1.6361 + } 1.6362 + var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1, d3_layout_forceChargeDistance2 = Infinity; 1.6363 + d3.layout.hierarchy = function() { 1.6364 + var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue; 1.6365 + function recurse(node, depth, nodes) { 1.6366 + var childs = children.call(hierarchy, node, depth); 1.6367 + node.depth = depth; 1.6368 + nodes.push(node); 1.6369 + if (childs && (n = childs.length)) { 1.6370 + var i = -1, n, c = node.children = new Array(n), v = 0, j = depth + 1, d; 1.6371 + while (++i < n) { 1.6372 + d = c[i] = recurse(childs[i], j, nodes); 1.6373 + d.parent = node; 1.6374 + v += d.value; 1.6375 + } 1.6376 + if (sort) c.sort(sort); 1.6377 + if (value) node.value = v; 1.6378 + } else { 1.6379 + delete node.children; 1.6380 + if (value) { 1.6381 + node.value = +value.call(hierarchy, node, depth) || 0; 1.6382 + } 1.6383 + } 1.6384 + return node; 1.6385 + } 1.6386 + function revalue(node, depth) { 1.6387 + var children = node.children, v = 0; 1.6388 + if (children && (n = children.length)) { 1.6389 + var i = -1, n, j = depth + 1; 1.6390 + while (++i < n) v += revalue(children[i], j); 1.6391 + } else if (value) { 1.6392 + v = +value.call(hierarchy, node, depth) || 0; 1.6393 + } 1.6394 + if (value) node.value = v; 1.6395 + return v; 1.6396 + } 1.6397 + function hierarchy(d) { 1.6398 + var nodes = []; 1.6399 + recurse(d, 0, nodes); 1.6400 + return nodes; 1.6401 + } 1.6402 + hierarchy.sort = function(x) { 1.6403 + if (!arguments.length) return sort; 1.6404 + sort = x; 1.6405 + return hierarchy; 1.6406 + }; 1.6407 + hierarchy.children = function(x) { 1.6408 + if (!arguments.length) return children; 1.6409 + children = x; 1.6410 + return hierarchy; 1.6411 + }; 1.6412 + hierarchy.value = function(x) { 1.6413 + if (!arguments.length) return value; 1.6414 + value = x; 1.6415 + return hierarchy; 1.6416 + }; 1.6417 + hierarchy.revalue = function(root) { 1.6418 + revalue(root, 0); 1.6419 + return root; 1.6420 + }; 1.6421 + return hierarchy; 1.6422 + }; 1.6423 + function d3_layout_hierarchyRebind(object, hierarchy) { 1.6424 + d3.rebind(object, hierarchy, "sort", "children", "value"); 1.6425 + object.nodes = object; 1.6426 + object.links = d3_layout_hierarchyLinks; 1.6427 + return object; 1.6428 + } 1.6429 + function d3_layout_hierarchyChildren(d) { 1.6430 + return d.children; 1.6431 + } 1.6432 + function d3_layout_hierarchyValue(d) { 1.6433 + return d.value; 1.6434 + } 1.6435 + function d3_layout_hierarchySort(a, b) { 1.6436 + return b.value - a.value; 1.6437 + } 1.6438 + function d3_layout_hierarchyLinks(nodes) { 1.6439 + return d3.merge(nodes.map(function(parent) { 1.6440 + return (parent.children || []).map(function(child) { 1.6441 + return { 1.6442 + source: parent, 1.6443 + target: child 1.6444 + }; 1.6445 + }); 1.6446 + })); 1.6447 + } 1.6448 + d3.layout.partition = function() { 1.6449 + var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ]; 1.6450 + function position(node, x, dx, dy) { 1.6451 + var children = node.children; 1.6452 + node.x = x; 1.6453 + node.y = node.depth * dy; 1.6454 + node.dx = dx; 1.6455 + node.dy = dy; 1.6456 + if (children && (n = children.length)) { 1.6457 + var i = -1, n, c, d; 1.6458 + dx = node.value ? dx / node.value : 0; 1.6459 + while (++i < n) { 1.6460 + position(c = children[i], x, d = c.value * dx, dy); 1.6461 + x += d; 1.6462 + } 1.6463 + } 1.6464 + } 1.6465 + function depth(node) { 1.6466 + var children = node.children, d = 0; 1.6467 + if (children && (n = children.length)) { 1.6468 + var i = -1, n; 1.6469 + while (++i < n) d = Math.max(d, depth(children[i])); 1.6470 + } 1.6471 + return 1 + d; 1.6472 + } 1.6473 + function partition(d, i) { 1.6474 + var nodes = hierarchy.call(this, d, i); 1.6475 + position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); 1.6476 + return nodes; 1.6477 + } 1.6478 + partition.size = function(x) { 1.6479 + if (!arguments.length) return size; 1.6480 + size = x; 1.6481 + return partition; 1.6482 + }; 1.6483 + return d3_layout_hierarchyRebind(partition, hierarchy); 1.6484 + }; 1.6485 + d3.layout.pie = function() { 1.6486 + var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = τ; 1.6487 + function pie(data) { 1.6488 + var values = data.map(function(d, i) { 1.6489 + return +value.call(pie, d, i); 1.6490 + }); 1.6491 + var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle); 1.6492 + var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a) / d3.sum(values); 1.6493 + var index = d3.range(data.length); 1.6494 + if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) { 1.6495 + return values[j] - values[i]; 1.6496 + } : function(i, j) { 1.6497 + return sort(data[i], data[j]); 1.6498 + }); 1.6499 + var arcs = []; 1.6500 + index.forEach(function(i) { 1.6501 + var d; 1.6502 + arcs[i] = { 1.6503 + data: data[i], 1.6504 + value: d = values[i], 1.6505 + startAngle: a, 1.6506 + endAngle: a += d * k 1.6507 + }; 1.6508 + }); 1.6509 + return arcs; 1.6510 + } 1.6511 + pie.value = function(x) { 1.6512 + if (!arguments.length) return value; 1.6513 + value = x; 1.6514 + return pie; 1.6515 + }; 1.6516 + pie.sort = function(x) { 1.6517 + if (!arguments.length) return sort; 1.6518 + sort = x; 1.6519 + return pie; 1.6520 + }; 1.6521 + pie.startAngle = function(x) { 1.6522 + if (!arguments.length) return startAngle; 1.6523 + startAngle = x; 1.6524 + return pie; 1.6525 + }; 1.6526 + pie.endAngle = function(x) { 1.6527 + if (!arguments.length) return endAngle; 1.6528 + endAngle = x; 1.6529 + return pie; 1.6530 + }; 1.6531 + return pie; 1.6532 + }; 1.6533 + var d3_layout_pieSortByValue = {}; 1.6534 + d3.layout.stack = function() { 1.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; 1.6536 + function stack(data, index) { 1.6537 + var series = data.map(function(d, i) { 1.6538 + return values.call(stack, d, i); 1.6539 + }); 1.6540 + var points = series.map(function(d) { 1.6541 + return d.map(function(v, i) { 1.6542 + return [ x.call(stack, v, i), y.call(stack, v, i) ]; 1.6543 + }); 1.6544 + }); 1.6545 + var orders = order.call(stack, points, index); 1.6546 + series = d3.permute(series, orders); 1.6547 + points = d3.permute(points, orders); 1.6548 + var offsets = offset.call(stack, points, index); 1.6549 + var n = series.length, m = series[0].length, i, j, o; 1.6550 + for (j = 0; j < m; ++j) { 1.6551 + out.call(stack, series[0][j], o = offsets[j], points[0][j][1]); 1.6552 + for (i = 1; i < n; ++i) { 1.6553 + out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]); 1.6554 + } 1.6555 + } 1.6556 + return data; 1.6557 + } 1.6558 + stack.values = function(x) { 1.6559 + if (!arguments.length) return values; 1.6560 + values = x; 1.6561 + return stack; 1.6562 + }; 1.6563 + stack.order = function(x) { 1.6564 + if (!arguments.length) return order; 1.6565 + order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault; 1.6566 + return stack; 1.6567 + }; 1.6568 + stack.offset = function(x) { 1.6569 + if (!arguments.length) return offset; 1.6570 + offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero; 1.6571 + return stack; 1.6572 + }; 1.6573 + stack.x = function(z) { 1.6574 + if (!arguments.length) return x; 1.6575 + x = z; 1.6576 + return stack; 1.6577 + }; 1.6578 + stack.y = function(z) { 1.6579 + if (!arguments.length) return y; 1.6580 + y = z; 1.6581 + return stack; 1.6582 + }; 1.6583 + stack.out = function(z) { 1.6584 + if (!arguments.length) return out; 1.6585 + out = z; 1.6586 + return stack; 1.6587 + }; 1.6588 + return stack; 1.6589 + }; 1.6590 + function d3_layout_stackX(d) { 1.6591 + return d.x; 1.6592 + } 1.6593 + function d3_layout_stackY(d) { 1.6594 + return d.y; 1.6595 + } 1.6596 + function d3_layout_stackOut(d, y0, y) { 1.6597 + d.y0 = y0; 1.6598 + d.y = y; 1.6599 + } 1.6600 + var d3_layout_stackOrders = d3.map({ 1.6601 + "inside-out": function(data) { 1.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) { 1.6603 + return max[a] - max[b]; 1.6604 + }), top = 0, bottom = 0, tops = [], bottoms = []; 1.6605 + for (i = 0; i < n; ++i) { 1.6606 + j = index[i]; 1.6607 + if (top < bottom) { 1.6608 + top += sums[j]; 1.6609 + tops.push(j); 1.6610 + } else { 1.6611 + bottom += sums[j]; 1.6612 + bottoms.push(j); 1.6613 + } 1.6614 + } 1.6615 + return bottoms.reverse().concat(tops); 1.6616 + }, 1.6617 + reverse: function(data) { 1.6618 + return d3.range(data.length).reverse(); 1.6619 + }, 1.6620 + "default": d3_layout_stackOrderDefault 1.6621 + }); 1.6622 + var d3_layout_stackOffsets = d3.map({ 1.6623 + silhouette: function(data) { 1.6624 + var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = []; 1.6625 + for (j = 0; j < m; ++j) { 1.6626 + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; 1.6627 + if (o > max) max = o; 1.6628 + sums.push(o); 1.6629 + } 1.6630 + for (j = 0; j < m; ++j) { 1.6631 + y0[j] = (max - sums[j]) / 2; 1.6632 + } 1.6633 + return y0; 1.6634 + }, 1.6635 + wiggle: function(data) { 1.6636 + var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = []; 1.6637 + y0[0] = o = o0 = 0; 1.6638 + for (j = 1; j < m; ++j) { 1.6639 + for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; 1.6640 + for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { 1.6641 + for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { 1.6642 + s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; 1.6643 + } 1.6644 + s2 += s3 * data[i][j][1]; 1.6645 + } 1.6646 + y0[j] = o -= s1 ? s2 / s1 * dx : 0; 1.6647 + if (o < o0) o0 = o; 1.6648 + } 1.6649 + for (j = 0; j < m; ++j) y0[j] -= o0; 1.6650 + return y0; 1.6651 + }, 1.6652 + expand: function(data) { 1.6653 + var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = []; 1.6654 + for (j = 0; j < m; ++j) { 1.6655 + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; 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; 1.6657 + } 1.6658 + for (j = 0; j < m; ++j) y0[j] = 0; 1.6659 + return y0; 1.6660 + }, 1.6661 + zero: d3_layout_stackOffsetZero 1.6662 + }); 1.6663 + function d3_layout_stackOrderDefault(data) { 1.6664 + return d3.range(data.length); 1.6665 + } 1.6666 + function d3_layout_stackOffsetZero(data) { 1.6667 + var j = -1, m = data[0].length, y0 = []; 1.6668 + while (++j < m) y0[j] = 0; 1.6669 + return y0; 1.6670 + } 1.6671 + function d3_layout_stackMaxIndex(array) { 1.6672 + var i = 1, j = 0, v = array[0][1], k, n = array.length; 1.6673 + for (;i < n; ++i) { 1.6674 + if ((k = array[i][1]) > v) { 1.6675 + j = i; 1.6676 + v = k; 1.6677 + } 1.6678 + } 1.6679 + return j; 1.6680 + } 1.6681 + function d3_layout_stackReduceSum(d) { 1.6682 + return d.reduce(d3_layout_stackSum, 0); 1.6683 + } 1.6684 + function d3_layout_stackSum(p, d) { 1.6685 + return p + d[1]; 1.6686 + } 1.6687 + d3.layout.histogram = function() { 1.6688 + var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges; 1.6689 + function histogram(data, i) { 1.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; 1.6691 + while (++i < m) { 1.6692 + bin = bins[i] = []; 1.6693 + bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); 1.6694 + bin.y = 0; 1.6695 + } 1.6696 + if (m > 0) { 1.6697 + i = -1; 1.6698 + while (++i < n) { 1.6699 + x = values[i]; 1.6700 + if (x >= range[0] && x <= range[1]) { 1.6701 + bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; 1.6702 + bin.y += k; 1.6703 + bin.push(data[i]); 1.6704 + } 1.6705 + } 1.6706 + } 1.6707 + return bins; 1.6708 + } 1.6709 + histogram.value = function(x) { 1.6710 + if (!arguments.length) return valuer; 1.6711 + valuer = x; 1.6712 + return histogram; 1.6713 + }; 1.6714 + histogram.range = function(x) { 1.6715 + if (!arguments.length) return ranger; 1.6716 + ranger = d3_functor(x); 1.6717 + return histogram; 1.6718 + }; 1.6719 + histogram.bins = function(x) { 1.6720 + if (!arguments.length) return binner; 1.6721 + binner = typeof x === "number" ? function(range) { 1.6722 + return d3_layout_histogramBinFixed(range, x); 1.6723 + } : d3_functor(x); 1.6724 + return histogram; 1.6725 + }; 1.6726 + histogram.frequency = function(x) { 1.6727 + if (!arguments.length) return frequency; 1.6728 + frequency = !!x; 1.6729 + return histogram; 1.6730 + }; 1.6731 + return histogram; 1.6732 + }; 1.6733 + function d3_layout_histogramBinSturges(range, values) { 1.6734 + return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); 1.6735 + } 1.6736 + function d3_layout_histogramBinFixed(range, n) { 1.6737 + var x = -1, b = +range[0], m = (range[1] - b) / n, f = []; 1.6738 + while (++x <= n) f[x] = m * x + b; 1.6739 + return f; 1.6740 + } 1.6741 + function d3_layout_histogramRange(values) { 1.6742 + return [ d3.min(values), d3.max(values) ]; 1.6743 + } 1.6744 + d3.layout.tree = function() { 1.6745 + var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = false; 1.6746 + function tree(d, i) { 1.6747 + var nodes = hierarchy.call(this, d, i), root = nodes[0]; 1.6748 + function firstWalk(node, previousSibling) { 1.6749 + var children = node.children, layout = node._tree; 1.6750 + if (children && (n = children.length)) { 1.6751 + var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1; 1.6752 + while (++i < n) { 1.6753 + child = children[i]; 1.6754 + firstWalk(child, previousChild); 1.6755 + ancestor = apportion(child, previousChild, ancestor); 1.6756 + previousChild = child; 1.6757 + } 1.6758 + d3_layout_treeShift(node); 1.6759 + var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim); 1.6760 + if (previousSibling) { 1.6761 + layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); 1.6762 + layout.mod = layout.prelim - midpoint; 1.6763 + } else { 1.6764 + layout.prelim = midpoint; 1.6765 + } 1.6766 + } else { 1.6767 + if (previousSibling) { 1.6768 + layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); 1.6769 + } 1.6770 + } 1.6771 + } 1.6772 + function secondWalk(node, x) { 1.6773 + node.x = node._tree.prelim + x; 1.6774 + var children = node.children; 1.6775 + if (children && (n = children.length)) { 1.6776 + var i = -1, n; 1.6777 + x += node._tree.mod; 1.6778 + while (++i < n) { 1.6779 + secondWalk(children[i], x); 1.6780 + } 1.6781 + } 1.6782 + } 1.6783 + function apportion(node, previousSibling, ancestor) { 1.6784 + if (previousSibling) { 1.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; 1.6786 + while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) { 1.6787 + vom = d3_layout_treeLeft(vom); 1.6788 + vop = d3_layout_treeRight(vop); 1.6789 + vop._tree.ancestor = node; 1.6790 + shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip); 1.6791 + if (shift > 0) { 1.6792 + d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift); 1.6793 + sip += shift; 1.6794 + sop += shift; 1.6795 + } 1.6796 + sim += vim._tree.mod; 1.6797 + sip += vip._tree.mod; 1.6798 + som += vom._tree.mod; 1.6799 + sop += vop._tree.mod; 1.6800 + } 1.6801 + if (vim && !d3_layout_treeRight(vop)) { 1.6802 + vop._tree.thread = vim; 1.6803 + vop._tree.mod += sim - sop; 1.6804 + } 1.6805 + if (vip && !d3_layout_treeLeft(vom)) { 1.6806 + vom._tree.thread = vip; 1.6807 + vom._tree.mod += sip - som; 1.6808 + ancestor = node; 1.6809 + } 1.6810 + } 1.6811 + return ancestor; 1.6812 + } 1.6813 + d3_layout_treeVisitAfter(root, function(node, previousSibling) { 1.6814 + node._tree = { 1.6815 + ancestor: node, 1.6816 + prelim: 0, 1.6817 + mod: 0, 1.6818 + change: 0, 1.6819 + shift: 0, 1.6820 + number: previousSibling ? previousSibling._tree.number + 1 : 0 1.6821 + }; 1.6822 + }); 1.6823 + firstWalk(root); 1.6824 + secondWalk(root, -root._tree.prelim); 1.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; 1.6826 + d3_layout_treeVisitAfter(root, nodeSize ? function(node) { 1.6827 + node.x *= size[0]; 1.6828 + node.y = node.depth * size[1]; 1.6829 + delete node._tree; 1.6830 + } : function(node) { 1.6831 + node.x = (node.x - x0) / (x1 - x0) * size[0]; 1.6832 + node.y = node.depth / y1 * size[1]; 1.6833 + delete node._tree; 1.6834 + }); 1.6835 + return nodes; 1.6836 + } 1.6837 + tree.separation = function(x) { 1.6838 + if (!arguments.length) return separation; 1.6839 + separation = x; 1.6840 + return tree; 1.6841 + }; 1.6842 + tree.size = function(x) { 1.6843 + if (!arguments.length) return nodeSize ? null : size; 1.6844 + nodeSize = (size = x) == null; 1.6845 + return tree; 1.6846 + }; 1.6847 + tree.nodeSize = function(x) { 1.6848 + if (!arguments.length) return nodeSize ? size : null; 1.6849 + nodeSize = (size = x) != null; 1.6850 + return tree; 1.6851 + }; 1.6852 + return d3_layout_hierarchyRebind(tree, hierarchy); 1.6853 + }; 1.6854 + function d3_layout_treeSeparation(a, b) { 1.6855 + return a.parent == b.parent ? 1 : 2; 1.6856 + } 1.6857 + function d3_layout_treeLeft(node) { 1.6858 + var children = node.children; 1.6859 + return children && children.length ? children[0] : node._tree.thread; 1.6860 + } 1.6861 + function d3_layout_treeRight(node) { 1.6862 + var children = node.children, n; 1.6863 + return children && (n = children.length) ? children[n - 1] : node._tree.thread; 1.6864 + } 1.6865 + function d3_layout_treeSearch(node, compare) { 1.6866 + var children = node.children; 1.6867 + if (children && (n = children.length)) { 1.6868 + var child, n, i = -1; 1.6869 + while (++i < n) { 1.6870 + if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) { 1.6871 + node = child; 1.6872 + } 1.6873 + } 1.6874 + } 1.6875 + return node; 1.6876 + } 1.6877 + function d3_layout_treeRightmost(a, b) { 1.6878 + return a.x - b.x; 1.6879 + } 1.6880 + function d3_layout_treeLeftmost(a, b) { 1.6881 + return b.x - a.x; 1.6882 + } 1.6883 + function d3_layout_treeDeepest(a, b) { 1.6884 + return a.depth - b.depth; 1.6885 + } 1.6886 + function d3_layout_treeVisitAfter(node, callback) { 1.6887 + function visit(node, previousSibling) { 1.6888 + var children = node.children; 1.6889 + if (children && (n = children.length)) { 1.6890 + var child, previousChild = null, i = -1, n; 1.6891 + while (++i < n) { 1.6892 + child = children[i]; 1.6893 + visit(child, previousChild); 1.6894 + previousChild = child; 1.6895 + } 1.6896 + } 1.6897 + callback(node, previousSibling); 1.6898 + } 1.6899 + visit(node, null); 1.6900 + } 1.6901 + function d3_layout_treeShift(node) { 1.6902 + var shift = 0, change = 0, children = node.children, i = children.length, child; 1.6903 + while (--i >= 0) { 1.6904 + child = children[i]._tree; 1.6905 + child.prelim += shift; 1.6906 + child.mod += shift; 1.6907 + shift += child.shift + (change += child.change); 1.6908 + } 1.6909 + } 1.6910 + function d3_layout_treeMove(ancestor, node, shift) { 1.6911 + ancestor = ancestor._tree; 1.6912 + node = node._tree; 1.6913 + var change = shift / (node.number - ancestor.number); 1.6914 + ancestor.change += change; 1.6915 + node.change -= change; 1.6916 + node.shift += shift; 1.6917 + node.prelim += shift; 1.6918 + node.mod += shift; 1.6919 + } 1.6920 + function d3_layout_treeAncestor(vim, node, ancestor) { 1.6921 + return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor; 1.6922 + } 1.6923 + d3.layout.pack = function() { 1.6924 + var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ], radius; 1.6925 + function pack(d, i) { 1.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() { 1.6927 + return radius; 1.6928 + }; 1.6929 + root.x = root.y = 0; 1.6930 + d3_layout_treeVisitAfter(root, function(d) { 1.6931 + d.r = +r(d.value); 1.6932 + }); 1.6933 + d3_layout_treeVisitAfter(root, d3_layout_packSiblings); 1.6934 + if (padding) { 1.6935 + var dr = padding * (radius ? 1 : Math.max(2 * root.r / w, 2 * root.r / h)) / 2; 1.6936 + d3_layout_treeVisitAfter(root, function(d) { 1.6937 + d.r += dr; 1.6938 + }); 1.6939 + d3_layout_treeVisitAfter(root, d3_layout_packSiblings); 1.6940 + d3_layout_treeVisitAfter(root, function(d) { 1.6941 + d.r -= dr; 1.6942 + }); 1.6943 + } 1.6944 + d3_layout_packTransform(root, w / 2, h / 2, radius ? 1 : 1 / Math.max(2 * root.r / w, 2 * root.r / h)); 1.6945 + return nodes; 1.6946 + } 1.6947 + pack.size = function(_) { 1.6948 + if (!arguments.length) return size; 1.6949 + size = _; 1.6950 + return pack; 1.6951 + }; 1.6952 + pack.radius = function(_) { 1.6953 + if (!arguments.length) return radius; 1.6954 + radius = _ == null || typeof _ === "function" ? _ : +_; 1.6955 + return pack; 1.6956 + }; 1.6957 + pack.padding = function(_) { 1.6958 + if (!arguments.length) return padding; 1.6959 + padding = +_; 1.6960 + return pack; 1.6961 + }; 1.6962 + return d3_layout_hierarchyRebind(pack, hierarchy); 1.6963 + }; 1.6964 + function d3_layout_packSort(a, b) { 1.6965 + return a.value - b.value; 1.6966 + } 1.6967 + function d3_layout_packInsert(a, b) { 1.6968 + var c = a._pack_next; 1.6969 + a._pack_next = b; 1.6970 + b._pack_prev = a; 1.6971 + b._pack_next = c; 1.6972 + c._pack_prev = b; 1.6973 + } 1.6974 + function d3_layout_packSplice(a, b) { 1.6975 + a._pack_next = b; 1.6976 + b._pack_prev = a; 1.6977 + } 1.6978 + function d3_layout_packIntersects(a, b) { 1.6979 + var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r; 1.6980 + return .999 * dr * dr > dx * dx + dy * dy; 1.6981 + } 1.6982 + function d3_layout_packSiblings(node) { 1.6983 + if (!(nodes = node.children) || !(n = nodes.length)) return; 1.6984 + var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n; 1.6985 + function bound(node) { 1.6986 + xMin = Math.min(node.x - node.r, xMin); 1.6987 + xMax = Math.max(node.x + node.r, xMax); 1.6988 + yMin = Math.min(node.y - node.r, yMin); 1.6989 + yMax = Math.max(node.y + node.r, yMax); 1.6990 + } 1.6991 + nodes.forEach(d3_layout_packLink); 1.6992 + a = nodes[0]; 1.6993 + a.x = -a.r; 1.6994 + a.y = 0; 1.6995 + bound(a); 1.6996 + if (n > 1) { 1.6997 + b = nodes[1]; 1.6998 + b.x = b.r; 1.6999 + b.y = 0; 1.7000 + bound(b); 1.7001 + if (n > 2) { 1.7002 + c = nodes[2]; 1.7003 + d3_layout_packPlace(a, b, c); 1.7004 + bound(c); 1.7005 + d3_layout_packInsert(a, c); 1.7006 + a._pack_prev = c; 1.7007 + d3_layout_packInsert(c, b); 1.7008 + b = a._pack_next; 1.7009 + for (i = 3; i < n; i++) { 1.7010 + d3_layout_packPlace(a, b, c = nodes[i]); 1.7011 + var isect = 0, s1 = 1, s2 = 1; 1.7012 + for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { 1.7013 + if (d3_layout_packIntersects(j, c)) { 1.7014 + isect = 1; 1.7015 + break; 1.7016 + } 1.7017 + } 1.7018 + if (isect == 1) { 1.7019 + for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { 1.7020 + if (d3_layout_packIntersects(k, c)) { 1.7021 + break; 1.7022 + } 1.7023 + } 1.7024 + } 1.7025 + if (isect) { 1.7026 + if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b); 1.7027 + i--; 1.7028 + } else { 1.7029 + d3_layout_packInsert(a, c); 1.7030 + b = c; 1.7031 + bound(c); 1.7032 + } 1.7033 + } 1.7034 + } 1.7035 + } 1.7036 + var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0; 1.7037 + for (i = 0; i < n; i++) { 1.7038 + c = nodes[i]; 1.7039 + c.x -= cx; 1.7040 + c.y -= cy; 1.7041 + cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y)); 1.7042 + } 1.7043 + node.r = cr; 1.7044 + nodes.forEach(d3_layout_packUnlink); 1.7045 + } 1.7046 + function d3_layout_packLink(node) { 1.7047 + node._pack_next = node._pack_prev = node; 1.7048 + } 1.7049 + function d3_layout_packUnlink(node) { 1.7050 + delete node._pack_next; 1.7051 + delete node._pack_prev; 1.7052 + } 1.7053 + function d3_layout_packTransform(node, x, y, k) { 1.7054 + var children = node.children; 1.7055 + node.x = x += k * node.x; 1.7056 + node.y = y += k * node.y; 1.7057 + node.r *= k; 1.7058 + if (children) { 1.7059 + var i = -1, n = children.length; 1.7060 + while (++i < n) d3_layout_packTransform(children[i], x, y, k); 1.7061 + } 1.7062 + } 1.7063 + function d3_layout_packPlace(a, b, c) { 1.7064 + var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y; 1.7065 + if (db && (dx || dy)) { 1.7066 + var da = b.r + c.r, dc = dx * dx + dy * dy; 1.7067 + da *= da; 1.7068 + db *= db; 1.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); 1.7070 + c.x = a.x + x * dx + y * dy; 1.7071 + c.y = a.y + x * dy - y * dx; 1.7072 + } else { 1.7073 + c.x = a.x + db; 1.7074 + c.y = a.y; 1.7075 + } 1.7076 + } 1.7077 + d3.layout.cluster = function() { 1.7078 + var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = false; 1.7079 + function cluster(d, i) { 1.7080 + var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0; 1.7081 + d3_layout_treeVisitAfter(root, function(node) { 1.7082 + var children = node.children; 1.7083 + if (children && children.length) { 1.7084 + node.x = d3_layout_clusterX(children); 1.7085 + node.y = d3_layout_clusterY(children); 1.7086 + } else { 1.7087 + node.x = previousNode ? x += separation(node, previousNode) : 0; 1.7088 + node.y = 0; 1.7089 + previousNode = node; 1.7090 + } 1.7091 + }); 1.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; 1.7093 + d3_layout_treeVisitAfter(root, nodeSize ? function(node) { 1.7094 + node.x = (node.x - root.x) * size[0]; 1.7095 + node.y = (root.y - node.y) * size[1]; 1.7096 + } : function(node) { 1.7097 + node.x = (node.x - x0) / (x1 - x0) * size[0]; 1.7098 + node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; 1.7099 + }); 1.7100 + return nodes; 1.7101 + } 1.7102 + cluster.separation = function(x) { 1.7103 + if (!arguments.length) return separation; 1.7104 + separation = x; 1.7105 + return cluster; 1.7106 + }; 1.7107 + cluster.size = function(x) { 1.7108 + if (!arguments.length) return nodeSize ? null : size; 1.7109 + nodeSize = (size = x) == null; 1.7110 + return cluster; 1.7111 + }; 1.7112 + cluster.nodeSize = function(x) { 1.7113 + if (!arguments.length) return nodeSize ? size : null; 1.7114 + nodeSize = (size = x) != null; 1.7115 + return cluster; 1.7116 + }; 1.7117 + return d3_layout_hierarchyRebind(cluster, hierarchy); 1.7118 + }; 1.7119 + function d3_layout_clusterY(children) { 1.7120 + return 1 + d3.max(children, function(child) { 1.7121 + return child.y; 1.7122 + }); 1.7123 + } 1.7124 + function d3_layout_clusterX(children) { 1.7125 + return children.reduce(function(x, child) { 1.7126 + return x + child.x; 1.7127 + }, 0) / children.length; 1.7128 + } 1.7129 + function d3_layout_clusterLeft(node) { 1.7130 + var children = node.children; 1.7131 + return children && children.length ? d3_layout_clusterLeft(children[0]) : node; 1.7132 + } 1.7133 + function d3_layout_clusterRight(node) { 1.7134 + var children = node.children, n; 1.7135 + return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; 1.7136 + } 1.7137 + d3.layout.treemap = function() { 1.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)); 1.7139 + function scale(children, k) { 1.7140 + var i = -1, n = children.length, child, area; 1.7141 + while (++i < n) { 1.7142 + area = (child = children[i]).value * (k < 0 ? 0 : k); 1.7143 + child.area = isNaN(area) || area <= 0 ? 0 : area; 1.7144 + } 1.7145 + } 1.7146 + function squarify(node) { 1.7147 + var children = node.children; 1.7148 + if (children && children.length) { 1.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; 1.7150 + scale(remaining, rect.dx * rect.dy / node.value); 1.7151 + row.area = 0; 1.7152 + while ((n = remaining.length) > 0) { 1.7153 + row.push(child = remaining[n - 1]); 1.7154 + row.area += child.area; 1.7155 + if (mode !== "squarify" || (score = worst(row, u)) <= best) { 1.7156 + remaining.pop(); 1.7157 + best = score; 1.7158 + } else { 1.7159 + row.area -= row.pop().area; 1.7160 + position(row, u, rect, false); 1.7161 + u = Math.min(rect.dx, rect.dy); 1.7162 + row.length = row.area = 0; 1.7163 + best = Infinity; 1.7164 + } 1.7165 + } 1.7166 + if (row.length) { 1.7167 + position(row, u, rect, true); 1.7168 + row.length = row.area = 0; 1.7169 + } 1.7170 + children.forEach(squarify); 1.7171 + } 1.7172 + } 1.7173 + function stickify(node) { 1.7174 + var children = node.children; 1.7175 + if (children && children.length) { 1.7176 + var rect = pad(node), remaining = children.slice(), child, row = []; 1.7177 + scale(remaining, rect.dx * rect.dy / node.value); 1.7178 + row.area = 0; 1.7179 + while (child = remaining.pop()) { 1.7180 + row.push(child); 1.7181 + row.area += child.area; 1.7182 + if (child.z != null) { 1.7183 + position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); 1.7184 + row.length = row.area = 0; 1.7185 + } 1.7186 + } 1.7187 + children.forEach(stickify); 1.7188 + } 1.7189 + } 1.7190 + function worst(row, u) { 1.7191 + var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length; 1.7192 + while (++i < n) { 1.7193 + if (!(r = row[i].area)) continue; 1.7194 + if (r < rmin) rmin = r; 1.7195 + if (r > rmax) rmax = r; 1.7196 + } 1.7197 + s *= s; 1.7198 + u *= u; 1.7199 + return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity; 1.7200 + } 1.7201 + function position(row, u, rect, flush) { 1.7202 + var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o; 1.7203 + if (u == rect.dx) { 1.7204 + if (flush || v > rect.dy) v = rect.dy; 1.7205 + while (++i < n) { 1.7206 + o = row[i]; 1.7207 + o.x = x; 1.7208 + o.y = y; 1.7209 + o.dy = v; 1.7210 + x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0); 1.7211 + } 1.7212 + o.z = true; 1.7213 + o.dx += rect.x + rect.dx - x; 1.7214 + rect.y += v; 1.7215 + rect.dy -= v; 1.7216 + } else { 1.7217 + if (flush || v > rect.dx) v = rect.dx; 1.7218 + while (++i < n) { 1.7219 + o = row[i]; 1.7220 + o.x = x; 1.7221 + o.y = y; 1.7222 + o.dx = v; 1.7223 + y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0); 1.7224 + } 1.7225 + o.z = false; 1.7226 + o.dy += rect.y + rect.dy - y; 1.7227 + rect.x += v; 1.7228 + rect.dx -= v; 1.7229 + } 1.7230 + } 1.7231 + function treemap(d) { 1.7232 + var nodes = stickies || hierarchy(d), root = nodes[0]; 1.7233 + root.x = 0; 1.7234 + root.y = 0; 1.7235 + root.dx = size[0]; 1.7236 + root.dy = size[1]; 1.7237 + if (stickies) hierarchy.revalue(root); 1.7238 + scale([ root ], root.dx * root.dy / root.value); 1.7239 + (stickies ? stickify : squarify)(root); 1.7240 + if (sticky) stickies = nodes; 1.7241 + return nodes; 1.7242 + } 1.7243 + treemap.size = function(x) { 1.7244 + if (!arguments.length) return size; 1.7245 + size = x; 1.7246 + return treemap; 1.7247 + }; 1.7248 + treemap.padding = function(x) { 1.7249 + if (!arguments.length) return padding; 1.7250 + function padFunction(node) { 1.7251 + var p = x.call(treemap, node, node.depth); 1.7252 + return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p); 1.7253 + } 1.7254 + function padConstant(node) { 1.7255 + return d3_layout_treemapPad(node, x); 1.7256 + } 1.7257 + var type; 1.7258 + pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], 1.7259 + padConstant) : padConstant; 1.7260 + return treemap; 1.7261 + }; 1.7262 + treemap.round = function(x) { 1.7263 + if (!arguments.length) return round != Number; 1.7264 + round = x ? Math.round : Number; 1.7265 + return treemap; 1.7266 + }; 1.7267 + treemap.sticky = function(x) { 1.7268 + if (!arguments.length) return sticky; 1.7269 + sticky = x; 1.7270 + stickies = null; 1.7271 + return treemap; 1.7272 + }; 1.7273 + treemap.ratio = function(x) { 1.7274 + if (!arguments.length) return ratio; 1.7275 + ratio = x; 1.7276 + return treemap; 1.7277 + }; 1.7278 + treemap.mode = function(x) { 1.7279 + if (!arguments.length) return mode; 1.7280 + mode = x + ""; 1.7281 + return treemap; 1.7282 + }; 1.7283 + return d3_layout_hierarchyRebind(treemap, hierarchy); 1.7284 + }; 1.7285 + function d3_layout_treemapPadNull(node) { 1.7286 + return { 1.7287 + x: node.x, 1.7288 + y: node.y, 1.7289 + dx: node.dx, 1.7290 + dy: node.dy 1.7291 + }; 1.7292 + } 1.7293 + function d3_layout_treemapPad(node, padding) { 1.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]; 1.7295 + if (dx < 0) { 1.7296 + x += dx / 2; 1.7297 + dx = 0; 1.7298 + } 1.7299 + if (dy < 0) { 1.7300 + y += dy / 2; 1.7301 + dy = 0; 1.7302 + } 1.7303 + return { 1.7304 + x: x, 1.7305 + y: y, 1.7306 + dx: dx, 1.7307 + dy: dy 1.7308 + }; 1.7309 + } 1.7310 + d3.random = { 1.7311 + normal: function(µ, σ) { 1.7312 + var n = arguments.length; 1.7313 + if (n < 2) σ = 1; 1.7314 + if (n < 1) µ = 0; 1.7315 + return function() { 1.7316 + var x, y, r; 1.7317 + do { 1.7318 + x = Math.random() * 2 - 1; 1.7319 + y = Math.random() * 2 - 1; 1.7320 + r = x * x + y * y; 1.7321 + } while (!r || r > 1); 1.7322 + return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r); 1.7323 + }; 1.7324 + }, 1.7325 + logNormal: function() { 1.7326 + var random = d3.random.normal.apply(d3, arguments); 1.7327 + return function() { 1.7328 + return Math.exp(random()); 1.7329 + }; 1.7330 + }, 1.7331 + bates: function(m) { 1.7332 + var random = d3.random.irwinHall(m); 1.7333 + return function() { 1.7334 + return random() / m; 1.7335 + }; 1.7336 + }, 1.7337 + irwinHall: function(m) { 1.7338 + return function() { 1.7339 + for (var s = 0, j = 0; j < m; j++) s += Math.random(); 1.7340 + return s; 1.7341 + }; 1.7342 + } 1.7343 + }; 1.7344 + d3.scale = {}; 1.7345 + function d3_scaleExtent(domain) { 1.7346 + var start = domain[0], stop = domain[domain.length - 1]; 1.7347 + return start < stop ? [ start, stop ] : [ stop, start ]; 1.7348 + } 1.7349 + function d3_scaleRange(scale) { 1.7350 + return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); 1.7351 + } 1.7352 + function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { 1.7353 + var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]); 1.7354 + return function(x) { 1.7355 + return i(u(x)); 1.7356 + }; 1.7357 + } 1.7358 + function d3_scale_nice(domain, nice) { 1.7359 + var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx; 1.7360 + if (x1 < x0) { 1.7361 + dx = i0, i0 = i1, i1 = dx; 1.7362 + dx = x0, x0 = x1, x1 = dx; 1.7363 + } 1.7364 + domain[i0] = nice.floor(x0); 1.7365 + domain[i1] = nice.ceil(x1); 1.7366 + return domain; 1.7367 + } 1.7368 + function d3_scale_niceStep(step) { 1.7369 + return step ? { 1.7370 + floor: function(x) { 1.7371 + return Math.floor(x / step) * step; 1.7372 + }, 1.7373 + ceil: function(x) { 1.7374 + return Math.ceil(x / step) * step; 1.7375 + } 1.7376 + } : d3_scale_niceIdentity; 1.7377 + } 1.7378 + var d3_scale_niceIdentity = { 1.7379 + floor: d3_identity, 1.7380 + ceil: d3_identity 1.7381 + }; 1.7382 + function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { 1.7383 + var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1; 1.7384 + if (domain[k] < domain[0]) { 1.7385 + domain = domain.slice().reverse(); 1.7386 + range = range.slice().reverse(); 1.7387 + } 1.7388 + while (++j <= k) { 1.7389 + u.push(uninterpolate(domain[j - 1], domain[j])); 1.7390 + i.push(interpolate(range[j - 1], range[j])); 1.7391 + } 1.7392 + return function(x) { 1.7393 + var j = d3.bisect(domain, x, 1, k) - 1; 1.7394 + return i[j](u[j](x)); 1.7395 + }; 1.7396 + } 1.7397 + d3.scale.linear = function() { 1.7398 + return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3_interpolate, false); 1.7399 + }; 1.7400 + function d3_scale_linear(domain, range, interpolate, clamp) { 1.7401 + var output, input; 1.7402 + function rescale() { 1.7403 + var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; 1.7404 + output = linear(domain, range, uninterpolate, interpolate); 1.7405 + input = linear(range, domain, uninterpolate, d3_interpolate); 1.7406 + return scale; 1.7407 + } 1.7408 + function scale(x) { 1.7409 + return output(x); 1.7410 + } 1.7411 + scale.invert = function(y) { 1.7412 + return input(y); 1.7413 + }; 1.7414 + scale.domain = function(x) { 1.7415 + if (!arguments.length) return domain; 1.7416 + domain = x.map(Number); 1.7417 + return rescale(); 1.7418 + }; 1.7419 + scale.range = function(x) { 1.7420 + if (!arguments.length) return range; 1.7421 + range = x; 1.7422 + return rescale(); 1.7423 + }; 1.7424 + scale.rangeRound = function(x) { 1.7425 + return scale.range(x).interpolate(d3_interpolateRound); 1.7426 + }; 1.7427 + scale.clamp = function(x) { 1.7428 + if (!arguments.length) return clamp; 1.7429 + clamp = x; 1.7430 + return rescale(); 1.7431 + }; 1.7432 + scale.interpolate = function(x) { 1.7433 + if (!arguments.length) return interpolate; 1.7434 + interpolate = x; 1.7435 + return rescale(); 1.7436 + }; 1.7437 + scale.ticks = function(m) { 1.7438 + return d3_scale_linearTicks(domain, m); 1.7439 + }; 1.7440 + scale.tickFormat = function(m, format) { 1.7441 + return d3_scale_linearTickFormat(domain, m, format); 1.7442 + }; 1.7443 + scale.nice = function(m) { 1.7444 + d3_scale_linearNice(domain, m); 1.7445 + return rescale(); 1.7446 + }; 1.7447 + scale.copy = function() { 1.7448 + return d3_scale_linear(domain, range, interpolate, clamp); 1.7449 + }; 1.7450 + return rescale(); 1.7451 + } 1.7452 + function d3_scale_linearRebind(scale, linear) { 1.7453 + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); 1.7454 + } 1.7455 + function d3_scale_linearNice(domain, m) { 1.7456 + return d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2])); 1.7457 + } 1.7458 + function d3_scale_linearTickRange(domain, m) { 1.7459 + if (m == null) m = 10; 1.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; 1.7461 + if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2; 1.7462 + extent[0] = Math.ceil(extent[0] / step) * step; 1.7463 + extent[1] = Math.floor(extent[1] / step) * step + step * .5; 1.7464 + extent[2] = step; 1.7465 + return extent; 1.7466 + } 1.7467 + function d3_scale_linearTicks(domain, m) { 1.7468 + return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); 1.7469 + } 1.7470 + function d3_scale_linearTickFormat(domain, m, format) { 1.7471 + var range = d3_scale_linearTickRange(domain, m); 1.7472 + return d3.format(format ? format.replace(d3_format_re, function(a, b, c, d, e, f, g, h, i, j) { 1.7473 + return [ b, c, d, e, f, g, h, i || "." + d3_scale_linearFormatPrecision(j, range), j ].join(""); 1.7474 + }) : ",." + d3_scale_linearPrecision(range[2]) + "f"); 1.7475 + } 1.7476 + var d3_scale_linearFormatSignificant = { 1.7477 + s: 1, 1.7478 + g: 1, 1.7479 + p: 1, 1.7480 + r: 1, 1.7481 + e: 1 1.7482 + }; 1.7483 + function d3_scale_linearPrecision(value) { 1.7484 + return -Math.floor(Math.log(value) / Math.LN10 + .01); 1.7485 + } 1.7486 + function d3_scale_linearFormatPrecision(type, range) { 1.7487 + var p = d3_scale_linearPrecision(range[2]); 1.7488 + return type in d3_scale_linearFormatSignificant ? Math.abs(p - d3_scale_linearPrecision(Math.max(Math.abs(range[0]), Math.abs(range[1])))) + +(type !== "e") : p - (type === "%") * 2; 1.7489 + } 1.7490 + d3.scale.log = function() { 1.7491 + return d3_scale_log(d3.scale.linear().domain([ 0, 1 ]), 10, true, [ 1, 10 ]); 1.7492 + }; 1.7493 + function d3_scale_log(linear, base, positive, domain) { 1.7494 + function log(x) { 1.7495 + return (positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(base); 1.7496 + } 1.7497 + function pow(x) { 1.7498 + return positive ? Math.pow(base, x) : -Math.pow(base, -x); 1.7499 + } 1.7500 + function scale(x) { 1.7501 + return linear(log(x)); 1.7502 + } 1.7503 + scale.invert = function(x) { 1.7504 + return pow(linear.invert(x)); 1.7505 + }; 1.7506 + scale.domain = function(x) { 1.7507 + if (!arguments.length) return domain; 1.7508 + positive = x[0] >= 0; 1.7509 + linear.domain((domain = x.map(Number)).map(log)); 1.7510 + return scale; 1.7511 + }; 1.7512 + scale.base = function(_) { 1.7513 + if (!arguments.length) return base; 1.7514 + base = +_; 1.7515 + linear.domain(domain.map(log)); 1.7516 + return scale; 1.7517 + }; 1.7518 + scale.nice = function() { 1.7519 + var niced = d3_scale_nice(domain.map(log), positive ? Math : d3_scale_logNiceNegative); 1.7520 + linear.domain(niced); 1.7521 + domain = niced.map(pow); 1.7522 + return scale; 1.7523 + }; 1.7524 + scale.ticks = function() { 1.7525 + 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; 1.7526 + if (isFinite(j - i)) { 1.7527 + if (positive) { 1.7528 + for (;i < j; i++) for (var k = 1; k < n; k++) ticks.push(pow(i) * k); 1.7529 + ticks.push(pow(i)); 1.7530 + } else { 1.7531 + ticks.push(pow(i)); 1.7532 + for (;i++ < j; ) for (var k = n - 1; k > 0; k--) ticks.push(pow(i) * k); 1.7533 + } 1.7534 + for (i = 0; ticks[i] < u; i++) {} 1.7535 + for (j = ticks.length; ticks[j - 1] > v; j--) {} 1.7536 + ticks = ticks.slice(i, j); 1.7537 + } 1.7538 + return ticks; 1.7539 + }; 1.7540 + scale.tickFormat = function(n, format) { 1.7541 + if (!arguments.length) return d3_scale_logFormat; 1.7542 + if (arguments.length < 2) format = d3_scale_logFormat; else if (typeof format !== "function") format = d3.format(format); 1.7543 + var k = Math.max(.1, n / scale.ticks().length), f = positive ? (e = 1e-12, Math.ceil) : (e = -1e-12, 1.7544 + Math.floor), e; 1.7545 + return function(d) { 1.7546 + return d / pow(f(log(d) + e)) <= k ? format(d) : ""; 1.7547 + }; 1.7548 + }; 1.7549 + scale.copy = function() { 1.7550 + return d3_scale_log(linear.copy(), base, positive, domain); 1.7551 + }; 1.7552 + return d3_scale_linearRebind(scale, linear); 1.7553 + } 1.7554 + var d3_scale_logFormat = d3.format(".0e"), d3_scale_logNiceNegative = { 1.7555 + floor: function(x) { 1.7556 + return -Math.ceil(-x); 1.7557 + }, 1.7558 + ceil: function(x) { 1.7559 + return -Math.floor(-x); 1.7560 + } 1.7561 + }; 1.7562 + d3.scale.pow = function() { 1.7563 + return d3_scale_pow(d3.scale.linear(), 1, [ 0, 1 ]); 1.7564 + }; 1.7565 + function d3_scale_pow(linear, exponent, domain) { 1.7566 + var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent); 1.7567 + function scale(x) { 1.7568 + return linear(powp(x)); 1.7569 + } 1.7570 + scale.invert = function(x) { 1.7571 + return powb(linear.invert(x)); 1.7572 + }; 1.7573 + scale.domain = function(x) { 1.7574 + if (!arguments.length) return domain; 1.7575 + linear.domain((domain = x.map(Number)).map(powp)); 1.7576 + return scale; 1.7577 + }; 1.7578 + scale.ticks = function(m) { 1.7579 + return d3_scale_linearTicks(domain, m); 1.7580 + }; 1.7581 + scale.tickFormat = function(m, format) { 1.7582 + return d3_scale_linearTickFormat(domain, m, format); 1.7583 + }; 1.7584 + scale.nice = function(m) { 1.7585 + return scale.domain(d3_scale_linearNice(domain, m)); 1.7586 + }; 1.7587 + scale.exponent = function(x) { 1.7588 + if (!arguments.length) return exponent; 1.7589 + powp = d3_scale_powPow(exponent = x); 1.7590 + powb = d3_scale_powPow(1 / exponent); 1.7591 + linear.domain(domain.map(powp)); 1.7592 + return scale; 1.7593 + }; 1.7594 + scale.copy = function() { 1.7595 + return d3_scale_pow(linear.copy(), exponent, domain); 1.7596 + }; 1.7597 + return d3_scale_linearRebind(scale, linear); 1.7598 + } 1.7599 + function d3_scale_powPow(e) { 1.7600 + return function(x) { 1.7601 + return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); 1.7602 + }; 1.7603 + } 1.7604 + d3.scale.sqrt = function() { 1.7605 + return d3.scale.pow().exponent(.5); 1.7606 + }; 1.7607 + d3.scale.ordinal = function() { 1.7608 + return d3_scale_ordinal([], { 1.7609 + t: "range", 1.7610 + a: [ [] ] 1.7611 + }); 1.7612 + }; 1.7613 + function d3_scale_ordinal(domain, ranger) { 1.7614 + var index, range, rangeBand; 1.7615 + function scale(x) { 1.7616 + return range[((index.get(x) || ranger.t === "range" && index.set(x, domain.push(x))) - 1) % range.length]; 1.7617 + } 1.7618 + function steps(start, step) { 1.7619 + return d3.range(domain.length).map(function(i) { 1.7620 + return start + step * i; 1.7621 + }); 1.7622 + } 1.7623 + scale.domain = function(x) { 1.7624 + if (!arguments.length) return domain; 1.7625 + domain = []; 1.7626 + index = new d3_Map(); 1.7627 + var i = -1, n = x.length, xi; 1.7628 + while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi)); 1.7629 + return scale[ranger.t].apply(scale, ranger.a); 1.7630 + }; 1.7631 + scale.range = function(x) { 1.7632 + if (!arguments.length) return range; 1.7633 + range = x; 1.7634 + rangeBand = 0; 1.7635 + ranger = { 1.7636 + t: "range", 1.7637 + a: arguments 1.7638 + }; 1.7639 + return scale; 1.7640 + }; 1.7641 + scale.rangePoints = function(x, padding) { 1.7642 + if (arguments.length < 2) padding = 0; 1.7643 + var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding); 1.7644 + range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step); 1.7645 + rangeBand = 0; 1.7646 + ranger = { 1.7647 + t: "rangePoints", 1.7648 + a: arguments 1.7649 + }; 1.7650 + return scale; 1.7651 + }; 1.7652 + scale.rangeBands = function(x, padding, outerPadding) { 1.7653 + if (arguments.length < 2) padding = 0; 1.7654 + if (arguments.length < 3) outerPadding = padding; 1.7655 + var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding); 1.7656 + range = steps(start + step * outerPadding, step); 1.7657 + if (reverse) range.reverse(); 1.7658 + rangeBand = step * (1 - padding); 1.7659 + ranger = { 1.7660 + t: "rangeBands", 1.7661 + a: arguments 1.7662 + }; 1.7663 + return scale; 1.7664 + }; 1.7665 + scale.rangeRoundBands = function(x, padding, outerPadding) { 1.7666 + if (arguments.length < 2) padding = 0; 1.7667 + if (arguments.length < 3) outerPadding = padding; 1.7668 + 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; 1.7669 + range = steps(start + Math.round(error / 2), step); 1.7670 + if (reverse) range.reverse(); 1.7671 + rangeBand = Math.round(step * (1 - padding)); 1.7672 + ranger = { 1.7673 + t: "rangeRoundBands", 1.7674 + a: arguments 1.7675 + }; 1.7676 + return scale; 1.7677 + }; 1.7678 + scale.rangeBand = function() { 1.7679 + return rangeBand; 1.7680 + }; 1.7681 + scale.rangeExtent = function() { 1.7682 + return d3_scaleExtent(ranger.a[0]); 1.7683 + }; 1.7684 + scale.copy = function() { 1.7685 + return d3_scale_ordinal(domain, ranger); 1.7686 + }; 1.7687 + return scale.domain(domain); 1.7688 + } 1.7689 + d3.scale.category10 = function() { 1.7690 + return d3.scale.ordinal().range(d3_category10); 1.7691 + }; 1.7692 + d3.scale.category20 = function() { 1.7693 + return d3.scale.ordinal().range(d3_category20); 1.7694 + }; 1.7695 + d3.scale.category20b = function() { 1.7696 + return d3.scale.ordinal().range(d3_category20b); 1.7697 + }; 1.7698 + d3.scale.category20c = function() { 1.7699 + return d3.scale.ordinal().range(d3_category20c); 1.7700 + }; 1.7701 + var d3_category10 = [ 2062260, 16744206, 2924588, 14034728, 9725885, 9197131, 14907330, 8355711, 12369186, 1556175 ].map(d3_rgbString); 1.7702 + 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); 1.7703 + 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); 1.7704 + 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); 1.7705 + d3.scale.quantile = function() { 1.7706 + return d3_scale_quantile([], []); 1.7707 + }; 1.7708 + function d3_scale_quantile(domain, range) { 1.7709 + var thresholds; 1.7710 + function rescale() { 1.7711 + var k = 0, q = range.length; 1.7712 + thresholds = []; 1.7713 + while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); 1.7714 + return scale; 1.7715 + } 1.7716 + function scale(x) { 1.7717 + if (!isNaN(x = +x)) return range[d3.bisect(thresholds, x)]; 1.7718 + } 1.7719 + scale.domain = function(x) { 1.7720 + if (!arguments.length) return domain; 1.7721 + domain = x.filter(function(d) { 1.7722 + return !isNaN(d); 1.7723 + }).sort(d3.ascending); 1.7724 + return rescale(); 1.7725 + }; 1.7726 + scale.range = function(x) { 1.7727 + if (!arguments.length) return range; 1.7728 + range = x; 1.7729 + return rescale(); 1.7730 + }; 1.7731 + scale.quantiles = function() { 1.7732 + return thresholds; 1.7733 + }; 1.7734 + scale.invertExtent = function(y) { 1.7735 + y = range.indexOf(y); 1.7736 + return y < 0 ? [ NaN, NaN ] : [ y > 0 ? thresholds[y - 1] : domain[0], y < thresholds.length ? thresholds[y] : domain[domain.length - 1] ]; 1.7737 + }; 1.7738 + scale.copy = function() { 1.7739 + return d3_scale_quantile(domain, range); 1.7740 + }; 1.7741 + return rescale(); 1.7742 + } 1.7743 + d3.scale.quantize = function() { 1.7744 + return d3_scale_quantize(0, 1, [ 0, 1 ]); 1.7745 + }; 1.7746 + function d3_scale_quantize(x0, x1, range) { 1.7747 + var kx, i; 1.7748 + function scale(x) { 1.7749 + return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; 1.7750 + } 1.7751 + function rescale() { 1.7752 + kx = range.length / (x1 - x0); 1.7753 + i = range.length - 1; 1.7754 + return scale; 1.7755 + } 1.7756 + scale.domain = function(x) { 1.7757 + if (!arguments.length) return [ x0, x1 ]; 1.7758 + x0 = +x[0]; 1.7759 + x1 = +x[x.length - 1]; 1.7760 + return rescale(); 1.7761 + }; 1.7762 + scale.range = function(x) { 1.7763 + if (!arguments.length) return range; 1.7764 + range = x; 1.7765 + return rescale(); 1.7766 + }; 1.7767 + scale.invertExtent = function(y) { 1.7768 + y = range.indexOf(y); 1.7769 + y = y < 0 ? NaN : y / kx + x0; 1.7770 + return [ y, y + 1 / kx ]; 1.7771 + }; 1.7772 + scale.copy = function() { 1.7773 + return d3_scale_quantize(x0, x1, range); 1.7774 + }; 1.7775 + return rescale(); 1.7776 + } 1.7777 + d3.scale.threshold = function() { 1.7778 + return d3_scale_threshold([ .5 ], [ 0, 1 ]); 1.7779 + }; 1.7780 + function d3_scale_threshold(domain, range) { 1.7781 + function scale(x) { 1.7782 + if (x <= x) return range[d3.bisect(domain, x)]; 1.7783 + } 1.7784 + scale.domain = function(_) { 1.7785 + if (!arguments.length) return domain; 1.7786 + domain = _; 1.7787 + return scale; 1.7788 + }; 1.7789 + scale.range = function(_) { 1.7790 + if (!arguments.length) return range; 1.7791 + range = _; 1.7792 + return scale; 1.7793 + }; 1.7794 + scale.invertExtent = function(y) { 1.7795 + y = range.indexOf(y); 1.7796 + return [ domain[y - 1], domain[y] ]; 1.7797 + }; 1.7798 + scale.copy = function() { 1.7799 + return d3_scale_threshold(domain, range); 1.7800 + }; 1.7801 + return scale; 1.7802 + } 1.7803 + d3.scale.identity = function() { 1.7804 + return d3_scale_identity([ 0, 1 ]); 1.7805 + }; 1.7806 + function d3_scale_identity(domain) { 1.7807 + function identity(x) { 1.7808 + return +x; 1.7809 + } 1.7810 + identity.invert = identity; 1.7811 + identity.domain = identity.range = function(x) { 1.7812 + if (!arguments.length) return domain; 1.7813 + domain = x.map(identity); 1.7814 + return identity; 1.7815 + }; 1.7816 + identity.ticks = function(m) { 1.7817 + return d3_scale_linearTicks(domain, m); 1.7818 + }; 1.7819 + identity.tickFormat = function(m, format) { 1.7820 + return d3_scale_linearTickFormat(domain, m, format); 1.7821 + }; 1.7822 + identity.copy = function() { 1.7823 + return d3_scale_identity(domain); 1.7824 + }; 1.7825 + return identity; 1.7826 + } 1.7827 + d3.svg = {}; 1.7828 + d3.svg.arc = function() { 1.7829 + var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; 1.7830 + function arc() { 1.7831 + 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, 1.7832 + 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); 1.7833 + 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"; 1.7834 + } 1.7835 + arc.innerRadius = function(v) { 1.7836 + if (!arguments.length) return innerRadius; 1.7837 + innerRadius = d3_functor(v); 1.7838 + return arc; 1.7839 + }; 1.7840 + arc.outerRadius = function(v) { 1.7841 + if (!arguments.length) return outerRadius; 1.7842 + outerRadius = d3_functor(v); 1.7843 + return arc; 1.7844 + }; 1.7845 + arc.startAngle = function(v) { 1.7846 + if (!arguments.length) return startAngle; 1.7847 + startAngle = d3_functor(v); 1.7848 + return arc; 1.7849 + }; 1.7850 + arc.endAngle = function(v) { 1.7851 + if (!arguments.length) return endAngle; 1.7852 + endAngle = d3_functor(v); 1.7853 + return arc; 1.7854 + }; 1.7855 + arc.centroid = function() { 1.7856 + var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset; 1.7857 + return [ Math.cos(a) * r, Math.sin(a) * r ]; 1.7858 + }; 1.7859 + return arc; 1.7860 + }; 1.7861 + var d3_svg_arcOffset = -halfπ, d3_svg_arcMax = τ - ε; 1.7862 + function d3_svg_arcInnerRadius(d) { 1.7863 + return d.innerRadius; 1.7864 + } 1.7865 + function d3_svg_arcOuterRadius(d) { 1.7866 + return d.outerRadius; 1.7867 + } 1.7868 + function d3_svg_arcStartAngle(d) { 1.7869 + return d.startAngle; 1.7870 + } 1.7871 + function d3_svg_arcEndAngle(d) { 1.7872 + return d.endAngle; 1.7873 + } 1.7874 + function d3_svg_line(projection) { 1.7875 + var x = d3_geom_pointX, y = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7; 1.7876 + function line(data) { 1.7877 + var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y); 1.7878 + function segment() { 1.7879 + segments.push("M", interpolate(projection(points), tension)); 1.7880 + } 1.7881 + while (++i < n) { 1.7882 + if (defined.call(this, d = data[i], i)) { 1.7883 + points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]); 1.7884 + } else if (points.length) { 1.7885 + segment(); 1.7886 + points = []; 1.7887 + } 1.7888 + } 1.7889 + if (points.length) segment(); 1.7890 + return segments.length ? segments.join("") : null; 1.7891 + } 1.7892 + line.x = function(_) { 1.7893 + if (!arguments.length) return x; 1.7894 + x = _; 1.7895 + return line; 1.7896 + }; 1.7897 + line.y = function(_) { 1.7898 + if (!arguments.length) return y; 1.7899 + y = _; 1.7900 + return line; 1.7901 + }; 1.7902 + line.defined = function(_) { 1.7903 + if (!arguments.length) return defined; 1.7904 + defined = _; 1.7905 + return line; 1.7906 + }; 1.7907 + line.interpolate = function(_) { 1.7908 + if (!arguments.length) return interpolateKey; 1.7909 + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; 1.7910 + return line; 1.7911 + }; 1.7912 + line.tension = function(_) { 1.7913 + if (!arguments.length) return tension; 1.7914 + tension = _; 1.7915 + return line; 1.7916 + }; 1.7917 + return line; 1.7918 + } 1.7919 + d3.svg.line = function() { 1.7920 + return d3_svg_line(d3_identity); 1.7921 + }; 1.7922 + var d3_svg_lineInterpolators = d3.map({ 1.7923 + linear: d3_svg_lineLinear, 1.7924 + "linear-closed": d3_svg_lineLinearClosed, 1.7925 + step: d3_svg_lineStep, 1.7926 + "step-before": d3_svg_lineStepBefore, 1.7927 + "step-after": d3_svg_lineStepAfter, 1.7928 + basis: d3_svg_lineBasis, 1.7929 + "basis-open": d3_svg_lineBasisOpen, 1.7930 + "basis-closed": d3_svg_lineBasisClosed, 1.7931 + bundle: d3_svg_lineBundle, 1.7932 + cardinal: d3_svg_lineCardinal, 1.7933 + "cardinal-open": d3_svg_lineCardinalOpen, 1.7934 + "cardinal-closed": d3_svg_lineCardinalClosed, 1.7935 + monotone: d3_svg_lineMonotone 1.7936 + }); 1.7937 + d3_svg_lineInterpolators.forEach(function(key, value) { 1.7938 + value.key = key; 1.7939 + value.closed = /-closed$/.test(key); 1.7940 + }); 1.7941 + function d3_svg_lineLinear(points) { 1.7942 + return points.join("L"); 1.7943 + } 1.7944 + function d3_svg_lineLinearClosed(points) { 1.7945 + return d3_svg_lineLinear(points) + "Z"; 1.7946 + } 1.7947 + function d3_svg_lineStep(points) { 1.7948 + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; 1.7949 + while (++i < n) path.push("H", (p[0] + (p = points[i])[0]) / 2, "V", p[1]); 1.7950 + if (n > 1) path.push("H", p[0]); 1.7951 + return path.join(""); 1.7952 + } 1.7953 + function d3_svg_lineStepBefore(points) { 1.7954 + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; 1.7955 + while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); 1.7956 + return path.join(""); 1.7957 + } 1.7958 + function d3_svg_lineStepAfter(points) { 1.7959 + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; 1.7960 + while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); 1.7961 + return path.join(""); 1.7962 + } 1.7963 + function d3_svg_lineCardinalOpen(points, tension) { 1.7964 + return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension)); 1.7965 + } 1.7966 + function d3_svg_lineCardinalClosed(points, tension) { 1.7967 + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), 1.7968 + points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension)); 1.7969 + } 1.7970 + function d3_svg_lineCardinal(points, tension) { 1.7971 + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension)); 1.7972 + } 1.7973 + function d3_svg_lineHermite(points, tangents) { 1.7974 + if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) { 1.7975 + return d3_svg_lineLinear(points); 1.7976 + } 1.7977 + var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1; 1.7978 + if (quad) { 1.7979 + path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1]; 1.7980 + p0 = points[1]; 1.7981 + pi = 2; 1.7982 + } 1.7983 + if (tangents.length > 1) { 1.7984 + t = tangents[1]; 1.7985 + p = points[pi]; 1.7986 + pi++; 1.7987 + path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; 1.7988 + for (var i = 2; i < tangents.length; i++, pi++) { 1.7989 + p = points[pi]; 1.7990 + t = tangents[i]; 1.7991 + path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; 1.7992 + } 1.7993 + } 1.7994 + if (quad) { 1.7995 + var lp = points[pi]; 1.7996 + path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1]; 1.7997 + } 1.7998 + return path; 1.7999 + } 1.8000 + function d3_svg_lineCardinalTangents(points, tension) { 1.8001 + var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length; 1.8002 + while (++i < n) { 1.8003 + p0 = p1; 1.8004 + p1 = p2; 1.8005 + p2 = points[i]; 1.8006 + tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]); 1.8007 + } 1.8008 + return tangents; 1.8009 + } 1.8010 + function d3_svg_lineBasis(points) { 1.8011 + if (points.length < 3) return d3_svg_lineLinear(points); 1.8012 + 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) ]; 1.8013 + points.push(points[n - 1]); 1.8014 + while (++i <= n) { 1.8015 + pi = points[i]; 1.8016 + px.shift(); 1.8017 + px.push(pi[0]); 1.8018 + py.shift(); 1.8019 + py.push(pi[1]); 1.8020 + d3_svg_lineBasisBezier(path, px, py); 1.8021 + } 1.8022 + points.pop(); 1.8023 + path.push("L", pi); 1.8024 + return path.join(""); 1.8025 + } 1.8026 + function d3_svg_lineBasisOpen(points) { 1.8027 + if (points.length < 4) return d3_svg_lineLinear(points); 1.8028 + var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ]; 1.8029 + while (++i < 3) { 1.8030 + pi = points[i]; 1.8031 + px.push(pi[0]); 1.8032 + py.push(pi[1]); 1.8033 + } 1.8034 + path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); 1.8035 + --i; 1.8036 + while (++i < n) { 1.8037 + pi = points[i]; 1.8038 + px.shift(); 1.8039 + px.push(pi[0]); 1.8040 + py.shift(); 1.8041 + py.push(pi[1]); 1.8042 + d3_svg_lineBasisBezier(path, px, py); 1.8043 + } 1.8044 + return path.join(""); 1.8045 + } 1.8046 + function d3_svg_lineBasisClosed(points) { 1.8047 + var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = []; 1.8048 + while (++i < 4) { 1.8049 + pi = points[i % n]; 1.8050 + px.push(pi[0]); 1.8051 + py.push(pi[1]); 1.8052 + } 1.8053 + path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; 1.8054 + --i; 1.8055 + while (++i < m) { 1.8056 + pi = points[i % n]; 1.8057 + px.shift(); 1.8058 + px.push(pi[0]); 1.8059 + py.shift(); 1.8060 + py.push(pi[1]); 1.8061 + d3_svg_lineBasisBezier(path, px, py); 1.8062 + } 1.8063 + return path.join(""); 1.8064 + } 1.8065 + function d3_svg_lineBundle(points, tension) { 1.8066 + var n = points.length - 1; 1.8067 + if (n) { 1.8068 + var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t; 1.8069 + while (++i <= n) { 1.8070 + p = points[i]; 1.8071 + t = i / n; 1.8072 + p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); 1.8073 + p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); 1.8074 + } 1.8075 + } 1.8076 + return d3_svg_lineBasis(points); 1.8077 + } 1.8078 + function d3_svg_lineDot4(a, b) { 1.8079 + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; 1.8080 + } 1.8081 + 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 ]; 1.8082 + function d3_svg_lineBasisBezier(path, x, y) { 1.8083 + 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)); 1.8084 + } 1.8085 + function d3_svg_lineSlope(p0, p1) { 1.8086 + return (p1[1] - p0[1]) / (p1[0] - p0[0]); 1.8087 + } 1.8088 + function d3_svg_lineFiniteDifferences(points) { 1.8089 + var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1); 1.8090 + while (++i < j) { 1.8091 + m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2; 1.8092 + } 1.8093 + m[i] = d; 1.8094 + return m; 1.8095 + } 1.8096 + function d3_svg_lineMonotoneTangents(points) { 1.8097 + var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1; 1.8098 + while (++i < j) { 1.8099 + d = d3_svg_lineSlope(points[i], points[i + 1]); 1.8100 + if (abs(d) < ε) { 1.8101 + m[i] = m[i + 1] = 0; 1.8102 + } else { 1.8103 + a = m[i] / d; 1.8104 + b = m[i + 1] / d; 1.8105 + s = a * a + b * b; 1.8106 + if (s > 9) { 1.8107 + s = d * 3 / Math.sqrt(s); 1.8108 + m[i] = s * a; 1.8109 + m[i + 1] = s * b; 1.8110 + } 1.8111 + } 1.8112 + } 1.8113 + i = -1; 1.8114 + while (++i <= j) { 1.8115 + s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i])); 1.8116 + tangents.push([ s || 0, m[i] * s || 0 ]); 1.8117 + } 1.8118 + return tangents; 1.8119 + } 1.8120 + function d3_svg_lineMonotone(points) { 1.8121 + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); 1.8122 + } 1.8123 + d3.svg.line.radial = function() { 1.8124 + var line = d3_svg_line(d3_svg_lineRadial); 1.8125 + line.radius = line.x, delete line.x; 1.8126 + line.angle = line.y, delete line.y; 1.8127 + return line; 1.8128 + }; 1.8129 + function d3_svg_lineRadial(points) { 1.8130 + var point, i = -1, n = points.length, r, a; 1.8131 + while (++i < n) { 1.8132 + point = points[i]; 1.8133 + r = point[0]; 1.8134 + a = point[1] + d3_svg_arcOffset; 1.8135 + point[0] = r * Math.cos(a); 1.8136 + point[1] = r * Math.sin(a); 1.8137 + } 1.8138 + return points; 1.8139 + } 1.8140 + function d3_svg_area(projection) { 1.8141 + 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; 1.8142 + function area(data) { 1.8143 + var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() { 1.8144 + return x; 1.8145 + } : d3_functor(x1), fy1 = y0 === y1 ? function() { 1.8146 + return y; 1.8147 + } : d3_functor(y1), x, y; 1.8148 + function segment() { 1.8149 + segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z"); 1.8150 + } 1.8151 + while (++i < n) { 1.8152 + if (defined.call(this, d = data[i], i)) { 1.8153 + points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]); 1.8154 + points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]); 1.8155 + } else if (points0.length) { 1.8156 + segment(); 1.8157 + points0 = []; 1.8158 + points1 = []; 1.8159 + } 1.8160 + } 1.8161 + if (points0.length) segment(); 1.8162 + return segments.length ? segments.join("") : null; 1.8163 + } 1.8164 + area.x = function(_) { 1.8165 + if (!arguments.length) return x1; 1.8166 + x0 = x1 = _; 1.8167 + return area; 1.8168 + }; 1.8169 + area.x0 = function(_) { 1.8170 + if (!arguments.length) return x0; 1.8171 + x0 = _; 1.8172 + return area; 1.8173 + }; 1.8174 + area.x1 = function(_) { 1.8175 + if (!arguments.length) return x1; 1.8176 + x1 = _; 1.8177 + return area; 1.8178 + }; 1.8179 + area.y = function(_) { 1.8180 + if (!arguments.length) return y1; 1.8181 + y0 = y1 = _; 1.8182 + return area; 1.8183 + }; 1.8184 + area.y0 = function(_) { 1.8185 + if (!arguments.length) return y0; 1.8186 + y0 = _; 1.8187 + return area; 1.8188 + }; 1.8189 + area.y1 = function(_) { 1.8190 + if (!arguments.length) return y1; 1.8191 + y1 = _; 1.8192 + return area; 1.8193 + }; 1.8194 + area.defined = function(_) { 1.8195 + if (!arguments.length) return defined; 1.8196 + defined = _; 1.8197 + return area; 1.8198 + }; 1.8199 + area.interpolate = function(_) { 1.8200 + if (!arguments.length) return interpolateKey; 1.8201 + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; 1.8202 + interpolateReverse = interpolate.reverse || interpolate; 1.8203 + L = interpolate.closed ? "M" : "L"; 1.8204 + return area; 1.8205 + }; 1.8206 + area.tension = function(_) { 1.8207 + if (!arguments.length) return tension; 1.8208 + tension = _; 1.8209 + return area; 1.8210 + }; 1.8211 + return area; 1.8212 + } 1.8213 + d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; 1.8214 + d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; 1.8215 + d3.svg.area = function() { 1.8216 + return d3_svg_area(d3_identity); 1.8217 + }; 1.8218 + d3.svg.area.radial = function() { 1.8219 + var area = d3_svg_area(d3_svg_lineRadial); 1.8220 + area.radius = area.x, delete area.x; 1.8221 + area.innerRadius = area.x0, delete area.x0; 1.8222 + area.outerRadius = area.x1, delete area.x1; 1.8223 + area.angle = area.y, delete area.y; 1.8224 + area.startAngle = area.y0, delete area.y0; 1.8225 + area.endAngle = area.y1, delete area.y1; 1.8226 + return area; 1.8227 + }; 1.8228 + d3.svg.chord = function() { 1.8229 + var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; 1.8230 + function chord(d, i) { 1.8231 + var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i); 1.8232 + 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"; 1.8233 + } 1.8234 + function subgroup(self, f, d, i) { 1.8235 + 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; 1.8236 + return { 1.8237 + r: r, 1.8238 + a0: a0, 1.8239 + a1: a1, 1.8240 + p0: [ r * Math.cos(a0), r * Math.sin(a0) ], 1.8241 + p1: [ r * Math.cos(a1), r * Math.sin(a1) ] 1.8242 + }; 1.8243 + } 1.8244 + function equals(a, b) { 1.8245 + return a.a0 == b.a0 && a.a1 == b.a1; 1.8246 + } 1.8247 + function arc(r, p, a) { 1.8248 + return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p; 1.8249 + } 1.8250 + function curve(r0, p0, r1, p1) { 1.8251 + return "Q 0,0 " + p1; 1.8252 + } 1.8253 + chord.radius = function(v) { 1.8254 + if (!arguments.length) return radius; 1.8255 + radius = d3_functor(v); 1.8256 + return chord; 1.8257 + }; 1.8258 + chord.source = function(v) { 1.8259 + if (!arguments.length) return source; 1.8260 + source = d3_functor(v); 1.8261 + return chord; 1.8262 + }; 1.8263 + chord.target = function(v) { 1.8264 + if (!arguments.length) return target; 1.8265 + target = d3_functor(v); 1.8266 + return chord; 1.8267 + }; 1.8268 + chord.startAngle = function(v) { 1.8269 + if (!arguments.length) return startAngle; 1.8270 + startAngle = d3_functor(v); 1.8271 + return chord; 1.8272 + }; 1.8273 + chord.endAngle = function(v) { 1.8274 + if (!arguments.length) return endAngle; 1.8275 + endAngle = d3_functor(v); 1.8276 + return chord; 1.8277 + }; 1.8278 + return chord; 1.8279 + }; 1.8280 + function d3_svg_chordRadius(d) { 1.8281 + return d.radius; 1.8282 + } 1.8283 + d3.svg.diagonal = function() { 1.8284 + var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection; 1.8285 + function diagonal(d, i) { 1.8286 + var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, { 1.8287 + x: p0.x, 1.8288 + y: m 1.8289 + }, { 1.8290 + x: p3.x, 1.8291 + y: m 1.8292 + }, p3 ]; 1.8293 + p = p.map(projection); 1.8294 + return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; 1.8295 + } 1.8296 + diagonal.source = function(x) { 1.8297 + if (!arguments.length) return source; 1.8298 + source = d3_functor(x); 1.8299 + return diagonal; 1.8300 + }; 1.8301 + diagonal.target = function(x) { 1.8302 + if (!arguments.length) return target; 1.8303 + target = d3_functor(x); 1.8304 + return diagonal; 1.8305 + }; 1.8306 + diagonal.projection = function(x) { 1.8307 + if (!arguments.length) return projection; 1.8308 + projection = x; 1.8309 + return diagonal; 1.8310 + }; 1.8311 + return diagonal; 1.8312 + }; 1.8313 + function d3_svg_diagonalProjection(d) { 1.8314 + return [ d.x, d.y ]; 1.8315 + } 1.8316 + d3.svg.diagonal.radial = function() { 1.8317 + var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection; 1.8318 + diagonal.projection = function(x) { 1.8319 + return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection; 1.8320 + }; 1.8321 + return diagonal; 1.8322 + }; 1.8323 + function d3_svg_diagonalRadialProjection(projection) { 1.8324 + return function() { 1.8325 + var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset; 1.8326 + return [ r * Math.cos(a), r * Math.sin(a) ]; 1.8327 + }; 1.8328 + } 1.8329 + d3.svg.symbol = function() { 1.8330 + var type = d3_svg_symbolType, size = d3_svg_symbolSize; 1.8331 + function symbol(d, i) { 1.8332 + return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i)); 1.8333 + } 1.8334 + symbol.type = function(x) { 1.8335 + if (!arguments.length) return type; 1.8336 + type = d3_functor(x); 1.8337 + return symbol; 1.8338 + }; 1.8339 + symbol.size = function(x) { 1.8340 + if (!arguments.length) return size; 1.8341 + size = d3_functor(x); 1.8342 + return symbol; 1.8343 + }; 1.8344 + return symbol; 1.8345 + }; 1.8346 + function d3_svg_symbolSize() { 1.8347 + return 64; 1.8348 + } 1.8349 + function d3_svg_symbolType() { 1.8350 + return "circle"; 1.8351 + } 1.8352 + function d3_svg_symbolCircle(size) { 1.8353 + var r = Math.sqrt(size / π); 1.8354 + return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z"; 1.8355 + } 1.8356 + var d3_svg_symbols = d3.map({ 1.8357 + circle: d3_svg_symbolCircle, 1.8358 + cross: function(size) { 1.8359 + var r = Math.sqrt(size / 5) / 2; 1.8360 + 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"; 1.8361 + }, 1.8362 + diamond: function(size) { 1.8363 + var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30; 1.8364 + return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z"; 1.8365 + }, 1.8366 + square: function(size) { 1.8367 + var r = Math.sqrt(size) / 2; 1.8368 + return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z"; 1.8369 + }, 1.8370 + "triangle-down": function(size) { 1.8371 + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; 1.8372 + return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z"; 1.8373 + }, 1.8374 + "triangle-up": function(size) { 1.8375 + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; 1.8376 + return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z"; 1.8377 + } 1.8378 + }); 1.8379 + d3.svg.symbolTypes = d3_svg_symbols.keys(); 1.8380 + var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians); 1.8381 + function d3_transition(groups, id) { 1.8382 + d3_subclass(groups, d3_transitionPrototype); 1.8383 + groups.id = id; 1.8384 + return groups; 1.8385 + } 1.8386 + var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit; 1.8387 + d3_transitionPrototype.call = d3_selectionPrototype.call; 1.8388 + d3_transitionPrototype.empty = d3_selectionPrototype.empty; 1.8389 + d3_transitionPrototype.node = d3_selectionPrototype.node; 1.8390 + d3_transitionPrototype.size = d3_selectionPrototype.size; 1.8391 + d3.transition = function(selection) { 1.8392 + return arguments.length ? d3_transitionInheritId ? selection.transition() : selection : d3_selectionRoot.transition(); 1.8393 + }; 1.8394 + d3.transition.prototype = d3_transitionPrototype; 1.8395 + d3_transitionPrototype.select = function(selector) { 1.8396 + var id = this.id, subgroups = [], subgroup, subnode, node; 1.8397 + selector = d3_selection_selector(selector); 1.8398 + for (var j = -1, m = this.length; ++j < m; ) { 1.8399 + subgroups.push(subgroup = []); 1.8400 + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { 1.8401 + if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i, j))) { 1.8402 + if ("__data__" in node) subnode.__data__ = node.__data__; 1.8403 + d3_transitionNode(subnode, i, id, node.__transition__[id]); 1.8404 + subgroup.push(subnode); 1.8405 + } else { 1.8406 + subgroup.push(null); 1.8407 + } 1.8408 + } 1.8409 + } 1.8410 + return d3_transition(subgroups, id); 1.8411 + }; 1.8412 + d3_transitionPrototype.selectAll = function(selector) { 1.8413 + var id = this.id, subgroups = [], subgroup, subnodes, node, subnode, transition; 1.8414 + selector = d3_selection_selectorAll(selector); 1.8415 + for (var j = -1, m = this.length; ++j < m; ) { 1.8416 + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { 1.8417 + if (node = group[i]) { 1.8418 + transition = node.__transition__[id]; 1.8419 + subnodes = selector.call(node, node.__data__, i, j); 1.8420 + subgroups.push(subgroup = []); 1.8421 + for (var k = -1, o = subnodes.length; ++k < o; ) { 1.8422 + if (subnode = subnodes[k]) d3_transitionNode(subnode, k, id, transition); 1.8423 + subgroup.push(subnode); 1.8424 + } 1.8425 + } 1.8426 + } 1.8427 + } 1.8428 + return d3_transition(subgroups, id); 1.8429 + }; 1.8430 + d3_transitionPrototype.filter = function(filter) { 1.8431 + var subgroups = [], subgroup, group, node; 1.8432 + if (typeof filter !== "function") filter = d3_selection_filter(filter); 1.8433 + for (var j = 0, m = this.length; j < m; j++) { 1.8434 + subgroups.push(subgroup = []); 1.8435 + for (var group = this[j], i = 0, n = group.length; i < n; i++) { 1.8436 + if ((node = group[i]) && filter.call(node, node.__data__, i, j)) { 1.8437 + subgroup.push(node); 1.8438 + } 1.8439 + } 1.8440 + } 1.8441 + return d3_transition(subgroups, this.id); 1.8442 + }; 1.8443 + d3_transitionPrototype.tween = function(name, tween) { 1.8444 + var id = this.id; 1.8445 + if (arguments.length < 2) return this.node().__transition__[id].tween.get(name); 1.8446 + return d3_selection_each(this, tween == null ? function(node) { 1.8447 + node.__transition__[id].tween.remove(name); 1.8448 + } : function(node) { 1.8449 + node.__transition__[id].tween.set(name, tween); 1.8450 + }); 1.8451 + }; 1.8452 + function d3_transition_tween(groups, name, value, tween) { 1.8453 + var id = groups.id; 1.8454 + return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) { 1.8455 + node.__transition__[id].tween.set(name, tween(value.call(node, node.__data__, i, j))); 1.8456 + } : (value = tween(value), function(node) { 1.8457 + node.__transition__[id].tween.set(name, value); 1.8458 + })); 1.8459 + } 1.8460 + d3_transitionPrototype.attr = function(nameNS, value) { 1.8461 + if (arguments.length < 2) { 1.8462 + for (value in nameNS) this.attr(value, nameNS[value]); 1.8463 + return this; 1.8464 + } 1.8465 + var interpolate = nameNS == "transform" ? d3_interpolateTransform : d3_interpolate, name = d3.ns.qualify(nameNS); 1.8466 + function attrNull() { 1.8467 + this.removeAttribute(name); 1.8468 + } 1.8469 + function attrNullNS() { 1.8470 + this.removeAttributeNS(name.space, name.local); 1.8471 + } 1.8472 + function attrTween(b) { 1.8473 + return b == null ? attrNull : (b += "", function() { 1.8474 + var a = this.getAttribute(name), i; 1.8475 + return a !== b && (i = interpolate(a, b), function(t) { 1.8476 + this.setAttribute(name, i(t)); 1.8477 + }); 1.8478 + }); 1.8479 + } 1.8480 + function attrTweenNS(b) { 1.8481 + return b == null ? attrNullNS : (b += "", function() { 1.8482 + var a = this.getAttributeNS(name.space, name.local), i; 1.8483 + return a !== b && (i = interpolate(a, b), function(t) { 1.8484 + this.setAttributeNS(name.space, name.local, i(t)); 1.8485 + }); 1.8486 + }); 1.8487 + } 1.8488 + return d3_transition_tween(this, "attr." + nameNS, value, name.local ? attrTweenNS : attrTween); 1.8489 + }; 1.8490 + d3_transitionPrototype.attrTween = function(nameNS, tween) { 1.8491 + var name = d3.ns.qualify(nameNS); 1.8492 + function attrTween(d, i) { 1.8493 + var f = tween.call(this, d, i, this.getAttribute(name)); 1.8494 + return f && function(t) { 1.8495 + this.setAttribute(name, f(t)); 1.8496 + }; 1.8497 + } 1.8498 + function attrTweenNS(d, i) { 1.8499 + var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); 1.8500 + return f && function(t) { 1.8501 + this.setAttributeNS(name.space, name.local, f(t)); 1.8502 + }; 1.8503 + } 1.8504 + return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); 1.8505 + }; 1.8506 + d3_transitionPrototype.style = function(name, value, priority) { 1.8507 + var n = arguments.length; 1.8508 + if (n < 3) { 1.8509 + if (typeof name !== "string") { 1.8510 + if (n < 2) value = ""; 1.8511 + for (priority in name) this.style(priority, name[priority], value); 1.8512 + return this; 1.8513 + } 1.8514 + priority = ""; 1.8515 + } 1.8516 + function styleNull() { 1.8517 + this.style.removeProperty(name); 1.8518 + } 1.8519 + function styleString(b) { 1.8520 + return b == null ? styleNull : (b += "", function() { 1.8521 + var a = d3_window.getComputedStyle(this, null).getPropertyValue(name), i; 1.8522 + return a !== b && (i = d3_interpolate(a, b), function(t) { 1.8523 + this.style.setProperty(name, i(t), priority); 1.8524 + }); 1.8525 + }); 1.8526 + } 1.8527 + return d3_transition_tween(this, "style." + name, value, styleString); 1.8528 + }; 1.8529 + d3_transitionPrototype.styleTween = function(name, tween, priority) { 1.8530 + if (arguments.length < 3) priority = ""; 1.8531 + function styleTween(d, i) { 1.8532 + var f = tween.call(this, d, i, d3_window.getComputedStyle(this, null).getPropertyValue(name)); 1.8533 + return f && function(t) { 1.8534 + this.style.setProperty(name, f(t), priority); 1.8535 + }; 1.8536 + } 1.8537 + return this.tween("style." + name, styleTween); 1.8538 + }; 1.8539 + d3_transitionPrototype.text = function(value) { 1.8540 + return d3_transition_tween(this, "text", value, d3_transition_text); 1.8541 + }; 1.8542 + function d3_transition_text(b) { 1.8543 + if (b == null) b = ""; 1.8544 + return function() { 1.8545 + this.textContent = b; 1.8546 + }; 1.8547 + } 1.8548 + d3_transitionPrototype.remove = function() { 1.8549 + return this.each("end.transition", function() { 1.8550 + var p; 1.8551 + if (this.__transition__.count < 2 && (p = this.parentNode)) p.removeChild(this); 1.8552 + }); 1.8553 + }; 1.8554 + d3_transitionPrototype.ease = function(value) { 1.8555 + var id = this.id; 1.8556 + if (arguments.length < 1) return this.node().__transition__[id].ease; 1.8557 + if (typeof value !== "function") value = d3.ease.apply(d3, arguments); 1.8558 + return d3_selection_each(this, function(node) { 1.8559 + node.__transition__[id].ease = value; 1.8560 + }); 1.8561 + }; 1.8562 + d3_transitionPrototype.delay = function(value) { 1.8563 + var id = this.id; 1.8564 + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { 1.8565 + node.__transition__[id].delay = +value.call(node, node.__data__, i, j); 1.8566 + } : (value = +value, function(node) { 1.8567 + node.__transition__[id].delay = value; 1.8568 + })); 1.8569 + }; 1.8570 + d3_transitionPrototype.duration = function(value) { 1.8571 + var id = this.id; 1.8572 + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { 1.8573 + node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j)); 1.8574 + } : (value = Math.max(1, value), function(node) { 1.8575 + node.__transition__[id].duration = value; 1.8576 + })); 1.8577 + }; 1.8578 + d3_transitionPrototype.each = function(type, listener) { 1.8579 + var id = this.id; 1.8580 + if (arguments.length < 2) { 1.8581 + var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId; 1.8582 + d3_transitionInheritId = id; 1.8583 + d3_selection_each(this, function(node, i, j) { 1.8584 + d3_transitionInherit = node.__transition__[id]; 1.8585 + type.call(node, node.__data__, i, j); 1.8586 + }); 1.8587 + d3_transitionInherit = inherit; 1.8588 + d3_transitionInheritId = inheritId; 1.8589 + } else { 1.8590 + d3_selection_each(this, function(node) { 1.8591 + var transition = node.__transition__[id]; 1.8592 + (transition.event || (transition.event = d3.dispatch("start", "end"))).on(type, listener); 1.8593 + }); 1.8594 + } 1.8595 + return this; 1.8596 + }; 1.8597 + d3_transitionPrototype.transition = function() { 1.8598 + var id0 = this.id, id1 = ++d3_transitionId, subgroups = [], subgroup, group, node, transition; 1.8599 + for (var j = 0, m = this.length; j < m; j++) { 1.8600 + subgroups.push(subgroup = []); 1.8601 + for (var group = this[j], i = 0, n = group.length; i < n; i++) { 1.8602 + if (node = group[i]) { 1.8603 + transition = Object.create(node.__transition__[id0]); 1.8604 + transition.delay += transition.duration; 1.8605 + d3_transitionNode(node, i, id1, transition); 1.8606 + } 1.8607 + subgroup.push(node); 1.8608 + } 1.8609 + } 1.8610 + return d3_transition(subgroups, id1); 1.8611 + }; 1.8612 + function d3_transitionNode(node, i, id, inherit) { 1.8613 + var lock = node.__transition__ || (node.__transition__ = { 1.8614 + active: 0, 1.8615 + count: 0 1.8616 + }), transition = lock[id]; 1.8617 + if (!transition) { 1.8618 + var time = inherit.time; 1.8619 + transition = lock[id] = { 1.8620 + tween: new d3_Map(), 1.8621 + time: time, 1.8622 + ease: inherit.ease, 1.8623 + delay: inherit.delay, 1.8624 + duration: inherit.duration 1.8625 + }; 1.8626 + ++lock.count; 1.8627 + d3.timer(function(elapsed) { 1.8628 + var d = node.__data__, ease = transition.ease, delay = transition.delay, duration = transition.duration, timer = d3_timer_active, tweened = []; 1.8629 + timer.t = delay + time; 1.8630 + if (delay <= elapsed) return start(elapsed - delay); 1.8631 + timer.c = start; 1.8632 + function start(elapsed) { 1.8633 + if (lock.active > id) return stop(); 1.8634 + lock.active = id; 1.8635 + transition.event && transition.event.start.call(node, d, i); 1.8636 + transition.tween.forEach(function(key, value) { 1.8637 + if (value = value.call(node, d, i)) { 1.8638 + tweened.push(value); 1.8639 + } 1.8640 + }); 1.8641 + d3.timer(function() { 1.8642 + timer.c = tick(elapsed || 1) ? d3_true : tick; 1.8643 + return 1; 1.8644 + }, 0, time); 1.8645 + } 1.8646 + function tick(elapsed) { 1.8647 + if (lock.active !== id) return stop(); 1.8648 + var t = elapsed / duration, e = ease(t), n = tweened.length; 1.8649 + while (n > 0) { 1.8650 + tweened[--n].call(node, e); 1.8651 + } 1.8652 + if (t >= 1) { 1.8653 + transition.event && transition.event.end.call(node, d, i); 1.8654 + return stop(); 1.8655 + } 1.8656 + } 1.8657 + function stop() { 1.8658 + if (--lock.count) delete lock[id]; else delete node.__transition__; 1.8659 + return 1; 1.8660 + } 1.8661 + }, 0, time); 1.8662 + } 1.8663 + } 1.8664 + d3.svg.axis = function() { 1.8665 + var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_; 1.8666 + function axis(g) { 1.8667 + g.each(function() { 1.8668 + var g = d3.select(this); 1.8669 + var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy(); 1.8670 + 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).style("opacity", 1), tickTransform; 1.8671 + var range = d3_scaleRange(scale1), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"), 1.8672 + d3.transition(path)); 1.8673 + tickEnter.append("line"); 1.8674 + tickEnter.append("text"); 1.8675 + var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"); 1.8676 + switch (orient) { 1.8677 + case "bottom": 1.8678 + { 1.8679 + tickTransform = d3_svg_axisX; 1.8680 + lineEnter.attr("y2", innerTickSize); 1.8681 + textEnter.attr("y", Math.max(innerTickSize, 0) + tickPadding); 1.8682 + lineUpdate.attr("x2", 0).attr("y2", innerTickSize); 1.8683 + textUpdate.attr("x", 0).attr("y", Math.max(innerTickSize, 0) + tickPadding); 1.8684 + text.attr("dy", ".71em").style("text-anchor", "middle"); 1.8685 + pathUpdate.attr("d", "M" + range[0] + "," + outerTickSize + "V0H" + range[1] + "V" + outerTickSize); 1.8686 + break; 1.8687 + } 1.8688 + 1.8689 + case "top": 1.8690 + { 1.8691 + tickTransform = d3_svg_axisX; 1.8692 + lineEnter.attr("y2", -innerTickSize); 1.8693 + textEnter.attr("y", -(Math.max(innerTickSize, 0) + tickPadding)); 1.8694 + lineUpdate.attr("x2", 0).attr("y2", -innerTickSize); 1.8695 + textUpdate.attr("x", 0).attr("y", -(Math.max(innerTickSize, 0) + tickPadding)); 1.8696 + text.attr("dy", "0em").style("text-anchor", "middle"); 1.8697 + pathUpdate.attr("d", "M" + range[0] + "," + -outerTickSize + "V0H" + range[1] + "V" + -outerTickSize); 1.8698 + break; 1.8699 + } 1.8700 + 1.8701 + case "left": 1.8702 + { 1.8703 + tickTransform = d3_svg_axisY; 1.8704 + lineEnter.attr("x2", -innerTickSize); 1.8705 + textEnter.attr("x", -(Math.max(innerTickSize, 0) + tickPadding)); 1.8706 + lineUpdate.attr("x2", -innerTickSize).attr("y2", 0); 1.8707 + textUpdate.attr("x", -(Math.max(innerTickSize, 0) + tickPadding)).attr("y", 0); 1.8708 + text.attr("dy", ".32em").style("text-anchor", "end"); 1.8709 + pathUpdate.attr("d", "M" + -outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + -outerTickSize); 1.8710 + break; 1.8711 + } 1.8712 + 1.8713 + case "right": 1.8714 + { 1.8715 + tickTransform = d3_svg_axisY; 1.8716 + lineEnter.attr("x2", innerTickSize); 1.8717 + textEnter.attr("x", Math.max(innerTickSize, 0) + tickPadding); 1.8718 + lineUpdate.attr("x2", innerTickSize).attr("y2", 0); 1.8719 + textUpdate.attr("x", Math.max(innerTickSize, 0) + tickPadding).attr("y", 0); 1.8720 + text.attr("dy", ".32em").style("text-anchor", "start"); 1.8721 + pathUpdate.attr("d", "M" + outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + outerTickSize); 1.8722 + break; 1.8723 + } 1.8724 + } 1.8725 + if (scale1.rangeBand) { 1.8726 + var x = scale1, dx = x.rangeBand() / 2; 1.8727 + scale0 = scale1 = function(d) { 1.8728 + return x(d) + dx; 1.8729 + }; 1.8730 + } else if (scale0.rangeBand) { 1.8731 + scale0 = scale1; 1.8732 + } else { 1.8733 + tickExit.call(tickTransform, scale1); 1.8734 + } 1.8735 + tickEnter.call(tickTransform, scale0); 1.8736 + tickUpdate.call(tickTransform, scale1); 1.8737 + }); 1.8738 + } 1.8739 + axis.scale = function(x) { 1.8740 + if (!arguments.length) return scale; 1.8741 + scale = x; 1.8742 + return axis; 1.8743 + }; 1.8744 + axis.orient = function(x) { 1.8745 + if (!arguments.length) return orient; 1.8746 + orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient; 1.8747 + return axis; 1.8748 + }; 1.8749 + axis.ticks = function() { 1.8750 + if (!arguments.length) return tickArguments_; 1.8751 + tickArguments_ = arguments; 1.8752 + return axis; 1.8753 + }; 1.8754 + axis.tickValues = function(x) { 1.8755 + if (!arguments.length) return tickValues; 1.8756 + tickValues = x; 1.8757 + return axis; 1.8758 + }; 1.8759 + axis.tickFormat = function(x) { 1.8760 + if (!arguments.length) return tickFormat_; 1.8761 + tickFormat_ = x; 1.8762 + return axis; 1.8763 + }; 1.8764 + axis.tickSize = function(x) { 1.8765 + var n = arguments.length; 1.8766 + if (!n) return innerTickSize; 1.8767 + innerTickSize = +x; 1.8768 + outerTickSize = +arguments[n - 1]; 1.8769 + return axis; 1.8770 + }; 1.8771 + axis.innerTickSize = function(x) { 1.8772 + if (!arguments.length) return innerTickSize; 1.8773 + innerTickSize = +x; 1.8774 + return axis; 1.8775 + }; 1.8776 + axis.outerTickSize = function(x) { 1.8777 + if (!arguments.length) return outerTickSize; 1.8778 + outerTickSize = +x; 1.8779 + return axis; 1.8780 + }; 1.8781 + axis.tickPadding = function(x) { 1.8782 + if (!arguments.length) return tickPadding; 1.8783 + tickPadding = +x; 1.8784 + return axis; 1.8785 + }; 1.8786 + axis.tickSubdivide = function() { 1.8787 + return arguments.length && axis; 1.8788 + }; 1.8789 + return axis; 1.8790 + }; 1.8791 + var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = { 1.8792 + top: 1, 1.8793 + right: 1, 1.8794 + bottom: 1, 1.8795 + left: 1 1.8796 + }; 1.8797 + function d3_svg_axisX(selection, x) { 1.8798 + selection.attr("transform", function(d) { 1.8799 + return "translate(" + x(d) + ",0)"; 1.8800 + }); 1.8801 + } 1.8802 + function d3_svg_axisY(selection, y) { 1.8803 + selection.attr("transform", function(d) { 1.8804 + return "translate(0," + y(d) + ")"; 1.8805 + }); 1.8806 + } 1.8807 + d3.svg.brush = function() { 1.8808 + 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]; 1.8809 + function brush(g) { 1.8810 + g.each(function() { 1.8811 + 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); 1.8812 + var background = g.selectAll(".background").data([ 0 ]); 1.8813 + background.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair"); 1.8814 + g.selectAll(".extent").data([ 0 ]).enter().append("rect").attr("class", "extent").style("cursor", "move"); 1.8815 + var resize = g.selectAll(".resize").data(resizes, d3_identity); 1.8816 + resize.exit().remove(); 1.8817 + resize.enter().append("g").attr("class", function(d) { 1.8818 + return "resize " + d; 1.8819 + }).style("cursor", function(d) { 1.8820 + return d3_svg_brushCursor[d]; 1.8821 + }).append("rect").attr("x", function(d) { 1.8822 + return /[ew]$/.test(d) ? -3 : null; 1.8823 + }).attr("y", function(d) { 1.8824 + return /^[ns]/.test(d) ? -3 : null; 1.8825 + }).attr("width", 6).attr("height", 6).style("visibility", "hidden"); 1.8826 + resize.style("display", brush.empty() ? "none" : null); 1.8827 + var gUpdate = d3.transition(g), backgroundUpdate = d3.transition(background), range; 1.8828 + if (x) { 1.8829 + range = d3_scaleRange(x); 1.8830 + backgroundUpdate.attr("x", range[0]).attr("width", range[1] - range[0]); 1.8831 + redrawX(gUpdate); 1.8832 + } 1.8833 + if (y) { 1.8834 + range = d3_scaleRange(y); 1.8835 + backgroundUpdate.attr("y", range[0]).attr("height", range[1] - range[0]); 1.8836 + redrawY(gUpdate); 1.8837 + } 1.8838 + redraw(gUpdate); 1.8839 + }); 1.8840 + } 1.8841 + brush.event = function(g) { 1.8842 + g.each(function() { 1.8843 + var event_ = event.of(this, arguments), extent1 = { 1.8844 + x: xExtent, 1.8845 + y: yExtent, 1.8846 + i: xExtentDomain, 1.8847 + j: yExtentDomain 1.8848 + }, extent0 = this.__chart__ || extent1; 1.8849 + this.__chart__ = extent1; 1.8850 + if (d3_transitionInheritId) { 1.8851 + d3.select(this).transition().each("start.brush", function() { 1.8852 + xExtentDomain = extent0.i; 1.8853 + yExtentDomain = extent0.j; 1.8854 + xExtent = extent0.x; 1.8855 + yExtent = extent0.y; 1.8856 + event_({ 1.8857 + type: "brushstart" 1.8858 + }); 1.8859 + }).tween("brush:brush", function() { 1.8860 + var xi = d3_interpolateArray(xExtent, extent1.x), yi = d3_interpolateArray(yExtent, extent1.y); 1.8861 + xExtentDomain = yExtentDomain = null; 1.8862 + return function(t) { 1.8863 + xExtent = extent1.x = xi(t); 1.8864 + yExtent = extent1.y = yi(t); 1.8865 + event_({ 1.8866 + type: "brush", 1.8867 + mode: "resize" 1.8868 + }); 1.8869 + }; 1.8870 + }).each("end.brush", function() { 1.8871 + xExtentDomain = extent1.i; 1.8872 + yExtentDomain = extent1.j; 1.8873 + event_({ 1.8874 + type: "brush", 1.8875 + mode: "resize" 1.8876 + }); 1.8877 + event_({ 1.8878 + type: "brushend" 1.8879 + }); 1.8880 + }); 1.8881 + } else { 1.8882 + event_({ 1.8883 + type: "brushstart" 1.8884 + }); 1.8885 + event_({ 1.8886 + type: "brush", 1.8887 + mode: "resize" 1.8888 + }); 1.8889 + event_({ 1.8890 + type: "brushend" 1.8891 + }); 1.8892 + } 1.8893 + }); 1.8894 + }; 1.8895 + function redraw(g) { 1.8896 + g.selectAll(".resize").attr("transform", function(d) { 1.8897 + return "translate(" + xExtent[+/e$/.test(d)] + "," + yExtent[+/^s/.test(d)] + ")"; 1.8898 + }); 1.8899 + } 1.8900 + function redrawX(g) { 1.8901 + g.select(".extent").attr("x", xExtent[0]); 1.8902 + g.selectAll(".extent,.n>rect,.s>rect").attr("width", xExtent[1] - xExtent[0]); 1.8903 + } 1.8904 + function redrawY(g) { 1.8905 + g.select(".extent").attr("y", yExtent[0]); 1.8906 + g.selectAll(".extent,.e>rect,.w>rect").attr("height", yExtent[1] - yExtent[0]); 1.8907 + } 1.8908 + function brushstart() { 1.8909 + 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; 1.8910 + var w = d3.select(d3_window).on("keydown.brush", keydown).on("keyup.brush", keyup); 1.8911 + if (d3.event.changedTouches) { 1.8912 + w.on("touchmove.brush", brushmove).on("touchend.brush", brushend); 1.8913 + } else { 1.8914 + w.on("mousemove.brush", brushmove).on("mouseup.brush", brushend); 1.8915 + } 1.8916 + g.interrupt().selectAll("*").interrupt(); 1.8917 + if (dragging) { 1.8918 + origin[0] = xExtent[0] - origin[0]; 1.8919 + origin[1] = yExtent[0] - origin[1]; 1.8920 + } else if (resizing) { 1.8921 + var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing); 1.8922 + offset = [ xExtent[1 - ex] - origin[0], yExtent[1 - ey] - origin[1] ]; 1.8923 + origin[0] = xExtent[ex]; 1.8924 + origin[1] = yExtent[ey]; 1.8925 + } else if (d3.event.altKey) center = origin.slice(); 1.8926 + g.style("pointer-events", "none").selectAll(".resize").style("display", null); 1.8927 + d3.select("body").style("cursor", eventTarget.style("cursor")); 1.8928 + event_({ 1.8929 + type: "brushstart" 1.8930 + }); 1.8931 + brushmove(); 1.8932 + function keydown() { 1.8933 + if (d3.event.keyCode == 32) { 1.8934 + if (!dragging) { 1.8935 + center = null; 1.8936 + origin[0] -= xExtent[1]; 1.8937 + origin[1] -= yExtent[1]; 1.8938 + dragging = 2; 1.8939 + } 1.8940 + d3_eventPreventDefault(); 1.8941 + } 1.8942 + } 1.8943 + function keyup() { 1.8944 + if (d3.event.keyCode == 32 && dragging == 2) { 1.8945 + origin[0] += xExtent[1]; 1.8946 + origin[1] += yExtent[1]; 1.8947 + dragging = 0; 1.8948 + d3_eventPreventDefault(); 1.8949 + } 1.8950 + } 1.8951 + function brushmove() { 1.8952 + var point = d3.mouse(target), moved = false; 1.8953 + if (offset) { 1.8954 + point[0] += offset[0]; 1.8955 + point[1] += offset[1]; 1.8956 + } 1.8957 + if (!dragging) { 1.8958 + if (d3.event.altKey) { 1.8959 + if (!center) center = [ (xExtent[0] + xExtent[1]) / 2, (yExtent[0] + yExtent[1]) / 2 ]; 1.8960 + origin[0] = xExtent[+(point[0] < center[0])]; 1.8961 + origin[1] = yExtent[+(point[1] < center[1])]; 1.8962 + } else center = null; 1.8963 + } 1.8964 + if (resizingX && move1(point, x, 0)) { 1.8965 + redrawX(g); 1.8966 + moved = true; 1.8967 + } 1.8968 + if (resizingY && move1(point, y, 1)) { 1.8969 + redrawY(g); 1.8970 + moved = true; 1.8971 + } 1.8972 + if (moved) { 1.8973 + redraw(g); 1.8974 + event_({ 1.8975 + type: "brush", 1.8976 + mode: dragging ? "move" : "resize" 1.8977 + }); 1.8978 + } 1.8979 + } 1.8980 + function move1(point, scale, i) { 1.8981 + 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; 1.8982 + if (dragging) { 1.8983 + r0 -= position; 1.8984 + r1 -= size + position; 1.8985 + } 1.8986 + min = (i ? yClamp : xClamp) ? Math.max(r0, Math.min(r1, point[i])) : point[i]; 1.8987 + if (dragging) { 1.8988 + max = (min += position) + size; 1.8989 + } else { 1.8990 + if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min)); 1.8991 + if (position < min) { 1.8992 + max = min; 1.8993 + min = position; 1.8994 + } else { 1.8995 + max = position; 1.8996 + } 1.8997 + } 1.8998 + if (extent[0] != min || extent[1] != max) { 1.8999 + if (i) yExtentDomain = null; else xExtentDomain = null; 1.9000 + extent[0] = min; 1.9001 + extent[1] = max; 1.9002 + return true; 1.9003 + } 1.9004 + } 1.9005 + function brushend() { 1.9006 + brushmove(); 1.9007 + g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null); 1.9008 + d3.select("body").style("cursor", null); 1.9009 + 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); 1.9010 + dragRestore(); 1.9011 + event_({ 1.9012 + type: "brushend" 1.9013 + }); 1.9014 + } 1.9015 + } 1.9016 + brush.x = function(z) { 1.9017 + if (!arguments.length) return x; 1.9018 + x = z; 1.9019 + resizes = d3_svg_brushResizes[!x << 1 | !y]; 1.9020 + return brush; 1.9021 + }; 1.9022 + brush.y = function(z) { 1.9023 + if (!arguments.length) return y; 1.9024 + y = z; 1.9025 + resizes = d3_svg_brushResizes[!x << 1 | !y]; 1.9026 + return brush; 1.9027 + }; 1.9028 + brush.clamp = function(z) { 1.9029 + if (!arguments.length) return x && y ? [ xClamp, yClamp ] : x ? xClamp : y ? yClamp : null; 1.9030 + if (x && y) xClamp = !!z[0], yClamp = !!z[1]; else if (x) xClamp = !!z; else if (y) yClamp = !!z; 1.9031 + return brush; 1.9032 + }; 1.9033 + brush.extent = function(z) { 1.9034 + var x0, x1, y0, y1, t; 1.9035 + if (!arguments.length) { 1.9036 + if (x) { 1.9037 + if (xExtentDomain) { 1.9038 + x0 = xExtentDomain[0], x1 = xExtentDomain[1]; 1.9039 + } else { 1.9040 + x0 = xExtent[0], x1 = xExtent[1]; 1.9041 + if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); 1.9042 + if (x1 < x0) t = x0, x0 = x1, x1 = t; 1.9043 + } 1.9044 + } 1.9045 + if (y) { 1.9046 + if (yExtentDomain) { 1.9047 + y0 = yExtentDomain[0], y1 = yExtentDomain[1]; 1.9048 + } else { 1.9049 + y0 = yExtent[0], y1 = yExtent[1]; 1.9050 + if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); 1.9051 + if (y1 < y0) t = y0, y0 = y1, y1 = t; 1.9052 + } 1.9053 + } 1.9054 + return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ]; 1.9055 + } 1.9056 + if (x) { 1.9057 + x0 = z[0], x1 = z[1]; 1.9058 + if (y) x0 = x0[0], x1 = x1[0]; 1.9059 + xExtentDomain = [ x0, x1 ]; 1.9060 + if (x.invert) x0 = x(x0), x1 = x(x1); 1.9061 + if (x1 < x0) t = x0, x0 = x1, x1 = t; 1.9062 + if (x0 != xExtent[0] || x1 != xExtent[1]) xExtent = [ x0, x1 ]; 1.9063 + } 1.9064 + if (y) { 1.9065 + y0 = z[0], y1 = z[1]; 1.9066 + if (x) y0 = y0[1], y1 = y1[1]; 1.9067 + yExtentDomain = [ y0, y1 ]; 1.9068 + if (y.invert) y0 = y(y0), y1 = y(y1); 1.9069 + if (y1 < y0) t = y0, y0 = y1, y1 = t; 1.9070 + if (y0 != yExtent[0] || y1 != yExtent[1]) yExtent = [ y0, y1 ]; 1.9071 + } 1.9072 + return brush; 1.9073 + }; 1.9074 + brush.clear = function() { 1.9075 + if (!brush.empty()) { 1.9076 + xExtent = [ 0, 0 ], yExtent = [ 0, 0 ]; 1.9077 + xExtentDomain = yExtentDomain = null; 1.9078 + } 1.9079 + return brush; 1.9080 + }; 1.9081 + brush.empty = function() { 1.9082 + return !!x && xExtent[0] == xExtent[1] || !!y && yExtent[0] == yExtent[1]; 1.9083 + }; 1.9084 + return d3.rebind(brush, event, "on"); 1.9085 + }; 1.9086 + var d3_svg_brushCursor = { 1.9087 + n: "ns-resize", 1.9088 + e: "ew-resize", 1.9089 + s: "ns-resize", 1.9090 + w: "ew-resize", 1.9091 + nw: "nwse-resize", 1.9092 + ne: "nesw-resize", 1.9093 + se: "nwse-resize", 1.9094 + sw: "nesw-resize" 1.9095 + }; 1.9096 + var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ]; 1.9097 + var d3_time_format = d3_time.format = d3_locale_enUS.timeFormat; 1.9098 + var d3_time_formatUtc = d3_time_format.utc; 1.9099 + var d3_time_formatIso = d3_time_formatUtc("%Y-%m-%dT%H:%M:%S.%LZ"); 1.9100 + d3_time_format.iso = Date.prototype.toISOString && +new Date("2000-01-01T00:00:00.000Z") ? d3_time_formatIsoNative : d3_time_formatIso; 1.9101 + function d3_time_formatIsoNative(date) { 1.9102 + return date.toISOString(); 1.9103 + } 1.9104 + d3_time_formatIsoNative.parse = function(string) { 1.9105 + var date = new Date(string); 1.9106 + return isNaN(date) ? null : date; 1.9107 + }; 1.9108 + d3_time_formatIsoNative.toString = d3_time_formatIso.toString; 1.9109 + d3_time.second = d3_time_interval(function(date) { 1.9110 + return new d3_date(Math.floor(date / 1e3) * 1e3); 1.9111 + }, function(date, offset) { 1.9112 + date.setTime(date.getTime() + Math.floor(offset) * 1e3); 1.9113 + }, function(date) { 1.9114 + return date.getSeconds(); 1.9115 + }); 1.9116 + d3_time.seconds = d3_time.second.range; 1.9117 + d3_time.seconds.utc = d3_time.second.utc.range; 1.9118 + d3_time.minute = d3_time_interval(function(date) { 1.9119 + return new d3_date(Math.floor(date / 6e4) * 6e4); 1.9120 + }, function(date, offset) { 1.9121 + date.setTime(date.getTime() + Math.floor(offset) * 6e4); 1.9122 + }, function(date) { 1.9123 + return date.getMinutes(); 1.9124 + }); 1.9125 + d3_time.minutes = d3_time.minute.range; 1.9126 + d3_time.minutes.utc = d3_time.minute.utc.range; 1.9127 + d3_time.hour = d3_time_interval(function(date) { 1.9128 + var timezone = date.getTimezoneOffset() / 60; 1.9129 + return new d3_date((Math.floor(date / 36e5 - timezone) + timezone) * 36e5); 1.9130 + }, function(date, offset) { 1.9131 + date.setTime(date.getTime() + Math.floor(offset) * 36e5); 1.9132 + }, function(date) { 1.9133 + return date.getHours(); 1.9134 + }); 1.9135 + d3_time.hours = d3_time.hour.range; 1.9136 + d3_time.hours.utc = d3_time.hour.utc.range; 1.9137 + d3_time.month = d3_time_interval(function(date) { 1.9138 + date = d3_time.day(date); 1.9139 + date.setDate(1); 1.9140 + return date; 1.9141 + }, function(date, offset) { 1.9142 + date.setMonth(date.getMonth() + offset); 1.9143 + }, function(date) { 1.9144 + return date.getMonth(); 1.9145 + }); 1.9146 + d3_time.months = d3_time.month.range; 1.9147 + d3_time.months.utc = d3_time.month.utc.range; 1.9148 + function d3_time_scale(linear, methods, format) { 1.9149 + function scale(x) { 1.9150 + return linear(x); 1.9151 + } 1.9152 + scale.invert = function(x) { 1.9153 + return d3_time_scaleDate(linear.invert(x)); 1.9154 + }; 1.9155 + scale.domain = function(x) { 1.9156 + if (!arguments.length) return linear.domain().map(d3_time_scaleDate); 1.9157 + linear.domain(x); 1.9158 + return scale; 1.9159 + }; 1.9160 + function tickMethod(extent, count) { 1.9161 + var span = extent[1] - extent[0], target = span / count, i = d3.bisect(d3_time_scaleSteps, target); 1.9162 + return i == d3_time_scaleSteps.length ? [ methods.year, d3_scale_linearTickRange(extent.map(function(d) { 1.9163 + return d / 31536e6; 1.9164 + }), 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]; 1.9165 + } 1.9166 + scale.nice = function(interval, skip) { 1.9167 + var domain = scale.domain(), extent = d3_scaleExtent(domain), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" && tickMethod(extent, interval); 1.9168 + if (method) interval = method[0], skip = method[1]; 1.9169 + function skipped(date) { 1.9170 + return !isNaN(date) && !interval.range(date, d3_time_scaleDate(+date + 1), skip).length; 1.9171 + } 1.9172 + return scale.domain(d3_scale_nice(domain, skip > 1 ? { 1.9173 + floor: function(date) { 1.9174 + while (skipped(date = interval.floor(date))) date = d3_time_scaleDate(date - 1); 1.9175 + return date; 1.9176 + }, 1.9177 + ceil: function(date) { 1.9178 + while (skipped(date = interval.ceil(date))) date = d3_time_scaleDate(+date + 1); 1.9179 + return date; 1.9180 + } 1.9181 + } : interval)); 1.9182 + }; 1.9183 + scale.ticks = function(interval, skip) { 1.9184 + var extent = d3_scaleExtent(scale.domain()), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" ? tickMethod(extent, interval) : !interval.range && [ { 1.9185 + range: interval 1.9186 + }, skip ]; 1.9187 + if (method) interval = method[0], skip = method[1]; 1.9188 + return interval.range(extent[0], d3_time_scaleDate(+extent[1] + 1), skip < 1 ? 1 : skip); 1.9189 + }; 1.9190 + scale.tickFormat = function() { 1.9191 + return format; 1.9192 + }; 1.9193 + scale.copy = function() { 1.9194 + return d3_time_scale(linear.copy(), methods, format); 1.9195 + }; 1.9196 + return d3_scale_linearRebind(scale, linear); 1.9197 + } 1.9198 + function d3_time_scaleDate(t) { 1.9199 + return new Date(t); 1.9200 + } 1.9201 + var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ]; 1.9202 + 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 ] ]; 1.9203 + var d3_time_scaleLocalFormat = d3_time_format.multi([ [ ".%L", function(d) { 1.9204 + return d.getMilliseconds(); 1.9205 + } ], [ ":%S", function(d) { 1.9206 + return d.getSeconds(); 1.9207 + } ], [ "%I:%M", function(d) { 1.9208 + return d.getMinutes(); 1.9209 + } ], [ "%I %p", function(d) { 1.9210 + return d.getHours(); 1.9211 + } ], [ "%a %d", function(d) { 1.9212 + return d.getDay() && d.getDate() != 1; 1.9213 + } ], [ "%b %d", function(d) { 1.9214 + return d.getDate() != 1; 1.9215 + } ], [ "%B", function(d) { 1.9216 + return d.getMonth(); 1.9217 + } ], [ "%Y", d3_true ] ]); 1.9218 + var d3_time_scaleMilliseconds = { 1.9219 + range: function(start, stop, step) { 1.9220 + return d3.range(+start, +stop, step).map(d3_time_scaleDate); 1.9221 + }, 1.9222 + floor: d3_identity, 1.9223 + ceil: d3_identity 1.9224 + }; 1.9225 + d3_time_scaleLocalMethods.year = d3_time.year; 1.9226 + d3_time.scale = function() { 1.9227 + return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); 1.9228 + }; 1.9229 + var d3_time_scaleUtcMethods = d3_time_scaleLocalMethods.map(function(m) { 1.9230 + return [ m[0].utc, m[1] ]; 1.9231 + }); 1.9232 + var d3_time_scaleUtcFormat = d3_time_formatUtc.multi([ [ ".%L", function(d) { 1.9233 + return d.getUTCMilliseconds(); 1.9234 + } ], [ ":%S", function(d) { 1.9235 + return d.getUTCSeconds(); 1.9236 + } ], [ "%I:%M", function(d) { 1.9237 + return d.getUTCMinutes(); 1.9238 + } ], [ "%I %p", function(d) { 1.9239 + return d.getUTCHours(); 1.9240 + } ], [ "%a %d", function(d) { 1.9241 + return d.getUTCDay() && d.getUTCDate() != 1; 1.9242 + } ], [ "%b %d", function(d) { 1.9243 + return d.getUTCDate() != 1; 1.9244 + } ], [ "%B", function(d) { 1.9245 + return d.getUTCMonth(); 1.9246 + } ], [ "%Y", d3_true ] ]); 1.9247 + d3_time_scaleUtcMethods.year = d3_time.year.utc; 1.9248 + d3_time.scale.utc = function() { 1.9249 + return d3_time_scale(d3.scale.linear(), d3_time_scaleUtcMethods, d3_time_scaleUtcFormat); 1.9250 + }; 1.9251 + d3.text = d3_xhrType(function(request) { 1.9252 + return request.responseText; 1.9253 + }); 1.9254 + d3.json = function(url, callback) { 1.9255 + return d3_xhr(url, "application/json", d3_json, callback); 1.9256 + }; 1.9257 + function d3_json(request) { 1.9258 + return JSON.parse(request.responseText); 1.9259 + } 1.9260 + d3.html = function(url, callback) { 1.9261 + return d3_xhr(url, "text/html", d3_html, callback); 1.9262 + }; 1.9263 + function d3_html(request) { 1.9264 + var range = d3_document.createRange(); 1.9265 + range.selectNode(d3_document.body); 1.9266 + return range.createContextualFragment(request.responseText); 1.9267 + } 1.9268 + d3.xml = d3_xhrType(function(request) { 1.9269 + return request.responseXML; 1.9270 + }); 1.9271 + if (typeof define === "function" && define.amd) { 1.9272 + define(d3); 1.9273 + } else if (typeof module === "object" && module.exports) { 1.9274 + module.exports = d3; 1.9275 + } else { 1.9276 + this.d3 = d3; 1.9277 + } 1.9278 +}(); 1.9279 \ No newline at end of file