Mercurial > hg > index.fcgi > www > www-1
diff gtc/d3.js @ 89:18f8c214169f
add gtc
author | paulo |
---|---|
date | Sun, 19 Feb 2017 19:45:31 -0800 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gtc/d3.js Sun Feb 19 19:45:31 2017 -0800 1.3 @@ -0,0 +1,9554 @@ 1.4 +!function() { 1.5 + var d3 = { 1.6 + version: "3.5.17" 1.7 + }; 1.8 + var d3_arraySlice = [].slice, d3_array = function(list) { 1.9 + return d3_arraySlice.call(list); 1.10 + }; 1.11 + var d3_document = this.document; 1.12 + function d3_documentElement(node) { 1.13 + return node && (node.ownerDocument || node.document || node).documentElement; 1.14 + } 1.15 + function d3_window(node) { 1.16 + return node && (node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView); 1.17 + } 1.18 + if (d3_document) { 1.19 + try { 1.20 + d3_array(d3_document.documentElement.childNodes)[0].nodeType; 1.21 + } catch (e) { 1.22 + d3_array = function(list) { 1.23 + var i = list.length, array = new Array(i); 1.24 + while (i--) array[i] = list[i]; 1.25 + return array; 1.26 + }; 1.27 + } 1.28 + } 1.29 + if (!Date.now) Date.now = function() { 1.30 + return +new Date(); 1.31 + }; 1.32 + if (d3_document) { 1.33 + try { 1.34 + d3_document.createElement("DIV").style.setProperty("opacity", 0, ""); 1.35 + } catch (error) { 1.36 + var d3_element_prototype = this.Element.prototype, d3_element_setAttribute = d3_element_prototype.setAttribute, d3_element_setAttributeNS = d3_element_prototype.setAttributeNS, d3_style_prototype = this.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty; 1.37 + d3_element_prototype.setAttribute = function(name, value) { 1.38 + d3_element_setAttribute.call(this, name, value + ""); 1.39 + }; 1.40 + d3_element_prototype.setAttributeNS = function(space, local, value) { 1.41 + d3_element_setAttributeNS.call(this, space, local, value + ""); 1.42 + }; 1.43 + d3_style_prototype.setProperty = function(name, value, priority) { 1.44 + d3_style_setProperty.call(this, name, value + "", priority); 1.45 + }; 1.46 + } 1.47 + } 1.48 + d3.ascending = d3_ascending; 1.49 + function d3_ascending(a, b) { 1.50 + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; 1.51 + } 1.52 + d3.descending = function(a, b) { 1.53 + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; 1.54 + }; 1.55 + d3.min = function(array, f) { 1.56 + var i = -1, n = array.length, a, b; 1.57 + if (arguments.length === 1) { 1.58 + while (++i < n) if ((b = array[i]) != null && b >= b) { 1.59 + a = b; 1.60 + break; 1.61 + } 1.62 + while (++i < n) if ((b = array[i]) != null && a > b) a = b; 1.63 + } else { 1.64 + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { 1.65 + a = b; 1.66 + break; 1.67 + } 1.68 + while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; 1.69 + } 1.70 + return a; 1.71 + }; 1.72 + d3.max = function(array, f) { 1.73 + var i = -1, n = array.length, a, b; 1.74 + if (arguments.length === 1) { 1.75 + while (++i < n) if ((b = array[i]) != null && b >= b) { 1.76 + a = b; 1.77 + break; 1.78 + } 1.79 + while (++i < n) if ((b = array[i]) != null && b > a) a = b; 1.80 + } else { 1.81 + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { 1.82 + a = b; 1.83 + break; 1.84 + } 1.85 + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; 1.86 + } 1.87 + return a; 1.88 + }; 1.89 + d3.extent = function(array, f) { 1.90 + var i = -1, n = array.length, a, b, c; 1.91 + if (arguments.length === 1) { 1.92 + while (++i < n) if ((b = array[i]) != null && b >= b) { 1.93 + a = c = b; 1.94 + break; 1.95 + } 1.96 + while (++i < n) if ((b = array[i]) != null) { 1.97 + if (a > b) a = b; 1.98 + if (c < b) c = b; 1.99 + } 1.100 + } else { 1.101 + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { 1.102 + a = c = b; 1.103 + break; 1.104 + } 1.105 + while (++i < n) if ((b = f.call(array, array[i], i)) != null) { 1.106 + if (a > b) a = b; 1.107 + if (c < b) c = b; 1.108 + } 1.109 + } 1.110 + return [ a, c ]; 1.111 + }; 1.112 + function d3_number(x) { 1.113 + return x === null ? NaN : +x; 1.114 + } 1.115 + function d3_numeric(x) { 1.116 + return !isNaN(x); 1.117 + } 1.118 + d3.sum = function(array, f) { 1.119 + var s = 0, n = array.length, a, i = -1; 1.120 + if (arguments.length === 1) { 1.121 + while (++i < n) if (d3_numeric(a = +array[i])) s += a; 1.122 + } else { 1.123 + while (++i < n) if (d3_numeric(a = +f.call(array, array[i], i))) s += a; 1.124 + } 1.125 + return s; 1.126 + }; 1.127 + d3.mean = function(array, f) { 1.128 + var s = 0, n = array.length, a, i = -1, j = n; 1.129 + if (arguments.length === 1) { 1.130 + while (++i < n) if (d3_numeric(a = d3_number(array[i]))) s += a; else --j; 1.131 + } else { 1.132 + while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) s += a; else --j; 1.133 + } 1.134 + if (j) return s / j; 1.135 + }; 1.136 + d3.quantile = function(values, p) { 1.137 + var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h; 1.138 + return e ? v + e * (values[h] - v) : v; 1.139 + }; 1.140 + d3.median = function(array, f) { 1.141 + var numbers = [], n = array.length, a, i = -1; 1.142 + if (arguments.length === 1) { 1.143 + while (++i < n) if (d3_numeric(a = d3_number(array[i]))) numbers.push(a); 1.144 + } else { 1.145 + while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) numbers.push(a); 1.146 + } 1.147 + if (numbers.length) return d3.quantile(numbers.sort(d3_ascending), .5); 1.148 + }; 1.149 + d3.variance = function(array, f) { 1.150 + var n = array.length, m = 0, a, d, s = 0, i = -1, j = 0; 1.151 + if (arguments.length === 1) { 1.152 + while (++i < n) { 1.153 + if (d3_numeric(a = d3_number(array[i]))) { 1.154 + d = a - m; 1.155 + m += d / ++j; 1.156 + s += d * (a - m); 1.157 + } 1.158 + } 1.159 + } else { 1.160 + while (++i < n) { 1.161 + if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) { 1.162 + d = a - m; 1.163 + m += d / ++j; 1.164 + s += d * (a - m); 1.165 + } 1.166 + } 1.167 + } 1.168 + if (j > 1) return s / (j - 1); 1.169 + }; 1.170 + d3.deviation = function() { 1.171 + var v = d3.variance.apply(this, arguments); 1.172 + return v ? Math.sqrt(v) : v; 1.173 + }; 1.174 + function d3_bisector(compare) { 1.175 + return { 1.176 + left: function(a, x, lo, hi) { 1.177 + if (arguments.length < 3) lo = 0; 1.178 + if (arguments.length < 4) hi = a.length; 1.179 + while (lo < hi) { 1.180 + var mid = lo + hi >>> 1; 1.181 + if (compare(a[mid], x) < 0) lo = mid + 1; else hi = mid; 1.182 + } 1.183 + return lo; 1.184 + }, 1.185 + right: function(a, x, lo, hi) { 1.186 + if (arguments.length < 3) lo = 0; 1.187 + if (arguments.length < 4) hi = a.length; 1.188 + while (lo < hi) { 1.189 + var mid = lo + hi >>> 1; 1.190 + if (compare(a[mid], x) > 0) hi = mid; else lo = mid + 1; 1.191 + } 1.192 + return lo; 1.193 + } 1.194 + }; 1.195 + } 1.196 + var d3_bisect = d3_bisector(d3_ascending); 1.197 + d3.bisectLeft = d3_bisect.left; 1.198 + d3.bisect = d3.bisectRight = d3_bisect.right; 1.199 + d3.bisector = function(f) { 1.200 + return d3_bisector(f.length === 1 ? function(d, x) { 1.201 + return d3_ascending(f(d), x); 1.202 + } : f); 1.203 + }; 1.204 + d3.shuffle = function(array, i0, i1) { 1.205 + if ((m = arguments.length) < 3) { 1.206 + i1 = array.length; 1.207 + if (m < 2) i0 = 0; 1.208 + } 1.209 + var m = i1 - i0, t, i; 1.210 + while (m) { 1.211 + i = Math.random() * m-- | 0; 1.212 + t = array[m + i0], array[m + i0] = array[i + i0], array[i + i0] = t; 1.213 + } 1.214 + return array; 1.215 + }; 1.216 + d3.permute = function(array, indexes) { 1.217 + var i = indexes.length, permutes = new Array(i); 1.218 + while (i--) permutes[i] = array[indexes[i]]; 1.219 + return permutes; 1.220 + }; 1.221 + d3.pairs = function(array) { 1.222 + var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n); 1.223 + while (i < n) pairs[i] = [ p0 = p1, p1 = array[++i] ]; 1.224 + return pairs; 1.225 + }; 1.226 + d3.transpose = function(matrix) { 1.227 + if (!(n = matrix.length)) return []; 1.228 + for (var i = -1, m = d3.min(matrix, d3_transposeLength), transpose = new Array(m); ++i < m; ) { 1.229 + for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n; ) { 1.230 + row[j] = matrix[j][i]; 1.231 + } 1.232 + } 1.233 + return transpose; 1.234 + }; 1.235 + function d3_transposeLength(d) { 1.236 + return d.length; 1.237 + } 1.238 + d3.zip = function() { 1.239 + return d3.transpose(arguments); 1.240 + }; 1.241 + d3.keys = function(map) { 1.242 + var keys = []; 1.243 + for (var key in map) keys.push(key); 1.244 + return keys; 1.245 + }; 1.246 + d3.values = function(map) { 1.247 + var values = []; 1.248 + for (var key in map) values.push(map[key]); 1.249 + return values; 1.250 + }; 1.251 + d3.entries = function(map) { 1.252 + var entries = []; 1.253 + for (var key in map) entries.push({ 1.254 + key: key, 1.255 + value: map[key] 1.256 + }); 1.257 + return entries; 1.258 + }; 1.259 + d3.merge = function(arrays) { 1.260 + var n = arrays.length, m, i = -1, j = 0, merged, array; 1.261 + while (++i < n) j += arrays[i].length; 1.262 + merged = new Array(j); 1.263 + while (--n >= 0) { 1.264 + array = arrays[n]; 1.265 + m = array.length; 1.266 + while (--m >= 0) { 1.267 + merged[--j] = array[m]; 1.268 + } 1.269 + } 1.270 + return merged; 1.271 + }; 1.272 + var abs = Math.abs; 1.273 + d3.range = function(start, stop, step) { 1.274 + if (arguments.length < 3) { 1.275 + step = 1; 1.276 + if (arguments.length < 2) { 1.277 + stop = start; 1.278 + start = 0; 1.279 + } 1.280 + } 1.281 + if ((stop - start) / step === Infinity) throw new Error("infinite range"); 1.282 + var range = [], k = d3_range_integerScale(abs(step)), i = -1, j; 1.283 + start *= k, stop *= k, step *= k; 1.284 + 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.285 + return range; 1.286 + }; 1.287 + function d3_range_integerScale(x) { 1.288 + var k = 1; 1.289 + while (x * k % 1) k *= 10; 1.290 + return k; 1.291 + } 1.292 + function d3_class(ctor, properties) { 1.293 + for (var key in properties) { 1.294 + Object.defineProperty(ctor.prototype, key, { 1.295 + value: properties[key], 1.296 + enumerable: false 1.297 + }); 1.298 + } 1.299 + } 1.300 + d3.map = function(object, f) { 1.301 + var map = new d3_Map(); 1.302 + if (object instanceof d3_Map) { 1.303 + object.forEach(function(key, value) { 1.304 + map.set(key, value); 1.305 + }); 1.306 + } else if (Array.isArray(object)) { 1.307 + var i = -1, n = object.length, o; 1.308 + if (arguments.length === 1) while (++i < n) map.set(i, object[i]); else while (++i < n) map.set(f.call(object, o = object[i], i), o); 1.309 + } else { 1.310 + for (var key in object) map.set(key, object[key]); 1.311 + } 1.312 + return map; 1.313 + }; 1.314 + function d3_Map() { 1.315 + this._ = Object.create(null); 1.316 + } 1.317 + var d3_map_proto = "__proto__", d3_map_zero = "\x00"; 1.318 + d3_class(d3_Map, { 1.319 + has: d3_map_has, 1.320 + get: function(key) { 1.321 + return this._[d3_map_escape(key)]; 1.322 + }, 1.323 + set: function(key, value) { 1.324 + return this._[d3_map_escape(key)] = value; 1.325 + }, 1.326 + remove: d3_map_remove, 1.327 + keys: d3_map_keys, 1.328 + values: function() { 1.329 + var values = []; 1.330 + for (var key in this._) values.push(this._[key]); 1.331 + return values; 1.332 + }, 1.333 + entries: function() { 1.334 + var entries = []; 1.335 + for (var key in this._) entries.push({ 1.336 + key: d3_map_unescape(key), 1.337 + value: this._[key] 1.338 + }); 1.339 + return entries; 1.340 + }, 1.341 + size: d3_map_size, 1.342 + empty: d3_map_empty, 1.343 + forEach: function(f) { 1.344 + for (var key in this._) f.call(this, d3_map_unescape(key), this._[key]); 1.345 + } 1.346 + }); 1.347 + function d3_map_escape(key) { 1.348 + return (key += "") === d3_map_proto || key[0] === d3_map_zero ? d3_map_zero + key : key; 1.349 + } 1.350 + function d3_map_unescape(key) { 1.351 + return (key += "")[0] === d3_map_zero ? key.slice(1) : key; 1.352 + } 1.353 + function d3_map_has(key) { 1.354 + return d3_map_escape(key) in this._; 1.355 + } 1.356 + function d3_map_remove(key) { 1.357 + return (key = d3_map_escape(key)) in this._ && delete this._[key]; 1.358 + } 1.359 + function d3_map_keys() { 1.360 + var keys = []; 1.361 + for (var key in this._) keys.push(d3_map_unescape(key)); 1.362 + return keys; 1.363 + } 1.364 + function d3_map_size() { 1.365 + var size = 0; 1.366 + for (var key in this._) ++size; 1.367 + return size; 1.368 + } 1.369 + function d3_map_empty() { 1.370 + for (var key in this._) return false; 1.371 + return true; 1.372 + } 1.373 + d3.nest = function() { 1.374 + var nest = {}, keys = [], sortKeys = [], sortValues, rollup; 1.375 + function map(mapType, array, depth) { 1.376 + if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array; 1.377 + var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values; 1.378 + while (++i < n) { 1.379 + if (values = valuesByKey.get(keyValue = key(object = array[i]))) { 1.380 + values.push(object); 1.381 + } else { 1.382 + valuesByKey.set(keyValue, [ object ]); 1.383 + } 1.384 + } 1.385 + if (mapType) { 1.386 + object = mapType(); 1.387 + setter = function(keyValue, values) { 1.388 + object.set(keyValue, map(mapType, values, depth)); 1.389 + }; 1.390 + } else { 1.391 + object = {}; 1.392 + setter = function(keyValue, values) { 1.393 + object[keyValue] = map(mapType, values, depth); 1.394 + }; 1.395 + } 1.396 + valuesByKey.forEach(setter); 1.397 + return object; 1.398 + } 1.399 + function entries(map, depth) { 1.400 + if (depth >= keys.length) return map; 1.401 + var array = [], sortKey = sortKeys[depth++]; 1.402 + map.forEach(function(key, keyMap) { 1.403 + array.push({ 1.404 + key: key, 1.405 + values: entries(keyMap, depth) 1.406 + }); 1.407 + }); 1.408 + return sortKey ? array.sort(function(a, b) { 1.409 + return sortKey(a.key, b.key); 1.410 + }) : array; 1.411 + } 1.412 + nest.map = function(array, mapType) { 1.413 + return map(mapType, array, 0); 1.414 + }; 1.415 + nest.entries = function(array) { 1.416 + return entries(map(d3.map, array, 0), 0); 1.417 + }; 1.418 + nest.key = function(d) { 1.419 + keys.push(d); 1.420 + return nest; 1.421 + }; 1.422 + nest.sortKeys = function(order) { 1.423 + sortKeys[keys.length - 1] = order; 1.424 + return nest; 1.425 + }; 1.426 + nest.sortValues = function(order) { 1.427 + sortValues = order; 1.428 + return nest; 1.429 + }; 1.430 + nest.rollup = function(f) { 1.431 + rollup = f; 1.432 + return nest; 1.433 + }; 1.434 + return nest; 1.435 + }; 1.436 + d3.set = function(array) { 1.437 + var set = new d3_Set(); 1.438 + if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]); 1.439 + return set; 1.440 + }; 1.441 + function d3_Set() { 1.442 + this._ = Object.create(null); 1.443 + } 1.444 + d3_class(d3_Set, { 1.445 + has: d3_map_has, 1.446 + add: function(key) { 1.447 + this._[d3_map_escape(key += "")] = true; 1.448 + return key; 1.449 + }, 1.450 + remove: d3_map_remove, 1.451 + values: d3_map_keys, 1.452 + size: d3_map_size, 1.453 + empty: d3_map_empty, 1.454 + forEach: function(f) { 1.455 + for (var key in this._) f.call(this, d3_map_unescape(key)); 1.456 + } 1.457 + }); 1.458 + d3.behavior = {}; 1.459 + function d3_identity(d) { 1.460 + return d; 1.461 + } 1.462 + d3.rebind = function(target, source) { 1.463 + var i = 1, n = arguments.length, method; 1.464 + while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); 1.465 + return target; 1.466 + }; 1.467 + function d3_rebind(target, source, method) { 1.468 + return function() { 1.469 + var value = method.apply(source, arguments); 1.470 + return value === source ? target : value; 1.471 + }; 1.472 + } 1.473 + function d3_vendorSymbol(object, name) { 1.474 + if (name in object) return name; 1.475 + name = name.charAt(0).toUpperCase() + name.slice(1); 1.476 + for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) { 1.477 + var prefixName = d3_vendorPrefixes[i] + name; 1.478 + if (prefixName in object) return prefixName; 1.479 + } 1.480 + } 1.481 + var d3_vendorPrefixes = [ "webkit", "ms", "moz", "Moz", "o", "O" ]; 1.482 + function d3_noop() {} 1.483 + d3.dispatch = function() { 1.484 + var dispatch = new d3_dispatch(), i = -1, n = arguments.length; 1.485 + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); 1.486 + return dispatch; 1.487 + }; 1.488 + function d3_dispatch() {} 1.489 + d3_dispatch.prototype.on = function(type, listener) { 1.490 + var i = type.indexOf("."), name = ""; 1.491 + if (i >= 0) { 1.492 + name = type.slice(i + 1); 1.493 + type = type.slice(0, i); 1.494 + } 1.495 + if (type) return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener); 1.496 + if (arguments.length === 2) { 1.497 + if (listener == null) for (type in this) { 1.498 + if (this.hasOwnProperty(type)) this[type].on(name, null); 1.499 + } 1.500 + return this; 1.501 + } 1.502 + }; 1.503 + function d3_dispatch_event(dispatch) { 1.504 + var listeners = [], listenerByName = new d3_Map(); 1.505 + function event() { 1.506 + var z = listeners, i = -1, n = z.length, l; 1.507 + while (++i < n) if (l = z[i].on) l.apply(this, arguments); 1.508 + return dispatch; 1.509 + } 1.510 + event.on = function(name, listener) { 1.511 + var l = listenerByName.get(name), i; 1.512 + if (arguments.length < 2) return l && l.on; 1.513 + if (l) { 1.514 + l.on = null; 1.515 + listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); 1.516 + listenerByName.remove(name); 1.517 + } 1.518 + if (listener) listeners.push(listenerByName.set(name, { 1.519 + on: listener 1.520 + })); 1.521 + return dispatch; 1.522 + }; 1.523 + return event; 1.524 + } 1.525 + d3.event = null; 1.526 + function d3_eventPreventDefault() { 1.527 + d3.event.preventDefault(); 1.528 + } 1.529 + function d3_eventSource() { 1.530 + var e = d3.event, s; 1.531 + while (s = e.sourceEvent) e = s; 1.532 + return e; 1.533 + } 1.534 + function d3_eventDispatch(target) { 1.535 + var dispatch = new d3_dispatch(), i = 0, n = arguments.length; 1.536 + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); 1.537 + dispatch.of = function(thiz, argumentz) { 1.538 + return function(e1) { 1.539 + try { 1.540 + var e0 = e1.sourceEvent = d3.event; 1.541 + e1.target = target; 1.542 + d3.event = e1; 1.543 + dispatch[e1.type].apply(thiz, argumentz); 1.544 + } finally { 1.545 + d3.event = e0; 1.546 + } 1.547 + }; 1.548 + }; 1.549 + return dispatch; 1.550 + } 1.551 + d3.requote = function(s) { 1.552 + return s.replace(d3_requote_re, "\\$&"); 1.553 + }; 1.554 + var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; 1.555 + var d3_subclass = {}.__proto__ ? function(object, prototype) { 1.556 + object.__proto__ = prototype; 1.557 + } : function(object, prototype) { 1.558 + for (var property in prototype) object[property] = prototype[property]; 1.559 + }; 1.560 + function d3_selection(groups) { 1.561 + d3_subclass(groups, d3_selectionPrototype); 1.562 + return groups; 1.563 + } 1.564 + var d3_select = function(s, n) { 1.565 + return n.querySelector(s); 1.566 + }, d3_selectAll = function(s, n) { 1.567 + return n.querySelectorAll(s); 1.568 + }, d3_selectMatches = function(n, s) { 1.569 + var d3_selectMatcher = n.matches || n[d3_vendorSymbol(n, "matchesSelector")]; 1.570 + d3_selectMatches = function(n, s) { 1.571 + return d3_selectMatcher.call(n, s); 1.572 + }; 1.573 + return d3_selectMatches(n, s); 1.574 + }; 1.575 + if (typeof Sizzle === "function") { 1.576 + d3_select = function(s, n) { 1.577 + return Sizzle(s, n)[0] || null; 1.578 + }; 1.579 + d3_selectAll = Sizzle; 1.580 + d3_selectMatches = Sizzle.matchesSelector; 1.581 + } 1.582 + d3.selection = function() { 1.583 + return d3.select(d3_document.documentElement); 1.584 + }; 1.585 + var d3_selectionPrototype = d3.selection.prototype = []; 1.586 + d3_selectionPrototype.select = function(selector) { 1.587 + var subgroups = [], subgroup, subnode, group, node; 1.588 + selector = d3_selection_selector(selector); 1.589 + for (var j = -1, m = this.length; ++j < m; ) { 1.590 + subgroups.push(subgroup = []); 1.591 + subgroup.parentNode = (group = this[j]).parentNode; 1.592 + for (var i = -1, n = group.length; ++i < n; ) { 1.593 + if (node = group[i]) { 1.594 + subgroup.push(subnode = selector.call(node, node.__data__, i, j)); 1.595 + if (subnode && "__data__" in node) subnode.__data__ = node.__data__; 1.596 + } else { 1.597 + subgroup.push(null); 1.598 + } 1.599 + } 1.600 + } 1.601 + return d3_selection(subgroups); 1.602 + }; 1.603 + function d3_selection_selector(selector) { 1.604 + return typeof selector === "function" ? selector : function() { 1.605 + return d3_select(selector, this); 1.606 + }; 1.607 + } 1.608 + d3_selectionPrototype.selectAll = function(selector) { 1.609 + var subgroups = [], subgroup, node; 1.610 + selector = d3_selection_selectorAll(selector); 1.611 + for (var j = -1, m = this.length; ++j < m; ) { 1.612 + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { 1.613 + if (node = group[i]) { 1.614 + subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i, j))); 1.615 + subgroup.parentNode = node; 1.616 + } 1.617 + } 1.618 + } 1.619 + return d3_selection(subgroups); 1.620 + }; 1.621 + function d3_selection_selectorAll(selector) { 1.622 + return typeof selector === "function" ? selector : function() { 1.623 + return d3_selectAll(selector, this); 1.624 + }; 1.625 + } 1.626 + var d3_nsXhtml = "http://www.w3.org/1999/xhtml"; 1.627 + var d3_nsPrefix = { 1.628 + svg: "http://www.w3.org/2000/svg", 1.629 + xhtml: d3_nsXhtml, 1.630 + xlink: "http://www.w3.org/1999/xlink", 1.631 + xml: "http://www.w3.org/XML/1998/namespace", 1.632 + xmlns: "http://www.w3.org/2000/xmlns/" 1.633 + }; 1.634 + d3.ns = { 1.635 + prefix: d3_nsPrefix, 1.636 + qualify: function(name) { 1.637 + var i = name.indexOf(":"), prefix = name; 1.638 + if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1); 1.639 + return d3_nsPrefix.hasOwnProperty(prefix) ? { 1.640 + space: d3_nsPrefix[prefix], 1.641 + local: name 1.642 + } : name; 1.643 + } 1.644 + }; 1.645 + d3_selectionPrototype.attr = function(name, value) { 1.646 + if (arguments.length < 2) { 1.647 + if (typeof name === "string") { 1.648 + var node = this.node(); 1.649 + name = d3.ns.qualify(name); 1.650 + return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name); 1.651 + } 1.652 + for (value in name) this.each(d3_selection_attr(value, name[value])); 1.653 + return this; 1.654 + } 1.655 + return this.each(d3_selection_attr(name, value)); 1.656 + }; 1.657 + function d3_selection_attr(name, value) { 1.658 + name = d3.ns.qualify(name); 1.659 + function attrNull() { 1.660 + this.removeAttribute(name); 1.661 + } 1.662 + function attrNullNS() { 1.663 + this.removeAttributeNS(name.space, name.local); 1.664 + } 1.665 + function attrConstant() { 1.666 + this.setAttribute(name, value); 1.667 + } 1.668 + function attrConstantNS() { 1.669 + this.setAttributeNS(name.space, name.local, value); 1.670 + } 1.671 + function attrFunction() { 1.672 + var x = value.apply(this, arguments); 1.673 + if (x == null) this.removeAttribute(name); else this.setAttribute(name, x); 1.674 + } 1.675 + function attrFunctionNS() { 1.676 + var x = value.apply(this, arguments); 1.677 + if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x); 1.678 + } 1.679 + return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant; 1.680 + } 1.681 + function d3_collapse(s) { 1.682 + return s.trim().replace(/\s+/g, " "); 1.683 + } 1.684 + d3_selectionPrototype.classed = function(name, value) { 1.685 + if (arguments.length < 2) { 1.686 + if (typeof name === "string") { 1.687 + var node = this.node(), n = (name = d3_selection_classes(name)).length, i = -1; 1.688 + if (value = node.classList) { 1.689 + while (++i < n) if (!value.contains(name[i])) return false; 1.690 + } else { 1.691 + value = node.getAttribute("class"); 1.692 + while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false; 1.693 + } 1.694 + return true; 1.695 + } 1.696 + for (value in name) this.each(d3_selection_classed(value, name[value])); 1.697 + return this; 1.698 + } 1.699 + return this.each(d3_selection_classed(name, value)); 1.700 + }; 1.701 + function d3_selection_classedRe(name) { 1.702 + return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g"); 1.703 + } 1.704 + function d3_selection_classes(name) { 1.705 + return (name + "").trim().split(/^|\s+/); 1.706 + } 1.707 + function d3_selection_classed(name, value) { 1.708 + name = d3_selection_classes(name).map(d3_selection_classedName); 1.709 + var n = name.length; 1.710 + function classedConstant() { 1.711 + var i = -1; 1.712 + while (++i < n) name[i](this, value); 1.713 + } 1.714 + function classedFunction() { 1.715 + var i = -1, x = value.apply(this, arguments); 1.716 + while (++i < n) name[i](this, x); 1.717 + } 1.718 + return typeof value === "function" ? classedFunction : classedConstant; 1.719 + } 1.720 + function d3_selection_classedName(name) { 1.721 + var re = d3_selection_classedRe(name); 1.722 + return function(node, value) { 1.723 + if (c = node.classList) return value ? c.add(name) : c.remove(name); 1.724 + var c = node.getAttribute("class") || ""; 1.725 + if (value) { 1.726 + re.lastIndex = 0; 1.727 + if (!re.test(c)) node.setAttribute("class", d3_collapse(c + " " + name)); 1.728 + } else { 1.729 + node.setAttribute("class", d3_collapse(c.replace(re, " "))); 1.730 + } 1.731 + }; 1.732 + } 1.733 + d3_selectionPrototype.style = function(name, value, priority) { 1.734 + var n = arguments.length; 1.735 + if (n < 3) { 1.736 + if (typeof name !== "string") { 1.737 + if (n < 2) value = ""; 1.738 + for (priority in name) this.each(d3_selection_style(priority, name[priority], value)); 1.739 + return this; 1.740 + } 1.741 + if (n < 2) { 1.742 + var node = this.node(); 1.743 + return d3_window(node).getComputedStyle(node, null).getPropertyValue(name); 1.744 + } 1.745 + priority = ""; 1.746 + } 1.747 + return this.each(d3_selection_style(name, value, priority)); 1.748 + }; 1.749 + function d3_selection_style(name, value, priority) { 1.750 + function styleNull() { 1.751 + this.style.removeProperty(name); 1.752 + } 1.753 + function styleConstant() { 1.754 + this.style.setProperty(name, value, priority); 1.755 + } 1.756 + function styleFunction() { 1.757 + var x = value.apply(this, arguments); 1.758 + if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority); 1.759 + } 1.760 + return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant; 1.761 + } 1.762 + d3_selectionPrototype.property = function(name, value) { 1.763 + if (arguments.length < 2) { 1.764 + if (typeof name === "string") return this.node()[name]; 1.765 + for (value in name) this.each(d3_selection_property(value, name[value])); 1.766 + return this; 1.767 + } 1.768 + return this.each(d3_selection_property(name, value)); 1.769 + }; 1.770 + function d3_selection_property(name, value) { 1.771 + function propertyNull() { 1.772 + delete this[name]; 1.773 + } 1.774 + function propertyConstant() { 1.775 + this[name] = value; 1.776 + } 1.777 + function propertyFunction() { 1.778 + var x = value.apply(this, arguments); 1.779 + if (x == null) delete this[name]; else this[name] = x; 1.780 + } 1.781 + return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant; 1.782 + } 1.783 + d3_selectionPrototype.text = function(value) { 1.784 + return arguments.length ? this.each(typeof value === "function" ? function() { 1.785 + var v = value.apply(this, arguments); 1.786 + this.textContent = v == null ? "" : v; 1.787 + } : value == null ? function() { 1.788 + this.textContent = ""; 1.789 + } : function() { 1.790 + this.textContent = value; 1.791 + }) : this.node().textContent; 1.792 + }; 1.793 + d3_selectionPrototype.html = function(value) { 1.794 + return arguments.length ? this.each(typeof value === "function" ? function() { 1.795 + var v = value.apply(this, arguments); 1.796 + this.innerHTML = v == null ? "" : v; 1.797 + } : value == null ? function() { 1.798 + this.innerHTML = ""; 1.799 + } : function() { 1.800 + this.innerHTML = value; 1.801 + }) : this.node().innerHTML; 1.802 + }; 1.803 + d3_selectionPrototype.append = function(name) { 1.804 + name = d3_selection_creator(name); 1.805 + return this.select(function() { 1.806 + return this.appendChild(name.apply(this, arguments)); 1.807 + }); 1.808 + }; 1.809 + function d3_selection_creator(name) { 1.810 + function create() { 1.811 + var document = this.ownerDocument, namespace = this.namespaceURI; 1.812 + return namespace === d3_nsXhtml && document.documentElement.namespaceURI === d3_nsXhtml ? document.createElement(name) : document.createElementNS(namespace, name); 1.813 + } 1.814 + function createNS() { 1.815 + return this.ownerDocument.createElementNS(name.space, name.local); 1.816 + } 1.817 + return typeof name === "function" ? name : (name = d3.ns.qualify(name)).local ? createNS : create; 1.818 + } 1.819 + d3_selectionPrototype.insert = function(name, before) { 1.820 + name = d3_selection_creator(name); 1.821 + before = d3_selection_selector(before); 1.822 + return this.select(function() { 1.823 + return this.insertBefore(name.apply(this, arguments), before.apply(this, arguments) || null); 1.824 + }); 1.825 + }; 1.826 + d3_selectionPrototype.remove = function() { 1.827 + return this.each(d3_selectionRemove); 1.828 + }; 1.829 + function d3_selectionRemove() { 1.830 + var parent = this.parentNode; 1.831 + if (parent) parent.removeChild(this); 1.832 + } 1.833 + d3_selectionPrototype.data = function(value, key) { 1.834 + var i = -1, n = this.length, group, node; 1.835 + if (!arguments.length) { 1.836 + value = new Array(n = (group = this[0]).length); 1.837 + while (++i < n) { 1.838 + if (node = group[i]) { 1.839 + value[i] = node.__data__; 1.840 + } 1.841 + } 1.842 + return value; 1.843 + } 1.844 + function bind(group, groupData) { 1.845 + 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.846 + if (key) { 1.847 + var nodeByKeyValue = new d3_Map(), keyValues = new Array(n), keyValue; 1.848 + for (i = -1; ++i < n; ) { 1.849 + if (node = group[i]) { 1.850 + if (nodeByKeyValue.has(keyValue = key.call(node, node.__data__, i))) { 1.851 + exitNodes[i] = node; 1.852 + } else { 1.853 + nodeByKeyValue.set(keyValue, node); 1.854 + } 1.855 + keyValues[i] = keyValue; 1.856 + } 1.857 + } 1.858 + for (i = -1; ++i < m; ) { 1.859 + if (!(node = nodeByKeyValue.get(keyValue = key.call(groupData, nodeData = groupData[i], i)))) { 1.860 + enterNodes[i] = d3_selection_dataNode(nodeData); 1.861 + } else if (node !== true) { 1.862 + updateNodes[i] = node; 1.863 + node.__data__ = nodeData; 1.864 + } 1.865 + nodeByKeyValue.set(keyValue, true); 1.866 + } 1.867 + for (i = -1; ++i < n; ) { 1.868 + if (i in keyValues && nodeByKeyValue.get(keyValues[i]) !== true) { 1.869 + exitNodes[i] = group[i]; 1.870 + } 1.871 + } 1.872 + } else { 1.873 + for (i = -1; ++i < n0; ) { 1.874 + node = group[i]; 1.875 + nodeData = groupData[i]; 1.876 + if (node) { 1.877 + node.__data__ = nodeData; 1.878 + updateNodes[i] = node; 1.879 + } else { 1.880 + enterNodes[i] = d3_selection_dataNode(nodeData); 1.881 + } 1.882 + } 1.883 + for (;i < m; ++i) { 1.884 + enterNodes[i] = d3_selection_dataNode(groupData[i]); 1.885 + } 1.886 + for (;i < n; ++i) { 1.887 + exitNodes[i] = group[i]; 1.888 + } 1.889 + } 1.890 + enterNodes.update = updateNodes; 1.891 + enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode; 1.892 + enter.push(enterNodes); 1.893 + update.push(updateNodes); 1.894 + exit.push(exitNodes); 1.895 + } 1.896 + var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]); 1.897 + if (typeof value === "function") { 1.898 + while (++i < n) { 1.899 + bind(group = this[i], value.call(group, group.parentNode.__data__, i)); 1.900 + } 1.901 + } else { 1.902 + while (++i < n) { 1.903 + bind(group = this[i], value); 1.904 + } 1.905 + } 1.906 + update.enter = function() { 1.907 + return enter; 1.908 + }; 1.909 + update.exit = function() { 1.910 + return exit; 1.911 + }; 1.912 + return update; 1.913 + }; 1.914 + function d3_selection_dataNode(data) { 1.915 + return { 1.916 + __data__: data 1.917 + }; 1.918 + } 1.919 + d3_selectionPrototype.datum = function(value) { 1.920 + return arguments.length ? this.property("__data__", value) : this.property("__data__"); 1.921 + }; 1.922 + d3_selectionPrototype.filter = function(filter) { 1.923 + var subgroups = [], subgroup, group, node; 1.924 + if (typeof filter !== "function") filter = d3_selection_filter(filter); 1.925 + for (var j = 0, m = this.length; j < m; j++) { 1.926 + subgroups.push(subgroup = []); 1.927 + subgroup.parentNode = (group = this[j]).parentNode; 1.928 + for (var i = 0, n = group.length; i < n; i++) { 1.929 + if ((node = group[i]) && filter.call(node, node.__data__, i, j)) { 1.930 + subgroup.push(node); 1.931 + } 1.932 + } 1.933 + } 1.934 + return d3_selection(subgroups); 1.935 + }; 1.936 + function d3_selection_filter(selector) { 1.937 + return function() { 1.938 + return d3_selectMatches(this, selector); 1.939 + }; 1.940 + } 1.941 + d3_selectionPrototype.order = function() { 1.942 + for (var j = -1, m = this.length; ++j < m; ) { 1.943 + for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) { 1.944 + if (node = group[i]) { 1.945 + if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); 1.946 + next = node; 1.947 + } 1.948 + } 1.949 + } 1.950 + return this; 1.951 + }; 1.952 + d3_selectionPrototype.sort = function(comparator) { 1.953 + comparator = d3_selection_sortComparator.apply(this, arguments); 1.954 + for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator); 1.955 + return this.order(); 1.956 + }; 1.957 + function d3_selection_sortComparator(comparator) { 1.958 + if (!arguments.length) comparator = d3_ascending; 1.959 + return function(a, b) { 1.960 + return a && b ? comparator(a.__data__, b.__data__) : !a - !b; 1.961 + }; 1.962 + } 1.963 + d3_selectionPrototype.each = function(callback) { 1.964 + return d3_selection_each(this, function(node, i, j) { 1.965 + callback.call(node, node.__data__, i, j); 1.966 + }); 1.967 + }; 1.968 + function d3_selection_each(groups, callback) { 1.969 + for (var j = 0, m = groups.length; j < m; j++) { 1.970 + for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) { 1.971 + if (node = group[i]) callback(node, i, j); 1.972 + } 1.973 + } 1.974 + return groups; 1.975 + } 1.976 + d3_selectionPrototype.call = function(callback) { 1.977 + var args = d3_array(arguments); 1.978 + callback.apply(args[0] = this, args); 1.979 + return this; 1.980 + }; 1.981 + d3_selectionPrototype.empty = function() { 1.982 + return !this.node(); 1.983 + }; 1.984 + d3_selectionPrototype.node = function() { 1.985 + for (var j = 0, m = this.length; j < m; j++) { 1.986 + for (var group = this[j], i = 0, n = group.length; i < n; i++) { 1.987 + var node = group[i]; 1.988 + if (node) return node; 1.989 + } 1.990 + } 1.991 + return null; 1.992 + }; 1.993 + d3_selectionPrototype.size = function() { 1.994 + var n = 0; 1.995 + d3_selection_each(this, function() { 1.996 + ++n; 1.997 + }); 1.998 + return n; 1.999 + }; 1.1000 + function d3_selection_enter(selection) { 1.1001 + d3_subclass(selection, d3_selection_enterPrototype); 1.1002 + return selection; 1.1003 + } 1.1004 + var d3_selection_enterPrototype = []; 1.1005 + d3.selection.enter = d3_selection_enter; 1.1006 + d3.selection.enter.prototype = d3_selection_enterPrototype; 1.1007 + d3_selection_enterPrototype.append = d3_selectionPrototype.append; 1.1008 + d3_selection_enterPrototype.empty = d3_selectionPrototype.empty; 1.1009 + d3_selection_enterPrototype.node = d3_selectionPrototype.node; 1.1010 + d3_selection_enterPrototype.call = d3_selectionPrototype.call; 1.1011 + d3_selection_enterPrototype.size = d3_selectionPrototype.size; 1.1012 + d3_selection_enterPrototype.select = function(selector) { 1.1013 + var subgroups = [], subgroup, subnode, upgroup, group, node; 1.1014 + for (var j = -1, m = this.length; ++j < m; ) { 1.1015 + upgroup = (group = this[j]).update; 1.1016 + subgroups.push(subgroup = []); 1.1017 + subgroup.parentNode = group.parentNode; 1.1018 + for (var i = -1, n = group.length; ++i < n; ) { 1.1019 + if (node = group[i]) { 1.1020 + subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i, j)); 1.1021 + subnode.__data__ = node.__data__; 1.1022 + } else { 1.1023 + subgroup.push(null); 1.1024 + } 1.1025 + } 1.1026 + } 1.1027 + return d3_selection(subgroups); 1.1028 + }; 1.1029 + d3_selection_enterPrototype.insert = function(name, before) { 1.1030 + if (arguments.length < 2) before = d3_selection_enterInsertBefore(this); 1.1031 + return d3_selectionPrototype.insert.call(this, name, before); 1.1032 + }; 1.1033 + function d3_selection_enterInsertBefore(enter) { 1.1034 + var i0, j0; 1.1035 + return function(d, i, j) { 1.1036 + var group = enter[j].update, n = group.length, node; 1.1037 + if (j != j0) j0 = j, i0 = 0; 1.1038 + if (i >= i0) i0 = i + 1; 1.1039 + while (!(node = group[i0]) && ++i0 < n) ; 1.1040 + return node; 1.1041 + }; 1.1042 + } 1.1043 + d3.select = function(node) { 1.1044 + var group; 1.1045 + if (typeof node === "string") { 1.1046 + group = [ d3_select(node, d3_document) ]; 1.1047 + group.parentNode = d3_document.documentElement; 1.1048 + } else { 1.1049 + group = [ node ]; 1.1050 + group.parentNode = d3_documentElement(node); 1.1051 + } 1.1052 + return d3_selection([ group ]); 1.1053 + }; 1.1054 + d3.selectAll = function(nodes) { 1.1055 + var group; 1.1056 + if (typeof nodes === "string") { 1.1057 + group = d3_array(d3_selectAll(nodes, d3_document)); 1.1058 + group.parentNode = d3_document.documentElement; 1.1059 + } else { 1.1060 + group = d3_array(nodes); 1.1061 + group.parentNode = null; 1.1062 + } 1.1063 + return d3_selection([ group ]); 1.1064 + }; 1.1065 + d3_selectionPrototype.on = function(type, listener, capture) { 1.1066 + var n = arguments.length; 1.1067 + if (n < 3) { 1.1068 + if (typeof type !== "string") { 1.1069 + if (n < 2) listener = false; 1.1070 + for (capture in type) this.each(d3_selection_on(capture, type[capture], listener)); 1.1071 + return this; 1.1072 + } 1.1073 + if (n < 2) return (n = this.node()["__on" + type]) && n._; 1.1074 + capture = false; 1.1075 + } 1.1076 + return this.each(d3_selection_on(type, listener, capture)); 1.1077 + }; 1.1078 + function d3_selection_on(type, listener, capture) { 1.1079 + var name = "__on" + type, i = type.indexOf("."), wrap = d3_selection_onListener; 1.1080 + if (i > 0) type = type.slice(0, i); 1.1081 + var filter = d3_selection_onFilters.get(type); 1.1082 + if (filter) type = filter, wrap = d3_selection_onFilter; 1.1083 + function onRemove() { 1.1084 + var l = this[name]; 1.1085 + if (l) { 1.1086 + this.removeEventListener(type, l, l.$); 1.1087 + delete this[name]; 1.1088 + } 1.1089 + } 1.1090 + function onAdd() { 1.1091 + var l = wrap(listener, d3_array(arguments)); 1.1092 + onRemove.call(this); 1.1093 + this.addEventListener(type, this[name] = l, l.$ = capture); 1.1094 + l._ = listener; 1.1095 + } 1.1096 + function removeAll() { 1.1097 + var re = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match; 1.1098 + for (var name in this) { 1.1099 + if (match = name.match(re)) { 1.1100 + var l = this[name]; 1.1101 + this.removeEventListener(match[1], l, l.$); 1.1102 + delete this[name]; 1.1103 + } 1.1104 + } 1.1105 + } 1.1106 + return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll; 1.1107 + } 1.1108 + var d3_selection_onFilters = d3.map({ 1.1109 + mouseenter: "mouseover", 1.1110 + mouseleave: "mouseout" 1.1111 + }); 1.1112 + if (d3_document) { 1.1113 + d3_selection_onFilters.forEach(function(k) { 1.1114 + if ("on" + k in d3_document) d3_selection_onFilters.remove(k); 1.1115 + }); 1.1116 + } 1.1117 + function d3_selection_onListener(listener, argumentz) { 1.1118 + return function(e) { 1.1119 + var o = d3.event; 1.1120 + d3.event = e; 1.1121 + argumentz[0] = this.__data__; 1.1122 + try { 1.1123 + listener.apply(this, argumentz); 1.1124 + } finally { 1.1125 + d3.event = o; 1.1126 + } 1.1127 + }; 1.1128 + } 1.1129 + function d3_selection_onFilter(listener, argumentz) { 1.1130 + var l = d3_selection_onListener(listener, argumentz); 1.1131 + return function(e) { 1.1132 + var target = this, related = e.relatedTarget; 1.1133 + if (!related || related !== target && !(related.compareDocumentPosition(target) & 8)) { 1.1134 + l.call(target, e); 1.1135 + } 1.1136 + }; 1.1137 + } 1.1138 + var d3_event_dragSelect, d3_event_dragId = 0; 1.1139 + function d3_event_dragSuppress(node) { 1.1140 + var name = ".dragsuppress-" + ++d3_event_dragId, click = "click" + name, w = d3.select(d3_window(node)).on("touchmove" + name, d3_eventPreventDefault).on("dragstart" + name, d3_eventPreventDefault).on("selectstart" + name, d3_eventPreventDefault); 1.1141 + if (d3_event_dragSelect == null) { 1.1142 + d3_event_dragSelect = "onselectstart" in node ? false : d3_vendorSymbol(node.style, "userSelect"); 1.1143 + } 1.1144 + if (d3_event_dragSelect) { 1.1145 + var style = d3_documentElement(node).style, select = style[d3_event_dragSelect]; 1.1146 + style[d3_event_dragSelect] = "none"; 1.1147 + } 1.1148 + return function(suppressClick) { 1.1149 + w.on(name, null); 1.1150 + if (d3_event_dragSelect) style[d3_event_dragSelect] = select; 1.1151 + if (suppressClick) { 1.1152 + var off = function() { 1.1153 + w.on(click, null); 1.1154 + }; 1.1155 + w.on(click, function() { 1.1156 + d3_eventPreventDefault(); 1.1157 + off(); 1.1158 + }, true); 1.1159 + setTimeout(off, 0); 1.1160 + } 1.1161 + }; 1.1162 + } 1.1163 + d3.mouse = function(container) { 1.1164 + return d3_mousePoint(container, d3_eventSource()); 1.1165 + }; 1.1166 + var d3_mouse_bug44083 = this.navigator && /WebKit/.test(this.navigator.userAgent) ? -1 : 0; 1.1167 + function d3_mousePoint(container, e) { 1.1168 + if (e.changedTouches) e = e.changedTouches[0]; 1.1169 + var svg = container.ownerSVGElement || container; 1.1170 + if (svg.createSVGPoint) { 1.1171 + var point = svg.createSVGPoint(); 1.1172 + if (d3_mouse_bug44083 < 0) { 1.1173 + var window = d3_window(container); 1.1174 + if (window.scrollX || window.scrollY) { 1.1175 + svg = d3.select("body").append("svg").style({ 1.1176 + position: "absolute", 1.1177 + top: 0, 1.1178 + left: 0, 1.1179 + margin: 0, 1.1180 + padding: 0, 1.1181 + border: "none" 1.1182 + }, "important"); 1.1183 + var ctm = svg[0][0].getScreenCTM(); 1.1184 + d3_mouse_bug44083 = !(ctm.f || ctm.e); 1.1185 + svg.remove(); 1.1186 + } 1.1187 + } 1.1188 + if (d3_mouse_bug44083) point.x = e.pageX, point.y = e.pageY; else point.x = e.clientX, 1.1189 + point.y = e.clientY; 1.1190 + point = point.matrixTransform(container.getScreenCTM().inverse()); 1.1191 + return [ point.x, point.y ]; 1.1192 + } 1.1193 + var rect = container.getBoundingClientRect(); 1.1194 + return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ]; 1.1195 + } 1.1196 + d3.touch = function(container, touches, identifier) { 1.1197 + if (arguments.length < 3) identifier = touches, touches = d3_eventSource().changedTouches; 1.1198 + if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) { 1.1199 + if ((touch = touches[i]).identifier === identifier) { 1.1200 + return d3_mousePoint(container, touch); 1.1201 + } 1.1202 + } 1.1203 + }; 1.1204 + d3.behavior.drag = function() { 1.1205 + var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null, mousedown = dragstart(d3_noop, d3.mouse, d3_window, "mousemove", "mouseup"), touchstart = dragstart(d3_behavior_dragTouchId, d3.touch, d3_identity, "touchmove", "touchend"); 1.1206 + function drag() { 1.1207 + this.on("mousedown.drag", mousedown).on("touchstart.drag", touchstart); 1.1208 + } 1.1209 + function dragstart(id, position, subject, move, end) { 1.1210 + return function() { 1.1211 + var that = this, target = d3.event.target.correspondingElement || d3.event.target, parent = that.parentNode, dispatch = event.of(that, arguments), dragged = 0, dragId = id(), dragName = ".drag" + (dragId == null ? "" : "-" + dragId), dragOffset, dragSubject = d3.select(subject(target)).on(move + dragName, moved).on(end + dragName, ended), dragRestore = d3_event_dragSuppress(target), position0 = position(parent, dragId); 1.1212 + if (origin) { 1.1213 + dragOffset = origin.apply(that, arguments); 1.1214 + dragOffset = [ dragOffset.x - position0[0], dragOffset.y - position0[1] ]; 1.1215 + } else { 1.1216 + dragOffset = [ 0, 0 ]; 1.1217 + } 1.1218 + dispatch({ 1.1219 + type: "dragstart" 1.1220 + }); 1.1221 + function moved() { 1.1222 + var position1 = position(parent, dragId), dx, dy; 1.1223 + if (!position1) return; 1.1224 + dx = position1[0] - position0[0]; 1.1225 + dy = position1[1] - position0[1]; 1.1226 + dragged |= dx | dy; 1.1227 + position0 = position1; 1.1228 + dispatch({ 1.1229 + type: "drag", 1.1230 + x: position1[0] + dragOffset[0], 1.1231 + y: position1[1] + dragOffset[1], 1.1232 + dx: dx, 1.1233 + dy: dy 1.1234 + }); 1.1235 + } 1.1236 + function ended() { 1.1237 + if (!position(parent, dragId)) return; 1.1238 + dragSubject.on(move + dragName, null).on(end + dragName, null); 1.1239 + dragRestore(dragged); 1.1240 + dispatch({ 1.1241 + type: "dragend" 1.1242 + }); 1.1243 + } 1.1244 + }; 1.1245 + } 1.1246 + drag.origin = function(x) { 1.1247 + if (!arguments.length) return origin; 1.1248 + origin = x; 1.1249 + return drag; 1.1250 + }; 1.1251 + return d3.rebind(drag, event, "on"); 1.1252 + }; 1.1253 + function d3_behavior_dragTouchId() { 1.1254 + return d3.event.changedTouches[0].identifier; 1.1255 + } 1.1256 + d3.touches = function(container, touches) { 1.1257 + if (arguments.length < 2) touches = d3_eventSource().touches; 1.1258 + return touches ? d3_array(touches).map(function(touch) { 1.1259 + var point = d3_mousePoint(container, touch); 1.1260 + point.identifier = touch.identifier; 1.1261 + return point; 1.1262 + }) : []; 1.1263 + }; 1.1264 + var ε = 1e-6, ε2 = ε * ε, π = Math.PI, τ = 2 * π, τε = τ - ε, halfπ = π / 2, d3_radians = π / 180, d3_degrees = 180 / π; 1.1265 + function d3_sgn(x) { 1.1266 + return x > 0 ? 1 : x < 0 ? -1 : 0; 1.1267 + } 1.1268 + function d3_cross2d(a, b, c) { 1.1269 + return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]); 1.1270 + } 1.1271 + function d3_acos(x) { 1.1272 + return x > 1 ? 0 : x < -1 ? π : Math.acos(x); 1.1273 + } 1.1274 + function d3_asin(x) { 1.1275 + return x > 1 ? halfπ : x < -1 ? -halfπ : Math.asin(x); 1.1276 + } 1.1277 + function d3_sinh(x) { 1.1278 + return ((x = Math.exp(x)) - 1 / x) / 2; 1.1279 + } 1.1280 + function d3_cosh(x) { 1.1281 + return ((x = Math.exp(x)) + 1 / x) / 2; 1.1282 + } 1.1283 + function d3_tanh(x) { 1.1284 + return ((x = Math.exp(2 * x)) - 1) / (x + 1); 1.1285 + } 1.1286 + function d3_haversin(x) { 1.1287 + return (x = Math.sin(x / 2)) * x; 1.1288 + } 1.1289 + var ρ = Math.SQRT2, ρ2 = 2, ρ4 = 4; 1.1290 + d3.interpolateZoom = function(p0, p1) { 1.1291 + var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; 1.1292 + if (d2 < ε2) { 1.1293 + S = Math.log(w1 / w0) / ρ; 1.1294 + i = function(t) { 1.1295 + return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(ρ * t * S) ]; 1.1296 + }; 1.1297 + } else { 1.1298 + var 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); 1.1299 + S = (r1 - r0) / ρ; 1.1300 + i = function(t) { 1.1301 + var s = t * S, coshr0 = d3_cosh(r0), u = w0 / (ρ2 * d1) * (coshr0 * d3_tanh(ρ * s + r0) - d3_sinh(r0)); 1.1302 + return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / d3_cosh(ρ * s + r0) ]; 1.1303 + }; 1.1304 + } 1.1305 + i.duration = S * 1e3; 1.1306 + return i; 1.1307 + }; 1.1308 + d3.behavior.zoom = function() { 1.1309 + var view = { 1.1310 + x: 0, 1.1311 + y: 0, 1.1312 + k: 1 1.1313 + }, translate0, center0, center, size = [ 960, 500 ], scaleExtent = d3_behavior_zoomInfinity, duration = 250, zooming = 0, 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.1314 + if (!d3_behavior_zoomWheel) { 1.1315 + d3_behavior_zoomWheel = "onwheel" in d3_document ? (d3_behavior_zoomDelta = function() { 1.1316 + return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1); 1.1317 + }, "wheel") : "onmousewheel" in d3_document ? (d3_behavior_zoomDelta = function() { 1.1318 + return d3.event.wheelDelta; 1.1319 + }, "mousewheel") : (d3_behavior_zoomDelta = function() { 1.1320 + return -d3.event.detail; 1.1321 + }, "MozMousePixelScroll"); 1.1322 + } 1.1323 + function zoom(g) { 1.1324 + g.on(mousedown, mousedowned).on(d3_behavior_zoomWheel + ".zoom", mousewheeled).on("dblclick.zoom", dblclicked).on(touchstart, touchstarted); 1.1325 + } 1.1326 + zoom.event = function(g) { 1.1327 + g.each(function() { 1.1328 + var dispatch = event.of(this, arguments), view1 = view; 1.1329 + if (d3_transitionInheritId) { 1.1330 + d3.select(this).transition().each("start.zoom", function() { 1.1331 + view = this.__chart__ || { 1.1332 + x: 0, 1.1333 + y: 0, 1.1334 + k: 1 1.1335 + }; 1.1336 + zoomstarted(dispatch); 1.1337 + }).tween("zoom:zoom", function() { 1.1338 + var dx = size[0], dy = size[1], cx = center0 ? center0[0] : dx / 2, cy = center0 ? center0[1] : 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.1339 + return function(t) { 1.1340 + var l = i(t), k = dx / l[2]; 1.1341 + this.__chart__ = view = { 1.1342 + x: cx - l[0] * k, 1.1343 + y: cy - l[1] * k, 1.1344 + k: k 1.1345 + }; 1.1346 + zoomed(dispatch); 1.1347 + }; 1.1348 + }).each("interrupt.zoom", function() { 1.1349 + zoomended(dispatch); 1.1350 + }).each("end.zoom", function() { 1.1351 + zoomended(dispatch); 1.1352 + }); 1.1353 + } else { 1.1354 + this.__chart__ = view; 1.1355 + zoomstarted(dispatch); 1.1356 + zoomed(dispatch); 1.1357 + zoomended(dispatch); 1.1358 + } 1.1359 + }); 1.1360 + }; 1.1361 + zoom.translate = function(_) { 1.1362 + if (!arguments.length) return [ view.x, view.y ]; 1.1363 + view = { 1.1364 + x: +_[0], 1.1365 + y: +_[1], 1.1366 + k: view.k 1.1367 + }; 1.1368 + rescale(); 1.1369 + return zoom; 1.1370 + }; 1.1371 + zoom.scale = function(_) { 1.1372 + if (!arguments.length) return view.k; 1.1373 + view = { 1.1374 + x: view.x, 1.1375 + y: view.y, 1.1376 + k: null 1.1377 + }; 1.1378 + scaleTo(+_); 1.1379 + rescale(); 1.1380 + return zoom; 1.1381 + }; 1.1382 + zoom.scaleExtent = function(_) { 1.1383 + if (!arguments.length) return scaleExtent; 1.1384 + scaleExtent = _ == null ? d3_behavior_zoomInfinity : [ +_[0], +_[1] ]; 1.1385 + return zoom; 1.1386 + }; 1.1387 + zoom.center = function(_) { 1.1388 + if (!arguments.length) return center; 1.1389 + center = _ && [ +_[0], +_[1] ]; 1.1390 + return zoom; 1.1391 + }; 1.1392 + zoom.size = function(_) { 1.1393 + if (!arguments.length) return size; 1.1394 + size = _ && [ +_[0], +_[1] ]; 1.1395 + return zoom; 1.1396 + }; 1.1397 + zoom.duration = function(_) { 1.1398 + if (!arguments.length) return duration; 1.1399 + duration = +_; 1.1400 + return zoom; 1.1401 + }; 1.1402 + zoom.x = function(z) { 1.1403 + if (!arguments.length) return x1; 1.1404 + x1 = z; 1.1405 + x0 = z.copy(); 1.1406 + view = { 1.1407 + x: 0, 1.1408 + y: 0, 1.1409 + k: 1 1.1410 + }; 1.1411 + return zoom; 1.1412 + }; 1.1413 + zoom.y = function(z) { 1.1414 + if (!arguments.length) return y1; 1.1415 + y1 = z; 1.1416 + y0 = z.copy(); 1.1417 + view = { 1.1418 + x: 0, 1.1419 + y: 0, 1.1420 + k: 1 1.1421 + }; 1.1422 + return zoom; 1.1423 + }; 1.1424 + function location(p) { 1.1425 + return [ (p[0] - view.x) / view.k, (p[1] - view.y) / view.k ]; 1.1426 + } 1.1427 + function point(l) { 1.1428 + return [ l[0] * view.k + view.x, l[1] * view.k + view.y ]; 1.1429 + } 1.1430 + function scaleTo(s) { 1.1431 + view.k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s)); 1.1432 + } 1.1433 + function translateTo(p, l) { 1.1434 + l = point(l); 1.1435 + view.x += p[0] - l[0]; 1.1436 + view.y += p[1] - l[1]; 1.1437 + } 1.1438 + function zoomTo(that, p, l, k) { 1.1439 + that.__chart__ = { 1.1440 + x: view.x, 1.1441 + y: view.y, 1.1442 + k: view.k 1.1443 + }; 1.1444 + scaleTo(Math.pow(2, k)); 1.1445 + translateTo(center0 = p, l); 1.1446 + that = d3.select(that); 1.1447 + if (duration > 0) that = that.transition().duration(duration); 1.1448 + that.call(zoom.event); 1.1449 + } 1.1450 + function rescale() { 1.1451 + if (x1) x1.domain(x0.range().map(function(x) { 1.1452 + return (x - view.x) / view.k; 1.1453 + }).map(x0.invert)); 1.1454 + if (y1) y1.domain(y0.range().map(function(y) { 1.1455 + return (y - view.y) / view.k; 1.1456 + }).map(y0.invert)); 1.1457 + } 1.1458 + function zoomstarted(dispatch) { 1.1459 + if (!zooming++) dispatch({ 1.1460 + type: "zoomstart" 1.1461 + }); 1.1462 + } 1.1463 + function zoomed(dispatch) { 1.1464 + rescale(); 1.1465 + dispatch({ 1.1466 + type: "zoom", 1.1467 + scale: view.k, 1.1468 + translate: [ view.x, view.y ] 1.1469 + }); 1.1470 + } 1.1471 + function zoomended(dispatch) { 1.1472 + if (!--zooming) dispatch({ 1.1473 + type: "zoomend" 1.1474 + }), center0 = null; 1.1475 + } 1.1476 + function mousedowned() { 1.1477 + var that = this, dispatch = event.of(that, arguments), dragged = 0, subject = d3.select(d3_window(that)).on(mousemove, moved).on(mouseup, ended), location0 = location(d3.mouse(that)), dragRestore = d3_event_dragSuppress(that); 1.1478 + d3_selection_interrupt.call(that); 1.1479 + zoomstarted(dispatch); 1.1480 + function moved() { 1.1481 + dragged = 1; 1.1482 + translateTo(d3.mouse(that), location0); 1.1483 + zoomed(dispatch); 1.1484 + } 1.1485 + function ended() { 1.1486 + subject.on(mousemove, null).on(mouseup, null); 1.1487 + dragRestore(dragged); 1.1488 + zoomended(dispatch); 1.1489 + } 1.1490 + } 1.1491 + function touchstarted() { 1.1492 + var that = this, dispatch = event.of(that, arguments), locations0 = {}, distance0 = 0, scale0, zoomName = ".zoom-" + d3.event.changedTouches[0].identifier, touchmove = "touchmove" + zoomName, touchend = "touchend" + zoomName, targets = [], subject = d3.select(that), dragRestore = d3_event_dragSuppress(that); 1.1493 + started(); 1.1494 + zoomstarted(dispatch); 1.1495 + subject.on(mousedown, null).on(touchstart, started); 1.1496 + function relocate() { 1.1497 + var touches = d3.touches(that); 1.1498 + scale0 = view.k; 1.1499 + touches.forEach(function(t) { 1.1500 + if (t.identifier in locations0) locations0[t.identifier] = location(t); 1.1501 + }); 1.1502 + return touches; 1.1503 + } 1.1504 + function started() { 1.1505 + var target = d3.event.target; 1.1506 + d3.select(target).on(touchmove, moved).on(touchend, ended); 1.1507 + targets.push(target); 1.1508 + var changed = d3.event.changedTouches; 1.1509 + for (var i = 0, n = changed.length; i < n; ++i) { 1.1510 + locations0[changed[i].identifier] = null; 1.1511 + } 1.1512 + var touches = relocate(), now = Date.now(); 1.1513 + if (touches.length === 1) { 1.1514 + if (now - touchtime < 500) { 1.1515 + var p = touches[0]; 1.1516 + zoomTo(that, p, locations0[p.identifier], Math.floor(Math.log(view.k) / Math.LN2) + 1); 1.1517 + d3_eventPreventDefault(); 1.1518 + } 1.1519 + touchtime = now; 1.1520 + } else if (touches.length > 1) { 1.1521 + var p = touches[0], q = touches[1], dx = p[0] - q[0], dy = p[1] - q[1]; 1.1522 + distance0 = dx * dx + dy * dy; 1.1523 + } 1.1524 + } 1.1525 + function moved() { 1.1526 + var touches = d3.touches(that), p0, l0, p1, l1; 1.1527 + d3_selection_interrupt.call(that); 1.1528 + for (var i = 0, n = touches.length; i < n; ++i, l1 = null) { 1.1529 + p1 = touches[i]; 1.1530 + if (l1 = locations0[p1.identifier]) { 1.1531 + if (l0) break; 1.1532 + p0 = p1, l0 = l1; 1.1533 + } 1.1534 + } 1.1535 + if (l1) { 1.1536 + var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1, scale1 = distance0 && Math.sqrt(distance1 / distance0); 1.1537 + p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ]; 1.1538 + l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ]; 1.1539 + scaleTo(scale1 * scale0); 1.1540 + } 1.1541 + touchtime = null; 1.1542 + translateTo(p0, l0); 1.1543 + zoomed(dispatch); 1.1544 + } 1.1545 + function ended() { 1.1546 + if (d3.event.touches.length) { 1.1547 + var changed = d3.event.changedTouches; 1.1548 + for (var i = 0, n = changed.length; i < n; ++i) { 1.1549 + delete locations0[changed[i].identifier]; 1.1550 + } 1.1551 + for (var identifier in locations0) { 1.1552 + return void relocate(); 1.1553 + } 1.1554 + } 1.1555 + d3.selectAll(targets).on(zoomName, null); 1.1556 + subject.on(mousedown, mousedowned).on(touchstart, touchstarted); 1.1557 + dragRestore(); 1.1558 + zoomended(dispatch); 1.1559 + } 1.1560 + } 1.1561 + function mousewheeled() { 1.1562 + var dispatch = event.of(this, arguments); 1.1563 + if (mousewheelTimer) clearTimeout(mousewheelTimer); else d3_selection_interrupt.call(this), 1.1564 + translate0 = location(center0 = center || d3.mouse(this)), zoomstarted(dispatch); 1.1565 + mousewheelTimer = setTimeout(function() { 1.1566 + mousewheelTimer = null; 1.1567 + zoomended(dispatch); 1.1568 + }, 50); 1.1569 + d3_eventPreventDefault(); 1.1570 + scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * view.k); 1.1571 + translateTo(center0, translate0); 1.1572 + zoomed(dispatch); 1.1573 + } 1.1574 + function dblclicked() { 1.1575 + var p = d3.mouse(this), k = Math.log(view.k) / Math.LN2; 1.1576 + zoomTo(this, p, location(p), d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1); 1.1577 + } 1.1578 + return d3.rebind(zoom, event, "on"); 1.1579 + }; 1.1580 + var d3_behavior_zoomInfinity = [ 0, Infinity ], d3_behavior_zoomDelta, d3_behavior_zoomWheel; 1.1581 + d3.color = d3_color; 1.1582 + function d3_color() {} 1.1583 + d3_color.prototype.toString = function() { 1.1584 + return this.rgb() + ""; 1.1585 + }; 1.1586 + d3.hsl = d3_hsl; 1.1587 + function d3_hsl(h, s, l) { 1.1588 + return this instanceof d3_hsl ? void (this.h = +h, this.s = +s, this.l = +l) : arguments.length < 2 ? h instanceof d3_hsl ? new d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : new d3_hsl(h, s, l); 1.1589 + } 1.1590 + var d3_hslPrototype = d3_hsl.prototype = new d3_color(); 1.1591 + d3_hslPrototype.brighter = function(k) { 1.1592 + k = Math.pow(.7, arguments.length ? k : 1); 1.1593 + return new d3_hsl(this.h, this.s, this.l / k); 1.1594 + }; 1.1595 + d3_hslPrototype.darker = function(k) { 1.1596 + k = Math.pow(.7, arguments.length ? k : 1); 1.1597 + return new d3_hsl(this.h, this.s, k * this.l); 1.1598 + }; 1.1599 + d3_hslPrototype.rgb = function() { 1.1600 + return d3_hsl_rgb(this.h, this.s, this.l); 1.1601 + }; 1.1602 + function d3_hsl_rgb(h, s, l) { 1.1603 + var m1, m2; 1.1604 + h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h; 1.1605 + s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s; 1.1606 + l = l < 0 ? 0 : l > 1 ? 1 : l; 1.1607 + m2 = l <= .5 ? l * (1 + s) : l + s - l * s; 1.1608 + m1 = 2 * l - m2; 1.1609 + function v(h) { 1.1610 + if (h > 360) h -= 360; else if (h < 0) h += 360; 1.1611 + if (h < 60) return m1 + (m2 - m1) * h / 60; 1.1612 + if (h < 180) return m2; 1.1613 + if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; 1.1614 + return m1; 1.1615 + } 1.1616 + function vv(h) { 1.1617 + return Math.round(v(h) * 255); 1.1618 + } 1.1619 + return new d3_rgb(vv(h + 120), vv(h), vv(h - 120)); 1.1620 + } 1.1621 + d3.hcl = d3_hcl; 1.1622 + function d3_hcl(h, c, l) { 1.1623 + return this instanceof d3_hcl ? void (this.h = +h, this.c = +c, this.l = +l) : arguments.length < 2 ? h instanceof d3_hcl ? new 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) : new d3_hcl(h, c, l); 1.1624 + } 1.1625 + var d3_hclPrototype = d3_hcl.prototype = new d3_color(); 1.1626 + d3_hclPrototype.brighter = function(k) { 1.1627 + return new d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1))); 1.1628 + }; 1.1629 + d3_hclPrototype.darker = function(k) { 1.1630 + return new d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1))); 1.1631 + }; 1.1632 + d3_hclPrototype.rgb = function() { 1.1633 + return d3_hcl_lab(this.h, this.c, this.l).rgb(); 1.1634 + }; 1.1635 + function d3_hcl_lab(h, c, l) { 1.1636 + if (isNaN(h)) h = 0; 1.1637 + if (isNaN(c)) c = 0; 1.1638 + return new d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c); 1.1639 + } 1.1640 + d3.lab = d3_lab; 1.1641 + function d3_lab(l, a, b) { 1.1642 + return this instanceof d3_lab ? void (this.l = +l, this.a = +a, this.b = +b) : arguments.length < 2 ? l instanceof d3_lab ? new d3_lab(l.l, l.a, l.b) : l instanceof d3_hcl ? d3_hcl_lab(l.h, l.c, l.l) : d3_rgb_lab((l = d3_rgb(l)).r, l.g, l.b) : new d3_lab(l, a, b); 1.1643 + } 1.1644 + var d3_lab_K = 18; 1.1645 + var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883; 1.1646 + var d3_labPrototype = d3_lab.prototype = new d3_color(); 1.1647 + d3_labPrototype.brighter = function(k) { 1.1648 + return new d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); 1.1649 + }; 1.1650 + d3_labPrototype.darker = function(k) { 1.1651 + return new d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); 1.1652 + }; 1.1653 + d3_labPrototype.rgb = function() { 1.1654 + return d3_lab_rgb(this.l, this.a, this.b); 1.1655 + }; 1.1656 + function d3_lab_rgb(l, a, b) { 1.1657 + var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200; 1.1658 + x = d3_lab_xyz(x) * d3_lab_X; 1.1659 + y = d3_lab_xyz(y) * d3_lab_Y; 1.1660 + z = d3_lab_xyz(z) * d3_lab_Z; 1.1661 + return new 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.1662 + } 1.1663 + function d3_lab_hcl(l, a, b) { 1.1664 + return l > 0 ? new d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l) : new d3_hcl(NaN, NaN, l); 1.1665 + } 1.1666 + function d3_lab_xyz(x) { 1.1667 + return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037; 1.1668 + } 1.1669 + function d3_xyz_lab(x) { 1.1670 + return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; 1.1671 + } 1.1672 + function d3_xyz_rgb(r) { 1.1673 + return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055)); 1.1674 + } 1.1675 + d3.rgb = d3_rgb; 1.1676 + function d3_rgb(r, g, b) { 1.1677 + return this instanceof d3_rgb ? void (this.r = ~~r, this.g = ~~g, this.b = ~~b) : arguments.length < 2 ? r instanceof d3_rgb ? new d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : new d3_rgb(r, g, b); 1.1678 + } 1.1679 + function d3_rgbNumber(value) { 1.1680 + return new d3_rgb(value >> 16, value >> 8 & 255, value & 255); 1.1681 + } 1.1682 + function d3_rgbString(value) { 1.1683 + return d3_rgbNumber(value) + ""; 1.1684 + } 1.1685 + var d3_rgbPrototype = d3_rgb.prototype = new d3_color(); 1.1686 + d3_rgbPrototype.brighter = function(k) { 1.1687 + k = Math.pow(.7, arguments.length ? k : 1); 1.1688 + var r = this.r, g = this.g, b = this.b, i = 30; 1.1689 + if (!r && !g && !b) return new d3_rgb(i, i, i); 1.1690 + if (r && r < i) r = i; 1.1691 + if (g && g < i) g = i; 1.1692 + if (b && b < i) b = i; 1.1693 + return new d3_rgb(Math.min(255, r / k), Math.min(255, g / k), Math.min(255, b / k)); 1.1694 + }; 1.1695 + d3_rgbPrototype.darker = function(k) { 1.1696 + k = Math.pow(.7, arguments.length ? k : 1); 1.1697 + return new d3_rgb(k * this.r, k * this.g, k * this.b); 1.1698 + }; 1.1699 + d3_rgbPrototype.hsl = function() { 1.1700 + return d3_rgb_hsl(this.r, this.g, this.b); 1.1701 + }; 1.1702 + d3_rgbPrototype.toString = function() { 1.1703 + return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); 1.1704 + }; 1.1705 + function d3_rgb_hex(v) { 1.1706 + return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16); 1.1707 + } 1.1708 + function d3_rgb_parse(format, rgb, hsl) { 1.1709 + var r = 0, g = 0, b = 0, m1, m2, color; 1.1710 + m1 = /([a-z]+)\((.*)\)/.exec(format = format.toLowerCase()); 1.1711 + if (m1) { 1.1712 + m2 = m1[2].split(","); 1.1713 + switch (m1[1]) { 1.1714 + case "hsl": 1.1715 + { 1.1716 + return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100); 1.1717 + } 1.1718 + 1.1719 + case "rgb": 1.1720 + { 1.1721 + return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2])); 1.1722 + } 1.1723 + } 1.1724 + } 1.1725 + if (color = d3_rgb_names.get(format)) { 1.1726 + return rgb(color.r, color.g, color.b); 1.1727 + } 1.1728 + if (format != null && format.charAt(0) === "#" && !isNaN(color = parseInt(format.slice(1), 16))) { 1.1729 + if (format.length === 4) { 1.1730 + r = (color & 3840) >> 4; 1.1731 + r = r >> 4 | r; 1.1732 + g = color & 240; 1.1733 + g = g >> 4 | g; 1.1734 + b = color & 15; 1.1735 + b = b << 4 | b; 1.1736 + } else if (format.length === 7) { 1.1737 + r = (color & 16711680) >> 16; 1.1738 + g = (color & 65280) >> 8; 1.1739 + b = color & 255; 1.1740 + } 1.1741 + } 1.1742 + return rgb(r, g, b); 1.1743 + } 1.1744 + function d3_rgb_hsl(r, g, b) { 1.1745 + 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.1746 + if (d) { 1.1747 + s = l < .5 ? d / (max + min) : d / (2 - max - min); 1.1748 + 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.1749 + h *= 60; 1.1750 + } else { 1.1751 + h = NaN; 1.1752 + s = l > 0 && l < 1 ? 0 : h; 1.1753 + } 1.1754 + return new d3_hsl(h, s, l); 1.1755 + } 1.1756 + function d3_rgb_lab(r, g, b) { 1.1757 + r = d3_rgb_xyz(r); 1.1758 + g = d3_rgb_xyz(g); 1.1759 + b = d3_rgb_xyz(b); 1.1760 + 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.1761 + return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z)); 1.1762 + } 1.1763 + function d3_rgb_xyz(r) { 1.1764 + return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4); 1.1765 + } 1.1766 + function d3_rgb_parseNumber(c) { 1.1767 + var f = parseFloat(c); 1.1768 + return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; 1.1769 + } 1.1770 + var d3_rgb_names = d3.map({ 1.1771 + aliceblue: 15792383, 1.1772 + antiquewhite: 16444375, 1.1773 + aqua: 65535, 1.1774 + aquamarine: 8388564, 1.1775 + azure: 15794175, 1.1776 + beige: 16119260, 1.1777 + bisque: 16770244, 1.1778 + black: 0, 1.1779 + blanchedalmond: 16772045, 1.1780 + blue: 255, 1.1781 + blueviolet: 9055202, 1.1782 + brown: 10824234, 1.1783 + burlywood: 14596231, 1.1784 + cadetblue: 6266528, 1.1785 + chartreuse: 8388352, 1.1786 + chocolate: 13789470, 1.1787 + coral: 16744272, 1.1788 + cornflowerblue: 6591981, 1.1789 + cornsilk: 16775388, 1.1790 + crimson: 14423100, 1.1791 + cyan: 65535, 1.1792 + darkblue: 139, 1.1793 + darkcyan: 35723, 1.1794 + darkgoldenrod: 12092939, 1.1795 + darkgray: 11119017, 1.1796 + darkgreen: 25600, 1.1797 + darkgrey: 11119017, 1.1798 + darkkhaki: 12433259, 1.1799 + darkmagenta: 9109643, 1.1800 + darkolivegreen: 5597999, 1.1801 + darkorange: 16747520, 1.1802 + darkorchid: 10040012, 1.1803 + darkred: 9109504, 1.1804 + darksalmon: 15308410, 1.1805 + darkseagreen: 9419919, 1.1806 + darkslateblue: 4734347, 1.1807 + darkslategray: 3100495, 1.1808 + darkslategrey: 3100495, 1.1809 + darkturquoise: 52945, 1.1810 + darkviolet: 9699539, 1.1811 + deeppink: 16716947, 1.1812 + deepskyblue: 49151, 1.1813 + dimgray: 6908265, 1.1814 + dimgrey: 6908265, 1.1815 + dodgerblue: 2003199, 1.1816 + firebrick: 11674146, 1.1817 + floralwhite: 16775920, 1.1818 + forestgreen: 2263842, 1.1819 + fuchsia: 16711935, 1.1820 + gainsboro: 14474460, 1.1821 + ghostwhite: 16316671, 1.1822 + gold: 16766720, 1.1823 + goldenrod: 14329120, 1.1824 + gray: 8421504, 1.1825 + green: 32768, 1.1826 + greenyellow: 11403055, 1.1827 + grey: 8421504, 1.1828 + honeydew: 15794160, 1.1829 + hotpink: 16738740, 1.1830 + indianred: 13458524, 1.1831 + indigo: 4915330, 1.1832 + ivory: 16777200, 1.1833 + khaki: 15787660, 1.1834 + lavender: 15132410, 1.1835 + lavenderblush: 16773365, 1.1836 + lawngreen: 8190976, 1.1837 + lemonchiffon: 16775885, 1.1838 + lightblue: 11393254, 1.1839 + lightcoral: 15761536, 1.1840 + lightcyan: 14745599, 1.1841 + lightgoldenrodyellow: 16448210, 1.1842 + lightgray: 13882323, 1.1843 + lightgreen: 9498256, 1.1844 + lightgrey: 13882323, 1.1845 + lightpink: 16758465, 1.1846 + lightsalmon: 16752762, 1.1847 + lightseagreen: 2142890, 1.1848 + lightskyblue: 8900346, 1.1849 + lightslategray: 7833753, 1.1850 + lightslategrey: 7833753, 1.1851 + lightsteelblue: 11584734, 1.1852 + lightyellow: 16777184, 1.1853 + lime: 65280, 1.1854 + limegreen: 3329330, 1.1855 + linen: 16445670, 1.1856 + magenta: 16711935, 1.1857 + maroon: 8388608, 1.1858 + mediumaquamarine: 6737322, 1.1859 + mediumblue: 205, 1.1860 + mediumorchid: 12211667, 1.1861 + mediumpurple: 9662683, 1.1862 + mediumseagreen: 3978097, 1.1863 + mediumslateblue: 8087790, 1.1864 + mediumspringgreen: 64154, 1.1865 + mediumturquoise: 4772300, 1.1866 + mediumvioletred: 13047173, 1.1867 + midnightblue: 1644912, 1.1868 + mintcream: 16121850, 1.1869 + mistyrose: 16770273, 1.1870 + moccasin: 16770229, 1.1871 + navajowhite: 16768685, 1.1872 + navy: 128, 1.1873 + oldlace: 16643558, 1.1874 + olive: 8421376, 1.1875 + olivedrab: 7048739, 1.1876 + orange: 16753920, 1.1877 + orangered: 16729344, 1.1878 + orchid: 14315734, 1.1879 + palegoldenrod: 15657130, 1.1880 + palegreen: 10025880, 1.1881 + paleturquoise: 11529966, 1.1882 + palevioletred: 14381203, 1.1883 + papayawhip: 16773077, 1.1884 + peachpuff: 16767673, 1.1885 + peru: 13468991, 1.1886 + pink: 16761035, 1.1887 + plum: 14524637, 1.1888 + powderblue: 11591910, 1.1889 + purple: 8388736, 1.1890 + rebeccapurple: 6697881, 1.1891 + red: 16711680, 1.1892 + rosybrown: 12357519, 1.1893 + royalblue: 4286945, 1.1894 + saddlebrown: 9127187, 1.1895 + salmon: 16416882, 1.1896 + sandybrown: 16032864, 1.1897 + seagreen: 3050327, 1.1898 + seashell: 16774638, 1.1899 + sienna: 10506797, 1.1900 + silver: 12632256, 1.1901 + skyblue: 8900331, 1.1902 + slateblue: 6970061, 1.1903 + slategray: 7372944, 1.1904 + slategrey: 7372944, 1.1905 + snow: 16775930, 1.1906 + springgreen: 65407, 1.1907 + steelblue: 4620980, 1.1908 + tan: 13808780, 1.1909 + teal: 32896, 1.1910 + thistle: 14204888, 1.1911 + tomato: 16737095, 1.1912 + turquoise: 4251856, 1.1913 + violet: 15631086, 1.1914 + wheat: 16113331, 1.1915 + white: 16777215, 1.1916 + whitesmoke: 16119285, 1.1917 + yellow: 16776960, 1.1918 + yellowgreen: 10145074 1.1919 + }); 1.1920 + d3_rgb_names.forEach(function(key, value) { 1.1921 + d3_rgb_names.set(key, d3_rgbNumber(value)); 1.1922 + }); 1.1923 + function d3_functor(v) { 1.1924 + return typeof v === "function" ? v : function() { 1.1925 + return v; 1.1926 + }; 1.1927 + } 1.1928 + d3.functor = d3_functor; 1.1929 + d3.xhr = d3_xhrType(d3_identity); 1.1930 + function d3_xhrType(response) { 1.1931 + return function(url, mimeType, callback) { 1.1932 + if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType, 1.1933 + mimeType = null; 1.1934 + return d3_xhr(url, mimeType, response, callback); 1.1935 + }; 1.1936 + } 1.1937 + function d3_xhr(url, mimeType, response, callback) { 1.1938 + var xhr = {}, dispatch = d3.dispatch("beforesend", "progress", "load", "error"), headers = {}, request = new XMLHttpRequest(), responseType = null; 1.1939 + if (this.XDomainRequest && !("withCredentials" in request) && /^(http(s)?:)?\/\//.test(url)) request = new XDomainRequest(); 1.1940 + "onload" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() { 1.1941 + request.readyState > 3 && respond(); 1.1942 + }; 1.1943 + function respond() { 1.1944 + var status = request.status, result; 1.1945 + if (!status && d3_xhrHasResponse(request) || status >= 200 && status < 300 || status === 304) { 1.1946 + try { 1.1947 + result = response.call(xhr, request); 1.1948 + } catch (e) { 1.1949 + dispatch.error.call(xhr, e); 1.1950 + return; 1.1951 + } 1.1952 + dispatch.load.call(xhr, result); 1.1953 + } else { 1.1954 + dispatch.error.call(xhr, request); 1.1955 + } 1.1956 + } 1.1957 + request.onprogress = function(event) { 1.1958 + var o = d3.event; 1.1959 + d3.event = event; 1.1960 + try { 1.1961 + dispatch.progress.call(xhr, request); 1.1962 + } finally { 1.1963 + d3.event = o; 1.1964 + } 1.1965 + }; 1.1966 + xhr.header = function(name, value) { 1.1967 + name = (name + "").toLowerCase(); 1.1968 + if (arguments.length < 2) return headers[name]; 1.1969 + if (value == null) delete headers[name]; else headers[name] = value + ""; 1.1970 + return xhr; 1.1971 + }; 1.1972 + xhr.mimeType = function(value) { 1.1973 + if (!arguments.length) return mimeType; 1.1974 + mimeType = value == null ? null : value + ""; 1.1975 + return xhr; 1.1976 + }; 1.1977 + xhr.responseType = function(value) { 1.1978 + if (!arguments.length) return responseType; 1.1979 + responseType = value; 1.1980 + return xhr; 1.1981 + }; 1.1982 + xhr.response = function(value) { 1.1983 + response = value; 1.1984 + return xhr; 1.1985 + }; 1.1986 + [ "get", "post" ].forEach(function(method) { 1.1987 + xhr[method] = function() { 1.1988 + return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments))); 1.1989 + }; 1.1990 + }); 1.1991 + xhr.send = function(method, data, callback) { 1.1992 + if (arguments.length === 2 && typeof data === "function") callback = data, data = null; 1.1993 + request.open(method, url, true); 1.1994 + if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*"; 1.1995 + if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]); 1.1996 + if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType); 1.1997 + if (responseType != null) request.responseType = responseType; 1.1998 + if (callback != null) xhr.on("error", callback).on("load", function(request) { 1.1999 + callback(null, request); 1.2000 + }); 1.2001 + dispatch.beforesend.call(xhr, request); 1.2002 + request.send(data == null ? null : data); 1.2003 + return xhr; 1.2004 + }; 1.2005 + xhr.abort = function() { 1.2006 + request.abort(); 1.2007 + return xhr; 1.2008 + }; 1.2009 + d3.rebind(xhr, dispatch, "on"); 1.2010 + return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback)); 1.2011 + } 1.2012 + function d3_xhr_fixCallback(callback) { 1.2013 + return callback.length === 1 ? function(error, request) { 1.2014 + callback(error == null ? request : null); 1.2015 + } : callback; 1.2016 + } 1.2017 + function d3_xhrHasResponse(request) { 1.2018 + var type = request.responseType; 1.2019 + return type && type !== "text" ? request.response : request.responseText; 1.2020 + } 1.2021 + d3.dsv = function(delimiter, mimeType) { 1.2022 + var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0); 1.2023 + function dsv(url, row, callback) { 1.2024 + if (arguments.length < 3) callback = row, row = null; 1.2025 + var xhr = d3_xhr(url, mimeType, row == null ? response : typedResponse(row), callback); 1.2026 + xhr.row = function(_) { 1.2027 + return arguments.length ? xhr.response((row = _) == null ? response : typedResponse(_)) : row; 1.2028 + }; 1.2029 + return xhr; 1.2030 + } 1.2031 + function response(request) { 1.2032 + return dsv.parse(request.responseText); 1.2033 + } 1.2034 + function typedResponse(f) { 1.2035 + return function(request) { 1.2036 + return dsv.parse(request.responseText, f); 1.2037 + }; 1.2038 + } 1.2039 + dsv.parse = function(text, f) { 1.2040 + var o; 1.2041 + return dsv.parseRows(text, function(row, i) { 1.2042 + if (o) return o(row, i - 1); 1.2043 + var a = new Function("d", "return {" + row.map(function(name, i) { 1.2044 + return JSON.stringify(name) + ": d[" + i + "]"; 1.2045 + }).join(",") + "}"); 1.2046 + o = f ? function(row, i) { 1.2047 + return f(a(row), i); 1.2048 + } : a; 1.2049 + }); 1.2050 + }; 1.2051 + dsv.parseRows = function(text, f) { 1.2052 + var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol; 1.2053 + function token() { 1.2054 + if (I >= N) return EOF; 1.2055 + if (eol) return eol = false, EOL; 1.2056 + var j = I; 1.2057 + if (text.charCodeAt(j) === 34) { 1.2058 + var i = j; 1.2059 + while (i++ < N) { 1.2060 + if (text.charCodeAt(i) === 34) { 1.2061 + if (text.charCodeAt(i + 1) !== 34) break; 1.2062 + ++i; 1.2063 + } 1.2064 + } 1.2065 + I = i + 2; 1.2066 + var c = text.charCodeAt(i + 1); 1.2067 + if (c === 13) { 1.2068 + eol = true; 1.2069 + if (text.charCodeAt(i + 2) === 10) ++I; 1.2070 + } else if (c === 10) { 1.2071 + eol = true; 1.2072 + } 1.2073 + return text.slice(j + 1, i).replace(/""/g, '"'); 1.2074 + } 1.2075 + while (I < N) { 1.2076 + var c = text.charCodeAt(I++), k = 1; 1.2077 + if (c === 10) eol = true; else if (c === 13) { 1.2078 + eol = true; 1.2079 + if (text.charCodeAt(I) === 10) ++I, ++k; 1.2080 + } else if (c !== delimiterCode) continue; 1.2081 + return text.slice(j, I - k); 1.2082 + } 1.2083 + return text.slice(j); 1.2084 + } 1.2085 + while ((t = token()) !== EOF) { 1.2086 + var a = []; 1.2087 + while (t !== EOL && t !== EOF) { 1.2088 + a.push(t); 1.2089 + t = token(); 1.2090 + } 1.2091 + if (f && (a = f(a, n++)) == null) continue; 1.2092 + rows.push(a); 1.2093 + } 1.2094 + return rows; 1.2095 + }; 1.2096 + dsv.format = function(rows) { 1.2097 + if (Array.isArray(rows[0])) return dsv.formatRows(rows); 1.2098 + var fieldSet = new d3_Set(), fields = []; 1.2099 + rows.forEach(function(row) { 1.2100 + for (var field in row) { 1.2101 + if (!fieldSet.has(field)) { 1.2102 + fields.push(fieldSet.add(field)); 1.2103 + } 1.2104 + } 1.2105 + }); 1.2106 + return [ fields.map(formatValue).join(delimiter) ].concat(rows.map(function(row) { 1.2107 + return fields.map(function(field) { 1.2108 + return formatValue(row[field]); 1.2109 + }).join(delimiter); 1.2110 + })).join("\n"); 1.2111 + }; 1.2112 + dsv.formatRows = function(rows) { 1.2113 + return rows.map(formatRow).join("\n"); 1.2114 + }; 1.2115 + function formatRow(row) { 1.2116 + return row.map(formatValue).join(delimiter); 1.2117 + } 1.2118 + function formatValue(text) { 1.2119 + return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text; 1.2120 + } 1.2121 + return dsv; 1.2122 + }; 1.2123 + d3.csv = d3.dsv(",", "text/csv"); 1.2124 + d3.tsv = d3.dsv(" ", "text/tab-separated-values"); 1.2125 + var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_frame = this[d3_vendorSymbol(this, "requestAnimationFrame")] || function(callback) { 1.2126 + setTimeout(callback, 17); 1.2127 + }; 1.2128 + d3.timer = function() { 1.2129 + d3_timer.apply(this, arguments); 1.2130 + }; 1.2131 + function d3_timer(callback, delay, then) { 1.2132 + var n = arguments.length; 1.2133 + if (n < 2) delay = 0; 1.2134 + if (n < 3) then = Date.now(); 1.2135 + var time = then + delay, timer = { 1.2136 + c: callback, 1.2137 + t: time, 1.2138 + n: null 1.2139 + }; 1.2140 + if (d3_timer_queueTail) d3_timer_queueTail.n = timer; else d3_timer_queueHead = timer; 1.2141 + d3_timer_queueTail = timer; 1.2142 + if (!d3_timer_interval) { 1.2143 + d3_timer_timeout = clearTimeout(d3_timer_timeout); 1.2144 + d3_timer_interval = 1; 1.2145 + d3_timer_frame(d3_timer_step); 1.2146 + } 1.2147 + return timer; 1.2148 + } 1.2149 + function d3_timer_step() { 1.2150 + var now = d3_timer_mark(), delay = d3_timer_sweep() - now; 1.2151 + if (delay > 24) { 1.2152 + if (isFinite(delay)) { 1.2153 + clearTimeout(d3_timer_timeout); 1.2154 + d3_timer_timeout = setTimeout(d3_timer_step, delay); 1.2155 + } 1.2156 + d3_timer_interval = 0; 1.2157 + } else { 1.2158 + d3_timer_interval = 1; 1.2159 + d3_timer_frame(d3_timer_step); 1.2160 + } 1.2161 + } 1.2162 + d3.timer.flush = function() { 1.2163 + d3_timer_mark(); 1.2164 + d3_timer_sweep(); 1.2165 + }; 1.2166 + function d3_timer_mark() { 1.2167 + var now = Date.now(), timer = d3_timer_queueHead; 1.2168 + while (timer) { 1.2169 + if (now >= timer.t && timer.c(now - timer.t)) timer.c = null; 1.2170 + timer = timer.n; 1.2171 + } 1.2172 + return now; 1.2173 + } 1.2174 + function d3_timer_sweep() { 1.2175 + var t0, t1 = d3_timer_queueHead, time = Infinity; 1.2176 + while (t1) { 1.2177 + if (t1.c) { 1.2178 + if (t1.t < time) time = t1.t; 1.2179 + t1 = (t0 = t1).n; 1.2180 + } else { 1.2181 + t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n; 1.2182 + } 1.2183 + } 1.2184 + d3_timer_queueTail = t0; 1.2185 + return time; 1.2186 + } 1.2187 + function d3_format_precision(x, p) { 1.2188 + return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1); 1.2189 + } 1.2190 + d3.round = function(x, n) { 1.2191 + return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x); 1.2192 + }; 1.2193 + var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix); 1.2194 + d3.formatPrefix = function(value, precision) { 1.2195 + var i = 0; 1.2196 + if (value = +value) { 1.2197 + if (value < 0) value *= -1; 1.2198 + if (precision) value = d3.round(value, d3_format_precision(value, precision)); 1.2199 + i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); 1.2200 + i = Math.max(-24, Math.min(24, Math.floor((i - 1) / 3) * 3)); 1.2201 + } 1.2202 + return d3_formatPrefixes[8 + i / 3]; 1.2203 + }; 1.2204 + function d3_formatPrefix(d, i) { 1.2205 + var k = Math.pow(10, abs(8 - i) * 3); 1.2206 + return { 1.2207 + scale: i > 8 ? function(d) { 1.2208 + return d / k; 1.2209 + } : function(d) { 1.2210 + return d * k; 1.2211 + }, 1.2212 + symbol: d 1.2213 + }; 1.2214 + } 1.2215 + function d3_locale_numberFormat(locale) { 1.2216 + var locale_decimal = locale.decimal, locale_thousands = locale.thousands, locale_grouping = locale.grouping, locale_currency = locale.currency, formatGroup = locale_grouping && locale_thousands ? function(value, width) { 1.2217 + var i = value.length, t = [], j = 0, g = locale_grouping[0], length = 0; 1.2218 + while (i > 0 && g > 0) { 1.2219 + if (length + g + 1 > width) g = Math.max(1, width - length); 1.2220 + t.push(value.substring(i -= g, i + g)); 1.2221 + if ((length += g + 1) > width) break; 1.2222 + g = locale_grouping[j = (j + 1) % locale_grouping.length]; 1.2223 + } 1.2224 + return t.reverse().join(locale_thousands); 1.2225 + } : d3_identity; 1.2226 + return function(specifier) { 1.2227 + 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, exponent = true; 1.2228 + if (precision) precision = +precision.substring(1); 1.2229 + if (zfill || fill === "0" && align === "=") { 1.2230 + zfill = fill = "0"; 1.2231 + align = "="; 1.2232 + } 1.2233 + switch (type) { 1.2234 + case "n": 1.2235 + comma = true; 1.2236 + type = "g"; 1.2237 + break; 1.2238 + 1.2239 + case "%": 1.2240 + scale = 100; 1.2241 + suffix = "%"; 1.2242 + type = "f"; 1.2243 + break; 1.2244 + 1.2245 + case "p": 1.2246 + scale = 100; 1.2247 + suffix = "%"; 1.2248 + type = "r"; 1.2249 + break; 1.2250 + 1.2251 + case "b": 1.2252 + case "o": 1.2253 + case "x": 1.2254 + case "X": 1.2255 + if (symbol === "#") prefix = "0" + type.toLowerCase(); 1.2256 + 1.2257 + case "c": 1.2258 + exponent = false; 1.2259 + 1.2260 + case "d": 1.2261 + integer = true; 1.2262 + precision = 0; 1.2263 + break; 1.2264 + 1.2265 + case "s": 1.2266 + scale = -1; 1.2267 + type = "r"; 1.2268 + break; 1.2269 + } 1.2270 + if (symbol === "$") prefix = locale_currency[0], suffix = locale_currency[1]; 1.2271 + if (type == "r" && !precision) type = "g"; 1.2272 + if (precision != null) { 1.2273 + 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.2274 + } 1.2275 + type = d3_format_types.get(type) || d3_format_typeDefault; 1.2276 + var zcomma = zfill && comma; 1.2277 + return function(value) { 1.2278 + var fullSuffix = suffix; 1.2279 + if (integer && value % 1) return ""; 1.2280 + var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign === "-" ? "" : sign; 1.2281 + if (scale < 0) { 1.2282 + var unit = d3.formatPrefix(value, precision); 1.2283 + value = unit.scale(value); 1.2284 + fullSuffix = unit.symbol + suffix; 1.2285 + } else { 1.2286 + value *= scale; 1.2287 + } 1.2288 + value = type(value, precision); 1.2289 + var i = value.lastIndexOf("."), before, after; 1.2290 + if (i < 0) { 1.2291 + var j = exponent ? value.lastIndexOf("e") : -1; 1.2292 + if (j < 0) before = value, after = ""; else before = value.substring(0, j), after = value.substring(j); 1.2293 + } else { 1.2294 + before = value.substring(0, i); 1.2295 + after = locale_decimal + value.substring(i + 1); 1.2296 + } 1.2297 + if (!zfill && comma) before = formatGroup(before, Infinity); 1.2298 + var length = prefix.length + before.length + after.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : ""; 1.2299 + if (zcomma) before = formatGroup(padding + before, padding.length ? width - after.length : Infinity); 1.2300 + negative += prefix; 1.2301 + value = before + after; 1.2302 + 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.2303 + }; 1.2304 + }; 1.2305 + } 1.2306 + var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i; 1.2307 + var d3_format_types = d3.map({ 1.2308 + b: function(x) { 1.2309 + return x.toString(2); 1.2310 + }, 1.2311 + c: function(x) { 1.2312 + return String.fromCharCode(x); 1.2313 + }, 1.2314 + o: function(x) { 1.2315 + return x.toString(8); 1.2316 + }, 1.2317 + x: function(x) { 1.2318 + return x.toString(16); 1.2319 + }, 1.2320 + X: function(x) { 1.2321 + return x.toString(16).toUpperCase(); 1.2322 + }, 1.2323 + g: function(x, p) { 1.2324 + return x.toPrecision(p); 1.2325 + }, 1.2326 + e: function(x, p) { 1.2327 + return x.toExponential(p); 1.2328 + }, 1.2329 + f: function(x, p) { 1.2330 + return x.toFixed(p); 1.2331 + }, 1.2332 + r: function(x, p) { 1.2333 + 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.2334 + } 1.2335 + }); 1.2336 + function d3_format_typeDefault(x) { 1.2337 + return x + ""; 1.2338 + } 1.2339 + var d3_time = d3.time = {}, d3_date = Date; 1.2340 + function d3_date_utc() { 1.2341 + this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]); 1.2342 + } 1.2343 + d3_date_utc.prototype = { 1.2344 + getDate: function() { 1.2345 + return this._.getUTCDate(); 1.2346 + }, 1.2347 + getDay: function() { 1.2348 + return this._.getUTCDay(); 1.2349 + }, 1.2350 + getFullYear: function() { 1.2351 + return this._.getUTCFullYear(); 1.2352 + }, 1.2353 + getHours: function() { 1.2354 + return this._.getUTCHours(); 1.2355 + }, 1.2356 + getMilliseconds: function() { 1.2357 + return this._.getUTCMilliseconds(); 1.2358 + }, 1.2359 + getMinutes: function() { 1.2360 + return this._.getUTCMinutes(); 1.2361 + }, 1.2362 + getMonth: function() { 1.2363 + return this._.getUTCMonth(); 1.2364 + }, 1.2365 + getSeconds: function() { 1.2366 + return this._.getUTCSeconds(); 1.2367 + }, 1.2368 + getTime: function() { 1.2369 + return this._.getTime(); 1.2370 + }, 1.2371 + getTimezoneOffset: function() { 1.2372 + return 0; 1.2373 + }, 1.2374 + valueOf: function() { 1.2375 + return this._.valueOf(); 1.2376 + }, 1.2377 + setDate: function() { 1.2378 + d3_time_prototype.setUTCDate.apply(this._, arguments); 1.2379 + }, 1.2380 + setDay: function() { 1.2381 + d3_time_prototype.setUTCDay.apply(this._, arguments); 1.2382 + }, 1.2383 + setFullYear: function() { 1.2384 + d3_time_prototype.setUTCFullYear.apply(this._, arguments); 1.2385 + }, 1.2386 + setHours: function() { 1.2387 + d3_time_prototype.setUTCHours.apply(this._, arguments); 1.2388 + }, 1.2389 + setMilliseconds: function() { 1.2390 + d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); 1.2391 + }, 1.2392 + setMinutes: function() { 1.2393 + d3_time_prototype.setUTCMinutes.apply(this._, arguments); 1.2394 + }, 1.2395 + setMonth: function() { 1.2396 + d3_time_prototype.setUTCMonth.apply(this._, arguments); 1.2397 + }, 1.2398 + setSeconds: function() { 1.2399 + d3_time_prototype.setUTCSeconds.apply(this._, arguments); 1.2400 + }, 1.2401 + setTime: function() { 1.2402 + d3_time_prototype.setTime.apply(this._, arguments); 1.2403 + } 1.2404 + }; 1.2405 + var d3_time_prototype = Date.prototype; 1.2406 + function d3_time_interval(local, step, number) { 1.2407 + function round(date) { 1.2408 + var d0 = local(date), d1 = offset(d0, 1); 1.2409 + return date - d0 < d1 - date ? d0 : d1; 1.2410 + } 1.2411 + function ceil(date) { 1.2412 + step(date = local(new d3_date(date - 1)), 1); 1.2413 + return date; 1.2414 + } 1.2415 + function offset(date, k) { 1.2416 + step(date = new d3_date(+date), k); 1.2417 + return date; 1.2418 + } 1.2419 + function range(t0, t1, dt) { 1.2420 + var time = ceil(t0), times = []; 1.2421 + if (dt > 1) { 1.2422 + while (time < t1) { 1.2423 + if (!(number(time) % dt)) times.push(new Date(+time)); 1.2424 + step(time, 1); 1.2425 + } 1.2426 + } else { 1.2427 + while (time < t1) times.push(new Date(+time)), step(time, 1); 1.2428 + } 1.2429 + return times; 1.2430 + } 1.2431 + function range_utc(t0, t1, dt) { 1.2432 + try { 1.2433 + d3_date = d3_date_utc; 1.2434 + var utc = new d3_date_utc(); 1.2435 + utc._ = t0; 1.2436 + return range(utc, t1, dt); 1.2437 + } finally { 1.2438 + d3_date = Date; 1.2439 + } 1.2440 + } 1.2441 + local.floor = local; 1.2442 + local.round = round; 1.2443 + local.ceil = ceil; 1.2444 + local.offset = offset; 1.2445 + local.range = range; 1.2446 + var utc = local.utc = d3_time_interval_utc(local); 1.2447 + utc.floor = utc; 1.2448 + utc.round = d3_time_interval_utc(round); 1.2449 + utc.ceil = d3_time_interval_utc(ceil); 1.2450 + utc.offset = d3_time_interval_utc(offset); 1.2451 + utc.range = range_utc; 1.2452 + return local; 1.2453 + } 1.2454 + function d3_time_interval_utc(method) { 1.2455 + return function(date, k) { 1.2456 + try { 1.2457 + d3_date = d3_date_utc; 1.2458 + var utc = new d3_date_utc(); 1.2459 + utc._ = date; 1.2460 + return method(utc, k)._; 1.2461 + } finally { 1.2462 + d3_date = Date; 1.2463 + } 1.2464 + }; 1.2465 + } 1.2466 + d3_time.year = d3_time_interval(function(date) { 1.2467 + date = d3_time.day(date); 1.2468 + date.setMonth(0, 1); 1.2469 + return date; 1.2470 + }, function(date, offset) { 1.2471 + date.setFullYear(date.getFullYear() + offset); 1.2472 + }, function(date) { 1.2473 + return date.getFullYear(); 1.2474 + }); 1.2475 + d3_time.years = d3_time.year.range; 1.2476 + d3_time.years.utc = d3_time.year.utc.range; 1.2477 + d3_time.day = d3_time_interval(function(date) { 1.2478 + var day = new d3_date(2e3, 0); 1.2479 + day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); 1.2480 + return day; 1.2481 + }, function(date, offset) { 1.2482 + date.setDate(date.getDate() + offset); 1.2483 + }, function(date) { 1.2484 + return date.getDate() - 1; 1.2485 + }); 1.2486 + d3_time.days = d3_time.day.range; 1.2487 + d3_time.days.utc = d3_time.day.utc.range; 1.2488 + d3_time.dayOfYear = function(date) { 1.2489 + var year = d3_time.year(date); 1.2490 + return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5); 1.2491 + }; 1.2492 + [ "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" ].forEach(function(day, i) { 1.2493 + i = 7 - i; 1.2494 + var interval = d3_time[day] = d3_time_interval(function(date) { 1.2495 + (date = d3_time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7); 1.2496 + return date; 1.2497 + }, function(date, offset) { 1.2498 + date.setDate(date.getDate() + Math.floor(offset) * 7); 1.2499 + }, function(date) { 1.2500 + var day = d3_time.year(date).getDay(); 1.2501 + return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i); 1.2502 + }); 1.2503 + d3_time[day + "s"] = interval.range; 1.2504 + d3_time[day + "s"].utc = interval.utc.range; 1.2505 + d3_time[day + "OfYear"] = function(date) { 1.2506 + var day = d3_time.year(date).getDay(); 1.2507 + return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7); 1.2508 + }; 1.2509 + }); 1.2510 + d3_time.week = d3_time.sunday; 1.2511 + d3_time.weeks = d3_time.sunday.range; 1.2512 + d3_time.weeks.utc = d3_time.sunday.utc.range; 1.2513 + d3_time.weekOfYear = d3_time.sundayOfYear; 1.2514 + function d3_locale_timeFormat(locale) { 1.2515 + 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.2516 + function d3_time_format(template) { 1.2517 + var n = template.length; 1.2518 + function format(date) { 1.2519 + var string = [], i = -1, j = 0, c, p, f; 1.2520 + while (++i < n) { 1.2521 + if (template.charCodeAt(i) === 37) { 1.2522 + string.push(template.slice(j, i)); 1.2523 + if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i); 1.2524 + if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p); 1.2525 + string.push(c); 1.2526 + j = i + 1; 1.2527 + } 1.2528 + } 1.2529 + string.push(template.slice(j, i)); 1.2530 + return string.join(""); 1.2531 + } 1.2532 + format.parse = function(string) { 1.2533 + var d = { 1.2534 + y: 1900, 1.2535 + m: 0, 1.2536 + d: 1, 1.2537 + H: 0, 1.2538 + M: 0, 1.2539 + S: 0, 1.2540 + L: 0, 1.2541 + Z: null 1.2542 + }, i = d3_time_parse(d, template, string, 0); 1.2543 + if (i != string.length) return null; 1.2544 + if ("p" in d) d.H = d.H % 12 + d.p * 12; 1.2545 + var localZ = d.Z != null && d3_date !== d3_date_utc, date = new (localZ ? d3_date_utc : d3_date)(); 1.2546 + if ("j" in d) date.setFullYear(d.y, 0, d.j); else if ("W" in d || "U" in d) { 1.2547 + if (!("w" in d)) d.w = "W" in d ? 1 : 0; 1.2548 + date.setFullYear(d.y, 0, 1); 1.2549 + 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.2550 + } else date.setFullYear(d.y, d.m, d.d); 1.2551 + date.setHours(d.H + (d.Z / 100 | 0), d.M + d.Z % 100, d.S, d.L); 1.2552 + return localZ ? date._ : date; 1.2553 + }; 1.2554 + format.toString = function() { 1.2555 + return template; 1.2556 + }; 1.2557 + return format; 1.2558 + } 1.2559 + function d3_time_parse(date, template, string, j) { 1.2560 + var c, p, t, i = 0, n = template.length, m = string.length; 1.2561 + while (i < n) { 1.2562 + if (j >= m) return -1; 1.2563 + c = template.charCodeAt(i++); 1.2564 + if (c === 37) { 1.2565 + t = template.charAt(i++); 1.2566 + p = d3_time_parsers[t in d3_time_formatPads ? template.charAt(i++) : t]; 1.2567 + if (!p || (j = p(date, string, j)) < 0) return -1; 1.2568 + } else if (c != string.charCodeAt(j++)) { 1.2569 + return -1; 1.2570 + } 1.2571 + } 1.2572 + return j; 1.2573 + } 1.2574 + d3_time_format.utc = function(template) { 1.2575 + var local = d3_time_format(template); 1.2576 + function format(date) { 1.2577 + try { 1.2578 + d3_date = d3_date_utc; 1.2579 + var utc = new d3_date(); 1.2580 + utc._ = date; 1.2581 + return local(utc); 1.2582 + } finally { 1.2583 + d3_date = Date; 1.2584 + } 1.2585 + } 1.2586 + format.parse = function(string) { 1.2587 + try { 1.2588 + d3_date = d3_date_utc; 1.2589 + var date = local.parse(string); 1.2590 + return date && date._; 1.2591 + } finally { 1.2592 + d3_date = Date; 1.2593 + } 1.2594 + }; 1.2595 + format.toString = local.toString; 1.2596 + return format; 1.2597 + }; 1.2598 + d3_time_format.multi = d3_time_format.utc.multi = d3_time_formatMulti; 1.2599 + 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.2600 + locale_periods.forEach(function(p, i) { 1.2601 + d3_time_periodLookup.set(p.toLowerCase(), i); 1.2602 + }); 1.2603 + var d3_time_formats = { 1.2604 + a: function(d) { 1.2605 + return locale_shortDays[d.getDay()]; 1.2606 + }, 1.2607 + A: function(d) { 1.2608 + return locale_days[d.getDay()]; 1.2609 + }, 1.2610 + b: function(d) { 1.2611 + return locale_shortMonths[d.getMonth()]; 1.2612 + }, 1.2613 + B: function(d) { 1.2614 + return locale_months[d.getMonth()]; 1.2615 + }, 1.2616 + c: d3_time_format(locale_dateTime), 1.2617 + d: function(d, p) { 1.2618 + return d3_time_formatPad(d.getDate(), p, 2); 1.2619 + }, 1.2620 + e: function(d, p) { 1.2621 + return d3_time_formatPad(d.getDate(), p, 2); 1.2622 + }, 1.2623 + H: function(d, p) { 1.2624 + return d3_time_formatPad(d.getHours(), p, 2); 1.2625 + }, 1.2626 + I: function(d, p) { 1.2627 + return d3_time_formatPad(d.getHours() % 12 || 12, p, 2); 1.2628 + }, 1.2629 + j: function(d, p) { 1.2630 + return d3_time_formatPad(1 + d3_time.dayOfYear(d), p, 3); 1.2631 + }, 1.2632 + L: function(d, p) { 1.2633 + return d3_time_formatPad(d.getMilliseconds(), p, 3); 1.2634 + }, 1.2635 + m: function(d, p) { 1.2636 + return d3_time_formatPad(d.getMonth() + 1, p, 2); 1.2637 + }, 1.2638 + M: function(d, p) { 1.2639 + return d3_time_formatPad(d.getMinutes(), p, 2); 1.2640 + }, 1.2641 + p: function(d) { 1.2642 + return locale_periods[+(d.getHours() >= 12)]; 1.2643 + }, 1.2644 + S: function(d, p) { 1.2645 + return d3_time_formatPad(d.getSeconds(), p, 2); 1.2646 + }, 1.2647 + U: function(d, p) { 1.2648 + return d3_time_formatPad(d3_time.sundayOfYear(d), p, 2); 1.2649 + }, 1.2650 + w: function(d) { 1.2651 + return d.getDay(); 1.2652 + }, 1.2653 + W: function(d, p) { 1.2654 + return d3_time_formatPad(d3_time.mondayOfYear(d), p, 2); 1.2655 + }, 1.2656 + x: d3_time_format(locale_date), 1.2657 + X: d3_time_format(locale_time), 1.2658 + y: function(d, p) { 1.2659 + return d3_time_formatPad(d.getFullYear() % 100, p, 2); 1.2660 + }, 1.2661 + Y: function(d, p) { 1.2662 + return d3_time_formatPad(d.getFullYear() % 1e4, p, 4); 1.2663 + }, 1.2664 + Z: d3_time_zone, 1.2665 + "%": function() { 1.2666 + return "%"; 1.2667 + } 1.2668 + }; 1.2669 + var d3_time_parsers = { 1.2670 + a: d3_time_parseWeekdayAbbrev, 1.2671 + A: d3_time_parseWeekday, 1.2672 + b: d3_time_parseMonthAbbrev, 1.2673 + B: d3_time_parseMonth, 1.2674 + c: d3_time_parseLocaleFull, 1.2675 + d: d3_time_parseDay, 1.2676 + e: d3_time_parseDay, 1.2677 + H: d3_time_parseHour24, 1.2678 + I: d3_time_parseHour24, 1.2679 + j: d3_time_parseDayOfYear, 1.2680 + L: d3_time_parseMilliseconds, 1.2681 + m: d3_time_parseMonthNumber, 1.2682 + M: d3_time_parseMinutes, 1.2683 + p: d3_time_parseAmPm, 1.2684 + S: d3_time_parseSeconds, 1.2685 + U: d3_time_parseWeekNumberSunday, 1.2686 + w: d3_time_parseWeekdayNumber, 1.2687 + W: d3_time_parseWeekNumberMonday, 1.2688 + x: d3_time_parseLocaleDate, 1.2689 + X: d3_time_parseLocaleTime, 1.2690 + y: d3_time_parseYear, 1.2691 + Y: d3_time_parseFullYear, 1.2692 + Z: d3_time_parseZone, 1.2693 + "%": d3_time_parseLiteralPercent 1.2694 + }; 1.2695 + function d3_time_parseWeekdayAbbrev(date, string, i) { 1.2696 + d3_time_dayAbbrevRe.lastIndex = 0; 1.2697 + var n = d3_time_dayAbbrevRe.exec(string.slice(i)); 1.2698 + return n ? (date.w = d3_time_dayAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; 1.2699 + } 1.2700 + function d3_time_parseWeekday(date, string, i) { 1.2701 + d3_time_dayRe.lastIndex = 0; 1.2702 + var n = d3_time_dayRe.exec(string.slice(i)); 1.2703 + return n ? (date.w = d3_time_dayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; 1.2704 + } 1.2705 + function d3_time_parseMonthAbbrev(date, string, i) { 1.2706 + d3_time_monthAbbrevRe.lastIndex = 0; 1.2707 + var n = d3_time_monthAbbrevRe.exec(string.slice(i)); 1.2708 + return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; 1.2709 + } 1.2710 + function d3_time_parseMonth(date, string, i) { 1.2711 + d3_time_monthRe.lastIndex = 0; 1.2712 + var n = d3_time_monthRe.exec(string.slice(i)); 1.2713 + return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; 1.2714 + } 1.2715 + function d3_time_parseLocaleFull(date, string, i) { 1.2716 + return d3_time_parse(date, d3_time_formats.c.toString(), string, i); 1.2717 + } 1.2718 + function d3_time_parseLocaleDate(date, string, i) { 1.2719 + return d3_time_parse(date, d3_time_formats.x.toString(), string, i); 1.2720 + } 1.2721 + function d3_time_parseLocaleTime(date, string, i) { 1.2722 + return d3_time_parse(date, d3_time_formats.X.toString(), string, i); 1.2723 + } 1.2724 + function d3_time_parseAmPm(date, string, i) { 1.2725 + var n = d3_time_periodLookup.get(string.slice(i, i += 2).toLowerCase()); 1.2726 + return n == null ? -1 : (date.p = n, i); 1.2727 + } 1.2728 + return d3_time_format; 1.2729 + } 1.2730 + var d3_time_formatPads = { 1.2731 + "-": "", 1.2732 + _: " ", 1.2733 + "0": "0" 1.2734 + }, d3_time_numberRe = /^\s*\d+/, d3_time_percentRe = /^%/; 1.2735 + function d3_time_formatPad(value, fill, width) { 1.2736 + var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; 1.2737 + return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); 1.2738 + } 1.2739 + function d3_time_formatRe(names) { 1.2740 + return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i"); 1.2741 + } 1.2742 + function d3_time_formatLookup(names) { 1.2743 + var map = new d3_Map(), i = -1, n = names.length; 1.2744 + while (++i < n) map.set(names[i].toLowerCase(), i); 1.2745 + return map; 1.2746 + } 1.2747 + function d3_time_parseWeekdayNumber(date, string, i) { 1.2748 + d3_time_numberRe.lastIndex = 0; 1.2749 + var n = d3_time_numberRe.exec(string.slice(i, i + 1)); 1.2750 + return n ? (date.w = +n[0], i + n[0].length) : -1; 1.2751 + } 1.2752 + function d3_time_parseWeekNumberSunday(date, string, i) { 1.2753 + d3_time_numberRe.lastIndex = 0; 1.2754 + var n = d3_time_numberRe.exec(string.slice(i)); 1.2755 + return n ? (date.U = +n[0], i + n[0].length) : -1; 1.2756 + } 1.2757 + function d3_time_parseWeekNumberMonday(date, string, i) { 1.2758 + d3_time_numberRe.lastIndex = 0; 1.2759 + var n = d3_time_numberRe.exec(string.slice(i)); 1.2760 + return n ? (date.W = +n[0], i + n[0].length) : -1; 1.2761 + } 1.2762 + function d3_time_parseFullYear(date, string, i) { 1.2763 + d3_time_numberRe.lastIndex = 0; 1.2764 + var n = d3_time_numberRe.exec(string.slice(i, i + 4)); 1.2765 + return n ? (date.y = +n[0], i + n[0].length) : -1; 1.2766 + } 1.2767 + function d3_time_parseYear(date, string, i) { 1.2768 + d3_time_numberRe.lastIndex = 0; 1.2769 + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); 1.2770 + return n ? (date.y = d3_time_expandYear(+n[0]), i + n[0].length) : -1; 1.2771 + } 1.2772 + function d3_time_parseZone(date, string, i) { 1.2773 + return /^[+-]\d{4}$/.test(string = string.slice(i, i + 5)) ? (date.Z = -string, 1.2774 + i + 5) : -1; 1.2775 + } 1.2776 + function d3_time_expandYear(d) { 1.2777 + return d + (d > 68 ? 1900 : 2e3); 1.2778 + } 1.2779 + function d3_time_parseMonthNumber(date, string, i) { 1.2780 + d3_time_numberRe.lastIndex = 0; 1.2781 + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); 1.2782 + return n ? (date.m = n[0] - 1, i + n[0].length) : -1; 1.2783 + } 1.2784 + function d3_time_parseDay(date, string, i) { 1.2785 + d3_time_numberRe.lastIndex = 0; 1.2786 + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); 1.2787 + return n ? (date.d = +n[0], i + n[0].length) : -1; 1.2788 + } 1.2789 + function d3_time_parseDayOfYear(date, string, i) { 1.2790 + d3_time_numberRe.lastIndex = 0; 1.2791 + var n = d3_time_numberRe.exec(string.slice(i, i + 3)); 1.2792 + return n ? (date.j = +n[0], i + n[0].length) : -1; 1.2793 + } 1.2794 + function d3_time_parseHour24(date, string, i) { 1.2795 + d3_time_numberRe.lastIndex = 0; 1.2796 + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); 1.2797 + return n ? (date.H = +n[0], i + n[0].length) : -1; 1.2798 + } 1.2799 + function d3_time_parseMinutes(date, string, i) { 1.2800 + d3_time_numberRe.lastIndex = 0; 1.2801 + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); 1.2802 + return n ? (date.M = +n[0], i + n[0].length) : -1; 1.2803 + } 1.2804 + function d3_time_parseSeconds(date, string, i) { 1.2805 + d3_time_numberRe.lastIndex = 0; 1.2806 + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); 1.2807 + return n ? (date.S = +n[0], i + n[0].length) : -1; 1.2808 + } 1.2809 + function d3_time_parseMilliseconds(date, string, i) { 1.2810 + d3_time_numberRe.lastIndex = 0; 1.2811 + var n = d3_time_numberRe.exec(string.slice(i, i + 3)); 1.2812 + return n ? (date.L = +n[0], i + n[0].length) : -1; 1.2813 + } 1.2814 + function d3_time_zone(d) { 1.2815 + var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = abs(z) / 60 | 0, zm = abs(z) % 60; 1.2816 + return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2); 1.2817 + } 1.2818 + function d3_time_parseLiteralPercent(date, string, i) { 1.2819 + d3_time_percentRe.lastIndex = 0; 1.2820 + var n = d3_time_percentRe.exec(string.slice(i, i + 1)); 1.2821 + return n ? i + n[0].length : -1; 1.2822 + } 1.2823 + function d3_time_formatMulti(formats) { 1.2824 + var n = formats.length, i = -1; 1.2825 + while (++i < n) formats[i][0] = this(formats[i][0]); 1.2826 + return function(date) { 1.2827 + var i = 0, f = formats[i]; 1.2828 + while (!f[1](date)) f = formats[++i]; 1.2829 + return f[0](date); 1.2830 + }; 1.2831 + } 1.2832 + d3.locale = function(locale) { 1.2833 + return { 1.2834 + numberFormat: d3_locale_numberFormat(locale), 1.2835 + timeFormat: d3_locale_timeFormat(locale) 1.2836 + }; 1.2837 + }; 1.2838 + var d3_locale_enUS = d3.locale({ 1.2839 + decimal: ".", 1.2840 + thousands: ",", 1.2841 + grouping: [ 3 ], 1.2842 + currency: [ "$", "" ], 1.2843 + dateTime: "%a %b %e %X %Y", 1.2844 + date: "%m/%d/%Y", 1.2845 + time: "%H:%M:%S", 1.2846 + periods: [ "AM", "PM" ], 1.2847 + days: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], 1.2848 + shortDays: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], 1.2849 + months: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], 1.2850 + shortMonths: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] 1.2851 + }); 1.2852 + d3.format = d3_locale_enUS.numberFormat; 1.2853 + d3.geo = {}; 1.2854 + function d3_adder() {} 1.2855 + d3_adder.prototype = { 1.2856 + s: 0, 1.2857 + t: 0, 1.2858 + add: function(y) { 1.2859 + d3_adderSum(y, this.t, d3_adderTemp); 1.2860 + d3_adderSum(d3_adderTemp.s, this.s, this); 1.2861 + if (this.s) this.t += d3_adderTemp.t; else this.s = d3_adderTemp.t; 1.2862 + }, 1.2863 + reset: function() { 1.2864 + this.s = this.t = 0; 1.2865 + }, 1.2866 + valueOf: function() { 1.2867 + return this.s; 1.2868 + } 1.2869 + }; 1.2870 + var d3_adderTemp = new d3_adder(); 1.2871 + function d3_adderSum(a, b, o) { 1.2872 + var x = o.s = a + b, bv = x - a, av = x - bv; 1.2873 + o.t = a - av + (b - bv); 1.2874 + } 1.2875 + d3.geo.stream = function(object, listener) { 1.2876 + if (object && d3_geo_streamObjectType.hasOwnProperty(object.type)) { 1.2877 + d3_geo_streamObjectType[object.type](object, listener); 1.2878 + } else { 1.2879 + d3_geo_streamGeometry(object, listener); 1.2880 + } 1.2881 + }; 1.2882 + function d3_geo_streamGeometry(geometry, listener) { 1.2883 + if (geometry && d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) { 1.2884 + d3_geo_streamGeometryType[geometry.type](geometry, listener); 1.2885 + } 1.2886 + } 1.2887 + var d3_geo_streamObjectType = { 1.2888 + Feature: function(feature, listener) { 1.2889 + d3_geo_streamGeometry(feature.geometry, listener); 1.2890 + }, 1.2891 + FeatureCollection: function(object, listener) { 1.2892 + var features = object.features, i = -1, n = features.length; 1.2893 + while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener); 1.2894 + } 1.2895 + }; 1.2896 + var d3_geo_streamGeometryType = { 1.2897 + Sphere: function(object, listener) { 1.2898 + listener.sphere(); 1.2899 + }, 1.2900 + Point: function(object, listener) { 1.2901 + object = object.coordinates; 1.2902 + listener.point(object[0], object[1], object[2]); 1.2903 + }, 1.2904 + MultiPoint: function(object, listener) { 1.2905 + var coordinates = object.coordinates, i = -1, n = coordinates.length; 1.2906 + while (++i < n) object = coordinates[i], listener.point(object[0], object[1], object[2]); 1.2907 + }, 1.2908 + LineString: function(object, listener) { 1.2909 + d3_geo_streamLine(object.coordinates, listener, 0); 1.2910 + }, 1.2911 + MultiLineString: function(object, listener) { 1.2912 + var coordinates = object.coordinates, i = -1, n = coordinates.length; 1.2913 + while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0); 1.2914 + }, 1.2915 + Polygon: function(object, listener) { 1.2916 + d3_geo_streamPolygon(object.coordinates, listener); 1.2917 + }, 1.2918 + MultiPolygon: function(object, listener) { 1.2919 + var coordinates = object.coordinates, i = -1, n = coordinates.length; 1.2920 + while (++i < n) d3_geo_streamPolygon(coordinates[i], listener); 1.2921 + }, 1.2922 + GeometryCollection: function(object, listener) { 1.2923 + var geometries = object.geometries, i = -1, n = geometries.length; 1.2924 + while (++i < n) d3_geo_streamGeometry(geometries[i], listener); 1.2925 + } 1.2926 + }; 1.2927 + function d3_geo_streamLine(coordinates, listener, closed) { 1.2928 + var i = -1, n = coordinates.length - closed, coordinate; 1.2929 + listener.lineStart(); 1.2930 + while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1], coordinate[2]); 1.2931 + listener.lineEnd(); 1.2932 + } 1.2933 + function d3_geo_streamPolygon(coordinates, listener) { 1.2934 + var i = -1, n = coordinates.length; 1.2935 + listener.polygonStart(); 1.2936 + while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1); 1.2937 + listener.polygonEnd(); 1.2938 + } 1.2939 + d3.geo.area = function(object) { 1.2940 + d3_geo_areaSum = 0; 1.2941 + d3.geo.stream(object, d3_geo_area); 1.2942 + return d3_geo_areaSum; 1.2943 + }; 1.2944 + var d3_geo_areaSum, d3_geo_areaRingSum = new d3_adder(); 1.2945 + var d3_geo_area = { 1.2946 + sphere: function() { 1.2947 + d3_geo_areaSum += 4 * π; 1.2948 + }, 1.2949 + point: d3_noop, 1.2950 + lineStart: d3_noop, 1.2951 + lineEnd: d3_noop, 1.2952 + polygonStart: function() { 1.2953 + d3_geo_areaRingSum.reset(); 1.2954 + d3_geo_area.lineStart = d3_geo_areaRingStart; 1.2955 + }, 1.2956 + polygonEnd: function() { 1.2957 + var area = 2 * d3_geo_areaRingSum; 1.2958 + d3_geo_areaSum += area < 0 ? 4 * π + area : area; 1.2959 + d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop; 1.2960 + } 1.2961 + }; 1.2962 + function d3_geo_areaRingStart() { 1.2963 + var λ00, φ00, λ0, cosφ0, sinφ0; 1.2964 + d3_geo_area.point = function(λ, φ) { 1.2965 + d3_geo_area.point = nextPoint; 1.2966 + λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4), 1.2967 + sinφ0 = Math.sin(φ); 1.2968 + }; 1.2969 + function nextPoint(λ, φ) { 1.2970 + λ *= d3_radians; 1.2971 + φ = φ * d3_radians / 2 + π / 4; 1.2972 + var dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u = cosφ0 * cosφ + k * Math.cos(adλ), v = k * sdλ * Math.sin(adλ); 1.2973 + d3_geo_areaRingSum.add(Math.atan2(v, u)); 1.2974 + λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ; 1.2975 + } 1.2976 + d3_geo_area.lineEnd = function() { 1.2977 + nextPoint(λ00, φ00); 1.2978 + }; 1.2979 + } 1.2980 + function d3_geo_cartesian(spherical) { 1.2981 + var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ); 1.2982 + return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ]; 1.2983 + } 1.2984 + function d3_geo_cartesianDot(a, b) { 1.2985 + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; 1.2986 + } 1.2987 + function d3_geo_cartesianCross(a, b) { 1.2988 + 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.2989 + } 1.2990 + function d3_geo_cartesianAdd(a, b) { 1.2991 + a[0] += b[0]; 1.2992 + a[1] += b[1]; 1.2993 + a[2] += b[2]; 1.2994 + } 1.2995 + function d3_geo_cartesianScale(vector, k) { 1.2996 + return [ vector[0] * k, vector[1] * k, vector[2] * k ]; 1.2997 + } 1.2998 + function d3_geo_cartesianNormalize(d) { 1.2999 + var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); 1.3000 + d[0] /= l; 1.3001 + d[1] /= l; 1.3002 + d[2] /= l; 1.3003 + } 1.3004 + function d3_geo_spherical(cartesian) { 1.3005 + return [ Math.atan2(cartesian[1], cartesian[0]), d3_asin(cartesian[2]) ]; 1.3006 + } 1.3007 + function d3_geo_sphericalEqual(a, b) { 1.3008 + return abs(a[0] - b[0]) < ε && abs(a[1] - b[1]) < ε; 1.3009 + } 1.3010 + d3.geo.bounds = function() { 1.3011 + var λ0, φ0, λ1, φ1, λ_, λ__, φ__, p0, dλSum, ranges, range; 1.3012 + var bound = { 1.3013 + point: point, 1.3014 + lineStart: lineStart, 1.3015 + lineEnd: lineEnd, 1.3016 + polygonStart: function() { 1.3017 + bound.point = ringPoint; 1.3018 + bound.lineStart = ringStart; 1.3019 + bound.lineEnd = ringEnd; 1.3020 + dλSum = 0; 1.3021 + d3_geo_area.polygonStart(); 1.3022 + }, 1.3023 + polygonEnd: function() { 1.3024 + d3_geo_area.polygonEnd(); 1.3025 + bound.point = point; 1.3026 + bound.lineStart = lineStart; 1.3027 + bound.lineEnd = lineEnd; 1.3028 + if (d3_geo_areaRingSum < 0) λ0 = -(λ1 = 180), φ0 = -(φ1 = 90); else if (dλSum > ε) φ1 = 90; else if (dλSum < -ε) φ0 = -90; 1.3029 + range[0] = λ0, range[1] = λ1; 1.3030 + } 1.3031 + }; 1.3032 + function point(λ, φ) { 1.3033 + ranges.push(range = [ λ0 = λ, λ1 = λ ]); 1.3034 + if (φ < φ0) φ0 = φ; 1.3035 + if (φ > φ1) φ1 = φ; 1.3036 + } 1.3037 + function linePoint(λ, φ) { 1.3038 + var p = d3_geo_cartesian([ λ * d3_radians, φ * d3_radians ]); 1.3039 + if (p0) { 1.3040 + var normal = d3_geo_cartesianCross(p0, p), equatorial = [ normal[1], -normal[0], 0 ], inflection = d3_geo_cartesianCross(equatorial, normal); 1.3041 + d3_geo_cartesianNormalize(inflection); 1.3042 + inflection = d3_geo_spherical(inflection); 1.3043 + var dλ = λ - λ_, s = dλ > 0 ? 1 : -1, λi = inflection[0] * d3_degrees * s, antimeridian = abs(dλ) > 180; 1.3044 + if (antimeridian ^ (s * λ_ < λi && λi < s * λ)) { 1.3045 + var φi = inflection[1] * d3_degrees; 1.3046 + if (φi > φ1) φ1 = φi; 1.3047 + } else if (λi = (λi + 360) % 360 - 180, antimeridian ^ (s * λ_ < λi && λi < s * λ)) { 1.3048 + var φi = -inflection[1] * d3_degrees; 1.3049 + if (φi < φ0) φ0 = φi; 1.3050 + } else { 1.3051 + if (φ < φ0) φ0 = φ; 1.3052 + if (φ > φ1) φ1 = φ; 1.3053 + } 1.3054 + if (antimeridian) { 1.3055 + if (λ < λ_) { 1.3056 + if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ; 1.3057 + } else { 1.3058 + if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ; 1.3059 + } 1.3060 + } else { 1.3061 + if (λ1 >= λ0) { 1.3062 + if (λ < λ0) λ0 = λ; 1.3063 + if (λ > λ1) λ1 = λ; 1.3064 + } else { 1.3065 + if (λ > λ_) { 1.3066 + if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ; 1.3067 + } else { 1.3068 + if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ; 1.3069 + } 1.3070 + } 1.3071 + } 1.3072 + } else { 1.3073 + point(λ, φ); 1.3074 + } 1.3075 + p0 = p, λ_ = λ; 1.3076 + } 1.3077 + function lineStart() { 1.3078 + bound.point = linePoint; 1.3079 + } 1.3080 + function lineEnd() { 1.3081 + range[0] = λ0, range[1] = λ1; 1.3082 + bound.point = point; 1.3083 + p0 = null; 1.3084 + } 1.3085 + function ringPoint(λ, φ) { 1.3086 + if (p0) { 1.3087 + var dλ = λ - λ_; 1.3088 + dλSum += abs(dλ) > 180 ? dλ + (dλ > 0 ? 360 : -360) : dλ; 1.3089 + } else λ__ = λ, φ__ = φ; 1.3090 + d3_geo_area.point(λ, φ); 1.3091 + linePoint(λ, φ); 1.3092 + } 1.3093 + function ringStart() { 1.3094 + d3_geo_area.lineStart(); 1.3095 + } 1.3096 + function ringEnd() { 1.3097 + ringPoint(λ__, φ__); 1.3098 + d3_geo_area.lineEnd(); 1.3099 + if (abs(dλSum) > ε) λ0 = -(λ1 = 180); 1.3100 + range[0] = λ0, range[1] = λ1; 1.3101 + p0 = null; 1.3102 + } 1.3103 + function angle(λ0, λ1) { 1.3104 + return (λ1 -= λ0) < 0 ? λ1 + 360 : λ1; 1.3105 + } 1.3106 + function compareRanges(a, b) { 1.3107 + return a[0] - b[0]; 1.3108 + } 1.3109 + function withinRange(x, range) { 1.3110 + return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; 1.3111 + } 1.3112 + return function(feature) { 1.3113 + φ1 = λ1 = -(λ0 = φ0 = Infinity); 1.3114 + ranges = []; 1.3115 + d3.geo.stream(feature, bound); 1.3116 + var n = ranges.length; 1.3117 + if (n) { 1.3118 + ranges.sort(compareRanges); 1.3119 + for (var i = 1, a = ranges[0], b, merged = [ a ]; i < n; ++i) { 1.3120 + b = ranges[i]; 1.3121 + if (withinRange(b[0], a) || withinRange(b[1], a)) { 1.3122 + if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1]; 1.3123 + if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0]; 1.3124 + } else { 1.3125 + merged.push(a = b); 1.3126 + } 1.3127 + } 1.3128 + var best = -Infinity, dλ; 1.3129 + for (var n = merged.length - 1, i = 0, a = merged[n], b; i <= n; a = b, ++i) { 1.3130 + b = merged[i]; 1.3131 + if ((dλ = angle(a[1], b[0])) > best) best = dλ, λ0 = b[0], λ1 = a[1]; 1.3132 + } 1.3133 + } 1.3134 + ranges = range = null; 1.3135 + return λ0 === Infinity || φ0 === Infinity ? [ [ NaN, NaN ], [ NaN, NaN ] ] : [ [ λ0, φ0 ], [ λ1, φ1 ] ]; 1.3136 + }; 1.3137 + }(); 1.3138 + d3.geo.centroid = function(object) { 1.3139 + 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.3140 + d3.geo.stream(object, d3_geo_centroid); 1.3141 + var x = d3_geo_centroidX2, y = d3_geo_centroidY2, z = d3_geo_centroidZ2, m = x * x + y * y + z * z; 1.3142 + if (m < ε2) { 1.3143 + x = d3_geo_centroidX1, y = d3_geo_centroidY1, z = d3_geo_centroidZ1; 1.3144 + if (d3_geo_centroidW1 < ε) x = d3_geo_centroidX0, y = d3_geo_centroidY0, z = d3_geo_centroidZ0; 1.3145 + m = x * x + y * y + z * z; 1.3146 + if (m < ε2) return [ NaN, NaN ]; 1.3147 + } 1.3148 + return [ Math.atan2(y, x) * d3_degrees, d3_asin(z / Math.sqrt(m)) * d3_degrees ]; 1.3149 + }; 1.3150 + 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.3151 + var d3_geo_centroid = { 1.3152 + sphere: d3_noop, 1.3153 + point: d3_geo_centroidPoint, 1.3154 + lineStart: d3_geo_centroidLineStart, 1.3155 + lineEnd: d3_geo_centroidLineEnd, 1.3156 + polygonStart: function() { 1.3157 + d3_geo_centroid.lineStart = d3_geo_centroidRingStart; 1.3158 + }, 1.3159 + polygonEnd: function() { 1.3160 + d3_geo_centroid.lineStart = d3_geo_centroidLineStart; 1.3161 + } 1.3162 + }; 1.3163 + function d3_geo_centroidPoint(λ, φ) { 1.3164 + λ *= d3_radians; 1.3165 + var cosφ = Math.cos(φ *= d3_radians); 1.3166 + d3_geo_centroidPointXYZ(cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ)); 1.3167 + } 1.3168 + function d3_geo_centroidPointXYZ(x, y, z) { 1.3169 + ++d3_geo_centroidW0; 1.3170 + d3_geo_centroidX0 += (x - d3_geo_centroidX0) / d3_geo_centroidW0; 1.3171 + d3_geo_centroidY0 += (y - d3_geo_centroidY0) / d3_geo_centroidW0; 1.3172 + d3_geo_centroidZ0 += (z - d3_geo_centroidZ0) / d3_geo_centroidW0; 1.3173 + } 1.3174 + function d3_geo_centroidLineStart() { 1.3175 + var x0, y0, z0; 1.3176 + d3_geo_centroid.point = function(λ, φ) { 1.3177 + λ *= d3_radians; 1.3178 + var cosφ = Math.cos(φ *= d3_radians); 1.3179 + x0 = cosφ * Math.cos(λ); 1.3180 + y0 = cosφ * Math.sin(λ); 1.3181 + z0 = Math.sin(φ); 1.3182 + d3_geo_centroid.point = nextPoint; 1.3183 + d3_geo_centroidPointXYZ(x0, y0, z0); 1.3184 + }; 1.3185 + function nextPoint(λ, φ) { 1.3186 + λ *= d3_radians; 1.3187 + 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.3188 + d3_geo_centroidW1 += w; 1.3189 + d3_geo_centroidX1 += w * (x0 + (x0 = x)); 1.3190 + d3_geo_centroidY1 += w * (y0 + (y0 = y)); 1.3191 + d3_geo_centroidZ1 += w * (z0 + (z0 = z)); 1.3192 + d3_geo_centroidPointXYZ(x0, y0, z0); 1.3193 + } 1.3194 + } 1.3195 + function d3_geo_centroidLineEnd() { 1.3196 + d3_geo_centroid.point = d3_geo_centroidPoint; 1.3197 + } 1.3198 + function d3_geo_centroidRingStart() { 1.3199 + var λ00, φ00, x0, y0, z0; 1.3200 + d3_geo_centroid.point = function(λ, φ) { 1.3201 + λ00 = λ, φ00 = φ; 1.3202 + d3_geo_centroid.point = nextPoint; 1.3203 + λ *= d3_radians; 1.3204 + var cosφ = Math.cos(φ *= d3_radians); 1.3205 + x0 = cosφ * Math.cos(λ); 1.3206 + y0 = cosφ * Math.sin(λ); 1.3207 + z0 = Math.sin(φ); 1.3208 + d3_geo_centroidPointXYZ(x0, y0, z0); 1.3209 + }; 1.3210 + d3_geo_centroid.lineEnd = function() { 1.3211 + nextPoint(λ00, φ00); 1.3212 + d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd; 1.3213 + d3_geo_centroid.point = d3_geo_centroidPoint; 1.3214 + }; 1.3215 + function nextPoint(λ, φ) { 1.3216 + λ *= d3_radians; 1.3217 + 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.3218 + d3_geo_centroidX2 += v * cx; 1.3219 + d3_geo_centroidY2 += v * cy; 1.3220 + d3_geo_centroidZ2 += v * cz; 1.3221 + d3_geo_centroidW1 += w; 1.3222 + d3_geo_centroidX1 += w * (x0 + (x0 = x)); 1.3223 + d3_geo_centroidY1 += w * (y0 + (y0 = y)); 1.3224 + d3_geo_centroidZ1 += w * (z0 + (z0 = z)); 1.3225 + d3_geo_centroidPointXYZ(x0, y0, z0); 1.3226 + } 1.3227 + } 1.3228 + function d3_geo_compose(a, b) { 1.3229 + function compose(x, y) { 1.3230 + return x = a(x, y), b(x[0], x[1]); 1.3231 + } 1.3232 + if (a.invert && b.invert) compose.invert = function(x, y) { 1.3233 + return x = b.invert(x, y), x && a.invert(x[0], x[1]); 1.3234 + }; 1.3235 + return compose; 1.3236 + } 1.3237 + function d3_true() { 1.3238 + return true; 1.3239 + } 1.3240 + function d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener) { 1.3241 + var subject = [], clip = []; 1.3242 + segments.forEach(function(segment) { 1.3243 + if ((n = segment.length - 1) <= 0) return; 1.3244 + var n, p0 = segment[0], p1 = segment[n]; 1.3245 + if (d3_geo_sphericalEqual(p0, p1)) { 1.3246 + listener.lineStart(); 1.3247 + for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]); 1.3248 + listener.lineEnd(); 1.3249 + return; 1.3250 + } 1.3251 + var a = new d3_geo_clipPolygonIntersection(p0, segment, null, true), b = new d3_geo_clipPolygonIntersection(p0, null, a, false); 1.3252 + a.o = b; 1.3253 + subject.push(a); 1.3254 + clip.push(b); 1.3255 + a = new d3_geo_clipPolygonIntersection(p1, segment, null, false); 1.3256 + b = new d3_geo_clipPolygonIntersection(p1, null, a, true); 1.3257 + a.o = b; 1.3258 + subject.push(a); 1.3259 + clip.push(b); 1.3260 + }); 1.3261 + clip.sort(compare); 1.3262 + d3_geo_clipPolygonLinkCircular(subject); 1.3263 + d3_geo_clipPolygonLinkCircular(clip); 1.3264 + if (!subject.length) return; 1.3265 + for (var i = 0, entry = clipStartInside, n = clip.length; i < n; ++i) { 1.3266 + clip[i].e = entry = !entry; 1.3267 + } 1.3268 + var start = subject[0], points, point; 1.3269 + while (1) { 1.3270 + var current = start, isSubject = true; 1.3271 + while (current.v) if ((current = current.n) === start) return; 1.3272 + points = current.z; 1.3273 + listener.lineStart(); 1.3274 + do { 1.3275 + current.v = current.o.v = true; 1.3276 + if (current.e) { 1.3277 + if (isSubject) { 1.3278 + for (var i = 0, n = points.length; i < n; ++i) listener.point((point = points[i])[0], point[1]); 1.3279 + } else { 1.3280 + interpolate(current.x, current.n.x, 1, listener); 1.3281 + } 1.3282 + current = current.n; 1.3283 + } else { 1.3284 + if (isSubject) { 1.3285 + points = current.p.z; 1.3286 + for (var i = points.length - 1; i >= 0; --i) listener.point((point = points[i])[0], point[1]); 1.3287 + } else { 1.3288 + interpolate(current.x, current.p.x, -1, listener); 1.3289 + } 1.3290 + current = current.p; 1.3291 + } 1.3292 + current = current.o; 1.3293 + points = current.z; 1.3294 + isSubject = !isSubject; 1.3295 + } while (!current.v); 1.3296 + listener.lineEnd(); 1.3297 + } 1.3298 + } 1.3299 + function d3_geo_clipPolygonLinkCircular(array) { 1.3300 + if (!(n = array.length)) return; 1.3301 + var n, i = 0, a = array[0], b; 1.3302 + while (++i < n) { 1.3303 + a.n = b = array[i]; 1.3304 + b.p = a; 1.3305 + a = b; 1.3306 + } 1.3307 + a.n = b = array[0]; 1.3308 + b.p = a; 1.3309 + } 1.3310 + function d3_geo_clipPolygonIntersection(point, points, other, entry) { 1.3311 + this.x = point; 1.3312 + this.z = points; 1.3313 + this.o = other; 1.3314 + this.e = entry; 1.3315 + this.v = false; 1.3316 + this.n = this.p = null; 1.3317 + } 1.3318 + function d3_geo_clip(pointVisible, clipLine, interpolate, clipStart) { 1.3319 + return function(rotate, listener) { 1.3320 + var line = clipLine(listener), rotatedClipStart = rotate.invert(clipStart[0], clipStart[1]); 1.3321 + var clip = { 1.3322 + point: point, 1.3323 + lineStart: lineStart, 1.3324 + lineEnd: lineEnd, 1.3325 + polygonStart: function() { 1.3326 + clip.point = pointRing; 1.3327 + clip.lineStart = ringStart; 1.3328 + clip.lineEnd = ringEnd; 1.3329 + segments = []; 1.3330 + polygon = []; 1.3331 + }, 1.3332 + polygonEnd: function() { 1.3333 + clip.point = point; 1.3334 + clip.lineStart = lineStart; 1.3335 + clip.lineEnd = lineEnd; 1.3336 + segments = d3.merge(segments); 1.3337 + var clipStartInside = d3_geo_pointInPolygon(rotatedClipStart, polygon); 1.3338 + if (segments.length) { 1.3339 + if (!polygonStarted) listener.polygonStart(), polygonStarted = true; 1.3340 + d3_geo_clipPolygon(segments, d3_geo_clipSort, clipStartInside, interpolate, listener); 1.3341 + } else if (clipStartInside) { 1.3342 + if (!polygonStarted) listener.polygonStart(), polygonStarted = true; 1.3343 + listener.lineStart(); 1.3344 + interpolate(null, null, 1, listener); 1.3345 + listener.lineEnd(); 1.3346 + } 1.3347 + if (polygonStarted) listener.polygonEnd(), polygonStarted = false; 1.3348 + segments = polygon = null; 1.3349 + }, 1.3350 + sphere: function() { 1.3351 + listener.polygonStart(); 1.3352 + listener.lineStart(); 1.3353 + interpolate(null, null, 1, listener); 1.3354 + listener.lineEnd(); 1.3355 + listener.polygonEnd(); 1.3356 + } 1.3357 + }; 1.3358 + function point(λ, φ) { 1.3359 + var point = rotate(λ, φ); 1.3360 + if (pointVisible(λ = point[0], φ = point[1])) listener.point(λ, φ); 1.3361 + } 1.3362 + function pointLine(λ, φ) { 1.3363 + var point = rotate(λ, φ); 1.3364 + line.point(point[0], point[1]); 1.3365 + } 1.3366 + function lineStart() { 1.3367 + clip.point = pointLine; 1.3368 + line.lineStart(); 1.3369 + } 1.3370 + function lineEnd() { 1.3371 + clip.point = point; 1.3372 + line.lineEnd(); 1.3373 + } 1.3374 + var segments; 1.3375 + var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), polygonStarted = false, polygon, ring; 1.3376 + function pointRing(λ, φ) { 1.3377 + ring.push([ λ, φ ]); 1.3378 + var point = rotate(λ, φ); 1.3379 + ringListener.point(point[0], point[1]); 1.3380 + } 1.3381 + function ringStart() { 1.3382 + ringListener.lineStart(); 1.3383 + ring = []; 1.3384 + } 1.3385 + function ringEnd() { 1.3386 + pointRing(ring[0][0], ring[0][1]); 1.3387 + ringListener.lineEnd(); 1.3388 + var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length; 1.3389 + ring.pop(); 1.3390 + polygon.push(ring); 1.3391 + ring = null; 1.3392 + if (!n) return; 1.3393 + if (clean & 1) { 1.3394 + segment = ringSegments[0]; 1.3395 + var n = segment.length - 1, i = -1, point; 1.3396 + if (n > 0) { 1.3397 + if (!polygonStarted) listener.polygonStart(), polygonStarted = true; 1.3398 + listener.lineStart(); 1.3399 + while (++i < n) listener.point((point = segment[i])[0], point[1]); 1.3400 + listener.lineEnd(); 1.3401 + } 1.3402 + return; 1.3403 + } 1.3404 + if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); 1.3405 + segments.push(ringSegments.filter(d3_geo_clipSegmentLength1)); 1.3406 + } 1.3407 + return clip; 1.3408 + }; 1.3409 + } 1.3410 + function d3_geo_clipSegmentLength1(segment) { 1.3411 + return segment.length > 1; 1.3412 + } 1.3413 + function d3_geo_clipBufferListener() { 1.3414 + var lines = [], line; 1.3415 + return { 1.3416 + lineStart: function() { 1.3417 + lines.push(line = []); 1.3418 + }, 1.3419 + point: function(λ, φ) { 1.3420 + line.push([ λ, φ ]); 1.3421 + }, 1.3422 + lineEnd: d3_noop, 1.3423 + buffer: function() { 1.3424 + var buffer = lines; 1.3425 + lines = []; 1.3426 + line = null; 1.3427 + return buffer; 1.3428 + }, 1.3429 + rejoin: function() { 1.3430 + if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); 1.3431 + } 1.3432 + }; 1.3433 + } 1.3434 + function d3_geo_clipSort(a, b) { 1.3435 + return ((a = a.x)[0] < 0 ? a[1] - halfπ - ε : halfπ - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfπ - ε : halfπ - b[1]); 1.3436 + } 1.3437 + var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate, [ -π, -π / 2 ]); 1.3438 + function d3_geo_clipAntimeridianLine(listener) { 1.3439 + var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean; 1.3440 + return { 1.3441 + lineStart: function() { 1.3442 + listener.lineStart(); 1.3443 + clean = 1; 1.3444 + }, 1.3445 + point: function(λ1, φ1) { 1.3446 + var sλ1 = λ1 > 0 ? π : -π, dλ = abs(λ1 - λ0); 1.3447 + if (abs(dλ - π) < ε) { 1.3448 + listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? halfπ : -halfπ); 1.3449 + listener.point(sλ0, φ0); 1.3450 + listener.lineEnd(); 1.3451 + listener.lineStart(); 1.3452 + listener.point(sλ1, φ0); 1.3453 + listener.point(λ1, φ0); 1.3454 + clean = 0; 1.3455 + } else if (sλ0 !== sλ1 && dλ >= π) { 1.3456 + if (abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε; 1.3457 + if (abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε; 1.3458 + φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1); 1.3459 + listener.point(sλ0, φ0); 1.3460 + listener.lineEnd(); 1.3461 + listener.lineStart(); 1.3462 + listener.point(sλ1, φ0); 1.3463 + clean = 0; 1.3464 + } 1.3465 + listener.point(λ0 = λ1, φ0 = φ1); 1.3466 + sλ0 = sλ1; 1.3467 + }, 1.3468 + lineEnd: function() { 1.3469 + listener.lineEnd(); 1.3470 + λ0 = φ0 = NaN; 1.3471 + }, 1.3472 + clean: function() { 1.3473 + return 2 - clean; 1.3474 + } 1.3475 + }; 1.3476 + } 1.3477 + function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) { 1.3478 + var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1); 1.3479 + 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.3480 + } 1.3481 + function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) { 1.3482 + var φ; 1.3483 + if (from == null) { 1.3484 + φ = direction * halfπ; 1.3485 + listener.point(-π, φ); 1.3486 + listener.point(0, φ); 1.3487 + listener.point(π, φ); 1.3488 + listener.point(π, 0); 1.3489 + listener.point(π, -φ); 1.3490 + listener.point(0, -φ); 1.3491 + listener.point(-π, -φ); 1.3492 + listener.point(-π, 0); 1.3493 + listener.point(-π, φ); 1.3494 + } else if (abs(from[0] - to[0]) > ε) { 1.3495 + var s = from[0] < to[0] ? π : -π; 1.3496 + φ = direction * s / 2; 1.3497 + listener.point(-s, φ); 1.3498 + listener.point(0, φ); 1.3499 + listener.point(s, φ); 1.3500 + } else { 1.3501 + listener.point(to[0], to[1]); 1.3502 + } 1.3503 + } 1.3504 + function d3_geo_pointInPolygon(point, polygon) { 1.3505 + var meridian = point[0], parallel = point[1], meridianNormal = [ Math.sin(meridian), -Math.cos(meridian), 0 ], polarAngle = 0, winding = 0; 1.3506 + d3_geo_areaRingSum.reset(); 1.3507 + for (var i = 0, n = polygon.length; i < n; ++i) { 1.3508 + var ring = polygon[i], m = ring.length; 1.3509 + if (!m) continue; 1.3510 + 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.3511 + while (true) { 1.3512 + if (j === m) j = 0; 1.3513 + point = ring[j]; 1.3514 + var λ = point[0], φ = point[1] / 2 + π / 4, sinφ = Math.sin(φ), cosφ = Math.cos(φ), dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, antimeridian = adλ > π, k = sinφ0 * sinφ; 1.3515 + d3_geo_areaRingSum.add(Math.atan2(k * sdλ * Math.sin(adλ), cosφ0 * cosφ + k * Math.cos(adλ))); 1.3516 + polarAngle += antimeridian ? dλ + sdλ * τ : dλ; 1.3517 + if (antimeridian ^ λ0 >= meridian ^ λ >= meridian) { 1.3518 + var arc = d3_geo_cartesianCross(d3_geo_cartesian(point0), d3_geo_cartesian(point)); 1.3519 + d3_geo_cartesianNormalize(arc); 1.3520 + var intersection = d3_geo_cartesianCross(meridianNormal, arc); 1.3521 + d3_geo_cartesianNormalize(intersection); 1.3522 + var φarc = (antimeridian ^ dλ >= 0 ? -1 : 1) * d3_asin(intersection[2]); 1.3523 + if (parallel > φarc || parallel === φarc && (arc[0] || arc[1])) { 1.3524 + winding += antimeridian ^ dλ >= 0 ? 1 : -1; 1.3525 + } 1.3526 + } 1.3527 + if (!j++) break; 1.3528 + λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ, point0 = point; 1.3529 + } 1.3530 + } 1.3531 + return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < -ε) ^ winding & 1; 1.3532 + } 1.3533 + function d3_geo_clipCircle(radius) { 1.3534 + var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = abs(cr) > ε, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians); 1.3535 + return d3_geo_clip(visible, clipLine, interpolate, smallRadius ? [ 0, -radius ] : [ -π, radius - π ]); 1.3536 + function visible(λ, φ) { 1.3537 + return Math.cos(λ) * Math.cos(φ) > cr; 1.3538 + } 1.3539 + function clipLine(listener) { 1.3540 + var point0, c0, v0, v00, clean; 1.3541 + return { 1.3542 + lineStart: function() { 1.3543 + v00 = v0 = false; 1.3544 + clean = 1; 1.3545 + }, 1.3546 + point: function(λ, φ) { 1.3547 + var point1 = [ λ, φ ], point2, v = visible(λ, φ), c = smallRadius ? v ? 0 : code(λ, φ) : v ? code(λ + (λ < 0 ? π : -π), φ) : 0; 1.3548 + if (!point0 && (v00 = v0 = v)) listener.lineStart(); 1.3549 + if (v !== v0) { 1.3550 + point2 = intersect(point0, point1); 1.3551 + if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) { 1.3552 + point1[0] += ε; 1.3553 + point1[1] += ε; 1.3554 + v = visible(point1[0], point1[1]); 1.3555 + } 1.3556 + } 1.3557 + if (v !== v0) { 1.3558 + clean = 0; 1.3559 + if (v) { 1.3560 + listener.lineStart(); 1.3561 + point2 = intersect(point1, point0); 1.3562 + listener.point(point2[0], point2[1]); 1.3563 + } else { 1.3564 + point2 = intersect(point0, point1); 1.3565 + listener.point(point2[0], point2[1]); 1.3566 + listener.lineEnd(); 1.3567 + } 1.3568 + point0 = point2; 1.3569 + } else if (notHemisphere && point0 && smallRadius ^ v) { 1.3570 + var t; 1.3571 + if (!(c & c0) && (t = intersect(point1, point0, true))) { 1.3572 + clean = 0; 1.3573 + if (smallRadius) { 1.3574 + listener.lineStart(); 1.3575 + listener.point(t[0][0], t[0][1]); 1.3576 + listener.point(t[1][0], t[1][1]); 1.3577 + listener.lineEnd(); 1.3578 + } else { 1.3579 + listener.point(t[1][0], t[1][1]); 1.3580 + listener.lineEnd(); 1.3581 + listener.lineStart(); 1.3582 + listener.point(t[0][0], t[0][1]); 1.3583 + } 1.3584 + } 1.3585 + } 1.3586 + if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) { 1.3587 + listener.point(point1[0], point1[1]); 1.3588 + } 1.3589 + point0 = point1, v0 = v, c0 = c; 1.3590 + }, 1.3591 + lineEnd: function() { 1.3592 + if (v0) listener.lineEnd(); 1.3593 + point0 = null; 1.3594 + }, 1.3595 + clean: function() { 1.3596 + return clean | (v00 && v0) << 1; 1.3597 + } 1.3598 + }; 1.3599 + } 1.3600 + function intersect(a, b, two) { 1.3601 + var pa = d3_geo_cartesian(a), pb = d3_geo_cartesian(b); 1.3602 + 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.3603 + if (!determinant) return !two && a; 1.3604 + 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.3605 + d3_geo_cartesianAdd(A, B); 1.3606 + 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.3607 + if (t2 < 0) return; 1.3608 + var t = Math.sqrt(t2), q = d3_geo_cartesianScale(u, (-w - t) / uu); 1.3609 + d3_geo_cartesianAdd(q, A); 1.3610 + q = d3_geo_spherical(q); 1.3611 + if (!two) return q; 1.3612 + var λ0 = a[0], λ1 = b[0], φ0 = a[1], φ1 = b[1], z; 1.3613 + if (λ1 < λ0) z = λ0, λ0 = λ1, λ1 = z; 1.3614 + var δλ = λ1 - λ0, polar = abs(δλ - π) < ε, meridian = polar || δλ < ε; 1.3615 + if (!polar && φ1 < φ0) z = φ0, φ0 = φ1, φ1 = z; 1.3616 + 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.3617 + var q1 = d3_geo_cartesianScale(u, (-w + t) / uu); 1.3618 + d3_geo_cartesianAdd(q1, A); 1.3619 + return [ q, d3_geo_spherical(q1) ]; 1.3620 + } 1.3621 + } 1.3622 + function code(λ, φ) { 1.3623 + var r = smallRadius ? radius : π - radius, code = 0; 1.3624 + if (λ < -r) code |= 1; else if (λ > r) code |= 2; 1.3625 + if (φ < -r) code |= 4; else if (φ > r) code |= 8; 1.3626 + return code; 1.3627 + } 1.3628 + } 1.3629 + function d3_geom_clipLine(x0, y0, x1, y1) { 1.3630 + return function(line) { 1.3631 + 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.3632 + r = x0 - ax; 1.3633 + if (!dx && r > 0) return; 1.3634 + r /= dx; 1.3635 + if (dx < 0) { 1.3636 + if (r < t0) return; 1.3637 + if (r < t1) t1 = r; 1.3638 + } else if (dx > 0) { 1.3639 + if (r > t1) return; 1.3640 + if (r > t0) t0 = r; 1.3641 + } 1.3642 + r = x1 - ax; 1.3643 + if (!dx && r < 0) return; 1.3644 + r /= dx; 1.3645 + if (dx < 0) { 1.3646 + if (r > t1) return; 1.3647 + if (r > t0) t0 = r; 1.3648 + } else if (dx > 0) { 1.3649 + if (r < t0) return; 1.3650 + if (r < t1) t1 = r; 1.3651 + } 1.3652 + r = y0 - ay; 1.3653 + if (!dy && r > 0) return; 1.3654 + r /= dy; 1.3655 + if (dy < 0) { 1.3656 + if (r < t0) return; 1.3657 + if (r < t1) t1 = r; 1.3658 + } else if (dy > 0) { 1.3659 + if (r > t1) return; 1.3660 + if (r > t0) t0 = r; 1.3661 + } 1.3662 + r = y1 - ay; 1.3663 + if (!dy && r < 0) return; 1.3664 + r /= dy; 1.3665 + if (dy < 0) { 1.3666 + if (r > t1) return; 1.3667 + if (r > t0) t0 = r; 1.3668 + } else if (dy > 0) { 1.3669 + if (r < t0) return; 1.3670 + if (r < t1) t1 = r; 1.3671 + } 1.3672 + if (t0 > 0) line.a = { 1.3673 + x: ax + t0 * dx, 1.3674 + y: ay + t0 * dy 1.3675 + }; 1.3676 + if (t1 < 1) line.b = { 1.3677 + x: ax + t1 * dx, 1.3678 + y: ay + t1 * dy 1.3679 + }; 1.3680 + return line; 1.3681 + }; 1.3682 + } 1.3683 + var d3_geo_clipExtentMAX = 1e9; 1.3684 + d3.geo.clipExtent = function() { 1.3685 + var x0, y0, x1, y1, stream, clip, clipExtent = { 1.3686 + stream: function(output) { 1.3687 + if (stream) stream.valid = false; 1.3688 + stream = clip(output); 1.3689 + stream.valid = true; 1.3690 + return stream; 1.3691 + }, 1.3692 + extent: function(_) { 1.3693 + if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; 1.3694 + clip = d3_geo_clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]); 1.3695 + if (stream) stream.valid = false, stream = null; 1.3696 + return clipExtent; 1.3697 + } 1.3698 + }; 1.3699 + return clipExtent.extent([ [ 0, 0 ], [ 960, 500 ] ]); 1.3700 + }; 1.3701 + function d3_geo_clipExtent(x0, y0, x1, y1) { 1.3702 + return function(listener) { 1.3703 + var listener_ = listener, bufferListener = d3_geo_clipBufferListener(), clipLine = d3_geom_clipLine(x0, y0, x1, y1), segments, polygon, ring; 1.3704 + var clip = { 1.3705 + point: point, 1.3706 + lineStart: lineStart, 1.3707 + lineEnd: lineEnd, 1.3708 + polygonStart: function() { 1.3709 + listener = bufferListener; 1.3710 + segments = []; 1.3711 + polygon = []; 1.3712 + clean = true; 1.3713 + }, 1.3714 + polygonEnd: function() { 1.3715 + listener = listener_; 1.3716 + segments = d3.merge(segments); 1.3717 + var clipStartInside = insidePolygon([ x0, y1 ]), inside = clean && clipStartInside, visible = segments.length; 1.3718 + if (inside || visible) { 1.3719 + listener.polygonStart(); 1.3720 + if (inside) { 1.3721 + listener.lineStart(); 1.3722 + interpolate(null, null, 1, listener); 1.3723 + listener.lineEnd(); 1.3724 + } 1.3725 + if (visible) { 1.3726 + d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener); 1.3727 + } 1.3728 + listener.polygonEnd(); 1.3729 + } 1.3730 + segments = polygon = ring = null; 1.3731 + } 1.3732 + }; 1.3733 + function insidePolygon(p) { 1.3734 + var wn = 0, n = polygon.length, y = p[1]; 1.3735 + for (var i = 0; i < n; ++i) { 1.3736 + for (var j = 1, v = polygon[i], m = v.length, a = v[0], b; j < m; ++j) { 1.3737 + b = v[j]; 1.3738 + if (a[1] <= y) { 1.3739 + if (b[1] > y && d3_cross2d(a, b, p) > 0) ++wn; 1.3740 + } else { 1.3741 + if (b[1] <= y && d3_cross2d(a, b, p) < 0) --wn; 1.3742 + } 1.3743 + a = b; 1.3744 + } 1.3745 + } 1.3746 + return wn !== 0; 1.3747 + } 1.3748 + function interpolate(from, to, direction, listener) { 1.3749 + var a = 0, a1 = 0; 1.3750 + if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoints(from, to) < 0 ^ direction > 0) { 1.3751 + do { 1.3752 + listener.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); 1.3753 + } while ((a = (a + direction + 4) % 4) !== a1); 1.3754 + } else { 1.3755 + listener.point(to[0], to[1]); 1.3756 + } 1.3757 + } 1.3758 + function pointVisible(x, y) { 1.3759 + return x0 <= x && x <= x1 && y0 <= y && y <= y1; 1.3760 + } 1.3761 + function point(x, y) { 1.3762 + if (pointVisible(x, y)) listener.point(x, y); 1.3763 + } 1.3764 + var x__, y__, v__, x_, y_, v_, first, clean; 1.3765 + function lineStart() { 1.3766 + clip.point = linePoint; 1.3767 + if (polygon) polygon.push(ring = []); 1.3768 + first = true; 1.3769 + v_ = false; 1.3770 + x_ = y_ = NaN; 1.3771 + } 1.3772 + function lineEnd() { 1.3773 + if (segments) { 1.3774 + linePoint(x__, y__); 1.3775 + if (v__ && v_) bufferListener.rejoin(); 1.3776 + segments.push(bufferListener.buffer()); 1.3777 + } 1.3778 + clip.point = point; 1.3779 + if (v_) listener.lineEnd(); 1.3780 + } 1.3781 + function linePoint(x, y) { 1.3782 + x = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, x)); 1.3783 + y = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, y)); 1.3784 + var v = pointVisible(x, y); 1.3785 + if (polygon) ring.push([ x, y ]); 1.3786 + if (first) { 1.3787 + x__ = x, y__ = y, v__ = v; 1.3788 + first = false; 1.3789 + if (v) { 1.3790 + listener.lineStart(); 1.3791 + listener.point(x, y); 1.3792 + } 1.3793 + } else { 1.3794 + if (v && v_) listener.point(x, y); else { 1.3795 + var l = { 1.3796 + a: { 1.3797 + x: x_, 1.3798 + y: y_ 1.3799 + }, 1.3800 + b: { 1.3801 + x: x, 1.3802 + y: y 1.3803 + } 1.3804 + }; 1.3805 + if (clipLine(l)) { 1.3806 + if (!v_) { 1.3807 + listener.lineStart(); 1.3808 + listener.point(l.a.x, l.a.y); 1.3809 + } 1.3810 + listener.point(l.b.x, l.b.y); 1.3811 + if (!v) listener.lineEnd(); 1.3812 + clean = false; 1.3813 + } else if (v) { 1.3814 + listener.lineStart(); 1.3815 + listener.point(x, y); 1.3816 + clean = false; 1.3817 + } 1.3818 + } 1.3819 + } 1.3820 + x_ = x, y_ = y, v_ = v; 1.3821 + } 1.3822 + return clip; 1.3823 + }; 1.3824 + function corner(p, direction) { 1.3825 + 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.3826 + } 1.3827 + function compare(a, b) { 1.3828 + return comparePoints(a.x, b.x); 1.3829 + } 1.3830 + function comparePoints(a, b) { 1.3831 + var ca = corner(a, 1), cb = corner(b, 1); 1.3832 + 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.3833 + } 1.3834 + } 1.3835 + function d3_geo_conic(projectAt) { 1.3836 + var φ0 = 0, φ1 = π / 3, m = d3_geo_projectionMutator(projectAt), p = m(φ0, φ1); 1.3837 + p.parallels = function(_) { 1.3838 + if (!arguments.length) return [ φ0 / π * 180, φ1 / π * 180 ]; 1.3839 + return m(φ0 = _[0] * π / 180, φ1 = _[1] * π / 180); 1.3840 + }; 1.3841 + return p; 1.3842 + } 1.3843 + function d3_geo_conicEqualArea(φ0, φ1) { 1.3844 + 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.3845 + function forward(λ, φ) { 1.3846 + var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n; 1.3847 + return [ ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ) ]; 1.3848 + } 1.3849 + forward.invert = function(x, y) { 1.3850 + var ρ0_y = ρ0 - y; 1.3851 + return [ Math.atan2(x, ρ0_y) / n, d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ]; 1.3852 + }; 1.3853 + return forward; 1.3854 + } 1.3855 + (d3.geo.conicEqualArea = function() { 1.3856 + return d3_geo_conic(d3_geo_conicEqualArea); 1.3857 + }).raw = d3_geo_conicEqualArea; 1.3858 + d3.geo.albers = function() { 1.3859 + return d3.geo.conicEqualArea().rotate([ 96, 0 ]).center([ -.6, 38.7 ]).parallels([ 29.5, 45.5 ]).scale(1070); 1.3860 + }; 1.3861 + d3.geo.albersUsa = function() { 1.3862 + var lower48 = d3.geo.albers(); 1.3863 + var alaska = d3.geo.conicEqualArea().rotate([ 154, 0 ]).center([ -2, 58.5 ]).parallels([ 55, 65 ]); 1.3864 + var hawaii = d3.geo.conicEqualArea().rotate([ 157, 0 ]).center([ -3, 19.9 ]).parallels([ 8, 18 ]); 1.3865 + var point, pointStream = { 1.3866 + point: function(x, y) { 1.3867 + point = [ x, y ]; 1.3868 + } 1.3869 + }, lower48Point, alaskaPoint, hawaiiPoint; 1.3870 + function albersUsa(coordinates) { 1.3871 + var x = coordinates[0], y = coordinates[1]; 1.3872 + point = null; 1.3873 + (lower48Point(x, y), point) || (alaskaPoint(x, y), point) || hawaiiPoint(x, y); 1.3874 + return point; 1.3875 + } 1.3876 + albersUsa.invert = function(coordinates) { 1.3877 + var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k; 1.3878 + return (y >= .12 && y < .234 && x >= -.425 && x < -.214 ? alaska : y >= .166 && y < .234 && x >= -.214 && x < -.115 ? hawaii : lower48).invert(coordinates); 1.3879 + }; 1.3880 + albersUsa.stream = function(stream) { 1.3881 + var lower48Stream = lower48.stream(stream), alaskaStream = alaska.stream(stream), hawaiiStream = hawaii.stream(stream); 1.3882 + return { 1.3883 + point: function(x, y) { 1.3884 + lower48Stream.point(x, y); 1.3885 + alaskaStream.point(x, y); 1.3886 + hawaiiStream.point(x, y); 1.3887 + }, 1.3888 + sphere: function() { 1.3889 + lower48Stream.sphere(); 1.3890 + alaskaStream.sphere(); 1.3891 + hawaiiStream.sphere(); 1.3892 + }, 1.3893 + lineStart: function() { 1.3894 + lower48Stream.lineStart(); 1.3895 + alaskaStream.lineStart(); 1.3896 + hawaiiStream.lineStart(); 1.3897 + }, 1.3898 + lineEnd: function() { 1.3899 + lower48Stream.lineEnd(); 1.3900 + alaskaStream.lineEnd(); 1.3901 + hawaiiStream.lineEnd(); 1.3902 + }, 1.3903 + polygonStart: function() { 1.3904 + lower48Stream.polygonStart(); 1.3905 + alaskaStream.polygonStart(); 1.3906 + hawaiiStream.polygonStart(); 1.3907 + }, 1.3908 + polygonEnd: function() { 1.3909 + lower48Stream.polygonEnd(); 1.3910 + alaskaStream.polygonEnd(); 1.3911 + hawaiiStream.polygonEnd(); 1.3912 + } 1.3913 + }; 1.3914 + }; 1.3915 + albersUsa.precision = function(_) { 1.3916 + if (!arguments.length) return lower48.precision(); 1.3917 + lower48.precision(_); 1.3918 + alaska.precision(_); 1.3919 + hawaii.precision(_); 1.3920 + return albersUsa; 1.3921 + }; 1.3922 + albersUsa.scale = function(_) { 1.3923 + if (!arguments.length) return lower48.scale(); 1.3924 + lower48.scale(_); 1.3925 + alaska.scale(_ * .35); 1.3926 + hawaii.scale(_); 1.3927 + return albersUsa.translate(lower48.translate()); 1.3928 + }; 1.3929 + albersUsa.translate = function(_) { 1.3930 + if (!arguments.length) return lower48.translate(); 1.3931 + var k = lower48.scale(), x = +_[0], y = +_[1]; 1.3932 + lower48Point = lower48.translate(_).clipExtent([ [ x - .455 * k, y - .238 * k ], [ x + .455 * k, y + .238 * k ] ]).stream(pointStream).point; 1.3933 + 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.3934 + 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.3935 + return albersUsa; 1.3936 + }; 1.3937 + return albersUsa.scale(1070); 1.3938 + }; 1.3939 + var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = { 1.3940 + point: d3_noop, 1.3941 + lineStart: d3_noop, 1.3942 + lineEnd: d3_noop, 1.3943 + polygonStart: function() { 1.3944 + d3_geo_pathAreaPolygon = 0; 1.3945 + d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart; 1.3946 + }, 1.3947 + polygonEnd: function() { 1.3948 + d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop; 1.3949 + d3_geo_pathAreaSum += abs(d3_geo_pathAreaPolygon / 2); 1.3950 + } 1.3951 + }; 1.3952 + function d3_geo_pathAreaRingStart() { 1.3953 + var x00, y00, x0, y0; 1.3954 + d3_geo_pathArea.point = function(x, y) { 1.3955 + d3_geo_pathArea.point = nextPoint; 1.3956 + x00 = x0 = x, y00 = y0 = y; 1.3957 + }; 1.3958 + function nextPoint(x, y) { 1.3959 + d3_geo_pathAreaPolygon += y0 * x - x0 * y; 1.3960 + x0 = x, y0 = y; 1.3961 + } 1.3962 + d3_geo_pathArea.lineEnd = function() { 1.3963 + nextPoint(x00, y00); 1.3964 + }; 1.3965 + } 1.3966 + var d3_geo_pathBoundsX0, d3_geo_pathBoundsY0, d3_geo_pathBoundsX1, d3_geo_pathBoundsY1; 1.3967 + var d3_geo_pathBounds = { 1.3968 + point: d3_geo_pathBoundsPoint, 1.3969 + lineStart: d3_noop, 1.3970 + lineEnd: d3_noop, 1.3971 + polygonStart: d3_noop, 1.3972 + polygonEnd: d3_noop 1.3973 + }; 1.3974 + function d3_geo_pathBoundsPoint(x, y) { 1.3975 + if (x < d3_geo_pathBoundsX0) d3_geo_pathBoundsX0 = x; 1.3976 + if (x > d3_geo_pathBoundsX1) d3_geo_pathBoundsX1 = x; 1.3977 + if (y < d3_geo_pathBoundsY0) d3_geo_pathBoundsY0 = y; 1.3978 + if (y > d3_geo_pathBoundsY1) d3_geo_pathBoundsY1 = y; 1.3979 + } 1.3980 + function d3_geo_pathBuffer() { 1.3981 + var pointCircle = d3_geo_pathBufferCircle(4.5), buffer = []; 1.3982 + var stream = { 1.3983 + point: point, 1.3984 + lineStart: function() { 1.3985 + stream.point = pointLineStart; 1.3986 + }, 1.3987 + lineEnd: lineEnd, 1.3988 + polygonStart: function() { 1.3989 + stream.lineEnd = lineEndPolygon; 1.3990 + }, 1.3991 + polygonEnd: function() { 1.3992 + stream.lineEnd = lineEnd; 1.3993 + stream.point = point; 1.3994 + }, 1.3995 + pointRadius: function(_) { 1.3996 + pointCircle = d3_geo_pathBufferCircle(_); 1.3997 + return stream; 1.3998 + }, 1.3999 + result: function() { 1.4000 + if (buffer.length) { 1.4001 + var result = buffer.join(""); 1.4002 + buffer = []; 1.4003 + return result; 1.4004 + } 1.4005 + } 1.4006 + }; 1.4007 + function point(x, y) { 1.4008 + buffer.push("M", x, ",", y, pointCircle); 1.4009 + } 1.4010 + function pointLineStart(x, y) { 1.4011 + buffer.push("M", x, ",", y); 1.4012 + stream.point = pointLine; 1.4013 + } 1.4014 + function pointLine(x, y) { 1.4015 + buffer.push("L", x, ",", y); 1.4016 + } 1.4017 + function lineEnd() { 1.4018 + stream.point = point; 1.4019 + } 1.4020 + function lineEndPolygon() { 1.4021 + buffer.push("Z"); 1.4022 + } 1.4023 + return stream; 1.4024 + } 1.4025 + function d3_geo_pathBufferCircle(radius) { 1.4026 + return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z"; 1.4027 + } 1.4028 + var d3_geo_pathCentroid = { 1.4029 + point: d3_geo_pathCentroidPoint, 1.4030 + lineStart: d3_geo_pathCentroidLineStart, 1.4031 + lineEnd: d3_geo_pathCentroidLineEnd, 1.4032 + polygonStart: function() { 1.4033 + d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart; 1.4034 + }, 1.4035 + polygonEnd: function() { 1.4036 + d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; 1.4037 + d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart; 1.4038 + d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd; 1.4039 + } 1.4040 + }; 1.4041 + function d3_geo_pathCentroidPoint(x, y) { 1.4042 + d3_geo_centroidX0 += x; 1.4043 + d3_geo_centroidY0 += y; 1.4044 + ++d3_geo_centroidZ0; 1.4045 + } 1.4046 + function d3_geo_pathCentroidLineStart() { 1.4047 + var x0, y0; 1.4048 + d3_geo_pathCentroid.point = function(x, y) { 1.4049 + d3_geo_pathCentroid.point = nextPoint; 1.4050 + d3_geo_pathCentroidPoint(x0 = x, y0 = y); 1.4051 + }; 1.4052 + function nextPoint(x, y) { 1.4053 + var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); 1.4054 + d3_geo_centroidX1 += z * (x0 + x) / 2; 1.4055 + d3_geo_centroidY1 += z * (y0 + y) / 2; 1.4056 + d3_geo_centroidZ1 += z; 1.4057 + d3_geo_pathCentroidPoint(x0 = x, y0 = y); 1.4058 + } 1.4059 + } 1.4060 + function d3_geo_pathCentroidLineEnd() { 1.4061 + d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; 1.4062 + } 1.4063 + function d3_geo_pathCentroidRingStart() { 1.4064 + var x00, y00, x0, y0; 1.4065 + d3_geo_pathCentroid.point = function(x, y) { 1.4066 + d3_geo_pathCentroid.point = nextPoint; 1.4067 + d3_geo_pathCentroidPoint(x00 = x0 = x, y00 = y0 = y); 1.4068 + }; 1.4069 + function nextPoint(x, y) { 1.4070 + var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); 1.4071 + d3_geo_centroidX1 += z * (x0 + x) / 2; 1.4072 + d3_geo_centroidY1 += z * (y0 + y) / 2; 1.4073 + d3_geo_centroidZ1 += z; 1.4074 + z = y0 * x - x0 * y; 1.4075 + d3_geo_centroidX2 += z * (x0 + x); 1.4076 + d3_geo_centroidY2 += z * (y0 + y); 1.4077 + d3_geo_centroidZ2 += z * 3; 1.4078 + d3_geo_pathCentroidPoint(x0 = x, y0 = y); 1.4079 + } 1.4080 + d3_geo_pathCentroid.lineEnd = function() { 1.4081 + nextPoint(x00, y00); 1.4082 + }; 1.4083 + } 1.4084 + function d3_geo_pathContext(context) { 1.4085 + var pointRadius = 4.5; 1.4086 + var stream = { 1.4087 + point: point, 1.4088 + lineStart: function() { 1.4089 + stream.point = pointLineStart; 1.4090 + }, 1.4091 + lineEnd: lineEnd, 1.4092 + polygonStart: function() { 1.4093 + stream.lineEnd = lineEndPolygon; 1.4094 + }, 1.4095 + polygonEnd: function() { 1.4096 + stream.lineEnd = lineEnd; 1.4097 + stream.point = point; 1.4098 + }, 1.4099 + pointRadius: function(_) { 1.4100 + pointRadius = _; 1.4101 + return stream; 1.4102 + }, 1.4103 + result: d3_noop 1.4104 + }; 1.4105 + function point(x, y) { 1.4106 + context.moveTo(x + pointRadius, y); 1.4107 + context.arc(x, y, pointRadius, 0, τ); 1.4108 + } 1.4109 + function pointLineStart(x, y) { 1.4110 + context.moveTo(x, y); 1.4111 + stream.point = pointLine; 1.4112 + } 1.4113 + function pointLine(x, y) { 1.4114 + context.lineTo(x, y); 1.4115 + } 1.4116 + function lineEnd() { 1.4117 + stream.point = point; 1.4118 + } 1.4119 + function lineEndPolygon() { 1.4120 + context.closePath(); 1.4121 + } 1.4122 + return stream; 1.4123 + } 1.4124 + function d3_geo_resample(project) { 1.4125 + var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16; 1.4126 + function resample(stream) { 1.4127 + return (maxDepth ? resampleRecursive : resampleNone)(stream); 1.4128 + } 1.4129 + function resampleNone(stream) { 1.4130 + return d3_geo_transformPoint(stream, function(x, y) { 1.4131 + x = project(x, y); 1.4132 + stream.point(x[0], x[1]); 1.4133 + }); 1.4134 + } 1.4135 + function resampleRecursive(stream) { 1.4136 + var λ00, φ00, x00, y00, a00, b00, c00, λ0, x0, y0, a0, b0, c0; 1.4137 + var resample = { 1.4138 + point: point, 1.4139 + lineStart: lineStart, 1.4140 + lineEnd: lineEnd, 1.4141 + polygonStart: function() { 1.4142 + stream.polygonStart(); 1.4143 + resample.lineStart = ringStart; 1.4144 + }, 1.4145 + polygonEnd: function() { 1.4146 + stream.polygonEnd(); 1.4147 + resample.lineStart = lineStart; 1.4148 + } 1.4149 + }; 1.4150 + function point(x, y) { 1.4151 + x = project(x, y); 1.4152 + stream.point(x[0], x[1]); 1.4153 + } 1.4154 + function lineStart() { 1.4155 + x0 = NaN; 1.4156 + resample.point = linePoint; 1.4157 + stream.lineStart(); 1.4158 + } 1.4159 + function linePoint(λ, φ) { 1.4160 + var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ); 1.4161 + 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.4162 + stream.point(x0, y0); 1.4163 + } 1.4164 + function lineEnd() { 1.4165 + resample.point = point; 1.4166 + stream.lineEnd(); 1.4167 + } 1.4168 + function ringStart() { 1.4169 + lineStart(); 1.4170 + resample.point = ringPoint; 1.4171 + resample.lineEnd = ringEnd; 1.4172 + } 1.4173 + function ringPoint(λ, φ) { 1.4174 + linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; 1.4175 + resample.point = linePoint; 1.4176 + } 1.4177 + function ringEnd() { 1.4178 + resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream); 1.4179 + resample.lineEnd = lineEnd; 1.4180 + lineEnd(); 1.4181 + } 1.4182 + return resample; 1.4183 + } 1.4184 + function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) { 1.4185 + var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy; 1.4186 + if (d2 > 4 * δ2 && depth--) { 1.4187 + 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.4188 + if (dz * dz / d2 > δ2 || abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { 1.4189 + resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream); 1.4190 + stream.point(x2, y2); 1.4191 + resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream); 1.4192 + } 1.4193 + } 1.4194 + } 1.4195 + resample.precision = function(_) { 1.4196 + if (!arguments.length) return Math.sqrt(δ2); 1.4197 + maxDepth = (δ2 = _ * _) > 0 && 16; 1.4198 + return resample; 1.4199 + }; 1.4200 + return resample; 1.4201 + } 1.4202 + d3.geo.path = function() { 1.4203 + var pointRadius = 4.5, projection, context, projectStream, contextStream, cacheStream; 1.4204 + function path(object) { 1.4205 + if (object) { 1.4206 + if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); 1.4207 + if (!cacheStream || !cacheStream.valid) cacheStream = projectStream(contextStream); 1.4208 + d3.geo.stream(object, cacheStream); 1.4209 + } 1.4210 + return contextStream.result(); 1.4211 + } 1.4212 + path.area = function(object) { 1.4213 + d3_geo_pathAreaSum = 0; 1.4214 + d3.geo.stream(object, projectStream(d3_geo_pathArea)); 1.4215 + return d3_geo_pathAreaSum; 1.4216 + }; 1.4217 + path.centroid = function(object) { 1.4218 + 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.4219 + d3.geo.stream(object, projectStream(d3_geo_pathCentroid)); 1.4220 + 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.4221 + }; 1.4222 + path.bounds = function(object) { 1.4223 + d3_geo_pathBoundsX1 = d3_geo_pathBoundsY1 = -(d3_geo_pathBoundsX0 = d3_geo_pathBoundsY0 = Infinity); 1.4224 + d3.geo.stream(object, projectStream(d3_geo_pathBounds)); 1.4225 + return [ [ d3_geo_pathBoundsX0, d3_geo_pathBoundsY0 ], [ d3_geo_pathBoundsX1, d3_geo_pathBoundsY1 ] ]; 1.4226 + }; 1.4227 + path.projection = function(_) { 1.4228 + if (!arguments.length) return projection; 1.4229 + projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity; 1.4230 + return reset(); 1.4231 + }; 1.4232 + path.context = function(_) { 1.4233 + if (!arguments.length) return context; 1.4234 + contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_); 1.4235 + if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); 1.4236 + return reset(); 1.4237 + }; 1.4238 + path.pointRadius = function(_) { 1.4239 + if (!arguments.length) return pointRadius; 1.4240 + pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); 1.4241 + return path; 1.4242 + }; 1.4243 + function reset() { 1.4244 + cacheStream = null; 1.4245 + return path; 1.4246 + } 1.4247 + return path.projection(d3.geo.albersUsa()).context(null); 1.4248 + }; 1.4249 + function d3_geo_pathProjectStream(project) { 1.4250 + var resample = d3_geo_resample(function(x, y) { 1.4251 + return project([ x * d3_degrees, y * d3_degrees ]); 1.4252 + }); 1.4253 + return function(stream) { 1.4254 + return d3_geo_projectionRadians(resample(stream)); 1.4255 + }; 1.4256 + } 1.4257 + d3.geo.transform = function(methods) { 1.4258 + return { 1.4259 + stream: function(stream) { 1.4260 + var transform = new d3_geo_transform(stream); 1.4261 + for (var k in methods) transform[k] = methods[k]; 1.4262 + return transform; 1.4263 + } 1.4264 + }; 1.4265 + }; 1.4266 + function d3_geo_transform(stream) { 1.4267 + this.stream = stream; 1.4268 + } 1.4269 + d3_geo_transform.prototype = { 1.4270 + point: function(x, y) { 1.4271 + this.stream.point(x, y); 1.4272 + }, 1.4273 + sphere: function() { 1.4274 + this.stream.sphere(); 1.4275 + }, 1.4276 + lineStart: function() { 1.4277 + this.stream.lineStart(); 1.4278 + }, 1.4279 + lineEnd: function() { 1.4280 + this.stream.lineEnd(); 1.4281 + }, 1.4282 + polygonStart: function() { 1.4283 + this.stream.polygonStart(); 1.4284 + }, 1.4285 + polygonEnd: function() { 1.4286 + this.stream.polygonEnd(); 1.4287 + } 1.4288 + }; 1.4289 + function d3_geo_transformPoint(stream, point) { 1.4290 + return { 1.4291 + point: point, 1.4292 + sphere: function() { 1.4293 + stream.sphere(); 1.4294 + }, 1.4295 + lineStart: function() { 1.4296 + stream.lineStart(); 1.4297 + }, 1.4298 + lineEnd: function() { 1.4299 + stream.lineEnd(); 1.4300 + }, 1.4301 + polygonStart: function() { 1.4302 + stream.polygonStart(); 1.4303 + }, 1.4304 + polygonEnd: function() { 1.4305 + stream.polygonEnd(); 1.4306 + } 1.4307 + }; 1.4308 + } 1.4309 + d3.geo.projection = d3_geo_projection; 1.4310 + d3.geo.projectionMutator = d3_geo_projectionMutator; 1.4311 + function d3_geo_projection(project) { 1.4312 + return d3_geo_projectionMutator(function() { 1.4313 + return project; 1.4314 + })(); 1.4315 + } 1.4316 + function d3_geo_projectionMutator(projectAt) { 1.4317 + var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) { 1.4318 + x = project(x, y); 1.4319 + return [ x[0] * k + δx, δy - x[1] * k ]; 1.4320 + }), 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.4321 + function projection(point) { 1.4322 + point = projectRotate(point[0] * d3_radians, point[1] * d3_radians); 1.4323 + return [ point[0] * k + δx, δy - point[1] * k ]; 1.4324 + } 1.4325 + function invert(point) { 1.4326 + point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k); 1.4327 + return point && [ point[0] * d3_degrees, point[1] * d3_degrees ]; 1.4328 + } 1.4329 + projection.stream = function(output) { 1.4330 + if (stream) stream.valid = false; 1.4331 + stream = d3_geo_projectionRadians(preclip(rotate, projectResample(postclip(output)))); 1.4332 + stream.valid = true; 1.4333 + return stream; 1.4334 + }; 1.4335 + projection.clipAngle = function(_) { 1.4336 + if (!arguments.length) return clipAngle; 1.4337 + preclip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle((clipAngle = +_) * d3_radians); 1.4338 + return invalidate(); 1.4339 + }; 1.4340 + projection.clipExtent = function(_) { 1.4341 + if (!arguments.length) return clipExtent; 1.4342 + clipExtent = _; 1.4343 + postclip = _ ? d3_geo_clipExtent(_[0][0], _[0][1], _[1][0], _[1][1]) : d3_identity; 1.4344 + return invalidate(); 1.4345 + }; 1.4346 + projection.scale = function(_) { 1.4347 + if (!arguments.length) return k; 1.4348 + k = +_; 1.4349 + return reset(); 1.4350 + }; 1.4351 + projection.translate = function(_) { 1.4352 + if (!arguments.length) return [ x, y ]; 1.4353 + x = +_[0]; 1.4354 + y = +_[1]; 1.4355 + return reset(); 1.4356 + }; 1.4357 + projection.center = function(_) { 1.4358 + if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ]; 1.4359 + λ = _[0] % 360 * d3_radians; 1.4360 + φ = _[1] % 360 * d3_radians; 1.4361 + return reset(); 1.4362 + }; 1.4363 + projection.rotate = function(_) { 1.4364 + if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ]; 1.4365 + δλ = _[0] % 360 * d3_radians; 1.4366 + δφ = _[1] % 360 * d3_radians; 1.4367 + δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0; 1.4368 + return reset(); 1.4369 + }; 1.4370 + d3.rebind(projection, projectResample, "precision"); 1.4371 + function reset() { 1.4372 + projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project); 1.4373 + var center = project(λ, φ); 1.4374 + δx = x - center[0] * k; 1.4375 + δy = y + center[1] * k; 1.4376 + return invalidate(); 1.4377 + } 1.4378 + function invalidate() { 1.4379 + if (stream) stream.valid = false, stream = null; 1.4380 + return projection; 1.4381 + } 1.4382 + return function() { 1.4383 + project = projectAt.apply(this, arguments); 1.4384 + projection.invert = project.invert && invert; 1.4385 + return reset(); 1.4386 + }; 1.4387 + } 1.4388 + function d3_geo_projectionRadians(stream) { 1.4389 + return d3_geo_transformPoint(stream, function(x, y) { 1.4390 + stream.point(x * d3_radians, y * d3_radians); 1.4391 + }); 1.4392 + } 1.4393 + function d3_geo_equirectangular(λ, φ) { 1.4394 + return [ λ, φ ]; 1.4395 + } 1.4396 + (d3.geo.equirectangular = function() { 1.4397 + return d3_geo_projection(d3_geo_equirectangular); 1.4398 + }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular; 1.4399 + d3.geo.rotation = function(rotate) { 1.4400 + rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0); 1.4401 + function forward(coordinates) { 1.4402 + coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians); 1.4403 + return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; 1.4404 + } 1.4405 + forward.invert = function(coordinates) { 1.4406 + coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians); 1.4407 + return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; 1.4408 + }; 1.4409 + return forward; 1.4410 + }; 1.4411 + function d3_geo_identityRotation(λ, φ) { 1.4412 + return [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ]; 1.4413 + } 1.4414 + d3_geo_identityRotation.invert = d3_geo_equirectangular; 1.4415 + function d3_geo_rotation(δλ, δφ, δγ) { 1.4416 + return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_identityRotation; 1.4417 + } 1.4418 + function d3_geo_forwardRotationλ(δλ) { 1.4419 + return function(λ, φ) { 1.4420 + return λ += δλ, [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ]; 1.4421 + }; 1.4422 + } 1.4423 + function d3_geo_rotationλ(δλ) { 1.4424 + var rotation = d3_geo_forwardRotationλ(δλ); 1.4425 + rotation.invert = d3_geo_forwardRotationλ(-δλ); 1.4426 + return rotation; 1.4427 + } 1.4428 + function d3_geo_rotationφγ(δφ, δγ) { 1.4429 + var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ); 1.4430 + function rotation(λ, φ) { 1.4431 + var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ; 1.4432 + return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), d3_asin(k * cosδγ + y * sinδγ) ]; 1.4433 + } 1.4434 + rotation.invert = function(λ, φ) { 1.4435 + var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ; 1.4436 + return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), d3_asin(k * cosδφ - x * sinδφ) ]; 1.4437 + }; 1.4438 + return rotation; 1.4439 + } 1.4440 + d3.geo.circle = function() { 1.4441 + var origin = [ 0, 0 ], angle, precision = 6, interpolate; 1.4442 + function circle() { 1.4443 + 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.4444 + interpolate(null, null, 1, { 1.4445 + point: function(x, y) { 1.4446 + ring.push(x = rotate(x, y)); 1.4447 + x[0] *= d3_degrees, x[1] *= d3_degrees; 1.4448 + } 1.4449 + }); 1.4450 + return { 1.4451 + type: "Polygon", 1.4452 + coordinates: [ ring ] 1.4453 + }; 1.4454 + } 1.4455 + circle.origin = function(x) { 1.4456 + if (!arguments.length) return origin; 1.4457 + origin = x; 1.4458 + return circle; 1.4459 + }; 1.4460 + circle.angle = function(x) { 1.4461 + if (!arguments.length) return angle; 1.4462 + interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians); 1.4463 + return circle; 1.4464 + }; 1.4465 + circle.precision = function(_) { 1.4466 + if (!arguments.length) return precision; 1.4467 + interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians); 1.4468 + return circle; 1.4469 + }; 1.4470 + return circle.angle(90); 1.4471 + }; 1.4472 + function d3_geo_circleInterpolate(radius, precision) { 1.4473 + var cr = Math.cos(radius), sr = Math.sin(radius); 1.4474 + return function(from, to, direction, listener) { 1.4475 + var step = direction * precision; 1.4476 + if (from != null) { 1.4477 + from = d3_geo_circleAngle(cr, from); 1.4478 + to = d3_geo_circleAngle(cr, to); 1.4479 + if (direction > 0 ? from < to : from > to) from += direction * τ; 1.4480 + } else { 1.4481 + from = radius + direction * τ; 1.4482 + to = radius - .5 * step; 1.4483 + } 1.4484 + for (var point, t = from; direction > 0 ? t > to : t < to; t -= step) { 1.4485 + listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]); 1.4486 + } 1.4487 + }; 1.4488 + } 1.4489 + function d3_geo_circleAngle(cr, point) { 1.4490 + var a = d3_geo_cartesian(point); 1.4491 + a[0] -= cr; 1.4492 + d3_geo_cartesianNormalize(a); 1.4493 + var angle = d3_acos(-a[1]); 1.4494 + return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI); 1.4495 + } 1.4496 + d3.geo.distance = function(a, b) { 1.4497 + 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.4498 + 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.4499 + }; 1.4500 + d3.geo.graticule = function() { 1.4501 + 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.4502 + function graticule() { 1.4503 + return { 1.4504 + type: "MultiLineString", 1.4505 + coordinates: lines() 1.4506 + }; 1.4507 + } 1.4508 + function lines() { 1.4509 + 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.4510 + return abs(x % DX) > ε; 1.4511 + }).map(x)).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).filter(function(y) { 1.4512 + return abs(y % DY) > ε; 1.4513 + }).map(y)); 1.4514 + } 1.4515 + graticule.lines = function() { 1.4516 + return lines().map(function(coordinates) { 1.4517 + return { 1.4518 + type: "LineString", 1.4519 + coordinates: coordinates 1.4520 + }; 1.4521 + }); 1.4522 + }; 1.4523 + graticule.outline = function() { 1.4524 + return { 1.4525 + type: "Polygon", 1.4526 + coordinates: [ X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ] 1.4527 + }; 1.4528 + }; 1.4529 + graticule.extent = function(_) { 1.4530 + if (!arguments.length) return graticule.minorExtent(); 1.4531 + return graticule.majorExtent(_).minorExtent(_); 1.4532 + }; 1.4533 + graticule.majorExtent = function(_) { 1.4534 + if (!arguments.length) return [ [ X0, Y0 ], [ X1, Y1 ] ]; 1.4535 + X0 = +_[0][0], X1 = +_[1][0]; 1.4536 + Y0 = +_[0][1], Y1 = +_[1][1]; 1.4537 + if (X0 > X1) _ = X0, X0 = X1, X1 = _; 1.4538 + if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; 1.4539 + return graticule.precision(precision); 1.4540 + }; 1.4541 + graticule.minorExtent = function(_) { 1.4542 + if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; 1.4543 + x0 = +_[0][0], x1 = +_[1][0]; 1.4544 + y0 = +_[0][1], y1 = +_[1][1]; 1.4545 + if (x0 > x1) _ = x0, x0 = x1, x1 = _; 1.4546 + if (y0 > y1) _ = y0, y0 = y1, y1 = _; 1.4547 + return graticule.precision(precision); 1.4548 + }; 1.4549 + graticule.step = function(_) { 1.4550 + if (!arguments.length) return graticule.minorStep(); 1.4551 + return graticule.majorStep(_).minorStep(_); 1.4552 + }; 1.4553 + graticule.majorStep = function(_) { 1.4554 + if (!arguments.length) return [ DX, DY ]; 1.4555 + DX = +_[0], DY = +_[1]; 1.4556 + return graticule; 1.4557 + }; 1.4558 + graticule.minorStep = function(_) { 1.4559 + if (!arguments.length) return [ dx, dy ]; 1.4560 + dx = +_[0], dy = +_[1]; 1.4561 + return graticule; 1.4562 + }; 1.4563 + graticule.precision = function(_) { 1.4564 + if (!arguments.length) return precision; 1.4565 + precision = +_; 1.4566 + x = d3_geo_graticuleX(y0, y1, 90); 1.4567 + y = d3_geo_graticuleY(x0, x1, precision); 1.4568 + X = d3_geo_graticuleX(Y0, Y1, 90); 1.4569 + Y = d3_geo_graticuleY(X0, X1, precision); 1.4570 + return graticule; 1.4571 + }; 1.4572 + return graticule.majorExtent([ [ -180, -90 + ε ], [ 180, 90 - ε ] ]).minorExtent([ [ -180, -80 - ε ], [ 180, 80 + ε ] ]); 1.4573 + }; 1.4574 + function d3_geo_graticuleX(y0, y1, dy) { 1.4575 + var y = d3.range(y0, y1 - ε, dy).concat(y1); 1.4576 + return function(x) { 1.4577 + return y.map(function(y) { 1.4578 + return [ x, y ]; 1.4579 + }); 1.4580 + }; 1.4581 + } 1.4582 + function d3_geo_graticuleY(x0, x1, dx) { 1.4583 + var x = d3.range(x0, x1 - ε, dx).concat(x1); 1.4584 + return function(y) { 1.4585 + return x.map(function(x) { 1.4586 + return [ x, y ]; 1.4587 + }); 1.4588 + }; 1.4589 + } 1.4590 + function d3_source(d) { 1.4591 + return d.source; 1.4592 + } 1.4593 + function d3_target(d) { 1.4594 + return d.target; 1.4595 + } 1.4596 + d3.geo.greatArc = function() { 1.4597 + var source = d3_source, source_, target = d3_target, target_; 1.4598 + function greatArc() { 1.4599 + return { 1.4600 + type: "LineString", 1.4601 + coordinates: [ source_ || source.apply(this, arguments), target_ || target.apply(this, arguments) ] 1.4602 + }; 1.4603 + } 1.4604 + greatArc.distance = function() { 1.4605 + return d3.geo.distance(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments)); 1.4606 + }; 1.4607 + greatArc.source = function(_) { 1.4608 + if (!arguments.length) return source; 1.4609 + source = _, source_ = typeof _ === "function" ? null : _; 1.4610 + return greatArc; 1.4611 + }; 1.4612 + greatArc.target = function(_) { 1.4613 + if (!arguments.length) return target; 1.4614 + target = _, target_ = typeof _ === "function" ? null : _; 1.4615 + return greatArc; 1.4616 + }; 1.4617 + greatArc.precision = function() { 1.4618 + return arguments.length ? greatArc : 0; 1.4619 + }; 1.4620 + return greatArc; 1.4621 + }; 1.4622 + d3.geo.interpolate = function(source, target) { 1.4623 + return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians); 1.4624 + }; 1.4625 + function d3_geo_interpolate(x0, y0, x1, y1) { 1.4626 + 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.4627 + var interpolate = d ? function(t) { 1.4628 + 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.4629 + return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ]; 1.4630 + } : function() { 1.4631 + return [ x0 * d3_degrees, y0 * d3_degrees ]; 1.4632 + }; 1.4633 + interpolate.distance = d; 1.4634 + return interpolate; 1.4635 + } 1.4636 + d3.geo.length = function(object) { 1.4637 + d3_geo_lengthSum = 0; 1.4638 + d3.geo.stream(object, d3_geo_length); 1.4639 + return d3_geo_lengthSum; 1.4640 + }; 1.4641 + var d3_geo_lengthSum; 1.4642 + var d3_geo_length = { 1.4643 + sphere: d3_noop, 1.4644 + point: d3_noop, 1.4645 + lineStart: d3_geo_lengthLineStart, 1.4646 + lineEnd: d3_noop, 1.4647 + polygonStart: d3_noop, 1.4648 + polygonEnd: d3_noop 1.4649 + }; 1.4650 + function d3_geo_lengthLineStart() { 1.4651 + var λ0, sinφ0, cosφ0; 1.4652 + d3_geo_length.point = function(λ, φ) { 1.4653 + λ0 = λ * d3_radians, sinφ0 = Math.sin(φ *= d3_radians), cosφ0 = Math.cos(φ); 1.4654 + d3_geo_length.point = nextPoint; 1.4655 + }; 1.4656 + d3_geo_length.lineEnd = function() { 1.4657 + d3_geo_length.point = d3_geo_length.lineEnd = d3_noop; 1.4658 + }; 1.4659 + function nextPoint(λ, φ) { 1.4660 + var sinφ = Math.sin(φ *= d3_radians), cosφ = Math.cos(φ), t = abs((λ *= d3_radians) - λ0), cosΔλ = Math.cos(t); 1.4661 + 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.4662 + λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ; 1.4663 + } 1.4664 + } 1.4665 + function d3_geo_azimuthal(scale, angle) { 1.4666 + function azimuthal(λ, φ) { 1.4667 + var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ); 1.4668 + return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ]; 1.4669 + } 1.4670 + azimuthal.invert = function(x, y) { 1.4671 + var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c); 1.4672 + return [ Math.atan2(x * sinc, ρ * cosc), Math.asin(ρ && y * sinc / ρ) ]; 1.4673 + }; 1.4674 + return azimuthal; 1.4675 + } 1.4676 + var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) { 1.4677 + return Math.sqrt(2 / (1 + cosλcosφ)); 1.4678 + }, function(ρ) { 1.4679 + return 2 * Math.asin(ρ / 2); 1.4680 + }); 1.4681 + (d3.geo.azimuthalEqualArea = function() { 1.4682 + return d3_geo_projection(d3_geo_azimuthalEqualArea); 1.4683 + }).raw = d3_geo_azimuthalEqualArea; 1.4684 + var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) { 1.4685 + var c = Math.acos(cosλcosφ); 1.4686 + return c && c / Math.sin(c); 1.4687 + }, d3_identity); 1.4688 + (d3.geo.azimuthalEquidistant = function() { 1.4689 + return d3_geo_projection(d3_geo_azimuthalEquidistant); 1.4690 + }).raw = d3_geo_azimuthalEquidistant; 1.4691 + function d3_geo_conicConformal(φ0, φ1) { 1.4692 + var cosφ0 = Math.cos(φ0), t = function(φ) { 1.4693 + return Math.tan(π / 4 + φ / 2); 1.4694 + }, 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.4695 + if (!n) return d3_geo_mercator; 1.4696 + function forward(λ, φ) { 1.4697 + if (F > 0) { 1.4698 + if (φ < -halfπ + ε) φ = -halfπ + ε; 1.4699 + } else { 1.4700 + if (φ > halfπ - ε) φ = halfπ - ε; 1.4701 + } 1.4702 + var ρ = F / Math.pow(t(φ), n); 1.4703 + return [ ρ * Math.sin(n * λ), F - ρ * Math.cos(n * λ) ]; 1.4704 + } 1.4705 + forward.invert = function(x, y) { 1.4706 + var ρ0_y = F - y, ρ = d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y); 1.4707 + return [ Math.atan2(x, ρ0_y) / n, 2 * Math.atan(Math.pow(F / ρ, 1 / n)) - halfπ ]; 1.4708 + }; 1.4709 + return forward; 1.4710 + } 1.4711 + (d3.geo.conicConformal = function() { 1.4712 + return d3_geo_conic(d3_geo_conicConformal); 1.4713 + }).raw = d3_geo_conicConformal; 1.4714 + function d3_geo_conicEquidistant(φ0, φ1) { 1.4715 + 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.4716 + if (abs(n) < ε) return d3_geo_equirectangular; 1.4717 + function forward(λ, φ) { 1.4718 + var ρ = G - φ; 1.4719 + return [ ρ * Math.sin(n * λ), G - ρ * Math.cos(n * λ) ]; 1.4720 + } 1.4721 + forward.invert = function(x, y) { 1.4722 + var ρ0_y = G - y; 1.4723 + return [ Math.atan2(x, ρ0_y) / n, G - d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y) ]; 1.4724 + }; 1.4725 + return forward; 1.4726 + } 1.4727 + (d3.geo.conicEquidistant = function() { 1.4728 + return d3_geo_conic(d3_geo_conicEquidistant); 1.4729 + }).raw = d3_geo_conicEquidistant; 1.4730 + var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) { 1.4731 + return 1 / cosλcosφ; 1.4732 + }, Math.atan); 1.4733 + (d3.geo.gnomonic = function() { 1.4734 + return d3_geo_projection(d3_geo_gnomonic); 1.4735 + }).raw = d3_geo_gnomonic; 1.4736 + function d3_geo_mercator(λ, φ) { 1.4737 + return [ λ, Math.log(Math.tan(π / 4 + φ / 2)) ]; 1.4738 + } 1.4739 + d3_geo_mercator.invert = function(x, y) { 1.4740 + return [ x, 2 * Math.atan(Math.exp(y)) - halfπ ]; 1.4741 + }; 1.4742 + function d3_geo_mercatorProjection(project) { 1.4743 + var m = d3_geo_projection(project), scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, clipAuto; 1.4744 + m.scale = function() { 1.4745 + var v = scale.apply(m, arguments); 1.4746 + return v === m ? clipAuto ? m.clipExtent(null) : m : v; 1.4747 + }; 1.4748 + m.translate = function() { 1.4749 + var v = translate.apply(m, arguments); 1.4750 + return v === m ? clipAuto ? m.clipExtent(null) : m : v; 1.4751 + }; 1.4752 + m.clipExtent = function(_) { 1.4753 + var v = clipExtent.apply(m, arguments); 1.4754 + if (v === m) { 1.4755 + if (clipAuto = _ == null) { 1.4756 + var k = π * scale(), t = translate(); 1.4757 + clipExtent([ [ t[0] - k, t[1] - k ], [ t[0] + k, t[1] + k ] ]); 1.4758 + } 1.4759 + } else if (clipAuto) { 1.4760 + v = null; 1.4761 + } 1.4762 + return v; 1.4763 + }; 1.4764 + return m.clipExtent(null); 1.4765 + } 1.4766 + (d3.geo.mercator = function() { 1.4767 + return d3_geo_mercatorProjection(d3_geo_mercator); 1.4768 + }).raw = d3_geo_mercator; 1.4769 + var d3_geo_orthographic = d3_geo_azimuthal(function() { 1.4770 + return 1; 1.4771 + }, Math.asin); 1.4772 + (d3.geo.orthographic = function() { 1.4773 + return d3_geo_projection(d3_geo_orthographic); 1.4774 + }).raw = d3_geo_orthographic; 1.4775 + var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) { 1.4776 + return 1 / (1 + cosλcosφ); 1.4777 + }, function(ρ) { 1.4778 + return 2 * Math.atan(ρ); 1.4779 + }); 1.4780 + (d3.geo.stereographic = function() { 1.4781 + return d3_geo_projection(d3_geo_stereographic); 1.4782 + }).raw = d3_geo_stereographic; 1.4783 + function d3_geo_transverseMercator(λ, φ) { 1.4784 + return [ Math.log(Math.tan(π / 4 + φ / 2)), -λ ]; 1.4785 + } 1.4786 + d3_geo_transverseMercator.invert = function(x, y) { 1.4787 + return [ -y, 2 * Math.atan(Math.exp(x)) - halfπ ]; 1.4788 + }; 1.4789 + (d3.geo.transverseMercator = function() { 1.4790 + var projection = d3_geo_mercatorProjection(d3_geo_transverseMercator), center = projection.center, rotate = projection.rotate; 1.4791 + projection.center = function(_) { 1.4792 + return _ ? center([ -_[1], _[0] ]) : (_ = center(), [ _[1], -_[0] ]); 1.4793 + }; 1.4794 + projection.rotate = function(_) { 1.4795 + return _ ? rotate([ _[0], _[1], _.length > 2 ? _[2] + 90 : 90 ]) : (_ = rotate(), 1.4796 + [ _[0], _[1], _[2] - 90 ]); 1.4797 + }; 1.4798 + return rotate([ 0, 0, 90 ]); 1.4799 + }).raw = d3_geo_transverseMercator; 1.4800 + d3.geom = {}; 1.4801 + function d3_geom_pointX(d) { 1.4802 + return d[0]; 1.4803 + } 1.4804 + function d3_geom_pointY(d) { 1.4805 + return d[1]; 1.4806 + } 1.4807 + d3.geom.hull = function(vertices) { 1.4808 + var x = d3_geom_pointX, y = d3_geom_pointY; 1.4809 + if (arguments.length) return hull(vertices); 1.4810 + function hull(data) { 1.4811 + if (data.length < 3) return []; 1.4812 + var fx = d3_functor(x), fy = d3_functor(y), i, n = data.length, points = [], flippedPoints = []; 1.4813 + for (i = 0; i < n; i++) { 1.4814 + points.push([ +fx.call(this, data[i], i), +fy.call(this, data[i], i), i ]); 1.4815 + } 1.4816 + points.sort(d3_geom_hullOrder); 1.4817 + for (i = 0; i < n; i++) flippedPoints.push([ points[i][0], -points[i][1] ]); 1.4818 + var upper = d3_geom_hullUpper(points), lower = d3_geom_hullUpper(flippedPoints); 1.4819 + var skipLeft = lower[0] === upper[0], skipRight = lower[lower.length - 1] === upper[upper.length - 1], polygon = []; 1.4820 + for (i = upper.length - 1; i >= 0; --i) polygon.push(data[points[upper[i]][2]]); 1.4821 + for (i = +skipLeft; i < lower.length - skipRight; ++i) polygon.push(data[points[lower[i]][2]]); 1.4822 + return polygon; 1.4823 + } 1.4824 + hull.x = function(_) { 1.4825 + return arguments.length ? (x = _, hull) : x; 1.4826 + }; 1.4827 + hull.y = function(_) { 1.4828 + return arguments.length ? (y = _, hull) : y; 1.4829 + }; 1.4830 + return hull; 1.4831 + }; 1.4832 + function d3_geom_hullUpper(points) { 1.4833 + var n = points.length, hull = [ 0, 1 ], hs = 2; 1.4834 + for (var i = 2; i < n; i++) { 1.4835 + while (hs > 1 && d3_cross2d(points[hull[hs - 2]], points[hull[hs - 1]], points[i]) <= 0) --hs; 1.4836 + hull[hs++] = i; 1.4837 + } 1.4838 + return hull.slice(0, hs); 1.4839 + } 1.4840 + function d3_geom_hullOrder(a, b) { 1.4841 + return a[0] - b[0] || a[1] - b[1]; 1.4842 + } 1.4843 + d3.geom.polygon = function(coordinates) { 1.4844 + d3_subclass(coordinates, d3_geom_polygonPrototype); 1.4845 + return coordinates; 1.4846 + }; 1.4847 + var d3_geom_polygonPrototype = d3.geom.polygon.prototype = []; 1.4848 + d3_geom_polygonPrototype.area = function() { 1.4849 + var i = -1, n = this.length, a, b = this[n - 1], area = 0; 1.4850 + while (++i < n) { 1.4851 + a = b; 1.4852 + b = this[i]; 1.4853 + area += a[1] * b[0] - a[0] * b[1]; 1.4854 + } 1.4855 + return area * .5; 1.4856 + }; 1.4857 + d3_geom_polygonPrototype.centroid = function(k) { 1.4858 + var i = -1, n = this.length, x = 0, y = 0, a, b = this[n - 1], c; 1.4859 + if (!arguments.length) k = -1 / (6 * this.area()); 1.4860 + while (++i < n) { 1.4861 + a = b; 1.4862 + b = this[i]; 1.4863 + c = a[0] * b[1] - b[0] * a[1]; 1.4864 + x += (a[0] + b[0]) * c; 1.4865 + y += (a[1] + b[1]) * c; 1.4866 + } 1.4867 + return [ x * k, y * k ]; 1.4868 + }; 1.4869 + d3_geom_polygonPrototype.clip = function(subject) { 1.4870 + 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.4871 + while (++i < n) { 1.4872 + input = subject.slice(); 1.4873 + subject.length = 0; 1.4874 + b = this[i]; 1.4875 + c = input[(m = input.length - closed) - 1]; 1.4876 + j = -1; 1.4877 + while (++j < m) { 1.4878 + d = input[j]; 1.4879 + if (d3_geom_polygonInside(d, a, b)) { 1.4880 + if (!d3_geom_polygonInside(c, a, b)) { 1.4881 + subject.push(d3_geom_polygonIntersect(c, d, a, b)); 1.4882 + } 1.4883 + subject.push(d); 1.4884 + } else if (d3_geom_polygonInside(c, a, b)) { 1.4885 + subject.push(d3_geom_polygonIntersect(c, d, a, b)); 1.4886 + } 1.4887 + c = d; 1.4888 + } 1.4889 + if (closed) subject.push(subject[0]); 1.4890 + a = b; 1.4891 + } 1.4892 + return subject; 1.4893 + }; 1.4894 + function d3_geom_polygonInside(p, a, b) { 1.4895 + return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); 1.4896 + } 1.4897 + function d3_geom_polygonIntersect(c, d, a, b) { 1.4898 + 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.4899 + return [ x1 + ua * x21, y1 + ua * y21 ]; 1.4900 + } 1.4901 + function d3_geom_polygonClosed(coordinates) { 1.4902 + var a = coordinates[0], b = coordinates[coordinates.length - 1]; 1.4903 + return !(a[0] - b[0] || a[1] - b[1]); 1.4904 + } 1.4905 + var d3_geom_voronoiEdges, d3_geom_voronoiCells, d3_geom_voronoiBeaches, d3_geom_voronoiBeachPool = [], d3_geom_voronoiFirstCircle, d3_geom_voronoiCircles, d3_geom_voronoiCirclePool = []; 1.4906 + function d3_geom_voronoiBeach() { 1.4907 + d3_geom_voronoiRedBlackNode(this); 1.4908 + this.edge = this.site = this.circle = null; 1.4909 + } 1.4910 + function d3_geom_voronoiCreateBeach(site) { 1.4911 + var beach = d3_geom_voronoiBeachPool.pop() || new d3_geom_voronoiBeach(); 1.4912 + beach.site = site; 1.4913 + return beach; 1.4914 + } 1.4915 + function d3_geom_voronoiDetachBeach(beach) { 1.4916 + d3_geom_voronoiDetachCircle(beach); 1.4917 + d3_geom_voronoiBeaches.remove(beach); 1.4918 + d3_geom_voronoiBeachPool.push(beach); 1.4919 + d3_geom_voronoiRedBlackNode(beach); 1.4920 + } 1.4921 + function d3_geom_voronoiRemoveBeach(beach) { 1.4922 + var circle = beach.circle, x = circle.x, y = circle.cy, vertex = { 1.4923 + x: x, 1.4924 + y: y 1.4925 + }, previous = beach.P, next = beach.N, disappearing = [ beach ]; 1.4926 + d3_geom_voronoiDetachBeach(beach); 1.4927 + var lArc = previous; 1.4928 + while (lArc.circle && abs(x - lArc.circle.x) < ε && abs(y - lArc.circle.cy) < ε) { 1.4929 + previous = lArc.P; 1.4930 + disappearing.unshift(lArc); 1.4931 + d3_geom_voronoiDetachBeach(lArc); 1.4932 + lArc = previous; 1.4933 + } 1.4934 + disappearing.unshift(lArc); 1.4935 + d3_geom_voronoiDetachCircle(lArc); 1.4936 + var rArc = next; 1.4937 + while (rArc.circle && abs(x - rArc.circle.x) < ε && abs(y - rArc.circle.cy) < ε) { 1.4938 + next = rArc.N; 1.4939 + disappearing.push(rArc); 1.4940 + d3_geom_voronoiDetachBeach(rArc); 1.4941 + rArc = next; 1.4942 + } 1.4943 + disappearing.push(rArc); 1.4944 + d3_geom_voronoiDetachCircle(rArc); 1.4945 + var nArcs = disappearing.length, iArc; 1.4946 + for (iArc = 1; iArc < nArcs; ++iArc) { 1.4947 + rArc = disappearing[iArc]; 1.4948 + lArc = disappearing[iArc - 1]; 1.4949 + d3_geom_voronoiSetEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex); 1.4950 + } 1.4951 + lArc = disappearing[0]; 1.4952 + rArc = disappearing[nArcs - 1]; 1.4953 + rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, rArc.site, null, vertex); 1.4954 + d3_geom_voronoiAttachCircle(lArc); 1.4955 + d3_geom_voronoiAttachCircle(rArc); 1.4956 + } 1.4957 + function d3_geom_voronoiAddBeach(site) { 1.4958 + var x = site.x, directrix = site.y, lArc, rArc, dxl, dxr, node = d3_geom_voronoiBeaches._; 1.4959 + while (node) { 1.4960 + dxl = d3_geom_voronoiLeftBreakPoint(node, directrix) - x; 1.4961 + if (dxl > ε) node = node.L; else { 1.4962 + dxr = x - d3_geom_voronoiRightBreakPoint(node, directrix); 1.4963 + if (dxr > ε) { 1.4964 + if (!node.R) { 1.4965 + lArc = node; 1.4966 + break; 1.4967 + } 1.4968 + node = node.R; 1.4969 + } else { 1.4970 + if (dxl > -ε) { 1.4971 + lArc = node.P; 1.4972 + rArc = node; 1.4973 + } else if (dxr > -ε) { 1.4974 + lArc = node; 1.4975 + rArc = node.N; 1.4976 + } else { 1.4977 + lArc = rArc = node; 1.4978 + } 1.4979 + break; 1.4980 + } 1.4981 + } 1.4982 + } 1.4983 + var newArc = d3_geom_voronoiCreateBeach(site); 1.4984 + d3_geom_voronoiBeaches.insert(lArc, newArc); 1.4985 + if (!lArc && !rArc) return; 1.4986 + if (lArc === rArc) { 1.4987 + d3_geom_voronoiDetachCircle(lArc); 1.4988 + rArc = d3_geom_voronoiCreateBeach(lArc.site); 1.4989 + d3_geom_voronoiBeaches.insert(newArc, rArc); 1.4990 + newArc.edge = rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site); 1.4991 + d3_geom_voronoiAttachCircle(lArc); 1.4992 + d3_geom_voronoiAttachCircle(rArc); 1.4993 + return; 1.4994 + } 1.4995 + if (!rArc) { 1.4996 + newArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site); 1.4997 + return; 1.4998 + } 1.4999 + d3_geom_voronoiDetachCircle(lArc); 1.5000 + d3_geom_voronoiDetachCircle(rArc); 1.5001 + 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.5002 + x: (cy * hb - by * hc) / d + ax, 1.5003 + y: (bx * hc - cx * hb) / d + ay 1.5004 + }; 1.5005 + d3_geom_voronoiSetEdgeEnd(rArc.edge, lSite, rSite, vertex); 1.5006 + newArc.edge = d3_geom_voronoiCreateEdge(lSite, site, null, vertex); 1.5007 + rArc.edge = d3_geom_voronoiCreateEdge(site, rSite, null, vertex); 1.5008 + d3_geom_voronoiAttachCircle(lArc); 1.5009 + d3_geom_voronoiAttachCircle(rArc); 1.5010 + } 1.5011 + function d3_geom_voronoiLeftBreakPoint(arc, directrix) { 1.5012 + var site = arc.site, rfocx = site.x, rfocy = site.y, pby2 = rfocy - directrix; 1.5013 + if (!pby2) return rfocx; 1.5014 + var lArc = arc.P; 1.5015 + if (!lArc) return -Infinity; 1.5016 + site = lArc.site; 1.5017 + var lfocx = site.x, lfocy = site.y, plby2 = lfocy - directrix; 1.5018 + if (!plby2) return lfocx; 1.5019 + var hl = lfocx - rfocx, aby2 = 1 / pby2 - 1 / plby2, b = hl / plby2; 1.5020 + if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx; 1.5021 + return (rfocx + lfocx) / 2; 1.5022 + } 1.5023 + function d3_geom_voronoiRightBreakPoint(arc, directrix) { 1.5024 + var rArc = arc.N; 1.5025 + if (rArc) return d3_geom_voronoiLeftBreakPoint(rArc, directrix); 1.5026 + var site = arc.site; 1.5027 + return site.y === directrix ? site.x : Infinity; 1.5028 + } 1.5029 + function d3_geom_voronoiCell(site) { 1.5030 + this.site = site; 1.5031 + this.edges = []; 1.5032 + } 1.5033 + d3_geom_voronoiCell.prototype.prepare = function() { 1.5034 + var halfEdges = this.edges, iHalfEdge = halfEdges.length, edge; 1.5035 + while (iHalfEdge--) { 1.5036 + edge = halfEdges[iHalfEdge].edge; 1.5037 + if (!edge.b || !edge.a) halfEdges.splice(iHalfEdge, 1); 1.5038 + } 1.5039 + halfEdges.sort(d3_geom_voronoiHalfEdgeOrder); 1.5040 + return halfEdges.length; 1.5041 + }; 1.5042 + function d3_geom_voronoiCloseCells(extent) { 1.5043 + 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.5044 + while (iCell--) { 1.5045 + cell = cells[iCell]; 1.5046 + if (!cell || !cell.prepare()) continue; 1.5047 + halfEdges = cell.edges; 1.5048 + nHalfEdges = halfEdges.length; 1.5049 + iHalfEdge = 0; 1.5050 + while (iHalfEdge < nHalfEdges) { 1.5051 + end = halfEdges[iHalfEdge].end(), x3 = end.x, y3 = end.y; 1.5052 + start = halfEdges[++iHalfEdge % nHalfEdges].start(), x2 = start.x, y2 = start.y; 1.5053 + if (abs(x3 - x2) > ε || abs(y3 - y2) > ε) { 1.5054 + halfEdges.splice(iHalfEdge, 0, new d3_geom_voronoiHalfEdge(d3_geom_voronoiCreateBorderEdge(cell.site, end, abs(x3 - x0) < ε && y1 - y3 > ε ? { 1.5055 + x: x0, 1.5056 + y: abs(x2 - x0) < ε ? y2 : y1 1.5057 + } : abs(y3 - y1) < ε && x1 - x3 > ε ? { 1.5058 + x: abs(y2 - y1) < ε ? x2 : x1, 1.5059 + y: y1 1.5060 + } : abs(x3 - x1) < ε && y3 - y0 > ε ? { 1.5061 + x: x1, 1.5062 + y: abs(x2 - x1) < ε ? y2 : y0 1.5063 + } : abs(y3 - y0) < ε && x3 - x0 > ε ? { 1.5064 + x: abs(y2 - y0) < ε ? x2 : x0, 1.5065 + y: y0 1.5066 + } : null), cell.site, null)); 1.5067 + ++nHalfEdges; 1.5068 + } 1.5069 + } 1.5070 + } 1.5071 + } 1.5072 + function d3_geom_voronoiHalfEdgeOrder(a, b) { 1.5073 + return b.angle - a.angle; 1.5074 + } 1.5075 + function d3_geom_voronoiCircle() { 1.5076 + d3_geom_voronoiRedBlackNode(this); 1.5077 + this.x = this.y = this.arc = this.site = this.cy = null; 1.5078 + } 1.5079 + function d3_geom_voronoiAttachCircle(arc) { 1.5080 + var lArc = arc.P, rArc = arc.N; 1.5081 + if (!lArc || !rArc) return; 1.5082 + var lSite = lArc.site, cSite = arc.site, rSite = rArc.site; 1.5083 + if (lSite === rSite) return; 1.5084 + var bx = cSite.x, by = cSite.y, ax = lSite.x - bx, ay = lSite.y - by, cx = rSite.x - bx, cy = rSite.y - by; 1.5085 + var d = 2 * (ax * cy - ay * cx); 1.5086 + if (d >= -ε2) return; 1.5087 + 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.5088 + var circle = d3_geom_voronoiCirclePool.pop() || new d3_geom_voronoiCircle(); 1.5089 + circle.arc = arc; 1.5090 + circle.site = cSite; 1.5091 + circle.x = x + bx; 1.5092 + circle.y = cy + Math.sqrt(x * x + y * y); 1.5093 + circle.cy = cy; 1.5094 + arc.circle = circle; 1.5095 + var before = null, node = d3_geom_voronoiCircles._; 1.5096 + while (node) { 1.5097 + if (circle.y < node.y || circle.y === node.y && circle.x <= node.x) { 1.5098 + if (node.L) node = node.L; else { 1.5099 + before = node.P; 1.5100 + break; 1.5101 + } 1.5102 + } else { 1.5103 + if (node.R) node = node.R; else { 1.5104 + before = node; 1.5105 + break; 1.5106 + } 1.5107 + } 1.5108 + } 1.5109 + d3_geom_voronoiCircles.insert(before, circle); 1.5110 + if (!before) d3_geom_voronoiFirstCircle = circle; 1.5111 + } 1.5112 + function d3_geom_voronoiDetachCircle(arc) { 1.5113 + var circle = arc.circle; 1.5114 + if (circle) { 1.5115 + if (!circle.P) d3_geom_voronoiFirstCircle = circle.N; 1.5116 + d3_geom_voronoiCircles.remove(circle); 1.5117 + d3_geom_voronoiCirclePool.push(circle); 1.5118 + d3_geom_voronoiRedBlackNode(circle); 1.5119 + arc.circle = null; 1.5120 + } 1.5121 + } 1.5122 + function d3_geom_voronoiClipEdges(extent) { 1.5123 + 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.5124 + while (i--) { 1.5125 + e = edges[i]; 1.5126 + if (!d3_geom_voronoiConnectEdge(e, extent) || !clip(e) || abs(e.a.x - e.b.x) < ε && abs(e.a.y - e.b.y) < ε) { 1.5127 + e.a = e.b = null; 1.5128 + edges.splice(i, 1); 1.5129 + } 1.5130 + } 1.5131 + } 1.5132 + function d3_geom_voronoiConnectEdge(edge, extent) { 1.5133 + var vb = edge.b; 1.5134 + if (vb) return true; 1.5135 + 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.5136 + if (ry === ly) { 1.5137 + if (fx < x0 || fx >= x1) return; 1.5138 + if (lx > rx) { 1.5139 + if (!va) va = { 1.5140 + x: fx, 1.5141 + y: y0 1.5142 + }; else if (va.y >= y1) return; 1.5143 + vb = { 1.5144 + x: fx, 1.5145 + y: y1 1.5146 + }; 1.5147 + } else { 1.5148 + if (!va) va = { 1.5149 + x: fx, 1.5150 + y: y1 1.5151 + }; else if (va.y < y0) return; 1.5152 + vb = { 1.5153 + x: fx, 1.5154 + y: y0 1.5155 + }; 1.5156 + } 1.5157 + } else { 1.5158 + fm = (lx - rx) / (ry - ly); 1.5159 + fb = fy - fm * fx; 1.5160 + if (fm < -1 || fm > 1) { 1.5161 + if (lx > rx) { 1.5162 + if (!va) va = { 1.5163 + x: (y0 - fb) / fm, 1.5164 + y: y0 1.5165 + }; else if (va.y >= y1) return; 1.5166 + vb = { 1.5167 + x: (y1 - fb) / fm, 1.5168 + y: y1 1.5169 + }; 1.5170 + } else { 1.5171 + if (!va) va = { 1.5172 + x: (y1 - fb) / fm, 1.5173 + y: y1 1.5174 + }; else if (va.y < y0) return; 1.5175 + vb = { 1.5176 + x: (y0 - fb) / fm, 1.5177 + y: y0 1.5178 + }; 1.5179 + } 1.5180 + } else { 1.5181 + if (ly < ry) { 1.5182 + if (!va) va = { 1.5183 + x: x0, 1.5184 + y: fm * x0 + fb 1.5185 + }; else if (va.x >= x1) return; 1.5186 + vb = { 1.5187 + x: x1, 1.5188 + y: fm * x1 + fb 1.5189 + }; 1.5190 + } else { 1.5191 + if (!va) va = { 1.5192 + x: x1, 1.5193 + y: fm * x1 + fb 1.5194 + }; else if (va.x < x0) return; 1.5195 + vb = { 1.5196 + x: x0, 1.5197 + y: fm * x0 + fb 1.5198 + }; 1.5199 + } 1.5200 + } 1.5201 + } 1.5202 + edge.a = va; 1.5203 + edge.b = vb; 1.5204 + return true; 1.5205 + } 1.5206 + function d3_geom_voronoiEdge(lSite, rSite) { 1.5207 + this.l = lSite; 1.5208 + this.r = rSite; 1.5209 + this.a = this.b = null; 1.5210 + } 1.5211 + function d3_geom_voronoiCreateEdge(lSite, rSite, va, vb) { 1.5212 + var edge = new d3_geom_voronoiEdge(lSite, rSite); 1.5213 + d3_geom_voronoiEdges.push(edge); 1.5214 + if (va) d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, va); 1.5215 + if (vb) d3_geom_voronoiSetEdgeEnd(edge, rSite, lSite, vb); 1.5216 + d3_geom_voronoiCells[lSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, lSite, rSite)); 1.5217 + d3_geom_voronoiCells[rSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, rSite, lSite)); 1.5218 + return edge; 1.5219 + } 1.5220 + function d3_geom_voronoiCreateBorderEdge(lSite, va, vb) { 1.5221 + var edge = new d3_geom_voronoiEdge(lSite, null); 1.5222 + edge.a = va; 1.5223 + edge.b = vb; 1.5224 + d3_geom_voronoiEdges.push(edge); 1.5225 + return edge; 1.5226 + } 1.5227 + function d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, vertex) { 1.5228 + if (!edge.a && !edge.b) { 1.5229 + edge.a = vertex; 1.5230 + edge.l = lSite; 1.5231 + edge.r = rSite; 1.5232 + } else if (edge.l === rSite) { 1.5233 + edge.b = vertex; 1.5234 + } else { 1.5235 + edge.a = vertex; 1.5236 + } 1.5237 + } 1.5238 + function d3_geom_voronoiHalfEdge(edge, lSite, rSite) { 1.5239 + var va = edge.a, vb = edge.b; 1.5240 + this.edge = edge; 1.5241 + this.site = lSite; 1.5242 + 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.5243 + } 1.5244 + d3_geom_voronoiHalfEdge.prototype = { 1.5245 + start: function() { 1.5246 + return this.edge.l === this.site ? this.edge.a : this.edge.b; 1.5247 + }, 1.5248 + end: function() { 1.5249 + return this.edge.l === this.site ? this.edge.b : this.edge.a; 1.5250 + } 1.5251 + }; 1.5252 + function d3_geom_voronoiRedBlackTree() { 1.5253 + this._ = null; 1.5254 + } 1.5255 + function d3_geom_voronoiRedBlackNode(node) { 1.5256 + node.U = node.C = node.L = node.R = node.P = node.N = null; 1.5257 + } 1.5258 + d3_geom_voronoiRedBlackTree.prototype = { 1.5259 + insert: function(after, node) { 1.5260 + var parent, grandpa, uncle; 1.5261 + if (after) { 1.5262 + node.P = after; 1.5263 + node.N = after.N; 1.5264 + if (after.N) after.N.P = node; 1.5265 + after.N = node; 1.5266 + if (after.R) { 1.5267 + after = after.R; 1.5268 + while (after.L) after = after.L; 1.5269 + after.L = node; 1.5270 + } else { 1.5271 + after.R = node; 1.5272 + } 1.5273 + parent = after; 1.5274 + } else if (this._) { 1.5275 + after = d3_geom_voronoiRedBlackFirst(this._); 1.5276 + node.P = null; 1.5277 + node.N = after; 1.5278 + after.P = after.L = node; 1.5279 + parent = after; 1.5280 + } else { 1.5281 + node.P = node.N = null; 1.5282 + this._ = node; 1.5283 + parent = null; 1.5284 + } 1.5285 + node.L = node.R = null; 1.5286 + node.U = parent; 1.5287 + node.C = true; 1.5288 + after = node; 1.5289 + while (parent && parent.C) { 1.5290 + grandpa = parent.U; 1.5291 + if (parent === grandpa.L) { 1.5292 + uncle = grandpa.R; 1.5293 + if (uncle && uncle.C) { 1.5294 + parent.C = uncle.C = false; 1.5295 + grandpa.C = true; 1.5296 + after = grandpa; 1.5297 + } else { 1.5298 + if (after === parent.R) { 1.5299 + d3_geom_voronoiRedBlackRotateLeft(this, parent); 1.5300 + after = parent; 1.5301 + parent = after.U; 1.5302 + } 1.5303 + parent.C = false; 1.5304 + grandpa.C = true; 1.5305 + d3_geom_voronoiRedBlackRotateRight(this, grandpa); 1.5306 + } 1.5307 + } else { 1.5308 + uncle = grandpa.L; 1.5309 + if (uncle && uncle.C) { 1.5310 + parent.C = uncle.C = false; 1.5311 + grandpa.C = true; 1.5312 + after = grandpa; 1.5313 + } else { 1.5314 + if (after === parent.L) { 1.5315 + d3_geom_voronoiRedBlackRotateRight(this, parent); 1.5316 + after = parent; 1.5317 + parent = after.U; 1.5318 + } 1.5319 + parent.C = false; 1.5320 + grandpa.C = true; 1.5321 + d3_geom_voronoiRedBlackRotateLeft(this, grandpa); 1.5322 + } 1.5323 + } 1.5324 + parent = after.U; 1.5325 + } 1.5326 + this._.C = false; 1.5327 + }, 1.5328 + remove: function(node) { 1.5329 + if (node.N) node.N.P = node.P; 1.5330 + if (node.P) node.P.N = node.N; 1.5331 + node.N = node.P = null; 1.5332 + var parent = node.U, sibling, left = node.L, right = node.R, next, red; 1.5333 + if (!left) next = right; else if (!right) next = left; else next = d3_geom_voronoiRedBlackFirst(right); 1.5334 + if (parent) { 1.5335 + if (parent.L === node) parent.L = next; else parent.R = next; 1.5336 + } else { 1.5337 + this._ = next; 1.5338 + } 1.5339 + if (left && right) { 1.5340 + red = next.C; 1.5341 + next.C = node.C; 1.5342 + next.L = left; 1.5343 + left.U = next; 1.5344 + if (next !== right) { 1.5345 + parent = next.U; 1.5346 + next.U = node.U; 1.5347 + node = next.R; 1.5348 + parent.L = node; 1.5349 + next.R = right; 1.5350 + right.U = next; 1.5351 + } else { 1.5352 + next.U = parent; 1.5353 + parent = next; 1.5354 + node = next.R; 1.5355 + } 1.5356 + } else { 1.5357 + red = node.C; 1.5358 + node = next; 1.5359 + } 1.5360 + if (node) node.U = parent; 1.5361 + if (red) return; 1.5362 + if (node && node.C) { 1.5363 + node.C = false; 1.5364 + return; 1.5365 + } 1.5366 + do { 1.5367 + if (node === this._) break; 1.5368 + if (node === parent.L) { 1.5369 + sibling = parent.R; 1.5370 + if (sibling.C) { 1.5371 + sibling.C = false; 1.5372 + parent.C = true; 1.5373 + d3_geom_voronoiRedBlackRotateLeft(this, parent); 1.5374 + sibling = parent.R; 1.5375 + } 1.5376 + if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) { 1.5377 + if (!sibling.R || !sibling.R.C) { 1.5378 + sibling.L.C = false; 1.5379 + sibling.C = true; 1.5380 + d3_geom_voronoiRedBlackRotateRight(this, sibling); 1.5381 + sibling = parent.R; 1.5382 + } 1.5383 + sibling.C = parent.C; 1.5384 + parent.C = sibling.R.C = false; 1.5385 + d3_geom_voronoiRedBlackRotateLeft(this, parent); 1.5386 + node = this._; 1.5387 + break; 1.5388 + } 1.5389 + } else { 1.5390 + sibling = parent.L; 1.5391 + if (sibling.C) { 1.5392 + sibling.C = false; 1.5393 + parent.C = true; 1.5394 + d3_geom_voronoiRedBlackRotateRight(this, parent); 1.5395 + sibling = parent.L; 1.5396 + } 1.5397 + if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) { 1.5398 + if (!sibling.L || !sibling.L.C) { 1.5399 + sibling.R.C = false; 1.5400 + sibling.C = true; 1.5401 + d3_geom_voronoiRedBlackRotateLeft(this, sibling); 1.5402 + sibling = parent.L; 1.5403 + } 1.5404 + sibling.C = parent.C; 1.5405 + parent.C = sibling.L.C = false; 1.5406 + d3_geom_voronoiRedBlackRotateRight(this, parent); 1.5407 + node = this._; 1.5408 + break; 1.5409 + } 1.5410 + } 1.5411 + sibling.C = true; 1.5412 + node = parent; 1.5413 + parent = parent.U; 1.5414 + } while (!node.C); 1.5415 + if (node) node.C = false; 1.5416 + } 1.5417 + }; 1.5418 + function d3_geom_voronoiRedBlackRotateLeft(tree, node) { 1.5419 + var p = node, q = node.R, parent = p.U; 1.5420 + if (parent) { 1.5421 + if (parent.L === p) parent.L = q; else parent.R = q; 1.5422 + } else { 1.5423 + tree._ = q; 1.5424 + } 1.5425 + q.U = parent; 1.5426 + p.U = q; 1.5427 + p.R = q.L; 1.5428 + if (p.R) p.R.U = p; 1.5429 + q.L = p; 1.5430 + } 1.5431 + function d3_geom_voronoiRedBlackRotateRight(tree, node) { 1.5432 + var p = node, q = node.L, parent = p.U; 1.5433 + if (parent) { 1.5434 + if (parent.L === p) parent.L = q; else parent.R = q; 1.5435 + } else { 1.5436 + tree._ = q; 1.5437 + } 1.5438 + q.U = parent; 1.5439 + p.U = q; 1.5440 + p.L = q.R; 1.5441 + if (p.L) p.L.U = p; 1.5442 + q.R = p; 1.5443 + } 1.5444 + function d3_geom_voronoiRedBlackFirst(node) { 1.5445 + while (node.L) node = node.L; 1.5446 + return node; 1.5447 + } 1.5448 + function d3_geom_voronoi(sites, bbox) { 1.5449 + var site = sites.sort(d3_geom_voronoiVertexOrder).pop(), x0, y0, circle; 1.5450 + d3_geom_voronoiEdges = []; 1.5451 + d3_geom_voronoiCells = new Array(sites.length); 1.5452 + d3_geom_voronoiBeaches = new d3_geom_voronoiRedBlackTree(); 1.5453 + d3_geom_voronoiCircles = new d3_geom_voronoiRedBlackTree(); 1.5454 + while (true) { 1.5455 + circle = d3_geom_voronoiFirstCircle; 1.5456 + if (site && (!circle || site.y < circle.y || site.y === circle.y && site.x < circle.x)) { 1.5457 + if (site.x !== x0 || site.y !== y0) { 1.5458 + d3_geom_voronoiCells[site.i] = new d3_geom_voronoiCell(site); 1.5459 + d3_geom_voronoiAddBeach(site); 1.5460 + x0 = site.x, y0 = site.y; 1.5461 + } 1.5462 + site = sites.pop(); 1.5463 + } else if (circle) { 1.5464 + d3_geom_voronoiRemoveBeach(circle.arc); 1.5465 + } else { 1.5466 + break; 1.5467 + } 1.5468 + } 1.5469 + if (bbox) d3_geom_voronoiClipEdges(bbox), d3_geom_voronoiCloseCells(bbox); 1.5470 + var diagram = { 1.5471 + cells: d3_geom_voronoiCells, 1.5472 + edges: d3_geom_voronoiEdges 1.5473 + }; 1.5474 + d3_geom_voronoiBeaches = d3_geom_voronoiCircles = d3_geom_voronoiEdges = d3_geom_voronoiCells = null; 1.5475 + return diagram; 1.5476 + } 1.5477 + function d3_geom_voronoiVertexOrder(a, b) { 1.5478 + return b.y - a.y || b.x - a.x; 1.5479 + } 1.5480 + d3.geom.voronoi = function(points) { 1.5481 + var x = d3_geom_pointX, y = d3_geom_pointY, fx = x, fy = y, clipExtent = d3_geom_voronoiClipExtent; 1.5482 + if (points) return voronoi(points); 1.5483 + function voronoi(data) { 1.5484 + var polygons = new Array(data.length), x0 = clipExtent[0][0], y0 = clipExtent[0][1], x1 = clipExtent[1][0], y1 = clipExtent[1][1]; 1.5485 + d3_geom_voronoi(sites(data), clipExtent).cells.forEach(function(cell, i) { 1.5486 + var edges = cell.edges, site = cell.site, polygon = polygons[i] = edges.length ? edges.map(function(e) { 1.5487 + var s = e.start(); 1.5488 + return [ s.x, s.y ]; 1.5489 + }) : site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1 ? [ [ x0, y1 ], [ x1, y1 ], [ x1, y0 ], [ x0, y0 ] ] : []; 1.5490 + polygon.point = data[i]; 1.5491 + }); 1.5492 + return polygons; 1.5493 + } 1.5494 + function sites(data) { 1.5495 + return data.map(function(d, i) { 1.5496 + return { 1.5497 + x: Math.round(fx(d, i) / ε) * ε, 1.5498 + y: Math.round(fy(d, i) / ε) * ε, 1.5499 + i: i 1.5500 + }; 1.5501 + }); 1.5502 + } 1.5503 + voronoi.links = function(data) { 1.5504 + return d3_geom_voronoi(sites(data)).edges.filter(function(edge) { 1.5505 + return edge.l && edge.r; 1.5506 + }).map(function(edge) { 1.5507 + return { 1.5508 + source: data[edge.l.i], 1.5509 + target: data[edge.r.i] 1.5510 + }; 1.5511 + }); 1.5512 + }; 1.5513 + voronoi.triangles = function(data) { 1.5514 + var triangles = []; 1.5515 + d3_geom_voronoi(sites(data)).cells.forEach(function(cell, i) { 1.5516 + 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.5517 + while (++j < m) { 1.5518 + e0 = e1; 1.5519 + s0 = s1; 1.5520 + e1 = edges[j].edge; 1.5521 + s1 = e1.l === site ? e1.r : e1.l; 1.5522 + if (i < s0.i && i < s1.i && d3_geom_voronoiTriangleArea(site, s0, s1) < 0) { 1.5523 + triangles.push([ data[i], data[s0.i], data[s1.i] ]); 1.5524 + } 1.5525 + } 1.5526 + }); 1.5527 + return triangles; 1.5528 + }; 1.5529 + voronoi.x = function(_) { 1.5530 + return arguments.length ? (fx = d3_functor(x = _), voronoi) : x; 1.5531 + }; 1.5532 + voronoi.y = function(_) { 1.5533 + return arguments.length ? (fy = d3_functor(y = _), voronoi) : y; 1.5534 + }; 1.5535 + voronoi.clipExtent = function(_) { 1.5536 + if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent; 1.5537 + clipExtent = _ == null ? d3_geom_voronoiClipExtent : _; 1.5538 + return voronoi; 1.5539 + }; 1.5540 + voronoi.size = function(_) { 1.5541 + if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent && clipExtent[1]; 1.5542 + return voronoi.clipExtent(_ && [ [ 0, 0 ], _ ]); 1.5543 + }; 1.5544 + return voronoi; 1.5545 + }; 1.5546 + var d3_geom_voronoiClipExtent = [ [ -1e6, -1e6 ], [ 1e6, 1e6 ] ]; 1.5547 + function d3_geom_voronoiTriangleArea(a, b, c) { 1.5548 + return (a.x - c.x) * (b.y - a.y) - (a.x - b.x) * (c.y - a.y); 1.5549 + } 1.5550 + d3.geom.delaunay = function(vertices) { 1.5551 + return d3.geom.voronoi().triangles(vertices); 1.5552 + }; 1.5553 + d3.geom.quadtree = function(points, x1, y1, x2, y2) { 1.5554 + var x = d3_geom_pointX, y = d3_geom_pointY, compat; 1.5555 + if (compat = arguments.length) { 1.5556 + x = d3_geom_quadtreeCompatX; 1.5557 + y = d3_geom_quadtreeCompatY; 1.5558 + if (compat === 3) { 1.5559 + y2 = y1; 1.5560 + x2 = x1; 1.5561 + y1 = x1 = 0; 1.5562 + } 1.5563 + return quadtree(points); 1.5564 + } 1.5565 + function quadtree(data) { 1.5566 + var d, fx = d3_functor(x), fy = d3_functor(y), xs, ys, i, n, x1_, y1_, x2_, y2_; 1.5567 + if (x1 != null) { 1.5568 + x1_ = x1, y1_ = y1, x2_ = x2, y2_ = y2; 1.5569 + } else { 1.5570 + x2_ = y2_ = -(x1_ = y1_ = Infinity); 1.5571 + xs = [], ys = []; 1.5572 + n = data.length; 1.5573 + if (compat) for (i = 0; i < n; ++i) { 1.5574 + d = data[i]; 1.5575 + if (d.x < x1_) x1_ = d.x; 1.5576 + if (d.y < y1_) y1_ = d.y; 1.5577 + if (d.x > x2_) x2_ = d.x; 1.5578 + if (d.y > y2_) y2_ = d.y; 1.5579 + xs.push(d.x); 1.5580 + ys.push(d.y); 1.5581 + } else for (i = 0; i < n; ++i) { 1.5582 + var x_ = +fx(d = data[i], i), y_ = +fy(d, i); 1.5583 + if (x_ < x1_) x1_ = x_; 1.5584 + if (y_ < y1_) y1_ = y_; 1.5585 + if (x_ > x2_) x2_ = x_; 1.5586 + if (y_ > y2_) y2_ = y_; 1.5587 + xs.push(x_); 1.5588 + ys.push(y_); 1.5589 + } 1.5590 + } 1.5591 + var dx = x2_ - x1_, dy = y2_ - y1_; 1.5592 + if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy; 1.5593 + function insert(n, d, x, y, x1, y1, x2, y2) { 1.5594 + if (isNaN(x) || isNaN(y)) return; 1.5595 + if (n.leaf) { 1.5596 + var nx = n.x, ny = n.y; 1.5597 + if (nx != null) { 1.5598 + if (abs(nx - x) + abs(ny - y) < .01) { 1.5599 + insertChild(n, d, x, y, x1, y1, x2, y2); 1.5600 + } else { 1.5601 + var nPoint = n.point; 1.5602 + n.x = n.y = n.point = null; 1.5603 + insertChild(n, nPoint, nx, ny, x1, y1, x2, y2); 1.5604 + insertChild(n, d, x, y, x1, y1, x2, y2); 1.5605 + } 1.5606 + } else { 1.5607 + n.x = x, n.y = y, n.point = d; 1.5608 + } 1.5609 + } else { 1.5610 + insertChild(n, d, x, y, x1, y1, x2, y2); 1.5611 + } 1.5612 + } 1.5613 + function insertChild(n, d, x, y, x1, y1, x2, y2) { 1.5614 + var xm = (x1 + x2) * .5, ym = (y1 + y2) * .5, right = x >= xm, below = y >= ym, i = below << 1 | right; 1.5615 + n.leaf = false; 1.5616 + n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); 1.5617 + if (right) x1 = xm; else x2 = xm; 1.5618 + if (below) y1 = ym; else y2 = ym; 1.5619 + insert(n, d, x, y, x1, y1, x2, y2); 1.5620 + } 1.5621 + var root = d3_geom_quadtreeNode(); 1.5622 + root.add = function(d) { 1.5623 + insert(root, d, +fx(d, ++i), +fy(d, i), x1_, y1_, x2_, y2_); 1.5624 + }; 1.5625 + root.visit = function(f) { 1.5626 + d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_); 1.5627 + }; 1.5628 + root.find = function(point) { 1.5629 + return d3_geom_quadtreeFind(root, point[0], point[1], x1_, y1_, x2_, y2_); 1.5630 + }; 1.5631 + i = -1; 1.5632 + if (x1 == null) { 1.5633 + while (++i < n) { 1.5634 + insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_); 1.5635 + } 1.5636 + --i; 1.5637 + } else data.forEach(root.add); 1.5638 + xs = ys = data = d = null; 1.5639 + return root; 1.5640 + } 1.5641 + quadtree.x = function(_) { 1.5642 + return arguments.length ? (x = _, quadtree) : x; 1.5643 + }; 1.5644 + quadtree.y = function(_) { 1.5645 + return arguments.length ? (y = _, quadtree) : y; 1.5646 + }; 1.5647 + quadtree.extent = function(_) { 1.5648 + if (!arguments.length) return x1 == null ? null : [ [ x1, y1 ], [ x2, y2 ] ]; 1.5649 + if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = +_[0][0], y1 = +_[0][1], x2 = +_[1][0], 1.5650 + y2 = +_[1][1]; 1.5651 + return quadtree; 1.5652 + }; 1.5653 + quadtree.size = function(_) { 1.5654 + if (!arguments.length) return x1 == null ? null : [ x2 - x1, y2 - y1 ]; 1.5655 + if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = y1 = 0, x2 = +_[0], y2 = +_[1]; 1.5656 + return quadtree; 1.5657 + }; 1.5658 + return quadtree; 1.5659 + }; 1.5660 + function d3_geom_quadtreeCompatX(d) { 1.5661 + return d.x; 1.5662 + } 1.5663 + function d3_geom_quadtreeCompatY(d) { 1.5664 + return d.y; 1.5665 + } 1.5666 + function d3_geom_quadtreeNode() { 1.5667 + return { 1.5668 + leaf: true, 1.5669 + nodes: [], 1.5670 + point: null, 1.5671 + x: null, 1.5672 + y: null 1.5673 + }; 1.5674 + } 1.5675 + function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { 1.5676 + if (!f(node, x1, y1, x2, y2)) { 1.5677 + var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes; 1.5678 + if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); 1.5679 + if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); 1.5680 + if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); 1.5681 + if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); 1.5682 + } 1.5683 + } 1.5684 + function d3_geom_quadtreeFind(root, x, y, x0, y0, x3, y3) { 1.5685 + var minDistance2 = Infinity, closestPoint; 1.5686 + (function find(node, x1, y1, x2, y2) { 1.5687 + if (x1 > x3 || y1 > y3 || x2 < x0 || y2 < y0) return; 1.5688 + if (point = node.point) { 1.5689 + var point, dx = x - node.x, dy = y - node.y, distance2 = dx * dx + dy * dy; 1.5690 + if (distance2 < minDistance2) { 1.5691 + var distance = Math.sqrt(minDistance2 = distance2); 1.5692 + x0 = x - distance, y0 = y - distance; 1.5693 + x3 = x + distance, y3 = y + distance; 1.5694 + closestPoint = point; 1.5695 + } 1.5696 + } 1.5697 + var children = node.nodes, xm = (x1 + x2) * .5, ym = (y1 + y2) * .5, right = x >= xm, below = y >= ym; 1.5698 + for (var i = below << 1 | right, j = i + 4; i < j; ++i) { 1.5699 + if (node = children[i & 3]) switch (i & 3) { 1.5700 + case 0: 1.5701 + find(node, x1, y1, xm, ym); 1.5702 + break; 1.5703 + 1.5704 + case 1: 1.5705 + find(node, xm, y1, x2, ym); 1.5706 + break; 1.5707 + 1.5708 + case 2: 1.5709 + find(node, x1, ym, xm, y2); 1.5710 + break; 1.5711 + 1.5712 + case 3: 1.5713 + find(node, xm, ym, x2, y2); 1.5714 + break; 1.5715 + } 1.5716 + } 1.5717 + })(root, x0, y0, x3, y3); 1.5718 + return closestPoint; 1.5719 + } 1.5720 + d3.interpolateRgb = d3_interpolateRgb; 1.5721 + function d3_interpolateRgb(a, b) { 1.5722 + a = d3.rgb(a); 1.5723 + b = d3.rgb(b); 1.5724 + var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab; 1.5725 + return function(t) { 1.5726 + 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.5727 + }; 1.5728 + } 1.5729 + d3.interpolateObject = d3_interpolateObject; 1.5730 + function d3_interpolateObject(a, b) { 1.5731 + var i = {}, c = {}, k; 1.5732 + for (k in a) { 1.5733 + if (k in b) { 1.5734 + i[k] = d3_interpolate(a[k], b[k]); 1.5735 + } else { 1.5736 + c[k] = a[k]; 1.5737 + } 1.5738 + } 1.5739 + for (k in b) { 1.5740 + if (!(k in a)) { 1.5741 + c[k] = b[k]; 1.5742 + } 1.5743 + } 1.5744 + return function(t) { 1.5745 + for (k in i) c[k] = i[k](t); 1.5746 + return c; 1.5747 + }; 1.5748 + } 1.5749 + d3.interpolateNumber = d3_interpolateNumber; 1.5750 + function d3_interpolateNumber(a, b) { 1.5751 + a = +a, b = +b; 1.5752 + return function(t) { 1.5753 + return a * (1 - t) + b * t; 1.5754 + }; 1.5755 + } 1.5756 + d3.interpolateString = d3_interpolateString; 1.5757 + function d3_interpolateString(a, b) { 1.5758 + var bi = d3_interpolate_numberA.lastIndex = d3_interpolate_numberB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = []; 1.5759 + a = a + "", b = b + ""; 1.5760 + while ((am = d3_interpolate_numberA.exec(a)) && (bm = d3_interpolate_numberB.exec(b))) { 1.5761 + if ((bs = bm.index) > bi) { 1.5762 + bs = b.slice(bi, bs); 1.5763 + if (s[i]) s[i] += bs; else s[++i] = bs; 1.5764 + } 1.5765 + if ((am = am[0]) === (bm = bm[0])) { 1.5766 + if (s[i]) s[i] += bm; else s[++i] = bm; 1.5767 + } else { 1.5768 + s[++i] = null; 1.5769 + q.push({ 1.5770 + i: i, 1.5771 + x: d3_interpolateNumber(am, bm) 1.5772 + }); 1.5773 + } 1.5774 + bi = d3_interpolate_numberB.lastIndex; 1.5775 + } 1.5776 + if (bi < b.length) { 1.5777 + bs = b.slice(bi); 1.5778 + if (s[i]) s[i] += bs; else s[++i] = bs; 1.5779 + } 1.5780 + return s.length < 2 ? q[0] ? (b = q[0].x, function(t) { 1.5781 + return b(t) + ""; 1.5782 + }) : function() { 1.5783 + return b; 1.5784 + } : (b = q.length, function(t) { 1.5785 + for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); 1.5786 + return s.join(""); 1.5787 + }); 1.5788 + } 1.5789 + var d3_interpolate_numberA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, d3_interpolate_numberB = new RegExp(d3_interpolate_numberA.source, "g"); 1.5790 + d3.interpolate = d3_interpolate; 1.5791 + function d3_interpolate(a, b) { 1.5792 + var i = d3.interpolators.length, f; 1.5793 + while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ; 1.5794 + return f; 1.5795 + } 1.5796 + d3.interpolators = [ function(a, b) { 1.5797 + var t = typeof b; 1.5798 + return (t === "string" ? d3_rgb_names.has(b.toLowerCase()) || /^(#|rgb\(|hsl\()/i.test(b) ? d3_interpolateRgb : d3_interpolateString : b instanceof d3_color ? d3_interpolateRgb : Array.isArray(b) ? d3_interpolateArray : t === "object" && isNaN(b) ? d3_interpolateObject : d3_interpolateNumber)(a, b); 1.5799 + } ]; 1.5800 + d3.interpolateArray = d3_interpolateArray; 1.5801 + function d3_interpolateArray(a, b) { 1.5802 + var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i; 1.5803 + for (i = 0; i < n0; ++i) x.push(d3_interpolate(a[i], b[i])); 1.5804 + for (;i < na; ++i) c[i] = a[i]; 1.5805 + for (;i < nb; ++i) c[i] = b[i]; 1.5806 + return function(t) { 1.5807 + for (i = 0; i < n0; ++i) c[i] = x[i](t); 1.5808 + return c; 1.5809 + }; 1.5810 + } 1.5811 + var d3_ease_default = function() { 1.5812 + return d3_identity; 1.5813 + }; 1.5814 + var d3_ease = d3.map({ 1.5815 + linear: d3_ease_default, 1.5816 + poly: d3_ease_poly, 1.5817 + quad: function() { 1.5818 + return d3_ease_quad; 1.5819 + }, 1.5820 + cubic: function() { 1.5821 + return d3_ease_cubic; 1.5822 + }, 1.5823 + sin: function() { 1.5824 + return d3_ease_sin; 1.5825 + }, 1.5826 + exp: function() { 1.5827 + return d3_ease_exp; 1.5828 + }, 1.5829 + circle: function() { 1.5830 + return d3_ease_circle; 1.5831 + }, 1.5832 + elastic: d3_ease_elastic, 1.5833 + back: d3_ease_back, 1.5834 + bounce: function() { 1.5835 + return d3_ease_bounce; 1.5836 + } 1.5837 + }); 1.5838 + var d3_ease_mode = d3.map({ 1.5839 + "in": d3_identity, 1.5840 + out: d3_ease_reverse, 1.5841 + "in-out": d3_ease_reflect, 1.5842 + "out-in": function(f) { 1.5843 + return d3_ease_reflect(d3_ease_reverse(f)); 1.5844 + } 1.5845 + }); 1.5846 + d3.ease = function(name) { 1.5847 + var i = name.indexOf("-"), t = i >= 0 ? name.slice(0, i) : name, m = i >= 0 ? name.slice(i + 1) : "in"; 1.5848 + t = d3_ease.get(t) || d3_ease_default; 1.5849 + m = d3_ease_mode.get(m) || d3_identity; 1.5850 + return d3_ease_clamp(m(t.apply(null, d3_arraySlice.call(arguments, 1)))); 1.5851 + }; 1.5852 + function d3_ease_clamp(f) { 1.5853 + return function(t) { 1.5854 + return t <= 0 ? 0 : t >= 1 ? 1 : f(t); 1.5855 + }; 1.5856 + } 1.5857 + function d3_ease_reverse(f) { 1.5858 + return function(t) { 1.5859 + return 1 - f(1 - t); 1.5860 + }; 1.5861 + } 1.5862 + function d3_ease_reflect(f) { 1.5863 + return function(t) { 1.5864 + return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t)); 1.5865 + }; 1.5866 + } 1.5867 + function d3_ease_quad(t) { 1.5868 + return t * t; 1.5869 + } 1.5870 + function d3_ease_cubic(t) { 1.5871 + return t * t * t; 1.5872 + } 1.5873 + function d3_ease_cubicInOut(t) { 1.5874 + if (t <= 0) return 0; 1.5875 + if (t >= 1) return 1; 1.5876 + var t2 = t * t, t3 = t2 * t; 1.5877 + return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75); 1.5878 + } 1.5879 + function d3_ease_poly(e) { 1.5880 + return function(t) { 1.5881 + return Math.pow(t, e); 1.5882 + }; 1.5883 + } 1.5884 + function d3_ease_sin(t) { 1.5885 + return 1 - Math.cos(t * halfπ); 1.5886 + } 1.5887 + function d3_ease_exp(t) { 1.5888 + return Math.pow(2, 10 * (t - 1)); 1.5889 + } 1.5890 + function d3_ease_circle(t) { 1.5891 + return 1 - Math.sqrt(1 - t * t); 1.5892 + } 1.5893 + function d3_ease_elastic(a, p) { 1.5894 + var s; 1.5895 + if (arguments.length < 2) p = .45; 1.5896 + if (arguments.length) s = p / τ * Math.asin(1 / a); else a = 1, s = p / 4; 1.5897 + return function(t) { 1.5898 + return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * τ / p); 1.5899 + }; 1.5900 + } 1.5901 + function d3_ease_back(s) { 1.5902 + if (!s) s = 1.70158; 1.5903 + return function(t) { 1.5904 + return t * t * ((s + 1) * t - s); 1.5905 + }; 1.5906 + } 1.5907 + function d3_ease_bounce(t) { 1.5908 + 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.5909 + } 1.5910 + d3.interpolateHcl = d3_interpolateHcl; 1.5911 + function d3_interpolateHcl(a, b) { 1.5912 + a = d3.hcl(a); 1.5913 + b = d3.hcl(b); 1.5914 + var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al; 1.5915 + if (isNaN(bc)) bc = 0, ac = isNaN(ac) ? b.c : ac; 1.5916 + if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; 1.5917 + return function(t) { 1.5918 + return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + ""; 1.5919 + }; 1.5920 + } 1.5921 + d3.interpolateHsl = d3_interpolateHsl; 1.5922 + function d3_interpolateHsl(a, b) { 1.5923 + a = d3.hsl(a); 1.5924 + b = d3.hsl(b); 1.5925 + var ah = a.h, as = a.s, al = a.l, bh = b.h - ah, bs = b.s - as, bl = b.l - al; 1.5926 + if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as; 1.5927 + if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; 1.5928 + return function(t) { 1.5929 + return d3_hsl_rgb(ah + bh * t, as + bs * t, al + bl * t) + ""; 1.5930 + }; 1.5931 + } 1.5932 + d3.interpolateLab = d3_interpolateLab; 1.5933 + function d3_interpolateLab(a, b) { 1.5934 + a = d3.lab(a); 1.5935 + b = d3.lab(b); 1.5936 + var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab; 1.5937 + return function(t) { 1.5938 + return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + ""; 1.5939 + }; 1.5940 + } 1.5941 + d3.interpolateRound = d3_interpolateRound; 1.5942 + function d3_interpolateRound(a, b) { 1.5943 + b -= a; 1.5944 + return function(t) { 1.5945 + return Math.round(a + b * t); 1.5946 + }; 1.5947 + } 1.5948 + d3.transform = function(string) { 1.5949 + var g = d3_document.createElementNS(d3.ns.prefix.svg, "g"); 1.5950 + return (d3.transform = function(string) { 1.5951 + if (string != null) { 1.5952 + g.setAttribute("transform", string); 1.5953 + var t = g.transform.baseVal.consolidate(); 1.5954 + } 1.5955 + return new d3_transform(t ? t.matrix : d3_transformIdentity); 1.5956 + })(string); 1.5957 + }; 1.5958 + function d3_transform(m) { 1.5959 + 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.5960 + if (r0[0] * r1[1] < r1[0] * r0[1]) { 1.5961 + r0[0] *= -1; 1.5962 + r0[1] *= -1; 1.5963 + kx *= -1; 1.5964 + kz *= -1; 1.5965 + } 1.5966 + this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees; 1.5967 + this.translate = [ m.e, m.f ]; 1.5968 + this.scale = [ kx, ky ]; 1.5969 + this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0; 1.5970 + } 1.5971 + d3_transform.prototype.toString = function() { 1.5972 + return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")"; 1.5973 + }; 1.5974 + function d3_transformDot(a, b) { 1.5975 + return a[0] * b[0] + a[1] * b[1]; 1.5976 + } 1.5977 + function d3_transformNormalize(a) { 1.5978 + var k = Math.sqrt(d3_transformDot(a, a)); 1.5979 + if (k) { 1.5980 + a[0] /= k; 1.5981 + a[1] /= k; 1.5982 + } 1.5983 + return k; 1.5984 + } 1.5985 + function d3_transformCombine(a, b, k) { 1.5986 + a[0] += k * b[0]; 1.5987 + a[1] += k * b[1]; 1.5988 + return a; 1.5989 + } 1.5990 + var d3_transformIdentity = { 1.5991 + a: 1, 1.5992 + b: 0, 1.5993 + c: 0, 1.5994 + d: 1, 1.5995 + e: 0, 1.5996 + f: 0 1.5997 + }; 1.5998 + d3.interpolateTransform = d3_interpolateTransform; 1.5999 + function d3_interpolateTransformPop(s) { 1.6000 + return s.length ? s.pop() + "," : ""; 1.6001 + } 1.6002 + function d3_interpolateTranslate(ta, tb, s, q) { 1.6003 + if (ta[0] !== tb[0] || ta[1] !== tb[1]) { 1.6004 + var i = s.push("translate(", null, ",", null, ")"); 1.6005 + q.push({ 1.6006 + i: i - 4, 1.6007 + x: d3_interpolateNumber(ta[0], tb[0]) 1.6008 + }, { 1.6009 + i: i - 2, 1.6010 + x: d3_interpolateNumber(ta[1], tb[1]) 1.6011 + }); 1.6012 + } else if (tb[0] || tb[1]) { 1.6013 + s.push("translate(" + tb + ")"); 1.6014 + } 1.6015 + } 1.6016 + function d3_interpolateRotate(ra, rb, s, q) { 1.6017 + if (ra !== rb) { 1.6018 + if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360; 1.6019 + q.push({ 1.6020 + i: s.push(d3_interpolateTransformPop(s) + "rotate(", null, ")") - 2, 1.6021 + x: d3_interpolateNumber(ra, rb) 1.6022 + }); 1.6023 + } else if (rb) { 1.6024 + s.push(d3_interpolateTransformPop(s) + "rotate(" + rb + ")"); 1.6025 + } 1.6026 + } 1.6027 + function d3_interpolateSkew(wa, wb, s, q) { 1.6028 + if (wa !== wb) { 1.6029 + q.push({ 1.6030 + i: s.push(d3_interpolateTransformPop(s) + "skewX(", null, ")") - 2, 1.6031 + x: d3_interpolateNumber(wa, wb) 1.6032 + }); 1.6033 + } else if (wb) { 1.6034 + s.push(d3_interpolateTransformPop(s) + "skewX(" + wb + ")"); 1.6035 + } 1.6036 + } 1.6037 + function d3_interpolateScale(ka, kb, s, q) { 1.6038 + if (ka[0] !== kb[0] || ka[1] !== kb[1]) { 1.6039 + var i = s.push(d3_interpolateTransformPop(s) + "scale(", null, ",", null, ")"); 1.6040 + q.push({ 1.6041 + i: i - 4, 1.6042 + x: d3_interpolateNumber(ka[0], kb[0]) 1.6043 + }, { 1.6044 + i: i - 2, 1.6045 + x: d3_interpolateNumber(ka[1], kb[1]) 1.6046 + }); 1.6047 + } else if (kb[0] !== 1 || kb[1] !== 1) { 1.6048 + s.push(d3_interpolateTransformPop(s) + "scale(" + kb + ")"); 1.6049 + } 1.6050 + } 1.6051 + function d3_interpolateTransform(a, b) { 1.6052 + var s = [], q = []; 1.6053 + a = d3.transform(a), b = d3.transform(b); 1.6054 + d3_interpolateTranslate(a.translate, b.translate, s, q); 1.6055 + d3_interpolateRotate(a.rotate, b.rotate, s, q); 1.6056 + d3_interpolateSkew(a.skew, b.skew, s, q); 1.6057 + d3_interpolateScale(a.scale, b.scale, s, q); 1.6058 + a = b = null; 1.6059 + return function(t) { 1.6060 + var i = -1, n = q.length, o; 1.6061 + while (++i < n) s[(o = q[i]).i] = o.x(t); 1.6062 + return s.join(""); 1.6063 + }; 1.6064 + } 1.6065 + function d3_uninterpolateNumber(a, b) { 1.6066 + b = (b -= a = +a) || 1 / b; 1.6067 + return function(x) { 1.6068 + return (x - a) / b; 1.6069 + }; 1.6070 + } 1.6071 + function d3_uninterpolateClamp(a, b) { 1.6072 + b = (b -= a = +a) || 1 / b; 1.6073 + return function(x) { 1.6074 + return Math.max(0, Math.min(1, (x - a) / b)); 1.6075 + }; 1.6076 + } 1.6077 + d3.layout = {}; 1.6078 + d3.layout.bundle = function() { 1.6079 + return function(links) { 1.6080 + var paths = [], i = -1, n = links.length; 1.6081 + while (++i < n) paths.push(d3_layout_bundlePath(links[i])); 1.6082 + return paths; 1.6083 + }; 1.6084 + }; 1.6085 + function d3_layout_bundlePath(link) { 1.6086 + var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ]; 1.6087 + while (start !== lca) { 1.6088 + start = start.parent; 1.6089 + points.push(start); 1.6090 + } 1.6091 + var k = points.length; 1.6092 + while (end !== lca) { 1.6093 + points.splice(k, 0, end); 1.6094 + end = end.parent; 1.6095 + } 1.6096 + return points; 1.6097 + } 1.6098 + function d3_layout_bundleAncestors(node) { 1.6099 + var ancestors = [], parent = node.parent; 1.6100 + while (parent != null) { 1.6101 + ancestors.push(node); 1.6102 + node = parent; 1.6103 + parent = parent.parent; 1.6104 + } 1.6105 + ancestors.push(node); 1.6106 + return ancestors; 1.6107 + } 1.6108 + function d3_layout_bundleLeastCommonAncestor(a, b) { 1.6109 + if (a === b) return a; 1.6110 + var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null; 1.6111 + while (aNode === bNode) { 1.6112 + sharedNode = aNode; 1.6113 + aNode = aNodes.pop(); 1.6114 + bNode = bNodes.pop(); 1.6115 + } 1.6116 + return sharedNode; 1.6117 + } 1.6118 + d3.layout.chord = function() { 1.6119 + var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords; 1.6120 + function relayout() { 1.6121 + var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j; 1.6122 + chords = []; 1.6123 + groups = []; 1.6124 + k = 0, i = -1; 1.6125 + while (++i < n) { 1.6126 + x = 0, j = -1; 1.6127 + while (++j < n) { 1.6128 + x += matrix[i][j]; 1.6129 + } 1.6130 + groupSums.push(x); 1.6131 + subgroupIndex.push(d3.range(n)); 1.6132 + k += x; 1.6133 + } 1.6134 + if (sortGroups) { 1.6135 + groupIndex.sort(function(a, b) { 1.6136 + return sortGroups(groupSums[a], groupSums[b]); 1.6137 + }); 1.6138 + } 1.6139 + if (sortSubgroups) { 1.6140 + subgroupIndex.forEach(function(d, i) { 1.6141 + d.sort(function(a, b) { 1.6142 + return sortSubgroups(matrix[i][a], matrix[i][b]); 1.6143 + }); 1.6144 + }); 1.6145 + } 1.6146 + k = (τ - padding * n) / k; 1.6147 + x = 0, i = -1; 1.6148 + while (++i < n) { 1.6149 + x0 = x, j = -1; 1.6150 + while (++j < n) { 1.6151 + var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k; 1.6152 + subgroups[di + "-" + dj] = { 1.6153 + index: di, 1.6154 + subindex: dj, 1.6155 + startAngle: a0, 1.6156 + endAngle: a1, 1.6157 + value: v 1.6158 + }; 1.6159 + } 1.6160 + groups[di] = { 1.6161 + index: di, 1.6162 + startAngle: x0, 1.6163 + endAngle: x, 1.6164 + value: groupSums[di] 1.6165 + }; 1.6166 + x += padding; 1.6167 + } 1.6168 + i = -1; 1.6169 + while (++i < n) { 1.6170 + j = i - 1; 1.6171 + while (++j < n) { 1.6172 + var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i]; 1.6173 + if (source.value || target.value) { 1.6174 + chords.push(source.value < target.value ? { 1.6175 + source: target, 1.6176 + target: source 1.6177 + } : { 1.6178 + source: source, 1.6179 + target: target 1.6180 + }); 1.6181 + } 1.6182 + } 1.6183 + } 1.6184 + if (sortChords) resort(); 1.6185 + } 1.6186 + function resort() { 1.6187 + chords.sort(function(a, b) { 1.6188 + return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2); 1.6189 + }); 1.6190 + } 1.6191 + chord.matrix = function(x) { 1.6192 + if (!arguments.length) return matrix; 1.6193 + n = (matrix = x) && matrix.length; 1.6194 + chords = groups = null; 1.6195 + return chord; 1.6196 + }; 1.6197 + chord.padding = function(x) { 1.6198 + if (!arguments.length) return padding; 1.6199 + padding = x; 1.6200 + chords = groups = null; 1.6201 + return chord; 1.6202 + }; 1.6203 + chord.sortGroups = function(x) { 1.6204 + if (!arguments.length) return sortGroups; 1.6205 + sortGroups = x; 1.6206 + chords = groups = null; 1.6207 + return chord; 1.6208 + }; 1.6209 + chord.sortSubgroups = function(x) { 1.6210 + if (!arguments.length) return sortSubgroups; 1.6211 + sortSubgroups = x; 1.6212 + chords = null; 1.6213 + return chord; 1.6214 + }; 1.6215 + chord.sortChords = function(x) { 1.6216 + if (!arguments.length) return sortChords; 1.6217 + sortChords = x; 1.6218 + if (chords) resort(); 1.6219 + return chord; 1.6220 + }; 1.6221 + chord.chords = function() { 1.6222 + if (!chords) relayout(); 1.6223 + return chords; 1.6224 + }; 1.6225 + chord.groups = function() { 1.6226 + if (!groups) relayout(); 1.6227 + return groups; 1.6228 + }; 1.6229 + return chord; 1.6230 + }; 1.6231 + d3.layout.force = function() { 1.6232 + var force = {}, event = d3.dispatch("start", "tick", "end"), timer, 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.6233 + function repulse(node) { 1.6234 + return function(quad, x1, _, x2) { 1.6235 + if (quad.point !== node) { 1.6236 + var dx = quad.cx - node.x, dy = quad.cy - node.y, dw = x2 - x1, dn = dx * dx + dy * dy; 1.6237 + if (dw * dw / theta2 < dn) { 1.6238 + if (dn < chargeDistance2) { 1.6239 + var k = quad.charge / dn; 1.6240 + node.px -= dx * k; 1.6241 + node.py -= dy * k; 1.6242 + } 1.6243 + return true; 1.6244 + } 1.6245 + if (quad.point && dn && dn < chargeDistance2) { 1.6246 + var k = quad.pointCharge / dn; 1.6247 + node.px -= dx * k; 1.6248 + node.py -= dy * k; 1.6249 + } 1.6250 + } 1.6251 + return !quad.charge; 1.6252 + }; 1.6253 + } 1.6254 + force.tick = function() { 1.6255 + if ((alpha *= .99) < .005) { 1.6256 + timer = null; 1.6257 + event.end({ 1.6258 + type: "end", 1.6259 + alpha: alpha = 0 1.6260 + }); 1.6261 + return true; 1.6262 + } 1.6263 + var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y; 1.6264 + for (i = 0; i < m; ++i) { 1.6265 + o = links[i]; 1.6266 + s = o.source; 1.6267 + t = o.target; 1.6268 + x = t.x - s.x; 1.6269 + y = t.y - s.y; 1.6270 + if (l = x * x + y * y) { 1.6271 + l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l; 1.6272 + x *= l; 1.6273 + y *= l; 1.6274 + t.x -= x * (k = s.weight + t.weight ? s.weight / (s.weight + t.weight) : .5); 1.6275 + t.y -= y * k; 1.6276 + s.x += x * (k = 1 - k); 1.6277 + s.y += y * k; 1.6278 + } 1.6279 + } 1.6280 + if (k = alpha * gravity) { 1.6281 + x = size[0] / 2; 1.6282 + y = size[1] / 2; 1.6283 + i = -1; 1.6284 + if (k) while (++i < n) { 1.6285 + o = nodes[i]; 1.6286 + o.x += (x - o.x) * k; 1.6287 + o.y += (y - o.y) * k; 1.6288 + } 1.6289 + } 1.6290 + if (charge) { 1.6291 + d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges); 1.6292 + i = -1; 1.6293 + while (++i < n) { 1.6294 + if (!(o = nodes[i]).fixed) { 1.6295 + q.visit(repulse(o)); 1.6296 + } 1.6297 + } 1.6298 + } 1.6299 + i = -1; 1.6300 + while (++i < n) { 1.6301 + o = nodes[i]; 1.6302 + if (o.fixed) { 1.6303 + o.x = o.px; 1.6304 + o.y = o.py; 1.6305 + } else { 1.6306 + o.x -= (o.px - (o.px = o.x)) * friction; 1.6307 + o.y -= (o.py - (o.py = o.y)) * friction; 1.6308 + } 1.6309 + } 1.6310 + event.tick({ 1.6311 + type: "tick", 1.6312 + alpha: alpha 1.6313 + }); 1.6314 + }; 1.6315 + force.nodes = function(x) { 1.6316 + if (!arguments.length) return nodes; 1.6317 + nodes = x; 1.6318 + return force; 1.6319 + }; 1.6320 + force.links = function(x) { 1.6321 + if (!arguments.length) return links; 1.6322 + links = x; 1.6323 + return force; 1.6324 + }; 1.6325 + force.size = function(x) { 1.6326 + if (!arguments.length) return size; 1.6327 + size = x; 1.6328 + return force; 1.6329 + }; 1.6330 + force.linkDistance = function(x) { 1.6331 + if (!arguments.length) return linkDistance; 1.6332 + linkDistance = typeof x === "function" ? x : +x; 1.6333 + return force; 1.6334 + }; 1.6335 + force.distance = force.linkDistance; 1.6336 + force.linkStrength = function(x) { 1.6337 + if (!arguments.length) return linkStrength; 1.6338 + linkStrength = typeof x === "function" ? x : +x; 1.6339 + return force; 1.6340 + }; 1.6341 + force.friction = function(x) { 1.6342 + if (!arguments.length) return friction; 1.6343 + friction = +x; 1.6344 + return force; 1.6345 + }; 1.6346 + force.charge = function(x) { 1.6347 + if (!arguments.length) return charge; 1.6348 + charge = typeof x === "function" ? x : +x; 1.6349 + return force; 1.6350 + }; 1.6351 + force.chargeDistance = function(x) { 1.6352 + if (!arguments.length) return Math.sqrt(chargeDistance2); 1.6353 + chargeDistance2 = x * x; 1.6354 + return force; 1.6355 + }; 1.6356 + force.gravity = function(x) { 1.6357 + if (!arguments.length) return gravity; 1.6358 + gravity = +x; 1.6359 + return force; 1.6360 + }; 1.6361 + force.theta = function(x) { 1.6362 + if (!arguments.length) return Math.sqrt(theta2); 1.6363 + theta2 = x * x; 1.6364 + return force; 1.6365 + }; 1.6366 + force.alpha = function(x) { 1.6367 + if (!arguments.length) return alpha; 1.6368 + x = +x; 1.6369 + if (alpha) { 1.6370 + if (x > 0) { 1.6371 + alpha = x; 1.6372 + } else { 1.6373 + timer.c = null, timer.t = NaN, timer = null; 1.6374 + event.end({ 1.6375 + type: "end", 1.6376 + alpha: alpha = 0 1.6377 + }); 1.6378 + } 1.6379 + } else if (x > 0) { 1.6380 + event.start({ 1.6381 + type: "start", 1.6382 + alpha: alpha = x 1.6383 + }); 1.6384 + timer = d3_timer(force.tick); 1.6385 + } 1.6386 + return force; 1.6387 + }; 1.6388 + force.start = function() { 1.6389 + var i, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o; 1.6390 + for (i = 0; i < n; ++i) { 1.6391 + (o = nodes[i]).index = i; 1.6392 + o.weight = 0; 1.6393 + } 1.6394 + for (i = 0; i < m; ++i) { 1.6395 + o = links[i]; 1.6396 + if (typeof o.source == "number") o.source = nodes[o.source]; 1.6397 + if (typeof o.target == "number") o.target = nodes[o.target]; 1.6398 + ++o.source.weight; 1.6399 + ++o.target.weight; 1.6400 + } 1.6401 + for (i = 0; i < n; ++i) { 1.6402 + o = nodes[i]; 1.6403 + if (isNaN(o.x)) o.x = position("x", w); 1.6404 + if (isNaN(o.y)) o.y = position("y", h); 1.6405 + if (isNaN(o.px)) o.px = o.x; 1.6406 + if (isNaN(o.py)) o.py = o.y; 1.6407 + } 1.6408 + distances = []; 1.6409 + 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.6410 + strengths = []; 1.6411 + 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.6412 + charges = []; 1.6413 + 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.6414 + function position(dimension, size) { 1.6415 + if (!neighbors) { 1.6416 + neighbors = new Array(n); 1.6417 + for (j = 0; j < n; ++j) { 1.6418 + neighbors[j] = []; 1.6419 + } 1.6420 + for (j = 0; j < m; ++j) { 1.6421 + var o = links[j]; 1.6422 + neighbors[o.source.index].push(o.target); 1.6423 + neighbors[o.target.index].push(o.source); 1.6424 + } 1.6425 + } 1.6426 + var candidates = neighbors[i], j = -1, l = candidates.length, x; 1.6427 + while (++j < l) if (!isNaN(x = candidates[j][dimension])) return x; 1.6428 + return Math.random() * size; 1.6429 + } 1.6430 + return force.resume(); 1.6431 + }; 1.6432 + force.resume = function() { 1.6433 + return force.alpha(.1); 1.6434 + }; 1.6435 + force.stop = function() { 1.6436 + return force.alpha(0); 1.6437 + }; 1.6438 + force.drag = function() { 1.6439 + 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.6440 + if (!arguments.length) return drag; 1.6441 + this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag); 1.6442 + }; 1.6443 + function dragmove(d) { 1.6444 + d.px = d3.event.x, d.py = d3.event.y; 1.6445 + force.resume(); 1.6446 + } 1.6447 + return d3.rebind(force, event, "on"); 1.6448 + }; 1.6449 + function d3_layout_forceDragstart(d) { 1.6450 + d.fixed |= 2; 1.6451 + } 1.6452 + function d3_layout_forceDragend(d) { 1.6453 + d.fixed &= ~6; 1.6454 + } 1.6455 + function d3_layout_forceMouseover(d) { 1.6456 + d.fixed |= 4; 1.6457 + d.px = d.x, d.py = d.y; 1.6458 + } 1.6459 + function d3_layout_forceMouseout(d) { 1.6460 + d.fixed &= ~4; 1.6461 + } 1.6462 + function d3_layout_forceAccumulate(quad, alpha, charges) { 1.6463 + var cx = 0, cy = 0; 1.6464 + quad.charge = 0; 1.6465 + if (!quad.leaf) { 1.6466 + var nodes = quad.nodes, n = nodes.length, i = -1, c; 1.6467 + while (++i < n) { 1.6468 + c = nodes[i]; 1.6469 + if (c == null) continue; 1.6470 + d3_layout_forceAccumulate(c, alpha, charges); 1.6471 + quad.charge += c.charge; 1.6472 + cx += c.charge * c.cx; 1.6473 + cy += c.charge * c.cy; 1.6474 + } 1.6475 + } 1.6476 + if (quad.point) { 1.6477 + if (!quad.leaf) { 1.6478 + quad.point.x += Math.random() - .5; 1.6479 + quad.point.y += Math.random() - .5; 1.6480 + } 1.6481 + var k = alpha * charges[quad.point.index]; 1.6482 + quad.charge += quad.pointCharge = k; 1.6483 + cx += k * quad.point.x; 1.6484 + cy += k * quad.point.y; 1.6485 + } 1.6486 + quad.cx = cx / quad.charge; 1.6487 + quad.cy = cy / quad.charge; 1.6488 + } 1.6489 + var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1, d3_layout_forceChargeDistance2 = Infinity; 1.6490 + d3.layout.hierarchy = function() { 1.6491 + var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue; 1.6492 + function hierarchy(root) { 1.6493 + var stack = [ root ], nodes = [], node; 1.6494 + root.depth = 0; 1.6495 + while ((node = stack.pop()) != null) { 1.6496 + nodes.push(node); 1.6497 + if ((childs = children.call(hierarchy, node, node.depth)) && (n = childs.length)) { 1.6498 + var n, childs, child; 1.6499 + while (--n >= 0) { 1.6500 + stack.push(child = childs[n]); 1.6501 + child.parent = node; 1.6502 + child.depth = node.depth + 1; 1.6503 + } 1.6504 + if (value) node.value = 0; 1.6505 + node.children = childs; 1.6506 + } else { 1.6507 + if (value) node.value = +value.call(hierarchy, node, node.depth) || 0; 1.6508 + delete node.children; 1.6509 + } 1.6510 + } 1.6511 + d3_layout_hierarchyVisitAfter(root, function(node) { 1.6512 + var childs, parent; 1.6513 + if (sort && (childs = node.children)) childs.sort(sort); 1.6514 + if (value && (parent = node.parent)) parent.value += node.value; 1.6515 + }); 1.6516 + return nodes; 1.6517 + } 1.6518 + hierarchy.sort = function(x) { 1.6519 + if (!arguments.length) return sort; 1.6520 + sort = x; 1.6521 + return hierarchy; 1.6522 + }; 1.6523 + hierarchy.children = function(x) { 1.6524 + if (!arguments.length) return children; 1.6525 + children = x; 1.6526 + return hierarchy; 1.6527 + }; 1.6528 + hierarchy.value = function(x) { 1.6529 + if (!arguments.length) return value; 1.6530 + value = x; 1.6531 + return hierarchy; 1.6532 + }; 1.6533 + hierarchy.revalue = function(root) { 1.6534 + if (value) { 1.6535 + d3_layout_hierarchyVisitBefore(root, function(node) { 1.6536 + if (node.children) node.value = 0; 1.6537 + }); 1.6538 + d3_layout_hierarchyVisitAfter(root, function(node) { 1.6539 + var parent; 1.6540 + if (!node.children) node.value = +value.call(hierarchy, node, node.depth) || 0; 1.6541 + if (parent = node.parent) parent.value += node.value; 1.6542 + }); 1.6543 + } 1.6544 + return root; 1.6545 + }; 1.6546 + return hierarchy; 1.6547 + }; 1.6548 + function d3_layout_hierarchyRebind(object, hierarchy) { 1.6549 + d3.rebind(object, hierarchy, "sort", "children", "value"); 1.6550 + object.nodes = object; 1.6551 + object.links = d3_layout_hierarchyLinks; 1.6552 + return object; 1.6553 + } 1.6554 + function d3_layout_hierarchyVisitBefore(node, callback) { 1.6555 + var nodes = [ node ]; 1.6556 + while ((node = nodes.pop()) != null) { 1.6557 + callback(node); 1.6558 + if ((children = node.children) && (n = children.length)) { 1.6559 + var n, children; 1.6560 + while (--n >= 0) nodes.push(children[n]); 1.6561 + } 1.6562 + } 1.6563 + } 1.6564 + function d3_layout_hierarchyVisitAfter(node, callback) { 1.6565 + var nodes = [ node ], nodes2 = []; 1.6566 + while ((node = nodes.pop()) != null) { 1.6567 + nodes2.push(node); 1.6568 + if ((children = node.children) && (n = children.length)) { 1.6569 + var i = -1, n, children; 1.6570 + while (++i < n) nodes.push(children[i]); 1.6571 + } 1.6572 + } 1.6573 + while ((node = nodes2.pop()) != null) { 1.6574 + callback(node); 1.6575 + } 1.6576 + } 1.6577 + function d3_layout_hierarchyChildren(d) { 1.6578 + return d.children; 1.6579 + } 1.6580 + function d3_layout_hierarchyValue(d) { 1.6581 + return d.value; 1.6582 + } 1.6583 + function d3_layout_hierarchySort(a, b) { 1.6584 + return b.value - a.value; 1.6585 + } 1.6586 + function d3_layout_hierarchyLinks(nodes) { 1.6587 + return d3.merge(nodes.map(function(parent) { 1.6588 + return (parent.children || []).map(function(child) { 1.6589 + return { 1.6590 + source: parent, 1.6591 + target: child 1.6592 + }; 1.6593 + }); 1.6594 + })); 1.6595 + } 1.6596 + d3.layout.partition = function() { 1.6597 + var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ]; 1.6598 + function position(node, x, dx, dy) { 1.6599 + var children = node.children; 1.6600 + node.x = x; 1.6601 + node.y = node.depth * dy; 1.6602 + node.dx = dx; 1.6603 + node.dy = dy; 1.6604 + if (children && (n = children.length)) { 1.6605 + var i = -1, n, c, d; 1.6606 + dx = node.value ? dx / node.value : 0; 1.6607 + while (++i < n) { 1.6608 + position(c = children[i], x, d = c.value * dx, dy); 1.6609 + x += d; 1.6610 + } 1.6611 + } 1.6612 + } 1.6613 + function depth(node) { 1.6614 + var children = node.children, d = 0; 1.6615 + if (children && (n = children.length)) { 1.6616 + var i = -1, n; 1.6617 + while (++i < n) d = Math.max(d, depth(children[i])); 1.6618 + } 1.6619 + return 1 + d; 1.6620 + } 1.6621 + function partition(d, i) { 1.6622 + var nodes = hierarchy.call(this, d, i); 1.6623 + position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); 1.6624 + return nodes; 1.6625 + } 1.6626 + partition.size = function(x) { 1.6627 + if (!arguments.length) return size; 1.6628 + size = x; 1.6629 + return partition; 1.6630 + }; 1.6631 + return d3_layout_hierarchyRebind(partition, hierarchy); 1.6632 + }; 1.6633 + d3.layout.pie = function() { 1.6634 + var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = τ, padAngle = 0; 1.6635 + function pie(data) { 1.6636 + var n = data.length, values = data.map(function(d, i) { 1.6637 + return +value.call(pie, d, i); 1.6638 + }), a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle), da = (typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a, p = Math.min(Math.abs(da) / n, +(typeof padAngle === "function" ? padAngle.apply(this, arguments) : padAngle)), pa = p * (da < 0 ? -1 : 1), sum = d3.sum(values), k = sum ? (da - n * pa) / sum : 0, index = d3.range(n), arcs = [], v; 1.6639 + if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) { 1.6640 + return values[j] - values[i]; 1.6641 + } : function(i, j) { 1.6642 + return sort(data[i], data[j]); 1.6643 + }); 1.6644 + index.forEach(function(i) { 1.6645 + arcs[i] = { 1.6646 + data: data[i], 1.6647 + value: v = values[i], 1.6648 + startAngle: a, 1.6649 + endAngle: a += v * k + pa, 1.6650 + padAngle: p 1.6651 + }; 1.6652 + }); 1.6653 + return arcs; 1.6654 + } 1.6655 + pie.value = function(_) { 1.6656 + if (!arguments.length) return value; 1.6657 + value = _; 1.6658 + return pie; 1.6659 + }; 1.6660 + pie.sort = function(_) { 1.6661 + if (!arguments.length) return sort; 1.6662 + sort = _; 1.6663 + return pie; 1.6664 + }; 1.6665 + pie.startAngle = function(_) { 1.6666 + if (!arguments.length) return startAngle; 1.6667 + startAngle = _; 1.6668 + return pie; 1.6669 + }; 1.6670 + pie.endAngle = function(_) { 1.6671 + if (!arguments.length) return endAngle; 1.6672 + endAngle = _; 1.6673 + return pie; 1.6674 + }; 1.6675 + pie.padAngle = function(_) { 1.6676 + if (!arguments.length) return padAngle; 1.6677 + padAngle = _; 1.6678 + return pie; 1.6679 + }; 1.6680 + return pie; 1.6681 + }; 1.6682 + var d3_layout_pieSortByValue = {}; 1.6683 + d3.layout.stack = function() { 1.6684 + 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.6685 + function stack(data, index) { 1.6686 + if (!(n = data.length)) return data; 1.6687 + var series = data.map(function(d, i) { 1.6688 + return values.call(stack, d, i); 1.6689 + }); 1.6690 + var points = series.map(function(d) { 1.6691 + return d.map(function(v, i) { 1.6692 + return [ x.call(stack, v, i), y.call(stack, v, i) ]; 1.6693 + }); 1.6694 + }); 1.6695 + var orders = order.call(stack, points, index); 1.6696 + series = d3.permute(series, orders); 1.6697 + points = d3.permute(points, orders); 1.6698 + var offsets = offset.call(stack, points, index); 1.6699 + var m = series[0].length, n, i, j, o; 1.6700 + for (j = 0; j < m; ++j) { 1.6701 + out.call(stack, series[0][j], o = offsets[j], points[0][j][1]); 1.6702 + for (i = 1; i < n; ++i) { 1.6703 + out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]); 1.6704 + } 1.6705 + } 1.6706 + return data; 1.6707 + } 1.6708 + stack.values = function(x) { 1.6709 + if (!arguments.length) return values; 1.6710 + values = x; 1.6711 + return stack; 1.6712 + }; 1.6713 + stack.order = function(x) { 1.6714 + if (!arguments.length) return order; 1.6715 + order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault; 1.6716 + return stack; 1.6717 + }; 1.6718 + stack.offset = function(x) { 1.6719 + if (!arguments.length) return offset; 1.6720 + offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero; 1.6721 + return stack; 1.6722 + }; 1.6723 + stack.x = function(z) { 1.6724 + if (!arguments.length) return x; 1.6725 + x = z; 1.6726 + return stack; 1.6727 + }; 1.6728 + stack.y = function(z) { 1.6729 + if (!arguments.length) return y; 1.6730 + y = z; 1.6731 + return stack; 1.6732 + }; 1.6733 + stack.out = function(z) { 1.6734 + if (!arguments.length) return out; 1.6735 + out = z; 1.6736 + return stack; 1.6737 + }; 1.6738 + return stack; 1.6739 + }; 1.6740 + function d3_layout_stackX(d) { 1.6741 + return d.x; 1.6742 + } 1.6743 + function d3_layout_stackY(d) { 1.6744 + return d.y; 1.6745 + } 1.6746 + function d3_layout_stackOut(d, y0, y) { 1.6747 + d.y0 = y0; 1.6748 + d.y = y; 1.6749 + } 1.6750 + var d3_layout_stackOrders = d3.map({ 1.6751 + "inside-out": function(data) { 1.6752 + 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.6753 + return max[a] - max[b]; 1.6754 + }), top = 0, bottom = 0, tops = [], bottoms = []; 1.6755 + for (i = 0; i < n; ++i) { 1.6756 + j = index[i]; 1.6757 + if (top < bottom) { 1.6758 + top += sums[j]; 1.6759 + tops.push(j); 1.6760 + } else { 1.6761 + bottom += sums[j]; 1.6762 + bottoms.push(j); 1.6763 + } 1.6764 + } 1.6765 + return bottoms.reverse().concat(tops); 1.6766 + }, 1.6767 + reverse: function(data) { 1.6768 + return d3.range(data.length).reverse(); 1.6769 + }, 1.6770 + "default": d3_layout_stackOrderDefault 1.6771 + }); 1.6772 + var d3_layout_stackOffsets = d3.map({ 1.6773 + silhouette: function(data) { 1.6774 + var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = []; 1.6775 + for (j = 0; j < m; ++j) { 1.6776 + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; 1.6777 + if (o > max) max = o; 1.6778 + sums.push(o); 1.6779 + } 1.6780 + for (j = 0; j < m; ++j) { 1.6781 + y0[j] = (max - sums[j]) / 2; 1.6782 + } 1.6783 + return y0; 1.6784 + }, 1.6785 + wiggle: function(data) { 1.6786 + var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = []; 1.6787 + y0[0] = o = o0 = 0; 1.6788 + for (j = 1; j < m; ++j) { 1.6789 + for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; 1.6790 + for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { 1.6791 + for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { 1.6792 + s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; 1.6793 + } 1.6794 + s2 += s3 * data[i][j][1]; 1.6795 + } 1.6796 + y0[j] = o -= s1 ? s2 / s1 * dx : 0; 1.6797 + if (o < o0) o0 = o; 1.6798 + } 1.6799 + for (j = 0; j < m; ++j) y0[j] -= o0; 1.6800 + return y0; 1.6801 + }, 1.6802 + expand: function(data) { 1.6803 + var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = []; 1.6804 + for (j = 0; j < m; ++j) { 1.6805 + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; 1.6806 + 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.6807 + } 1.6808 + for (j = 0; j < m; ++j) y0[j] = 0; 1.6809 + return y0; 1.6810 + }, 1.6811 + zero: d3_layout_stackOffsetZero 1.6812 + }); 1.6813 + function d3_layout_stackOrderDefault(data) { 1.6814 + return d3.range(data.length); 1.6815 + } 1.6816 + function d3_layout_stackOffsetZero(data) { 1.6817 + var j = -1, m = data[0].length, y0 = []; 1.6818 + while (++j < m) y0[j] = 0; 1.6819 + return y0; 1.6820 + } 1.6821 + function d3_layout_stackMaxIndex(array) { 1.6822 + var i = 1, j = 0, v = array[0][1], k, n = array.length; 1.6823 + for (;i < n; ++i) { 1.6824 + if ((k = array[i][1]) > v) { 1.6825 + j = i; 1.6826 + v = k; 1.6827 + } 1.6828 + } 1.6829 + return j; 1.6830 + } 1.6831 + function d3_layout_stackReduceSum(d) { 1.6832 + return d.reduce(d3_layout_stackSum, 0); 1.6833 + } 1.6834 + function d3_layout_stackSum(p, d) { 1.6835 + return p + d[1]; 1.6836 + } 1.6837 + d3.layout.histogram = function() { 1.6838 + var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges; 1.6839 + function histogram(data, i) { 1.6840 + 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.6841 + while (++i < m) { 1.6842 + bin = bins[i] = []; 1.6843 + bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); 1.6844 + bin.y = 0; 1.6845 + } 1.6846 + if (m > 0) { 1.6847 + i = -1; 1.6848 + while (++i < n) { 1.6849 + x = values[i]; 1.6850 + if (x >= range[0] && x <= range[1]) { 1.6851 + bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; 1.6852 + bin.y += k; 1.6853 + bin.push(data[i]); 1.6854 + } 1.6855 + } 1.6856 + } 1.6857 + return bins; 1.6858 + } 1.6859 + histogram.value = function(x) { 1.6860 + if (!arguments.length) return valuer; 1.6861 + valuer = x; 1.6862 + return histogram; 1.6863 + }; 1.6864 + histogram.range = function(x) { 1.6865 + if (!arguments.length) return ranger; 1.6866 + ranger = d3_functor(x); 1.6867 + return histogram; 1.6868 + }; 1.6869 + histogram.bins = function(x) { 1.6870 + if (!arguments.length) return binner; 1.6871 + binner = typeof x === "number" ? function(range) { 1.6872 + return d3_layout_histogramBinFixed(range, x); 1.6873 + } : d3_functor(x); 1.6874 + return histogram; 1.6875 + }; 1.6876 + histogram.frequency = function(x) { 1.6877 + if (!arguments.length) return frequency; 1.6878 + frequency = !!x; 1.6879 + return histogram; 1.6880 + }; 1.6881 + return histogram; 1.6882 + }; 1.6883 + function d3_layout_histogramBinSturges(range, values) { 1.6884 + return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); 1.6885 + } 1.6886 + function d3_layout_histogramBinFixed(range, n) { 1.6887 + var x = -1, b = +range[0], m = (range[1] - b) / n, f = []; 1.6888 + while (++x <= n) f[x] = m * x + b; 1.6889 + return f; 1.6890 + } 1.6891 + function d3_layout_histogramRange(values) { 1.6892 + return [ d3.min(values), d3.max(values) ]; 1.6893 + } 1.6894 + d3.layout.pack = function() { 1.6895 + var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ], radius; 1.6896 + function pack(d, i) { 1.6897 + 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.6898 + return radius; 1.6899 + }; 1.6900 + root.x = root.y = 0; 1.6901 + d3_layout_hierarchyVisitAfter(root, function(d) { 1.6902 + d.r = +r(d.value); 1.6903 + }); 1.6904 + d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings); 1.6905 + if (padding) { 1.6906 + var dr = padding * (radius ? 1 : Math.max(2 * root.r / w, 2 * root.r / h)) / 2; 1.6907 + d3_layout_hierarchyVisitAfter(root, function(d) { 1.6908 + d.r += dr; 1.6909 + }); 1.6910 + d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings); 1.6911 + d3_layout_hierarchyVisitAfter(root, function(d) { 1.6912 + d.r -= dr; 1.6913 + }); 1.6914 + } 1.6915 + d3_layout_packTransform(root, w / 2, h / 2, radius ? 1 : 1 / Math.max(2 * root.r / w, 2 * root.r / h)); 1.6916 + return nodes; 1.6917 + } 1.6918 + pack.size = function(_) { 1.6919 + if (!arguments.length) return size; 1.6920 + size = _; 1.6921 + return pack; 1.6922 + }; 1.6923 + pack.radius = function(_) { 1.6924 + if (!arguments.length) return radius; 1.6925 + radius = _ == null || typeof _ === "function" ? _ : +_; 1.6926 + return pack; 1.6927 + }; 1.6928 + pack.padding = function(_) { 1.6929 + if (!arguments.length) return padding; 1.6930 + padding = +_; 1.6931 + return pack; 1.6932 + }; 1.6933 + return d3_layout_hierarchyRebind(pack, hierarchy); 1.6934 + }; 1.6935 + function d3_layout_packSort(a, b) { 1.6936 + return a.value - b.value; 1.6937 + } 1.6938 + function d3_layout_packInsert(a, b) { 1.6939 + var c = a._pack_next; 1.6940 + a._pack_next = b; 1.6941 + b._pack_prev = a; 1.6942 + b._pack_next = c; 1.6943 + c._pack_prev = b; 1.6944 + } 1.6945 + function d3_layout_packSplice(a, b) { 1.6946 + a._pack_next = b; 1.6947 + b._pack_prev = a; 1.6948 + } 1.6949 + function d3_layout_packIntersects(a, b) { 1.6950 + var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r; 1.6951 + return .999 * dr * dr > dx * dx + dy * dy; 1.6952 + } 1.6953 + function d3_layout_packSiblings(node) { 1.6954 + if (!(nodes = node.children) || !(n = nodes.length)) return; 1.6955 + var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n; 1.6956 + function bound(node) { 1.6957 + xMin = Math.min(node.x - node.r, xMin); 1.6958 + xMax = Math.max(node.x + node.r, xMax); 1.6959 + yMin = Math.min(node.y - node.r, yMin); 1.6960 + yMax = Math.max(node.y + node.r, yMax); 1.6961 + } 1.6962 + nodes.forEach(d3_layout_packLink); 1.6963 + a = nodes[0]; 1.6964 + a.x = -a.r; 1.6965 + a.y = 0; 1.6966 + bound(a); 1.6967 + if (n > 1) { 1.6968 + b = nodes[1]; 1.6969 + b.x = b.r; 1.6970 + b.y = 0; 1.6971 + bound(b); 1.6972 + if (n > 2) { 1.6973 + c = nodes[2]; 1.6974 + d3_layout_packPlace(a, b, c); 1.6975 + bound(c); 1.6976 + d3_layout_packInsert(a, c); 1.6977 + a._pack_prev = c; 1.6978 + d3_layout_packInsert(c, b); 1.6979 + b = a._pack_next; 1.6980 + for (i = 3; i < n; i++) { 1.6981 + d3_layout_packPlace(a, b, c = nodes[i]); 1.6982 + var isect = 0, s1 = 1, s2 = 1; 1.6983 + for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { 1.6984 + if (d3_layout_packIntersects(j, c)) { 1.6985 + isect = 1; 1.6986 + break; 1.6987 + } 1.6988 + } 1.6989 + if (isect == 1) { 1.6990 + for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { 1.6991 + if (d3_layout_packIntersects(k, c)) { 1.6992 + break; 1.6993 + } 1.6994 + } 1.6995 + } 1.6996 + if (isect) { 1.6997 + if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b); 1.6998 + i--; 1.6999 + } else { 1.7000 + d3_layout_packInsert(a, c); 1.7001 + b = c; 1.7002 + bound(c); 1.7003 + } 1.7004 + } 1.7005 + } 1.7006 + } 1.7007 + var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0; 1.7008 + for (i = 0; i < n; i++) { 1.7009 + c = nodes[i]; 1.7010 + c.x -= cx; 1.7011 + c.y -= cy; 1.7012 + cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y)); 1.7013 + } 1.7014 + node.r = cr; 1.7015 + nodes.forEach(d3_layout_packUnlink); 1.7016 + } 1.7017 + function d3_layout_packLink(node) { 1.7018 + node._pack_next = node._pack_prev = node; 1.7019 + } 1.7020 + function d3_layout_packUnlink(node) { 1.7021 + delete node._pack_next; 1.7022 + delete node._pack_prev; 1.7023 + } 1.7024 + function d3_layout_packTransform(node, x, y, k) { 1.7025 + var children = node.children; 1.7026 + node.x = x += k * node.x; 1.7027 + node.y = y += k * node.y; 1.7028 + node.r *= k; 1.7029 + if (children) { 1.7030 + var i = -1, n = children.length; 1.7031 + while (++i < n) d3_layout_packTransform(children[i], x, y, k); 1.7032 + } 1.7033 + } 1.7034 + function d3_layout_packPlace(a, b, c) { 1.7035 + var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y; 1.7036 + if (db && (dx || dy)) { 1.7037 + var da = b.r + c.r, dc = dx * dx + dy * dy; 1.7038 + da *= da; 1.7039 + db *= db; 1.7040 + 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.7041 + c.x = a.x + x * dx + y * dy; 1.7042 + c.y = a.y + x * dy - y * dx; 1.7043 + } else { 1.7044 + c.x = a.x + db; 1.7045 + c.y = a.y; 1.7046 + } 1.7047 + } 1.7048 + d3.layout.tree = function() { 1.7049 + var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = null; 1.7050 + function tree(d, i) { 1.7051 + var nodes = hierarchy.call(this, d, i), root0 = nodes[0], root1 = wrapTree(root0); 1.7052 + d3_layout_hierarchyVisitAfter(root1, firstWalk), root1.parent.m = -root1.z; 1.7053 + d3_layout_hierarchyVisitBefore(root1, secondWalk); 1.7054 + if (nodeSize) d3_layout_hierarchyVisitBefore(root0, sizeNode); else { 1.7055 + var left = root0, right = root0, bottom = root0; 1.7056 + d3_layout_hierarchyVisitBefore(root0, function(node) { 1.7057 + if (node.x < left.x) left = node; 1.7058 + if (node.x > right.x) right = node; 1.7059 + if (node.depth > bottom.depth) bottom = node; 1.7060 + }); 1.7061 + var tx = separation(left, right) / 2 - left.x, kx = size[0] / (right.x + separation(right, left) / 2 + tx), ky = size[1] / (bottom.depth || 1); 1.7062 + d3_layout_hierarchyVisitBefore(root0, function(node) { 1.7063 + node.x = (node.x + tx) * kx; 1.7064 + node.y = node.depth * ky; 1.7065 + }); 1.7066 + } 1.7067 + return nodes; 1.7068 + } 1.7069 + function wrapTree(root0) { 1.7070 + var root1 = { 1.7071 + A: null, 1.7072 + children: [ root0 ] 1.7073 + }, queue = [ root1 ], node1; 1.7074 + while ((node1 = queue.pop()) != null) { 1.7075 + for (var children = node1.children, child, i = 0, n = children.length; i < n; ++i) { 1.7076 + queue.push((children[i] = child = { 1.7077 + _: children[i], 1.7078 + parent: node1, 1.7079 + children: (child = children[i].children) && child.slice() || [], 1.7080 + A: null, 1.7081 + a: null, 1.7082 + z: 0, 1.7083 + m: 0, 1.7084 + c: 0, 1.7085 + s: 0, 1.7086 + t: null, 1.7087 + i: i 1.7088 + }).a = child); 1.7089 + } 1.7090 + } 1.7091 + return root1.children[0]; 1.7092 + } 1.7093 + function firstWalk(v) { 1.7094 + var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null; 1.7095 + if (children.length) { 1.7096 + d3_layout_treeShift(v); 1.7097 + var midpoint = (children[0].z + children[children.length - 1].z) / 2; 1.7098 + if (w) { 1.7099 + v.z = w.z + separation(v._, w._); 1.7100 + v.m = v.z - midpoint; 1.7101 + } else { 1.7102 + v.z = midpoint; 1.7103 + } 1.7104 + } else if (w) { 1.7105 + v.z = w.z + separation(v._, w._); 1.7106 + } 1.7107 + v.parent.A = apportion(v, w, v.parent.A || siblings[0]); 1.7108 + } 1.7109 + function secondWalk(v) { 1.7110 + v._.x = v.z + v.parent.m; 1.7111 + v.m += v.parent.m; 1.7112 + } 1.7113 + function apportion(v, w, ancestor) { 1.7114 + if (w) { 1.7115 + var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift; 1.7116 + while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) { 1.7117 + vom = d3_layout_treeLeft(vom); 1.7118 + vop = d3_layout_treeRight(vop); 1.7119 + vop.a = v; 1.7120 + shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); 1.7121 + if (shift > 0) { 1.7122 + d3_layout_treeMove(d3_layout_treeAncestor(vim, v, ancestor), v, shift); 1.7123 + sip += shift; 1.7124 + sop += shift; 1.7125 + } 1.7126 + sim += vim.m; 1.7127 + sip += vip.m; 1.7128 + som += vom.m; 1.7129 + sop += vop.m; 1.7130 + } 1.7131 + if (vim && !d3_layout_treeRight(vop)) { 1.7132 + vop.t = vim; 1.7133 + vop.m += sim - sop; 1.7134 + } 1.7135 + if (vip && !d3_layout_treeLeft(vom)) { 1.7136 + vom.t = vip; 1.7137 + vom.m += sip - som; 1.7138 + ancestor = v; 1.7139 + } 1.7140 + } 1.7141 + return ancestor; 1.7142 + } 1.7143 + function sizeNode(node) { 1.7144 + node.x *= size[0]; 1.7145 + node.y = node.depth * size[1]; 1.7146 + } 1.7147 + tree.separation = function(x) { 1.7148 + if (!arguments.length) return separation; 1.7149 + separation = x; 1.7150 + return tree; 1.7151 + }; 1.7152 + tree.size = function(x) { 1.7153 + if (!arguments.length) return nodeSize ? null : size; 1.7154 + nodeSize = (size = x) == null ? sizeNode : null; 1.7155 + return tree; 1.7156 + }; 1.7157 + tree.nodeSize = function(x) { 1.7158 + if (!arguments.length) return nodeSize ? size : null; 1.7159 + nodeSize = (size = x) == null ? null : sizeNode; 1.7160 + return tree; 1.7161 + }; 1.7162 + return d3_layout_hierarchyRebind(tree, hierarchy); 1.7163 + }; 1.7164 + function d3_layout_treeSeparation(a, b) { 1.7165 + return a.parent == b.parent ? 1 : 2; 1.7166 + } 1.7167 + function d3_layout_treeLeft(v) { 1.7168 + var children = v.children; 1.7169 + return children.length ? children[0] : v.t; 1.7170 + } 1.7171 + function d3_layout_treeRight(v) { 1.7172 + var children = v.children, n; 1.7173 + return (n = children.length) ? children[n - 1] : v.t; 1.7174 + } 1.7175 + function d3_layout_treeMove(wm, wp, shift) { 1.7176 + var change = shift / (wp.i - wm.i); 1.7177 + wp.c -= change; 1.7178 + wp.s += shift; 1.7179 + wm.c += change; 1.7180 + wp.z += shift; 1.7181 + wp.m += shift; 1.7182 + } 1.7183 + function d3_layout_treeShift(v) { 1.7184 + var shift = 0, change = 0, children = v.children, i = children.length, w; 1.7185 + while (--i >= 0) { 1.7186 + w = children[i]; 1.7187 + w.z += shift; 1.7188 + w.m += shift; 1.7189 + shift += w.s + (change += w.c); 1.7190 + } 1.7191 + } 1.7192 + function d3_layout_treeAncestor(vim, v, ancestor) { 1.7193 + return vim.a.parent === v.parent ? vim.a : ancestor; 1.7194 + } 1.7195 + d3.layout.cluster = function() { 1.7196 + var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = false; 1.7197 + function cluster(d, i) { 1.7198 + var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0; 1.7199 + d3_layout_hierarchyVisitAfter(root, function(node) { 1.7200 + var children = node.children; 1.7201 + if (children && children.length) { 1.7202 + node.x = d3_layout_clusterX(children); 1.7203 + node.y = d3_layout_clusterY(children); 1.7204 + } else { 1.7205 + node.x = previousNode ? x += separation(node, previousNode) : 0; 1.7206 + node.y = 0; 1.7207 + previousNode = node; 1.7208 + } 1.7209 + }); 1.7210 + 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.7211 + d3_layout_hierarchyVisitAfter(root, nodeSize ? function(node) { 1.7212 + node.x = (node.x - root.x) * size[0]; 1.7213 + node.y = (root.y - node.y) * size[1]; 1.7214 + } : function(node) { 1.7215 + node.x = (node.x - x0) / (x1 - x0) * size[0]; 1.7216 + node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; 1.7217 + }); 1.7218 + return nodes; 1.7219 + } 1.7220 + cluster.separation = function(x) { 1.7221 + if (!arguments.length) return separation; 1.7222 + separation = x; 1.7223 + return cluster; 1.7224 + }; 1.7225 + cluster.size = function(x) { 1.7226 + if (!arguments.length) return nodeSize ? null : size; 1.7227 + nodeSize = (size = x) == null; 1.7228 + return cluster; 1.7229 + }; 1.7230 + cluster.nodeSize = function(x) { 1.7231 + if (!arguments.length) return nodeSize ? size : null; 1.7232 + nodeSize = (size = x) != null; 1.7233 + return cluster; 1.7234 + }; 1.7235 + return d3_layout_hierarchyRebind(cluster, hierarchy); 1.7236 + }; 1.7237 + function d3_layout_clusterY(children) { 1.7238 + return 1 + d3.max(children, function(child) { 1.7239 + return child.y; 1.7240 + }); 1.7241 + } 1.7242 + function d3_layout_clusterX(children) { 1.7243 + return children.reduce(function(x, child) { 1.7244 + return x + child.x; 1.7245 + }, 0) / children.length; 1.7246 + } 1.7247 + function d3_layout_clusterLeft(node) { 1.7248 + var children = node.children; 1.7249 + return children && children.length ? d3_layout_clusterLeft(children[0]) : node; 1.7250 + } 1.7251 + function d3_layout_clusterRight(node) { 1.7252 + var children = node.children, n; 1.7253 + return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; 1.7254 + } 1.7255 + d3.layout.treemap = function() { 1.7256 + 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.7257 + function scale(children, k) { 1.7258 + var i = -1, n = children.length, child, area; 1.7259 + while (++i < n) { 1.7260 + area = (child = children[i]).value * (k < 0 ? 0 : k); 1.7261 + child.area = isNaN(area) || area <= 0 ? 0 : area; 1.7262 + } 1.7263 + } 1.7264 + function squarify(node) { 1.7265 + var children = node.children; 1.7266 + if (children && children.length) { 1.7267 + 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.7268 + scale(remaining, rect.dx * rect.dy / node.value); 1.7269 + row.area = 0; 1.7270 + while ((n = remaining.length) > 0) { 1.7271 + row.push(child = remaining[n - 1]); 1.7272 + row.area += child.area; 1.7273 + if (mode !== "squarify" || (score = worst(row, u)) <= best) { 1.7274 + remaining.pop(); 1.7275 + best = score; 1.7276 + } else { 1.7277 + row.area -= row.pop().area; 1.7278 + position(row, u, rect, false); 1.7279 + u = Math.min(rect.dx, rect.dy); 1.7280 + row.length = row.area = 0; 1.7281 + best = Infinity; 1.7282 + } 1.7283 + } 1.7284 + if (row.length) { 1.7285 + position(row, u, rect, true); 1.7286 + row.length = row.area = 0; 1.7287 + } 1.7288 + children.forEach(squarify); 1.7289 + } 1.7290 + } 1.7291 + function stickify(node) { 1.7292 + var children = node.children; 1.7293 + if (children && children.length) { 1.7294 + var rect = pad(node), remaining = children.slice(), child, row = []; 1.7295 + scale(remaining, rect.dx * rect.dy / node.value); 1.7296 + row.area = 0; 1.7297 + while (child = remaining.pop()) { 1.7298 + row.push(child); 1.7299 + row.area += child.area; 1.7300 + if (child.z != null) { 1.7301 + position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); 1.7302 + row.length = row.area = 0; 1.7303 + } 1.7304 + } 1.7305 + children.forEach(stickify); 1.7306 + } 1.7307 + } 1.7308 + function worst(row, u) { 1.7309 + var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length; 1.7310 + while (++i < n) { 1.7311 + if (!(r = row[i].area)) continue; 1.7312 + if (r < rmin) rmin = r; 1.7313 + if (r > rmax) rmax = r; 1.7314 + } 1.7315 + s *= s; 1.7316 + u *= u; 1.7317 + return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity; 1.7318 + } 1.7319 + function position(row, u, rect, flush) { 1.7320 + var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o; 1.7321 + if (u == rect.dx) { 1.7322 + if (flush || v > rect.dy) v = rect.dy; 1.7323 + while (++i < n) { 1.7324 + o = row[i]; 1.7325 + o.x = x; 1.7326 + o.y = y; 1.7327 + o.dy = v; 1.7328 + x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0); 1.7329 + } 1.7330 + o.z = true; 1.7331 + o.dx += rect.x + rect.dx - x; 1.7332 + rect.y += v; 1.7333 + rect.dy -= v; 1.7334 + } else { 1.7335 + if (flush || v > rect.dx) v = rect.dx; 1.7336 + while (++i < n) { 1.7337 + o = row[i]; 1.7338 + o.x = x; 1.7339 + o.y = y; 1.7340 + o.dx = v; 1.7341 + y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0); 1.7342 + } 1.7343 + o.z = false; 1.7344 + o.dy += rect.y + rect.dy - y; 1.7345 + rect.x += v; 1.7346 + rect.dx -= v; 1.7347 + } 1.7348 + } 1.7349 + function treemap(d) { 1.7350 + var nodes = stickies || hierarchy(d), root = nodes[0]; 1.7351 + root.x = root.y = 0; 1.7352 + if (root.value) root.dx = size[0], root.dy = size[1]; else root.dx = root.dy = 0; 1.7353 + if (stickies) hierarchy.revalue(root); 1.7354 + scale([ root ], root.dx * root.dy / root.value); 1.7355 + (stickies ? stickify : squarify)(root); 1.7356 + if (sticky) stickies = nodes; 1.7357 + return nodes; 1.7358 + } 1.7359 + treemap.size = function(x) { 1.7360 + if (!arguments.length) return size; 1.7361 + size = x; 1.7362 + return treemap; 1.7363 + }; 1.7364 + treemap.padding = function(x) { 1.7365 + if (!arguments.length) return padding; 1.7366 + function padFunction(node) { 1.7367 + var p = x.call(treemap, node, node.depth); 1.7368 + return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p); 1.7369 + } 1.7370 + function padConstant(node) { 1.7371 + return d3_layout_treemapPad(node, x); 1.7372 + } 1.7373 + var type; 1.7374 + pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], 1.7375 + padConstant) : padConstant; 1.7376 + return treemap; 1.7377 + }; 1.7378 + treemap.round = function(x) { 1.7379 + if (!arguments.length) return round != Number; 1.7380 + round = x ? Math.round : Number; 1.7381 + return treemap; 1.7382 + }; 1.7383 + treemap.sticky = function(x) { 1.7384 + if (!arguments.length) return sticky; 1.7385 + sticky = x; 1.7386 + stickies = null; 1.7387 + return treemap; 1.7388 + }; 1.7389 + treemap.ratio = function(x) { 1.7390 + if (!arguments.length) return ratio; 1.7391 + ratio = x; 1.7392 + return treemap; 1.7393 + }; 1.7394 + treemap.mode = function(x) { 1.7395 + if (!arguments.length) return mode; 1.7396 + mode = x + ""; 1.7397 + return treemap; 1.7398 + }; 1.7399 + return d3_layout_hierarchyRebind(treemap, hierarchy); 1.7400 + }; 1.7401 + function d3_layout_treemapPadNull(node) { 1.7402 + return { 1.7403 + x: node.x, 1.7404 + y: node.y, 1.7405 + dx: node.dx, 1.7406 + dy: node.dy 1.7407 + }; 1.7408 + } 1.7409 + function d3_layout_treemapPad(node, padding) { 1.7410 + 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.7411 + if (dx < 0) { 1.7412 + x += dx / 2; 1.7413 + dx = 0; 1.7414 + } 1.7415 + if (dy < 0) { 1.7416 + y += dy / 2; 1.7417 + dy = 0; 1.7418 + } 1.7419 + return { 1.7420 + x: x, 1.7421 + y: y, 1.7422 + dx: dx, 1.7423 + dy: dy 1.7424 + }; 1.7425 + } 1.7426 + d3.random = { 1.7427 + normal: function(µ, σ) { 1.7428 + var n = arguments.length; 1.7429 + if (n < 2) σ = 1; 1.7430 + if (n < 1) µ = 0; 1.7431 + return function() { 1.7432 + var x, y, r; 1.7433 + do { 1.7434 + x = Math.random() * 2 - 1; 1.7435 + y = Math.random() * 2 - 1; 1.7436 + r = x * x + y * y; 1.7437 + } while (!r || r > 1); 1.7438 + return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r); 1.7439 + }; 1.7440 + }, 1.7441 + logNormal: function() { 1.7442 + var random = d3.random.normal.apply(d3, arguments); 1.7443 + return function() { 1.7444 + return Math.exp(random()); 1.7445 + }; 1.7446 + }, 1.7447 + bates: function(m) { 1.7448 + var random = d3.random.irwinHall(m); 1.7449 + return function() { 1.7450 + return random() / m; 1.7451 + }; 1.7452 + }, 1.7453 + irwinHall: function(m) { 1.7454 + return function() { 1.7455 + for (var s = 0, j = 0; j < m; j++) s += Math.random(); 1.7456 + return s; 1.7457 + }; 1.7458 + } 1.7459 + }; 1.7460 + d3.scale = {}; 1.7461 + function d3_scaleExtent(domain) { 1.7462 + var start = domain[0], stop = domain[domain.length - 1]; 1.7463 + return start < stop ? [ start, stop ] : [ stop, start ]; 1.7464 + } 1.7465 + function d3_scaleRange(scale) { 1.7466 + return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); 1.7467 + } 1.7468 + function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { 1.7469 + var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]); 1.7470 + return function(x) { 1.7471 + return i(u(x)); 1.7472 + }; 1.7473 + } 1.7474 + function d3_scale_nice(domain, nice) { 1.7475 + var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx; 1.7476 + if (x1 < x0) { 1.7477 + dx = i0, i0 = i1, i1 = dx; 1.7478 + dx = x0, x0 = x1, x1 = dx; 1.7479 + } 1.7480 + domain[i0] = nice.floor(x0); 1.7481 + domain[i1] = nice.ceil(x1); 1.7482 + return domain; 1.7483 + } 1.7484 + function d3_scale_niceStep(step) { 1.7485 + return step ? { 1.7486 + floor: function(x) { 1.7487 + return Math.floor(x / step) * step; 1.7488 + }, 1.7489 + ceil: function(x) { 1.7490 + return Math.ceil(x / step) * step; 1.7491 + } 1.7492 + } : d3_scale_niceIdentity; 1.7493 + } 1.7494 + var d3_scale_niceIdentity = { 1.7495 + floor: d3_identity, 1.7496 + ceil: d3_identity 1.7497 + }; 1.7498 + function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { 1.7499 + var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1; 1.7500 + if (domain[k] < domain[0]) { 1.7501 + domain = domain.slice().reverse(); 1.7502 + range = range.slice().reverse(); 1.7503 + } 1.7504 + while (++j <= k) { 1.7505 + u.push(uninterpolate(domain[j - 1], domain[j])); 1.7506 + i.push(interpolate(range[j - 1], range[j])); 1.7507 + } 1.7508 + return function(x) { 1.7509 + var j = d3.bisect(domain, x, 1, k) - 1; 1.7510 + return i[j](u[j](x)); 1.7511 + }; 1.7512 + } 1.7513 + d3.scale.linear = function() { 1.7514 + return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3_interpolate, false); 1.7515 + }; 1.7516 + function d3_scale_linear(domain, range, interpolate, clamp) { 1.7517 + var output, input; 1.7518 + function rescale() { 1.7519 + var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; 1.7520 + output = linear(domain, range, uninterpolate, interpolate); 1.7521 + input = linear(range, domain, uninterpolate, d3_interpolate); 1.7522 + return scale; 1.7523 + } 1.7524 + function scale(x) { 1.7525 + return output(x); 1.7526 + } 1.7527 + scale.invert = function(y) { 1.7528 + return input(y); 1.7529 + }; 1.7530 + scale.domain = function(x) { 1.7531 + if (!arguments.length) return domain; 1.7532 + domain = x.map(Number); 1.7533 + return rescale(); 1.7534 + }; 1.7535 + scale.range = function(x) { 1.7536 + if (!arguments.length) return range; 1.7537 + range = x; 1.7538 + return rescale(); 1.7539 + }; 1.7540 + scale.rangeRound = function(x) { 1.7541 + return scale.range(x).interpolate(d3_interpolateRound); 1.7542 + }; 1.7543 + scale.clamp = function(x) { 1.7544 + if (!arguments.length) return clamp; 1.7545 + clamp = x; 1.7546 + return rescale(); 1.7547 + }; 1.7548 + scale.interpolate = function(x) { 1.7549 + if (!arguments.length) return interpolate; 1.7550 + interpolate = x; 1.7551 + return rescale(); 1.7552 + }; 1.7553 + scale.ticks = function(m) { 1.7554 + return d3_scale_linearTicks(domain, m); 1.7555 + }; 1.7556 + scale.tickFormat = function(m, format) { 1.7557 + return d3_scale_linearTickFormat(domain, m, format); 1.7558 + }; 1.7559 + scale.nice = function(m) { 1.7560 + d3_scale_linearNice(domain, m); 1.7561 + return rescale(); 1.7562 + }; 1.7563 + scale.copy = function() { 1.7564 + return d3_scale_linear(domain, range, interpolate, clamp); 1.7565 + }; 1.7566 + return rescale(); 1.7567 + } 1.7568 + function d3_scale_linearRebind(scale, linear) { 1.7569 + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); 1.7570 + } 1.7571 + function d3_scale_linearNice(domain, m) { 1.7572 + d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2])); 1.7573 + d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2])); 1.7574 + return domain; 1.7575 + } 1.7576 + function d3_scale_linearTickRange(domain, m) { 1.7577 + if (m == null) m = 10; 1.7578 + 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.7579 + if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2; 1.7580 + extent[0] = Math.ceil(extent[0] / step) * step; 1.7581 + extent[1] = Math.floor(extent[1] / step) * step + step * .5; 1.7582 + extent[2] = step; 1.7583 + return extent; 1.7584 + } 1.7585 + function d3_scale_linearTicks(domain, m) { 1.7586 + return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); 1.7587 + } 1.7588 + function d3_scale_linearTickFormat(domain, m, format) { 1.7589 + var range = d3_scale_linearTickRange(domain, m); 1.7590 + if (format) { 1.7591 + var match = d3_format_re.exec(format); 1.7592 + match.shift(); 1.7593 + if (match[8] === "s") { 1.7594 + var prefix = d3.formatPrefix(Math.max(abs(range[0]), abs(range[1]))); 1.7595 + if (!match[7]) match[7] = "." + d3_scale_linearPrecision(prefix.scale(range[2])); 1.7596 + match[8] = "f"; 1.7597 + format = d3.format(match.join("")); 1.7598 + return function(d) { 1.7599 + return format(prefix.scale(d)) + prefix.symbol; 1.7600 + }; 1.7601 + } 1.7602 + if (!match[7]) match[7] = "." + d3_scale_linearFormatPrecision(match[8], range); 1.7603 + format = match.join(""); 1.7604 + } else { 1.7605 + format = ",." + d3_scale_linearPrecision(range[2]) + "f"; 1.7606 + } 1.7607 + return d3.format(format); 1.7608 + } 1.7609 + var d3_scale_linearFormatSignificant = { 1.7610 + s: 1, 1.7611 + g: 1, 1.7612 + p: 1, 1.7613 + r: 1, 1.7614 + e: 1 1.7615 + }; 1.7616 + function d3_scale_linearPrecision(value) { 1.7617 + return -Math.floor(Math.log(value) / Math.LN10 + .01); 1.7618 + } 1.7619 + function d3_scale_linearFormatPrecision(type, range) { 1.7620 + var p = d3_scale_linearPrecision(range[2]); 1.7621 + return type in d3_scale_linearFormatSignificant ? Math.abs(p - d3_scale_linearPrecision(Math.max(abs(range[0]), abs(range[1])))) + +(type !== "e") : p - (type === "%") * 2; 1.7622 + } 1.7623 + d3.scale.log = function() { 1.7624 + return d3_scale_log(d3.scale.linear().domain([ 0, 1 ]), 10, true, [ 1, 10 ]); 1.7625 + }; 1.7626 + function d3_scale_log(linear, base, positive, domain) { 1.7627 + function log(x) { 1.7628 + return (positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(base); 1.7629 + } 1.7630 + function pow(x) { 1.7631 + return positive ? Math.pow(base, x) : -Math.pow(base, -x); 1.7632 + } 1.7633 + function scale(x) { 1.7634 + return linear(log(x)); 1.7635 + } 1.7636 + scale.invert = function(x) { 1.7637 + return pow(linear.invert(x)); 1.7638 + }; 1.7639 + scale.domain = function(x) { 1.7640 + if (!arguments.length) return domain; 1.7641 + positive = x[0] >= 0; 1.7642 + linear.domain((domain = x.map(Number)).map(log)); 1.7643 + return scale; 1.7644 + }; 1.7645 + scale.base = function(_) { 1.7646 + if (!arguments.length) return base; 1.7647 + base = +_; 1.7648 + linear.domain(domain.map(log)); 1.7649 + return scale; 1.7650 + }; 1.7651 + scale.nice = function() { 1.7652 + var niced = d3_scale_nice(domain.map(log), positive ? Math : d3_scale_logNiceNegative); 1.7653 + linear.domain(niced); 1.7654 + domain = niced.map(pow); 1.7655 + return scale; 1.7656 + }; 1.7657 + scale.ticks = function() { 1.7658 + 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.7659 + if (isFinite(j - i)) { 1.7660 + if (positive) { 1.7661 + for (;i < j; i++) for (var k = 1; k < n; k++) ticks.push(pow(i) * k); 1.7662 + ticks.push(pow(i)); 1.7663 + } else { 1.7664 + ticks.push(pow(i)); 1.7665 + for (;i++ < j; ) for (var k = n - 1; k > 0; k--) ticks.push(pow(i) * k); 1.7666 + } 1.7667 + for (i = 0; ticks[i] < u; i++) {} 1.7668 + for (j = ticks.length; ticks[j - 1] > v; j--) {} 1.7669 + ticks = ticks.slice(i, j); 1.7670 + } 1.7671 + return ticks; 1.7672 + }; 1.7673 + scale.tickFormat = function(n, format) { 1.7674 + if (!arguments.length) return d3_scale_logFormat; 1.7675 + if (arguments.length < 2) format = d3_scale_logFormat; else if (typeof format !== "function") format = d3.format(format); 1.7676 + var k = Math.max(1, base * n / scale.ticks().length); 1.7677 + return function(d) { 1.7678 + var i = d / pow(Math.round(log(d))); 1.7679 + if (i * base < base - .5) i *= base; 1.7680 + return i <= k ? format(d) : ""; 1.7681 + }; 1.7682 + }; 1.7683 + scale.copy = function() { 1.7684 + return d3_scale_log(linear.copy(), base, positive, domain); 1.7685 + }; 1.7686 + return d3_scale_linearRebind(scale, linear); 1.7687 + } 1.7688 + var d3_scale_logFormat = d3.format(".0e"), d3_scale_logNiceNegative = { 1.7689 + floor: function(x) { 1.7690 + return -Math.ceil(-x); 1.7691 + }, 1.7692 + ceil: function(x) { 1.7693 + return -Math.floor(-x); 1.7694 + } 1.7695 + }; 1.7696 + d3.scale.pow = function() { 1.7697 + return d3_scale_pow(d3.scale.linear(), 1, [ 0, 1 ]); 1.7698 + }; 1.7699 + function d3_scale_pow(linear, exponent, domain) { 1.7700 + var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent); 1.7701 + function scale(x) { 1.7702 + return linear(powp(x)); 1.7703 + } 1.7704 + scale.invert = function(x) { 1.7705 + return powb(linear.invert(x)); 1.7706 + }; 1.7707 + scale.domain = function(x) { 1.7708 + if (!arguments.length) return domain; 1.7709 + linear.domain((domain = x.map(Number)).map(powp)); 1.7710 + return scale; 1.7711 + }; 1.7712 + scale.ticks = function(m) { 1.7713 + return d3_scale_linearTicks(domain, m); 1.7714 + }; 1.7715 + scale.tickFormat = function(m, format) { 1.7716 + return d3_scale_linearTickFormat(domain, m, format); 1.7717 + }; 1.7718 + scale.nice = function(m) { 1.7719 + return scale.domain(d3_scale_linearNice(domain, m)); 1.7720 + }; 1.7721 + scale.exponent = function(x) { 1.7722 + if (!arguments.length) return exponent; 1.7723 + powp = d3_scale_powPow(exponent = x); 1.7724 + powb = d3_scale_powPow(1 / exponent); 1.7725 + linear.domain(domain.map(powp)); 1.7726 + return scale; 1.7727 + }; 1.7728 + scale.copy = function() { 1.7729 + return d3_scale_pow(linear.copy(), exponent, domain); 1.7730 + }; 1.7731 + return d3_scale_linearRebind(scale, linear); 1.7732 + } 1.7733 + function d3_scale_powPow(e) { 1.7734 + return function(x) { 1.7735 + return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); 1.7736 + }; 1.7737 + } 1.7738 + d3.scale.sqrt = function() { 1.7739 + return d3.scale.pow().exponent(.5); 1.7740 + }; 1.7741 + d3.scale.ordinal = function() { 1.7742 + return d3_scale_ordinal([], { 1.7743 + t: "range", 1.7744 + a: [ [] ] 1.7745 + }); 1.7746 + }; 1.7747 + function d3_scale_ordinal(domain, ranger) { 1.7748 + var index, range, rangeBand; 1.7749 + function scale(x) { 1.7750 + return range[((index.get(x) || (ranger.t === "range" ? index.set(x, domain.push(x)) : NaN)) - 1) % range.length]; 1.7751 + } 1.7752 + function steps(start, step) { 1.7753 + return d3.range(domain.length).map(function(i) { 1.7754 + return start + step * i; 1.7755 + }); 1.7756 + } 1.7757 + scale.domain = function(x) { 1.7758 + if (!arguments.length) return domain; 1.7759 + domain = []; 1.7760 + index = new d3_Map(); 1.7761 + var i = -1, n = x.length, xi; 1.7762 + while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi)); 1.7763 + return scale[ranger.t].apply(scale, ranger.a); 1.7764 + }; 1.7765 + scale.range = function(x) { 1.7766 + if (!arguments.length) return range; 1.7767 + range = x; 1.7768 + rangeBand = 0; 1.7769 + ranger = { 1.7770 + t: "range", 1.7771 + a: arguments 1.7772 + }; 1.7773 + return scale; 1.7774 + }; 1.7775 + scale.rangePoints = function(x, padding) { 1.7776 + if (arguments.length < 2) padding = 0; 1.7777 + var start = x[0], stop = x[1], step = domain.length < 2 ? (start = (start + stop) / 2, 1.7778 + 0) : (stop - start) / (domain.length - 1 + padding); 1.7779 + range = steps(start + step * padding / 2, step); 1.7780 + rangeBand = 0; 1.7781 + ranger = { 1.7782 + t: "rangePoints", 1.7783 + a: arguments 1.7784 + }; 1.7785 + return scale; 1.7786 + }; 1.7787 + scale.rangeRoundPoints = function(x, padding) { 1.7788 + if (arguments.length < 2) padding = 0; 1.7789 + var start = x[0], stop = x[1], step = domain.length < 2 ? (start = stop = Math.round((start + stop) / 2), 1.7790 + 0) : (stop - start) / (domain.length - 1 + padding) | 0; 1.7791 + range = steps(start + Math.round(step * padding / 2 + (stop - start - (domain.length - 1 + padding) * step) / 2), step); 1.7792 + rangeBand = 0; 1.7793 + ranger = { 1.7794 + t: "rangeRoundPoints", 1.7795 + a: arguments 1.7796 + }; 1.7797 + return scale; 1.7798 + }; 1.7799 + scale.rangeBands = function(x, padding, outerPadding) { 1.7800 + if (arguments.length < 2) padding = 0; 1.7801 + if (arguments.length < 3) outerPadding = padding; 1.7802 + var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding); 1.7803 + range = steps(start + step * outerPadding, step); 1.7804 + if (reverse) range.reverse(); 1.7805 + rangeBand = step * (1 - padding); 1.7806 + ranger = { 1.7807 + t: "rangeBands", 1.7808 + a: arguments 1.7809 + }; 1.7810 + return scale; 1.7811 + }; 1.7812 + scale.rangeRoundBands = function(x, padding, outerPadding) { 1.7813 + if (arguments.length < 2) padding = 0; 1.7814 + if (arguments.length < 3) outerPadding = padding; 1.7815 + var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)); 1.7816 + range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 2), step); 1.7817 + if (reverse) range.reverse(); 1.7818 + rangeBand = Math.round(step * (1 - padding)); 1.7819 + ranger = { 1.7820 + t: "rangeRoundBands", 1.7821 + a: arguments 1.7822 + }; 1.7823 + return scale; 1.7824 + }; 1.7825 + scale.rangeBand = function() { 1.7826 + return rangeBand; 1.7827 + }; 1.7828 + scale.rangeExtent = function() { 1.7829 + return d3_scaleExtent(ranger.a[0]); 1.7830 + }; 1.7831 + scale.copy = function() { 1.7832 + return d3_scale_ordinal(domain, ranger); 1.7833 + }; 1.7834 + return scale.domain(domain); 1.7835 + } 1.7836 + d3.scale.category10 = function() { 1.7837 + return d3.scale.ordinal().range(d3_category10); 1.7838 + }; 1.7839 + d3.scale.category20 = function() { 1.7840 + return d3.scale.ordinal().range(d3_category20); 1.7841 + }; 1.7842 + d3.scale.category20b = function() { 1.7843 + return d3.scale.ordinal().range(d3_category20b); 1.7844 + }; 1.7845 + d3.scale.category20c = function() { 1.7846 + return d3.scale.ordinal().range(d3_category20c); 1.7847 + }; 1.7848 + var d3_category10 = [ 2062260, 16744206, 2924588, 14034728, 9725885, 9197131, 14907330, 8355711, 12369186, 1556175 ].map(d3_rgbString); 1.7849 + 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.7850 + 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.7851 + 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.7852 + d3.scale.quantile = function() { 1.7853 + return d3_scale_quantile([], []); 1.7854 + }; 1.7855 + function d3_scale_quantile(domain, range) { 1.7856 + var thresholds; 1.7857 + function rescale() { 1.7858 + var k = 0, q = range.length; 1.7859 + thresholds = []; 1.7860 + while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); 1.7861 + return scale; 1.7862 + } 1.7863 + function scale(x) { 1.7864 + if (!isNaN(x = +x)) return range[d3.bisect(thresholds, x)]; 1.7865 + } 1.7866 + scale.domain = function(x) { 1.7867 + if (!arguments.length) return domain; 1.7868 + domain = x.map(d3_number).filter(d3_numeric).sort(d3_ascending); 1.7869 + return rescale(); 1.7870 + }; 1.7871 + scale.range = function(x) { 1.7872 + if (!arguments.length) return range; 1.7873 + range = x; 1.7874 + return rescale(); 1.7875 + }; 1.7876 + scale.quantiles = function() { 1.7877 + return thresholds; 1.7878 + }; 1.7879 + scale.invertExtent = function(y) { 1.7880 + y = range.indexOf(y); 1.7881 + return y < 0 ? [ NaN, NaN ] : [ y > 0 ? thresholds[y - 1] : domain[0], y < thresholds.length ? thresholds[y] : domain[domain.length - 1] ]; 1.7882 + }; 1.7883 + scale.copy = function() { 1.7884 + return d3_scale_quantile(domain, range); 1.7885 + }; 1.7886 + return rescale(); 1.7887 + } 1.7888 + d3.scale.quantize = function() { 1.7889 + return d3_scale_quantize(0, 1, [ 0, 1 ]); 1.7890 + }; 1.7891 + function d3_scale_quantize(x0, x1, range) { 1.7892 + var kx, i; 1.7893 + function scale(x) { 1.7894 + return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; 1.7895 + } 1.7896 + function rescale() { 1.7897 + kx = range.length / (x1 - x0); 1.7898 + i = range.length - 1; 1.7899 + return scale; 1.7900 + } 1.7901 + scale.domain = function(x) { 1.7902 + if (!arguments.length) return [ x0, x1 ]; 1.7903 + x0 = +x[0]; 1.7904 + x1 = +x[x.length - 1]; 1.7905 + return rescale(); 1.7906 + }; 1.7907 + scale.range = function(x) { 1.7908 + if (!arguments.length) return range; 1.7909 + range = x; 1.7910 + return rescale(); 1.7911 + }; 1.7912 + scale.invertExtent = function(y) { 1.7913 + y = range.indexOf(y); 1.7914 + y = y < 0 ? NaN : y / kx + x0; 1.7915 + return [ y, y + 1 / kx ]; 1.7916 + }; 1.7917 + scale.copy = function() { 1.7918 + return d3_scale_quantize(x0, x1, range); 1.7919 + }; 1.7920 + return rescale(); 1.7921 + } 1.7922 + d3.scale.threshold = function() { 1.7923 + return d3_scale_threshold([ .5 ], [ 0, 1 ]); 1.7924 + }; 1.7925 + function d3_scale_threshold(domain, range) { 1.7926 + function scale(x) { 1.7927 + if (x <= x) return range[d3.bisect(domain, x)]; 1.7928 + } 1.7929 + scale.domain = function(_) { 1.7930 + if (!arguments.length) return domain; 1.7931 + domain = _; 1.7932 + return scale; 1.7933 + }; 1.7934 + scale.range = function(_) { 1.7935 + if (!arguments.length) return range; 1.7936 + range = _; 1.7937 + return scale; 1.7938 + }; 1.7939 + scale.invertExtent = function(y) { 1.7940 + y = range.indexOf(y); 1.7941 + return [ domain[y - 1], domain[y] ]; 1.7942 + }; 1.7943 + scale.copy = function() { 1.7944 + return d3_scale_threshold(domain, range); 1.7945 + }; 1.7946 + return scale; 1.7947 + } 1.7948 + d3.scale.identity = function() { 1.7949 + return d3_scale_identity([ 0, 1 ]); 1.7950 + }; 1.7951 + function d3_scale_identity(domain) { 1.7952 + function identity(x) { 1.7953 + return +x; 1.7954 + } 1.7955 + identity.invert = identity; 1.7956 + identity.domain = identity.range = function(x) { 1.7957 + if (!arguments.length) return domain; 1.7958 + domain = x.map(identity); 1.7959 + return identity; 1.7960 + }; 1.7961 + identity.ticks = function(m) { 1.7962 + return d3_scale_linearTicks(domain, m); 1.7963 + }; 1.7964 + identity.tickFormat = function(m, format) { 1.7965 + return d3_scale_linearTickFormat(domain, m, format); 1.7966 + }; 1.7967 + identity.copy = function() { 1.7968 + return d3_scale_identity(domain); 1.7969 + }; 1.7970 + return identity; 1.7971 + } 1.7972 + d3.svg = {}; 1.7973 + function d3_zero() { 1.7974 + return 0; 1.7975 + } 1.7976 + d3.svg.arc = function() { 1.7977 + var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, cornerRadius = d3_zero, padRadius = d3_svg_arcAuto, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle, padAngle = d3_svg_arcPadAngle; 1.7978 + function arc() { 1.7979 + var r0 = Math.max(0, +innerRadius.apply(this, arguments)), r1 = Math.max(0, +outerRadius.apply(this, arguments)), a0 = startAngle.apply(this, arguments) - halfπ, a1 = endAngle.apply(this, arguments) - halfπ, da = Math.abs(a1 - a0), cw = a0 > a1 ? 0 : 1; 1.7980 + if (r1 < r0) rc = r1, r1 = r0, r0 = rc; 1.7981 + if (da >= τε) return circleSegment(r1, cw) + (r0 ? circleSegment(r0, 1 - cw) : "") + "Z"; 1.7982 + var rc, cr, rp, ap, p0 = 0, p1 = 0, x0, y0, x1, y1, x2, y2, x3, y3, path = []; 1.7983 + if (ap = (+padAngle.apply(this, arguments) || 0) / 2) { 1.7984 + rp = padRadius === d3_svg_arcAuto ? Math.sqrt(r0 * r0 + r1 * r1) : +padRadius.apply(this, arguments); 1.7985 + if (!cw) p1 *= -1; 1.7986 + if (r1) p1 = d3_asin(rp / r1 * Math.sin(ap)); 1.7987 + if (r0) p0 = d3_asin(rp / r0 * Math.sin(ap)); 1.7988 + } 1.7989 + if (r1) { 1.7990 + x0 = r1 * Math.cos(a0 + p1); 1.7991 + y0 = r1 * Math.sin(a0 + p1); 1.7992 + x1 = r1 * Math.cos(a1 - p1); 1.7993 + y1 = r1 * Math.sin(a1 - p1); 1.7994 + var l1 = Math.abs(a1 - a0 - 2 * p1) <= π ? 0 : 1; 1.7995 + if (p1 && d3_svg_arcSweep(x0, y0, x1, y1) === cw ^ l1) { 1.7996 + var h1 = (a0 + a1) / 2; 1.7997 + x0 = r1 * Math.cos(h1); 1.7998 + y0 = r1 * Math.sin(h1); 1.7999 + x1 = y1 = null; 1.8000 + } 1.8001 + } else { 1.8002 + x0 = y0 = 0; 1.8003 + } 1.8004 + if (r0) { 1.8005 + x2 = r0 * Math.cos(a1 - p0); 1.8006 + y2 = r0 * Math.sin(a1 - p0); 1.8007 + x3 = r0 * Math.cos(a0 + p0); 1.8008 + y3 = r0 * Math.sin(a0 + p0); 1.8009 + var l0 = Math.abs(a0 - a1 + 2 * p0) <= π ? 0 : 1; 1.8010 + if (p0 && d3_svg_arcSweep(x2, y2, x3, y3) === 1 - cw ^ l0) { 1.8011 + var h0 = (a0 + a1) / 2; 1.8012 + x2 = r0 * Math.cos(h0); 1.8013 + y2 = r0 * Math.sin(h0); 1.8014 + x3 = y3 = null; 1.8015 + } 1.8016 + } else { 1.8017 + x2 = y2 = 0; 1.8018 + } 1.8019 + if (da > ε && (rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) { 1.8020 + cr = r0 < r1 ^ cw ? 0 : 1; 1.8021 + var rc1 = rc, rc0 = rc; 1.8022 + if (da < π) { 1.8023 + var oc = x3 == null ? [ x2, y2 ] : x1 == null ? [ x0, y0 ] : d3_geom_polygonIntersect([ x0, y0 ], [ x3, y3 ], [ x1, y1 ], [ x2, y2 ]), ax = x0 - oc[0], ay = y0 - oc[1], bx = x1 - oc[0], by = y1 - oc[1], kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2), lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]); 1.8024 + rc0 = Math.min(rc, (r0 - lc) / (kc - 1)); 1.8025 + rc1 = Math.min(rc, (r1 - lc) / (kc + 1)); 1.8026 + } 1.8027 + if (x1 != null) { 1.8028 + var t30 = d3_svg_arcCornerTangents(x3 == null ? [ x2, y2 ] : [ x3, y3 ], [ x0, y0 ], r1, rc1, cw), t12 = d3_svg_arcCornerTangents([ x1, y1 ], [ x2, y2 ], r1, rc1, cw); 1.8029 + if (rc === rc1) { 1.8030 + path.push("M", t30[0], "A", rc1, ",", rc1, " 0 0,", cr, " ", t30[1], "A", r1, ",", r1, " 0 ", 1 - cw ^ d3_svg_arcSweep(t30[1][0], t30[1][1], t12[1][0], t12[1][1]), ",", cw, " ", t12[1], "A", rc1, ",", rc1, " 0 0,", cr, " ", t12[0]); 1.8031 + } else { 1.8032 + path.push("M", t30[0], "A", rc1, ",", rc1, " 0 1,", cr, " ", t12[0]); 1.8033 + } 1.8034 + } else { 1.8035 + path.push("M", x0, ",", y0); 1.8036 + } 1.8037 + if (x3 != null) { 1.8038 + var t03 = d3_svg_arcCornerTangents([ x0, y0 ], [ x3, y3 ], r0, -rc0, cw), t21 = d3_svg_arcCornerTangents([ x2, y2 ], x1 == null ? [ x0, y0 ] : [ x1, y1 ], r0, -rc0, cw); 1.8039 + if (rc === rc0) { 1.8040 + path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr, " ", t21[1], "A", r0, ",", r0, " 0 ", cw ^ d3_svg_arcSweep(t21[1][0], t21[1][1], t03[1][0], t03[1][1]), ",", 1 - cw, " ", t03[1], "A", rc0, ",", rc0, " 0 0,", cr, " ", t03[0]); 1.8041 + } else { 1.8042 + path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr, " ", t03[0]); 1.8043 + } 1.8044 + } else { 1.8045 + path.push("L", x2, ",", y2); 1.8046 + } 1.8047 + } else { 1.8048 + path.push("M", x0, ",", y0); 1.8049 + if (x1 != null) path.push("A", r1, ",", r1, " 0 ", l1, ",", cw, " ", x1, ",", y1); 1.8050 + path.push("L", x2, ",", y2); 1.8051 + if (x3 != null) path.push("A", r0, ",", r0, " 0 ", l0, ",", 1 - cw, " ", x3, ",", y3); 1.8052 + } 1.8053 + path.push("Z"); 1.8054 + return path.join(""); 1.8055 + } 1.8056 + function circleSegment(r1, cw) { 1.8057 + return "M0," + r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + -r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + r1; 1.8058 + } 1.8059 + arc.innerRadius = function(v) { 1.8060 + if (!arguments.length) return innerRadius; 1.8061 + innerRadius = d3_functor(v); 1.8062 + return arc; 1.8063 + }; 1.8064 + arc.outerRadius = function(v) { 1.8065 + if (!arguments.length) return outerRadius; 1.8066 + outerRadius = d3_functor(v); 1.8067 + return arc; 1.8068 + }; 1.8069 + arc.cornerRadius = function(v) { 1.8070 + if (!arguments.length) return cornerRadius; 1.8071 + cornerRadius = d3_functor(v); 1.8072 + return arc; 1.8073 + }; 1.8074 + arc.padRadius = function(v) { 1.8075 + if (!arguments.length) return padRadius; 1.8076 + padRadius = v == d3_svg_arcAuto ? d3_svg_arcAuto : d3_functor(v); 1.8077 + return arc; 1.8078 + }; 1.8079 + arc.startAngle = function(v) { 1.8080 + if (!arguments.length) return startAngle; 1.8081 + startAngle = d3_functor(v); 1.8082 + return arc; 1.8083 + }; 1.8084 + arc.endAngle = function(v) { 1.8085 + if (!arguments.length) return endAngle; 1.8086 + endAngle = d3_functor(v); 1.8087 + return arc; 1.8088 + }; 1.8089 + arc.padAngle = function(v) { 1.8090 + if (!arguments.length) return padAngle; 1.8091 + padAngle = d3_functor(v); 1.8092 + return arc; 1.8093 + }; 1.8094 + arc.centroid = function() { 1.8095 + var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - halfπ; 1.8096 + return [ Math.cos(a) * r, Math.sin(a) * r ]; 1.8097 + }; 1.8098 + return arc; 1.8099 + }; 1.8100 + var d3_svg_arcAuto = "auto"; 1.8101 + function d3_svg_arcInnerRadius(d) { 1.8102 + return d.innerRadius; 1.8103 + } 1.8104 + function d3_svg_arcOuterRadius(d) { 1.8105 + return d.outerRadius; 1.8106 + } 1.8107 + function d3_svg_arcStartAngle(d) { 1.8108 + return d.startAngle; 1.8109 + } 1.8110 + function d3_svg_arcEndAngle(d) { 1.8111 + return d.endAngle; 1.8112 + } 1.8113 + function d3_svg_arcPadAngle(d) { 1.8114 + return d && d.padAngle; 1.8115 + } 1.8116 + function d3_svg_arcSweep(x0, y0, x1, y1) { 1.8117 + return (x0 - x1) * y0 - (y0 - y1) * x0 > 0 ? 0 : 1; 1.8118 + } 1.8119 + function d3_svg_arcCornerTangents(p0, p1, r1, rc, cw) { 1.8120 + var x01 = p0[0] - p1[0], y01 = p0[1] - p1[1], lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x1 = p0[0] + ox, y1 = p0[1] + oy, x2 = p1[0] + ox, y2 = p1[1] + oy, x3 = (x1 + x2) / 2, y3 = (y1 + y2) / 2, dx = x2 - x1, dy = y2 - y1, d2 = dx * dx + dy * dy, r = r1 - rc, D = x1 * y2 - x2 * y1, d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x3, dy0 = cy0 - y3, dx1 = cx1 - x3, dy1 = cy1 - y3; 1.8121 + if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; 1.8122 + return [ [ cx0 - ox, cy0 - oy ], [ cx0 * r1 / r, cy0 * r1 / r ] ]; 1.8123 + } 1.8124 + function d3_svg_line(projection) { 1.8125 + var x = d3_geom_pointX, y = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7; 1.8126 + function line(data) { 1.8127 + var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y); 1.8128 + function segment() { 1.8129 + segments.push("M", interpolate(projection(points), tension)); 1.8130 + } 1.8131 + while (++i < n) { 1.8132 + if (defined.call(this, d = data[i], i)) { 1.8133 + points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]); 1.8134 + } else if (points.length) { 1.8135 + segment(); 1.8136 + points = []; 1.8137 + } 1.8138 + } 1.8139 + if (points.length) segment(); 1.8140 + return segments.length ? segments.join("") : null; 1.8141 + } 1.8142 + line.x = function(_) { 1.8143 + if (!arguments.length) return x; 1.8144 + x = _; 1.8145 + return line; 1.8146 + }; 1.8147 + line.y = function(_) { 1.8148 + if (!arguments.length) return y; 1.8149 + y = _; 1.8150 + return line; 1.8151 + }; 1.8152 + line.defined = function(_) { 1.8153 + if (!arguments.length) return defined; 1.8154 + defined = _; 1.8155 + return line; 1.8156 + }; 1.8157 + line.interpolate = function(_) { 1.8158 + if (!arguments.length) return interpolateKey; 1.8159 + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; 1.8160 + return line; 1.8161 + }; 1.8162 + line.tension = function(_) { 1.8163 + if (!arguments.length) return tension; 1.8164 + tension = _; 1.8165 + return line; 1.8166 + }; 1.8167 + return line; 1.8168 + } 1.8169 + d3.svg.line = function() { 1.8170 + return d3_svg_line(d3_identity); 1.8171 + }; 1.8172 + var d3_svg_lineInterpolators = d3.map({ 1.8173 + linear: d3_svg_lineLinear, 1.8174 + "linear-closed": d3_svg_lineLinearClosed, 1.8175 + step: d3_svg_lineStep, 1.8176 + "step-before": d3_svg_lineStepBefore, 1.8177 + "step-after": d3_svg_lineStepAfter, 1.8178 + basis: d3_svg_lineBasis, 1.8179 + "basis-open": d3_svg_lineBasisOpen, 1.8180 + "basis-closed": d3_svg_lineBasisClosed, 1.8181 + bundle: d3_svg_lineBundle, 1.8182 + cardinal: d3_svg_lineCardinal, 1.8183 + "cardinal-open": d3_svg_lineCardinalOpen, 1.8184 + "cardinal-closed": d3_svg_lineCardinalClosed, 1.8185 + monotone: d3_svg_lineMonotone 1.8186 + }); 1.8187 + d3_svg_lineInterpolators.forEach(function(key, value) { 1.8188 + value.key = key; 1.8189 + value.closed = /-closed$/.test(key); 1.8190 + }); 1.8191 + function d3_svg_lineLinear(points) { 1.8192 + return points.length > 1 ? points.join("L") : points + "Z"; 1.8193 + } 1.8194 + function d3_svg_lineLinearClosed(points) { 1.8195 + return points.join("L") + "Z"; 1.8196 + } 1.8197 + function d3_svg_lineStep(points) { 1.8198 + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; 1.8199 + while (++i < n) path.push("H", (p[0] + (p = points[i])[0]) / 2, "V", p[1]); 1.8200 + if (n > 1) path.push("H", p[0]); 1.8201 + return path.join(""); 1.8202 + } 1.8203 + function d3_svg_lineStepBefore(points) { 1.8204 + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; 1.8205 + while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); 1.8206 + return path.join(""); 1.8207 + } 1.8208 + function d3_svg_lineStepAfter(points) { 1.8209 + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; 1.8210 + while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); 1.8211 + return path.join(""); 1.8212 + } 1.8213 + function d3_svg_lineCardinalOpen(points, tension) { 1.8214 + return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, -1), d3_svg_lineCardinalTangents(points, tension)); 1.8215 + } 1.8216 + function d3_svg_lineCardinalClosed(points, tension) { 1.8217 + return points.length < 3 ? d3_svg_lineLinearClosed(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), 1.8218 + points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension)); 1.8219 + } 1.8220 + function d3_svg_lineCardinal(points, tension) { 1.8221 + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension)); 1.8222 + } 1.8223 + function d3_svg_lineHermite(points, tangents) { 1.8224 + if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) { 1.8225 + return d3_svg_lineLinear(points); 1.8226 + } 1.8227 + var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1; 1.8228 + if (quad) { 1.8229 + path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1]; 1.8230 + p0 = points[1]; 1.8231 + pi = 2; 1.8232 + } 1.8233 + if (tangents.length > 1) { 1.8234 + t = tangents[1]; 1.8235 + p = points[pi]; 1.8236 + pi++; 1.8237 + path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; 1.8238 + for (var i = 2; i < tangents.length; i++, pi++) { 1.8239 + p = points[pi]; 1.8240 + t = tangents[i]; 1.8241 + path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; 1.8242 + } 1.8243 + } 1.8244 + if (quad) { 1.8245 + var lp = points[pi]; 1.8246 + path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1]; 1.8247 + } 1.8248 + return path; 1.8249 + } 1.8250 + function d3_svg_lineCardinalTangents(points, tension) { 1.8251 + var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length; 1.8252 + while (++i < n) { 1.8253 + p0 = p1; 1.8254 + p1 = p2; 1.8255 + p2 = points[i]; 1.8256 + tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]); 1.8257 + } 1.8258 + return tangents; 1.8259 + } 1.8260 + function d3_svg_lineBasis(points) { 1.8261 + if (points.length < 3) return d3_svg_lineLinear(points); 1.8262 + 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.8263 + points.push(points[n - 1]); 1.8264 + while (++i <= n) { 1.8265 + pi = points[i]; 1.8266 + px.shift(); 1.8267 + px.push(pi[0]); 1.8268 + py.shift(); 1.8269 + py.push(pi[1]); 1.8270 + d3_svg_lineBasisBezier(path, px, py); 1.8271 + } 1.8272 + points.pop(); 1.8273 + path.push("L", pi); 1.8274 + return path.join(""); 1.8275 + } 1.8276 + function d3_svg_lineBasisOpen(points) { 1.8277 + if (points.length < 4) return d3_svg_lineLinear(points); 1.8278 + var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ]; 1.8279 + while (++i < 3) { 1.8280 + pi = points[i]; 1.8281 + px.push(pi[0]); 1.8282 + py.push(pi[1]); 1.8283 + } 1.8284 + path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); 1.8285 + --i; 1.8286 + while (++i < n) { 1.8287 + pi = points[i]; 1.8288 + px.shift(); 1.8289 + px.push(pi[0]); 1.8290 + py.shift(); 1.8291 + py.push(pi[1]); 1.8292 + d3_svg_lineBasisBezier(path, px, py); 1.8293 + } 1.8294 + return path.join(""); 1.8295 + } 1.8296 + function d3_svg_lineBasisClosed(points) { 1.8297 + var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = []; 1.8298 + while (++i < 4) { 1.8299 + pi = points[i % n]; 1.8300 + px.push(pi[0]); 1.8301 + py.push(pi[1]); 1.8302 + } 1.8303 + path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; 1.8304 + --i; 1.8305 + while (++i < m) { 1.8306 + pi = points[i % n]; 1.8307 + px.shift(); 1.8308 + px.push(pi[0]); 1.8309 + py.shift(); 1.8310 + py.push(pi[1]); 1.8311 + d3_svg_lineBasisBezier(path, px, py); 1.8312 + } 1.8313 + return path.join(""); 1.8314 + } 1.8315 + function d3_svg_lineBundle(points, tension) { 1.8316 + var n = points.length - 1; 1.8317 + if (n) { 1.8318 + var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t; 1.8319 + while (++i <= n) { 1.8320 + p = points[i]; 1.8321 + t = i / n; 1.8322 + p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); 1.8323 + p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); 1.8324 + } 1.8325 + } 1.8326 + return d3_svg_lineBasis(points); 1.8327 + } 1.8328 + function d3_svg_lineDot4(a, b) { 1.8329 + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; 1.8330 + } 1.8331 + 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.8332 + function d3_svg_lineBasisBezier(path, x, y) { 1.8333 + 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.8334 + } 1.8335 + function d3_svg_lineSlope(p0, p1) { 1.8336 + return (p1[1] - p0[1]) / (p1[0] - p0[0]); 1.8337 + } 1.8338 + function d3_svg_lineFiniteDifferences(points) { 1.8339 + var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1); 1.8340 + while (++i < j) { 1.8341 + m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2; 1.8342 + } 1.8343 + m[i] = d; 1.8344 + return m; 1.8345 + } 1.8346 + function d3_svg_lineMonotoneTangents(points) { 1.8347 + var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1; 1.8348 + while (++i < j) { 1.8349 + d = d3_svg_lineSlope(points[i], points[i + 1]); 1.8350 + if (abs(d) < ε) { 1.8351 + m[i] = m[i + 1] = 0; 1.8352 + } else { 1.8353 + a = m[i] / d; 1.8354 + b = m[i + 1] / d; 1.8355 + s = a * a + b * b; 1.8356 + if (s > 9) { 1.8357 + s = d * 3 / Math.sqrt(s); 1.8358 + m[i] = s * a; 1.8359 + m[i + 1] = s * b; 1.8360 + } 1.8361 + } 1.8362 + } 1.8363 + i = -1; 1.8364 + while (++i <= j) { 1.8365 + s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i])); 1.8366 + tangents.push([ s || 0, m[i] * s || 0 ]); 1.8367 + } 1.8368 + return tangents; 1.8369 + } 1.8370 + function d3_svg_lineMonotone(points) { 1.8371 + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); 1.8372 + } 1.8373 + d3.svg.line.radial = function() { 1.8374 + var line = d3_svg_line(d3_svg_lineRadial); 1.8375 + line.radius = line.x, delete line.x; 1.8376 + line.angle = line.y, delete line.y; 1.8377 + return line; 1.8378 + }; 1.8379 + function d3_svg_lineRadial(points) { 1.8380 + var point, i = -1, n = points.length, r, a; 1.8381 + while (++i < n) { 1.8382 + point = points[i]; 1.8383 + r = point[0]; 1.8384 + a = point[1] - halfπ; 1.8385 + point[0] = r * Math.cos(a); 1.8386 + point[1] = r * Math.sin(a); 1.8387 + } 1.8388 + return points; 1.8389 + } 1.8390 + function d3_svg_area(projection) { 1.8391 + 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.8392 + function area(data) { 1.8393 + var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() { 1.8394 + return x; 1.8395 + } : d3_functor(x1), fy1 = y0 === y1 ? function() { 1.8396 + return y; 1.8397 + } : d3_functor(y1), x, y; 1.8398 + function segment() { 1.8399 + segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z"); 1.8400 + } 1.8401 + while (++i < n) { 1.8402 + if (defined.call(this, d = data[i], i)) { 1.8403 + points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]); 1.8404 + points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]); 1.8405 + } else if (points0.length) { 1.8406 + segment(); 1.8407 + points0 = []; 1.8408 + points1 = []; 1.8409 + } 1.8410 + } 1.8411 + if (points0.length) segment(); 1.8412 + return segments.length ? segments.join("") : null; 1.8413 + } 1.8414 + area.x = function(_) { 1.8415 + if (!arguments.length) return x1; 1.8416 + x0 = x1 = _; 1.8417 + return area; 1.8418 + }; 1.8419 + area.x0 = function(_) { 1.8420 + if (!arguments.length) return x0; 1.8421 + x0 = _; 1.8422 + return area; 1.8423 + }; 1.8424 + area.x1 = function(_) { 1.8425 + if (!arguments.length) return x1; 1.8426 + x1 = _; 1.8427 + return area; 1.8428 + }; 1.8429 + area.y = function(_) { 1.8430 + if (!arguments.length) return y1; 1.8431 + y0 = y1 = _; 1.8432 + return area; 1.8433 + }; 1.8434 + area.y0 = function(_) { 1.8435 + if (!arguments.length) return y0; 1.8436 + y0 = _; 1.8437 + return area; 1.8438 + }; 1.8439 + area.y1 = function(_) { 1.8440 + if (!arguments.length) return y1; 1.8441 + y1 = _; 1.8442 + return area; 1.8443 + }; 1.8444 + area.defined = function(_) { 1.8445 + if (!arguments.length) return defined; 1.8446 + defined = _; 1.8447 + return area; 1.8448 + }; 1.8449 + area.interpolate = function(_) { 1.8450 + if (!arguments.length) return interpolateKey; 1.8451 + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; 1.8452 + interpolateReverse = interpolate.reverse || interpolate; 1.8453 + L = interpolate.closed ? "M" : "L"; 1.8454 + return area; 1.8455 + }; 1.8456 + area.tension = function(_) { 1.8457 + if (!arguments.length) return tension; 1.8458 + tension = _; 1.8459 + return area; 1.8460 + }; 1.8461 + return area; 1.8462 + } 1.8463 + d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; 1.8464 + d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; 1.8465 + d3.svg.area = function() { 1.8466 + return d3_svg_area(d3_identity); 1.8467 + }; 1.8468 + d3.svg.area.radial = function() { 1.8469 + var area = d3_svg_area(d3_svg_lineRadial); 1.8470 + area.radius = area.x, delete area.x; 1.8471 + area.innerRadius = area.x0, delete area.x0; 1.8472 + area.outerRadius = area.x1, delete area.x1; 1.8473 + area.angle = area.y, delete area.y; 1.8474 + area.startAngle = area.y0, delete area.y0; 1.8475 + area.endAngle = area.y1, delete area.y1; 1.8476 + return area; 1.8477 + }; 1.8478 + d3.svg.chord = function() { 1.8479 + var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; 1.8480 + function chord(d, i) { 1.8481 + var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i); 1.8482 + 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.8483 + } 1.8484 + function subgroup(self, f, d, i) { 1.8485 + var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) - halfπ, a1 = endAngle.call(self, subgroup, i) - halfπ; 1.8486 + return { 1.8487 + r: r, 1.8488 + a0: a0, 1.8489 + a1: a1, 1.8490 + p0: [ r * Math.cos(a0), r * Math.sin(a0) ], 1.8491 + p1: [ r * Math.cos(a1), r * Math.sin(a1) ] 1.8492 + }; 1.8493 + } 1.8494 + function equals(a, b) { 1.8495 + return a.a0 == b.a0 && a.a1 == b.a1; 1.8496 + } 1.8497 + function arc(r, p, a) { 1.8498 + return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p; 1.8499 + } 1.8500 + function curve(r0, p0, r1, p1) { 1.8501 + return "Q 0,0 " + p1; 1.8502 + } 1.8503 + chord.radius = function(v) { 1.8504 + if (!arguments.length) return radius; 1.8505 + radius = d3_functor(v); 1.8506 + return chord; 1.8507 + }; 1.8508 + chord.source = function(v) { 1.8509 + if (!arguments.length) return source; 1.8510 + source = d3_functor(v); 1.8511 + return chord; 1.8512 + }; 1.8513 + chord.target = function(v) { 1.8514 + if (!arguments.length) return target; 1.8515 + target = d3_functor(v); 1.8516 + return chord; 1.8517 + }; 1.8518 + chord.startAngle = function(v) { 1.8519 + if (!arguments.length) return startAngle; 1.8520 + startAngle = d3_functor(v); 1.8521 + return chord; 1.8522 + }; 1.8523 + chord.endAngle = function(v) { 1.8524 + if (!arguments.length) return endAngle; 1.8525 + endAngle = d3_functor(v); 1.8526 + return chord; 1.8527 + }; 1.8528 + return chord; 1.8529 + }; 1.8530 + function d3_svg_chordRadius(d) { 1.8531 + return d.radius; 1.8532 + } 1.8533 + d3.svg.diagonal = function() { 1.8534 + var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection; 1.8535 + function diagonal(d, i) { 1.8536 + var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, { 1.8537 + x: p0.x, 1.8538 + y: m 1.8539 + }, { 1.8540 + x: p3.x, 1.8541 + y: m 1.8542 + }, p3 ]; 1.8543 + p = p.map(projection); 1.8544 + return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; 1.8545 + } 1.8546 + diagonal.source = function(x) { 1.8547 + if (!arguments.length) return source; 1.8548 + source = d3_functor(x); 1.8549 + return diagonal; 1.8550 + }; 1.8551 + diagonal.target = function(x) { 1.8552 + if (!arguments.length) return target; 1.8553 + target = d3_functor(x); 1.8554 + return diagonal; 1.8555 + }; 1.8556 + diagonal.projection = function(x) { 1.8557 + if (!arguments.length) return projection; 1.8558 + projection = x; 1.8559 + return diagonal; 1.8560 + }; 1.8561 + return diagonal; 1.8562 + }; 1.8563 + function d3_svg_diagonalProjection(d) { 1.8564 + return [ d.x, d.y ]; 1.8565 + } 1.8566 + d3.svg.diagonal.radial = function() { 1.8567 + var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection; 1.8568 + diagonal.projection = function(x) { 1.8569 + return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection; 1.8570 + }; 1.8571 + return diagonal; 1.8572 + }; 1.8573 + function d3_svg_diagonalRadialProjection(projection) { 1.8574 + return function() { 1.8575 + var d = projection.apply(this, arguments), r = d[0], a = d[1] - halfπ; 1.8576 + return [ r * Math.cos(a), r * Math.sin(a) ]; 1.8577 + }; 1.8578 + } 1.8579 + d3.svg.symbol = function() { 1.8580 + var type = d3_svg_symbolType, size = d3_svg_symbolSize; 1.8581 + function symbol(d, i) { 1.8582 + return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i)); 1.8583 + } 1.8584 + symbol.type = function(x) { 1.8585 + if (!arguments.length) return type; 1.8586 + type = d3_functor(x); 1.8587 + return symbol; 1.8588 + }; 1.8589 + symbol.size = function(x) { 1.8590 + if (!arguments.length) return size; 1.8591 + size = d3_functor(x); 1.8592 + return symbol; 1.8593 + }; 1.8594 + return symbol; 1.8595 + }; 1.8596 + function d3_svg_symbolSize() { 1.8597 + return 64; 1.8598 + } 1.8599 + function d3_svg_symbolType() { 1.8600 + return "circle"; 1.8601 + } 1.8602 + function d3_svg_symbolCircle(size) { 1.8603 + var r = Math.sqrt(size / π); 1.8604 + return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z"; 1.8605 + } 1.8606 + var d3_svg_symbols = d3.map({ 1.8607 + circle: d3_svg_symbolCircle, 1.8608 + cross: function(size) { 1.8609 + var r = Math.sqrt(size / 5) / 2; 1.8610 + 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.8611 + }, 1.8612 + diamond: function(size) { 1.8613 + var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30; 1.8614 + return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z"; 1.8615 + }, 1.8616 + square: function(size) { 1.8617 + var r = Math.sqrt(size) / 2; 1.8618 + return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z"; 1.8619 + }, 1.8620 + "triangle-down": function(size) { 1.8621 + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; 1.8622 + return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z"; 1.8623 + }, 1.8624 + "triangle-up": function(size) { 1.8625 + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; 1.8626 + return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z"; 1.8627 + } 1.8628 + }); 1.8629 + d3.svg.symbolTypes = d3_svg_symbols.keys(); 1.8630 + var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians); 1.8631 + d3_selectionPrototype.transition = function(name) { 1.8632 + var id = d3_transitionInheritId || ++d3_transitionId, ns = d3_transitionNamespace(name), subgroups = [], subgroup, node, transition = d3_transitionInherit || { 1.8633 + time: Date.now(), 1.8634 + ease: d3_ease_cubicInOut, 1.8635 + delay: 0, 1.8636 + duration: 250 1.8637 + }; 1.8638 + for (var j = -1, m = this.length; ++j < m; ) { 1.8639 + subgroups.push(subgroup = []); 1.8640 + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { 1.8641 + if (node = group[i]) d3_transitionNode(node, i, ns, id, transition); 1.8642 + subgroup.push(node); 1.8643 + } 1.8644 + } 1.8645 + return d3_transition(subgroups, ns, id); 1.8646 + }; 1.8647 + d3_selectionPrototype.interrupt = function(name) { 1.8648 + return this.each(name == null ? d3_selection_interrupt : d3_selection_interruptNS(d3_transitionNamespace(name))); 1.8649 + }; 1.8650 + var d3_selection_interrupt = d3_selection_interruptNS(d3_transitionNamespace()); 1.8651 + function d3_selection_interruptNS(ns) { 1.8652 + return function() { 1.8653 + var lock, activeId, active; 1.8654 + if ((lock = this[ns]) && (active = lock[activeId = lock.active])) { 1.8655 + active.timer.c = null; 1.8656 + active.timer.t = NaN; 1.8657 + if (--lock.count) delete lock[activeId]; else delete this[ns]; 1.8658 + lock.active += .5; 1.8659 + active.event && active.event.interrupt.call(this, this.__data__, active.index); 1.8660 + } 1.8661 + }; 1.8662 + } 1.8663 + function d3_transition(groups, ns, id) { 1.8664 + d3_subclass(groups, d3_transitionPrototype); 1.8665 + groups.namespace = ns; 1.8666 + groups.id = id; 1.8667 + return groups; 1.8668 + } 1.8669 + var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit; 1.8670 + d3_transitionPrototype.call = d3_selectionPrototype.call; 1.8671 + d3_transitionPrototype.empty = d3_selectionPrototype.empty; 1.8672 + d3_transitionPrototype.node = d3_selectionPrototype.node; 1.8673 + d3_transitionPrototype.size = d3_selectionPrototype.size; 1.8674 + d3.transition = function(selection, name) { 1.8675 + return selection && selection.transition ? d3_transitionInheritId ? selection.transition(name) : selection : d3.selection().transition(selection); 1.8676 + }; 1.8677 + d3.transition.prototype = d3_transitionPrototype; 1.8678 + d3_transitionPrototype.select = function(selector) { 1.8679 + var id = this.id, ns = this.namespace, subgroups = [], subgroup, subnode, node; 1.8680 + selector = d3_selection_selector(selector); 1.8681 + for (var j = -1, m = this.length; ++j < m; ) { 1.8682 + subgroups.push(subgroup = []); 1.8683 + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { 1.8684 + if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i, j))) { 1.8685 + if ("__data__" in node) subnode.__data__ = node.__data__; 1.8686 + d3_transitionNode(subnode, i, ns, id, node[ns][id]); 1.8687 + subgroup.push(subnode); 1.8688 + } else { 1.8689 + subgroup.push(null); 1.8690 + } 1.8691 + } 1.8692 + } 1.8693 + return d3_transition(subgroups, ns, id); 1.8694 + }; 1.8695 + d3_transitionPrototype.selectAll = function(selector) { 1.8696 + var id = this.id, ns = this.namespace, subgroups = [], subgroup, subnodes, node, subnode, transition; 1.8697 + selector = d3_selection_selectorAll(selector); 1.8698 + for (var j = -1, m = this.length; ++j < m; ) { 1.8699 + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { 1.8700 + if (node = group[i]) { 1.8701 + transition = node[ns][id]; 1.8702 + subnodes = selector.call(node, node.__data__, i, j); 1.8703 + subgroups.push(subgroup = []); 1.8704 + for (var k = -1, o = subnodes.length; ++k < o; ) { 1.8705 + if (subnode = subnodes[k]) d3_transitionNode(subnode, k, ns, id, transition); 1.8706 + subgroup.push(subnode); 1.8707 + } 1.8708 + } 1.8709 + } 1.8710 + } 1.8711 + return d3_transition(subgroups, ns, id); 1.8712 + }; 1.8713 + d3_transitionPrototype.filter = function(filter) { 1.8714 + var subgroups = [], subgroup, group, node; 1.8715 + if (typeof filter !== "function") filter = d3_selection_filter(filter); 1.8716 + for (var j = 0, m = this.length; j < m; j++) { 1.8717 + subgroups.push(subgroup = []); 1.8718 + for (var group = this[j], i = 0, n = group.length; i < n; i++) { 1.8719 + if ((node = group[i]) && filter.call(node, node.__data__, i, j)) { 1.8720 + subgroup.push(node); 1.8721 + } 1.8722 + } 1.8723 + } 1.8724 + return d3_transition(subgroups, this.namespace, this.id); 1.8725 + }; 1.8726 + d3_transitionPrototype.tween = function(name, tween) { 1.8727 + var id = this.id, ns = this.namespace; 1.8728 + if (arguments.length < 2) return this.node()[ns][id].tween.get(name); 1.8729 + return d3_selection_each(this, tween == null ? function(node) { 1.8730 + node[ns][id].tween.remove(name); 1.8731 + } : function(node) { 1.8732 + node[ns][id].tween.set(name, tween); 1.8733 + }); 1.8734 + }; 1.8735 + function d3_transition_tween(groups, name, value, tween) { 1.8736 + var id = groups.id, ns = groups.namespace; 1.8737 + return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) { 1.8738 + node[ns][id].tween.set(name, tween(value.call(node, node.__data__, i, j))); 1.8739 + } : (value = tween(value), function(node) { 1.8740 + node[ns][id].tween.set(name, value); 1.8741 + })); 1.8742 + } 1.8743 + d3_transitionPrototype.attr = function(nameNS, value) { 1.8744 + if (arguments.length < 2) { 1.8745 + for (value in nameNS) this.attr(value, nameNS[value]); 1.8746 + return this; 1.8747 + } 1.8748 + var interpolate = nameNS == "transform" ? d3_interpolateTransform : d3_interpolate, name = d3.ns.qualify(nameNS); 1.8749 + function attrNull() { 1.8750 + this.removeAttribute(name); 1.8751 + } 1.8752 + function attrNullNS() { 1.8753 + this.removeAttributeNS(name.space, name.local); 1.8754 + } 1.8755 + function attrTween(b) { 1.8756 + return b == null ? attrNull : (b += "", function() { 1.8757 + var a = this.getAttribute(name), i; 1.8758 + return a !== b && (i = interpolate(a, b), function(t) { 1.8759 + this.setAttribute(name, i(t)); 1.8760 + }); 1.8761 + }); 1.8762 + } 1.8763 + function attrTweenNS(b) { 1.8764 + return b == null ? attrNullNS : (b += "", function() { 1.8765 + var a = this.getAttributeNS(name.space, name.local), i; 1.8766 + return a !== b && (i = interpolate(a, b), function(t) { 1.8767 + this.setAttributeNS(name.space, name.local, i(t)); 1.8768 + }); 1.8769 + }); 1.8770 + } 1.8771 + return d3_transition_tween(this, "attr." + nameNS, value, name.local ? attrTweenNS : attrTween); 1.8772 + }; 1.8773 + d3_transitionPrototype.attrTween = function(nameNS, tween) { 1.8774 + var name = d3.ns.qualify(nameNS); 1.8775 + function attrTween(d, i) { 1.8776 + var f = tween.call(this, d, i, this.getAttribute(name)); 1.8777 + return f && function(t) { 1.8778 + this.setAttribute(name, f(t)); 1.8779 + }; 1.8780 + } 1.8781 + function attrTweenNS(d, i) { 1.8782 + var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); 1.8783 + return f && function(t) { 1.8784 + this.setAttributeNS(name.space, name.local, f(t)); 1.8785 + }; 1.8786 + } 1.8787 + return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); 1.8788 + }; 1.8789 + d3_transitionPrototype.style = function(name, value, priority) { 1.8790 + var n = arguments.length; 1.8791 + if (n < 3) { 1.8792 + if (typeof name !== "string") { 1.8793 + if (n < 2) value = ""; 1.8794 + for (priority in name) this.style(priority, name[priority], value); 1.8795 + return this; 1.8796 + } 1.8797 + priority = ""; 1.8798 + } 1.8799 + function styleNull() { 1.8800 + this.style.removeProperty(name); 1.8801 + } 1.8802 + function styleString(b) { 1.8803 + return b == null ? styleNull : (b += "", function() { 1.8804 + var a = d3_window(this).getComputedStyle(this, null).getPropertyValue(name), i; 1.8805 + return a !== b && (i = d3_interpolate(a, b), function(t) { 1.8806 + this.style.setProperty(name, i(t), priority); 1.8807 + }); 1.8808 + }); 1.8809 + } 1.8810 + return d3_transition_tween(this, "style." + name, value, styleString); 1.8811 + }; 1.8812 + d3_transitionPrototype.styleTween = function(name, tween, priority) { 1.8813 + if (arguments.length < 3) priority = ""; 1.8814 + function styleTween(d, i) { 1.8815 + var f = tween.call(this, d, i, d3_window(this).getComputedStyle(this, null).getPropertyValue(name)); 1.8816 + return f && function(t) { 1.8817 + this.style.setProperty(name, f(t), priority); 1.8818 + }; 1.8819 + } 1.8820 + return this.tween("style." + name, styleTween); 1.8821 + }; 1.8822 + d3_transitionPrototype.text = function(value) { 1.8823 + return d3_transition_tween(this, "text", value, d3_transition_text); 1.8824 + }; 1.8825 + function d3_transition_text(b) { 1.8826 + if (b == null) b = ""; 1.8827 + return function() { 1.8828 + this.textContent = b; 1.8829 + }; 1.8830 + } 1.8831 + d3_transitionPrototype.remove = function() { 1.8832 + var ns = this.namespace; 1.8833 + return this.each("end.transition", function() { 1.8834 + var p; 1.8835 + if (this[ns].count < 2 && (p = this.parentNode)) p.removeChild(this); 1.8836 + }); 1.8837 + }; 1.8838 + d3_transitionPrototype.ease = function(value) { 1.8839 + var id = this.id, ns = this.namespace; 1.8840 + if (arguments.length < 1) return this.node()[ns][id].ease; 1.8841 + if (typeof value !== "function") value = d3.ease.apply(d3, arguments); 1.8842 + return d3_selection_each(this, function(node) { 1.8843 + node[ns][id].ease = value; 1.8844 + }); 1.8845 + }; 1.8846 + d3_transitionPrototype.delay = function(value) { 1.8847 + var id = this.id, ns = this.namespace; 1.8848 + if (arguments.length < 1) return this.node()[ns][id].delay; 1.8849 + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { 1.8850 + node[ns][id].delay = +value.call(node, node.__data__, i, j); 1.8851 + } : (value = +value, function(node) { 1.8852 + node[ns][id].delay = value; 1.8853 + })); 1.8854 + }; 1.8855 + d3_transitionPrototype.duration = function(value) { 1.8856 + var id = this.id, ns = this.namespace; 1.8857 + if (arguments.length < 1) return this.node()[ns][id].duration; 1.8858 + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { 1.8859 + node[ns][id].duration = Math.max(1, value.call(node, node.__data__, i, j)); 1.8860 + } : (value = Math.max(1, value), function(node) { 1.8861 + node[ns][id].duration = value; 1.8862 + })); 1.8863 + }; 1.8864 + d3_transitionPrototype.each = function(type, listener) { 1.8865 + var id = this.id, ns = this.namespace; 1.8866 + if (arguments.length < 2) { 1.8867 + var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId; 1.8868 + try { 1.8869 + d3_transitionInheritId = id; 1.8870 + d3_selection_each(this, function(node, i, j) { 1.8871 + d3_transitionInherit = node[ns][id]; 1.8872 + type.call(node, node.__data__, i, j); 1.8873 + }); 1.8874 + } finally { 1.8875 + d3_transitionInherit = inherit; 1.8876 + d3_transitionInheritId = inheritId; 1.8877 + } 1.8878 + } else { 1.8879 + d3_selection_each(this, function(node) { 1.8880 + var transition = node[ns][id]; 1.8881 + (transition.event || (transition.event = d3.dispatch("start", "end", "interrupt"))).on(type, listener); 1.8882 + }); 1.8883 + } 1.8884 + return this; 1.8885 + }; 1.8886 + d3_transitionPrototype.transition = function() { 1.8887 + var id0 = this.id, id1 = ++d3_transitionId, ns = this.namespace, subgroups = [], subgroup, group, node, transition; 1.8888 + for (var j = 0, m = this.length; j < m; j++) { 1.8889 + subgroups.push(subgroup = []); 1.8890 + for (var group = this[j], i = 0, n = group.length; i < n; i++) { 1.8891 + if (node = group[i]) { 1.8892 + transition = node[ns][id0]; 1.8893 + d3_transitionNode(node, i, ns, id1, { 1.8894 + time: transition.time, 1.8895 + ease: transition.ease, 1.8896 + delay: transition.delay + transition.duration, 1.8897 + duration: transition.duration 1.8898 + }); 1.8899 + } 1.8900 + subgroup.push(node); 1.8901 + } 1.8902 + } 1.8903 + return d3_transition(subgroups, ns, id1); 1.8904 + }; 1.8905 + function d3_transitionNamespace(name) { 1.8906 + return name == null ? "__transition__" : "__transition_" + name + "__"; 1.8907 + } 1.8908 + function d3_transitionNode(node, i, ns, id, inherit) { 1.8909 + var lock = node[ns] || (node[ns] = { 1.8910 + active: 0, 1.8911 + count: 0 1.8912 + }), transition = lock[id], time, timer, duration, ease, tweens; 1.8913 + function schedule(elapsed) { 1.8914 + var delay = transition.delay; 1.8915 + timer.t = delay + time; 1.8916 + if (delay <= elapsed) return start(elapsed - delay); 1.8917 + timer.c = start; 1.8918 + } 1.8919 + function start(elapsed) { 1.8920 + var activeId = lock.active, active = lock[activeId]; 1.8921 + if (active) { 1.8922 + active.timer.c = null; 1.8923 + active.timer.t = NaN; 1.8924 + --lock.count; 1.8925 + delete lock[activeId]; 1.8926 + active.event && active.event.interrupt.call(node, node.__data__, active.index); 1.8927 + } 1.8928 + for (var cancelId in lock) { 1.8929 + if (+cancelId < id) { 1.8930 + var cancel = lock[cancelId]; 1.8931 + cancel.timer.c = null; 1.8932 + cancel.timer.t = NaN; 1.8933 + --lock.count; 1.8934 + delete lock[cancelId]; 1.8935 + } 1.8936 + } 1.8937 + timer.c = tick; 1.8938 + d3_timer(function() { 1.8939 + if (timer.c && tick(elapsed || 1)) { 1.8940 + timer.c = null; 1.8941 + timer.t = NaN; 1.8942 + } 1.8943 + return 1; 1.8944 + }, 0, time); 1.8945 + lock.active = id; 1.8946 + transition.event && transition.event.start.call(node, node.__data__, i); 1.8947 + tweens = []; 1.8948 + transition.tween.forEach(function(key, value) { 1.8949 + if (value = value.call(node, node.__data__, i)) { 1.8950 + tweens.push(value); 1.8951 + } 1.8952 + }); 1.8953 + ease = transition.ease; 1.8954 + duration = transition.duration; 1.8955 + } 1.8956 + function tick(elapsed) { 1.8957 + var t = elapsed / duration, e = ease(t), n = tweens.length; 1.8958 + while (n > 0) { 1.8959 + tweens[--n].call(node, e); 1.8960 + } 1.8961 + if (t >= 1) { 1.8962 + transition.event && transition.event.end.call(node, node.__data__, i); 1.8963 + if (--lock.count) delete lock[id]; else delete node[ns]; 1.8964 + return 1; 1.8965 + } 1.8966 + } 1.8967 + if (!transition) { 1.8968 + time = inherit.time; 1.8969 + timer = d3_timer(schedule, 0, time); 1.8970 + transition = lock[id] = { 1.8971 + tween: new d3_Map(), 1.8972 + time: time, 1.8973 + timer: timer, 1.8974 + delay: inherit.delay, 1.8975 + duration: inherit.duration, 1.8976 + ease: inherit.ease, 1.8977 + index: i 1.8978 + }; 1.8979 + inherit = null; 1.8980 + ++lock.count; 1.8981 + } 1.8982 + } 1.8983 + d3.svg.axis = function() { 1.8984 + var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_; 1.8985 + function axis(g) { 1.8986 + g.each(function() { 1.8987 + var g = d3.select(this); 1.8988 + var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy(); 1.8989 + var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g.selectAll(".tick").data(ticks, scale1), tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", ε), tickExit = d3.transition(tick.exit()).style("opacity", ε).remove(), tickUpdate = d3.transition(tick.order()).style("opacity", 1), tickSpacing = Math.max(innerTickSize, 0) + tickPadding, tickTransform; 1.8990 + var range = d3_scaleRange(scale1), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"), 1.8991 + d3.transition(path)); 1.8992 + tickEnter.append("line"); 1.8993 + tickEnter.append("text"); 1.8994 + var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"), sign = orient === "top" || orient === "left" ? -1 : 1, x1, x2, y1, y2; 1.8995 + if (orient === "bottom" || orient === "top") { 1.8996 + tickTransform = d3_svg_axisX, x1 = "x", y1 = "y", x2 = "x2", y2 = "y2"; 1.8997 + text.attr("dy", sign < 0 ? "0em" : ".71em").style("text-anchor", "middle"); 1.8998 + pathUpdate.attr("d", "M" + range[0] + "," + sign * outerTickSize + "V0H" + range[1] + "V" + sign * outerTickSize); 1.8999 + } else { 1.9000 + tickTransform = d3_svg_axisY, x1 = "y", y1 = "x", x2 = "y2", y2 = "x2"; 1.9001 + text.attr("dy", ".32em").style("text-anchor", sign < 0 ? "end" : "start"); 1.9002 + pathUpdate.attr("d", "M" + sign * outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + sign * outerTickSize); 1.9003 + } 1.9004 + lineEnter.attr(y2, sign * innerTickSize); 1.9005 + textEnter.attr(y1, sign * tickSpacing); 1.9006 + lineUpdate.attr(x2, 0).attr(y2, sign * innerTickSize); 1.9007 + textUpdate.attr(x1, 0).attr(y1, sign * tickSpacing); 1.9008 + if (scale1.rangeBand) { 1.9009 + var x = scale1, dx = x.rangeBand() / 2; 1.9010 + scale0 = scale1 = function(d) { 1.9011 + return x(d) + dx; 1.9012 + }; 1.9013 + } else if (scale0.rangeBand) { 1.9014 + scale0 = scale1; 1.9015 + } else { 1.9016 + tickExit.call(tickTransform, scale1, scale0); 1.9017 + } 1.9018 + tickEnter.call(tickTransform, scale0, scale1); 1.9019 + tickUpdate.call(tickTransform, scale1, scale1); 1.9020 + }); 1.9021 + } 1.9022 + axis.scale = function(x) { 1.9023 + if (!arguments.length) return scale; 1.9024 + scale = x; 1.9025 + return axis; 1.9026 + }; 1.9027 + axis.orient = function(x) { 1.9028 + if (!arguments.length) return orient; 1.9029 + orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient; 1.9030 + return axis; 1.9031 + }; 1.9032 + axis.ticks = function() { 1.9033 + if (!arguments.length) return tickArguments_; 1.9034 + tickArguments_ = d3_array(arguments); 1.9035 + return axis; 1.9036 + }; 1.9037 + axis.tickValues = function(x) { 1.9038 + if (!arguments.length) return tickValues; 1.9039 + tickValues = x; 1.9040 + return axis; 1.9041 + }; 1.9042 + axis.tickFormat = function(x) { 1.9043 + if (!arguments.length) return tickFormat_; 1.9044 + tickFormat_ = x; 1.9045 + return axis; 1.9046 + }; 1.9047 + axis.tickSize = function(x) { 1.9048 + var n = arguments.length; 1.9049 + if (!n) return innerTickSize; 1.9050 + innerTickSize = +x; 1.9051 + outerTickSize = +arguments[n - 1]; 1.9052 + return axis; 1.9053 + }; 1.9054 + axis.innerTickSize = function(x) { 1.9055 + if (!arguments.length) return innerTickSize; 1.9056 + innerTickSize = +x; 1.9057 + return axis; 1.9058 + }; 1.9059 + axis.outerTickSize = function(x) { 1.9060 + if (!arguments.length) return outerTickSize; 1.9061 + outerTickSize = +x; 1.9062 + return axis; 1.9063 + }; 1.9064 + axis.tickPadding = function(x) { 1.9065 + if (!arguments.length) return tickPadding; 1.9066 + tickPadding = +x; 1.9067 + return axis; 1.9068 + }; 1.9069 + axis.tickSubdivide = function() { 1.9070 + return arguments.length && axis; 1.9071 + }; 1.9072 + return axis; 1.9073 + }; 1.9074 + var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = { 1.9075 + top: 1, 1.9076 + right: 1, 1.9077 + bottom: 1, 1.9078 + left: 1 1.9079 + }; 1.9080 + function d3_svg_axisX(selection, x0, x1) { 1.9081 + selection.attr("transform", function(d) { 1.9082 + var v0 = x0(d); 1.9083 + return "translate(" + (isFinite(v0) ? v0 : x1(d)) + ",0)"; 1.9084 + }); 1.9085 + } 1.9086 + function d3_svg_axisY(selection, y0, y1) { 1.9087 + selection.attr("transform", function(d) { 1.9088 + var v0 = y0(d); 1.9089 + return "translate(0," + (isFinite(v0) ? v0 : y1(d)) + ")"; 1.9090 + }); 1.9091 + } 1.9092 + d3.svg.brush = function() { 1.9093 + 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.9094 + function brush(g) { 1.9095 + g.each(function() { 1.9096 + 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.9097 + var background = g.selectAll(".background").data([ 0 ]); 1.9098 + background.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair"); 1.9099 + g.selectAll(".extent").data([ 0 ]).enter().append("rect").attr("class", "extent").style("cursor", "move"); 1.9100 + var resize = g.selectAll(".resize").data(resizes, d3_identity); 1.9101 + resize.exit().remove(); 1.9102 + resize.enter().append("g").attr("class", function(d) { 1.9103 + return "resize " + d; 1.9104 + }).style("cursor", function(d) { 1.9105 + return d3_svg_brushCursor[d]; 1.9106 + }).append("rect").attr("x", function(d) { 1.9107 + return /[ew]$/.test(d) ? -3 : null; 1.9108 + }).attr("y", function(d) { 1.9109 + return /^[ns]/.test(d) ? -3 : null; 1.9110 + }).attr("width", 6).attr("height", 6).style("visibility", "hidden"); 1.9111 + resize.style("display", brush.empty() ? "none" : null); 1.9112 + var gUpdate = d3.transition(g), backgroundUpdate = d3.transition(background), range; 1.9113 + if (x) { 1.9114 + range = d3_scaleRange(x); 1.9115 + backgroundUpdate.attr("x", range[0]).attr("width", range[1] - range[0]); 1.9116 + redrawX(gUpdate); 1.9117 + } 1.9118 + if (y) { 1.9119 + range = d3_scaleRange(y); 1.9120 + backgroundUpdate.attr("y", range[0]).attr("height", range[1] - range[0]); 1.9121 + redrawY(gUpdate); 1.9122 + } 1.9123 + redraw(gUpdate); 1.9124 + }); 1.9125 + } 1.9126 + brush.event = function(g) { 1.9127 + g.each(function() { 1.9128 + var event_ = event.of(this, arguments), extent1 = { 1.9129 + x: xExtent, 1.9130 + y: yExtent, 1.9131 + i: xExtentDomain, 1.9132 + j: yExtentDomain 1.9133 + }, extent0 = this.__chart__ || extent1; 1.9134 + this.__chart__ = extent1; 1.9135 + if (d3_transitionInheritId) { 1.9136 + d3.select(this).transition().each("start.brush", function() { 1.9137 + xExtentDomain = extent0.i; 1.9138 + yExtentDomain = extent0.j; 1.9139 + xExtent = extent0.x; 1.9140 + yExtent = extent0.y; 1.9141 + event_({ 1.9142 + type: "brushstart" 1.9143 + }); 1.9144 + }).tween("brush:brush", function() { 1.9145 + var xi = d3_interpolateArray(xExtent, extent1.x), yi = d3_interpolateArray(yExtent, extent1.y); 1.9146 + xExtentDomain = yExtentDomain = null; 1.9147 + return function(t) { 1.9148 + xExtent = extent1.x = xi(t); 1.9149 + yExtent = extent1.y = yi(t); 1.9150 + event_({ 1.9151 + type: "brush", 1.9152 + mode: "resize" 1.9153 + }); 1.9154 + }; 1.9155 + }).each("end.brush", function() { 1.9156 + xExtentDomain = extent1.i; 1.9157 + yExtentDomain = extent1.j; 1.9158 + event_({ 1.9159 + type: "brush", 1.9160 + mode: "resize" 1.9161 + }); 1.9162 + event_({ 1.9163 + type: "brushend" 1.9164 + }); 1.9165 + }); 1.9166 + } else { 1.9167 + event_({ 1.9168 + type: "brushstart" 1.9169 + }); 1.9170 + event_({ 1.9171 + type: "brush", 1.9172 + mode: "resize" 1.9173 + }); 1.9174 + event_({ 1.9175 + type: "brushend" 1.9176 + }); 1.9177 + } 1.9178 + }); 1.9179 + }; 1.9180 + function redraw(g) { 1.9181 + g.selectAll(".resize").attr("transform", function(d) { 1.9182 + return "translate(" + xExtent[+/e$/.test(d)] + "," + yExtent[+/^s/.test(d)] + ")"; 1.9183 + }); 1.9184 + } 1.9185 + function redrawX(g) { 1.9186 + g.select(".extent").attr("x", xExtent[0]); 1.9187 + g.selectAll(".extent,.n>rect,.s>rect").attr("width", xExtent[1] - xExtent[0]); 1.9188 + } 1.9189 + function redrawY(g) { 1.9190 + g.select(".extent").attr("y", yExtent[0]); 1.9191 + g.selectAll(".extent,.e>rect,.w>rect").attr("height", yExtent[1] - yExtent[0]); 1.9192 + } 1.9193 + function brushstart() { 1.9194 + 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(target), center, origin = d3.mouse(target), offset; 1.9195 + var w = d3.select(d3_window(target)).on("keydown.brush", keydown).on("keyup.brush", keyup); 1.9196 + if (d3.event.changedTouches) { 1.9197 + w.on("touchmove.brush", brushmove).on("touchend.brush", brushend); 1.9198 + } else { 1.9199 + w.on("mousemove.brush", brushmove).on("mouseup.brush", brushend); 1.9200 + } 1.9201 + g.interrupt().selectAll("*").interrupt(); 1.9202 + if (dragging) { 1.9203 + origin[0] = xExtent[0] - origin[0]; 1.9204 + origin[1] = yExtent[0] - origin[1]; 1.9205 + } else if (resizing) { 1.9206 + var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing); 1.9207 + offset = [ xExtent[1 - ex] - origin[0], yExtent[1 - ey] - origin[1] ]; 1.9208 + origin[0] = xExtent[ex]; 1.9209 + origin[1] = yExtent[ey]; 1.9210 + } else if (d3.event.altKey) center = origin.slice(); 1.9211 + g.style("pointer-events", "none").selectAll(".resize").style("display", null); 1.9212 + d3.select("body").style("cursor", eventTarget.style("cursor")); 1.9213 + event_({ 1.9214 + type: "brushstart" 1.9215 + }); 1.9216 + brushmove(); 1.9217 + function keydown() { 1.9218 + if (d3.event.keyCode == 32) { 1.9219 + if (!dragging) { 1.9220 + center = null; 1.9221 + origin[0] -= xExtent[1]; 1.9222 + origin[1] -= yExtent[1]; 1.9223 + dragging = 2; 1.9224 + } 1.9225 + d3_eventPreventDefault(); 1.9226 + } 1.9227 + } 1.9228 + function keyup() { 1.9229 + if (d3.event.keyCode == 32 && dragging == 2) { 1.9230 + origin[0] += xExtent[1]; 1.9231 + origin[1] += yExtent[1]; 1.9232 + dragging = 0; 1.9233 + d3_eventPreventDefault(); 1.9234 + } 1.9235 + } 1.9236 + function brushmove() { 1.9237 + var point = d3.mouse(target), moved = false; 1.9238 + if (offset) { 1.9239 + point[0] += offset[0]; 1.9240 + point[1] += offset[1]; 1.9241 + } 1.9242 + if (!dragging) { 1.9243 + if (d3.event.altKey) { 1.9244 + if (!center) center = [ (xExtent[0] + xExtent[1]) / 2, (yExtent[0] + yExtent[1]) / 2 ]; 1.9245 + origin[0] = xExtent[+(point[0] < center[0])]; 1.9246 + origin[1] = yExtent[+(point[1] < center[1])]; 1.9247 + } else center = null; 1.9248 + } 1.9249 + if (resizingX && move1(point, x, 0)) { 1.9250 + redrawX(g); 1.9251 + moved = true; 1.9252 + } 1.9253 + if (resizingY && move1(point, y, 1)) { 1.9254 + redrawY(g); 1.9255 + moved = true; 1.9256 + } 1.9257 + if (moved) { 1.9258 + redraw(g); 1.9259 + event_({ 1.9260 + type: "brush", 1.9261 + mode: dragging ? "move" : "resize" 1.9262 + }); 1.9263 + } 1.9264 + } 1.9265 + function move1(point, scale, i) { 1.9266 + 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.9267 + if (dragging) { 1.9268 + r0 -= position; 1.9269 + r1 -= size + position; 1.9270 + } 1.9271 + min = (i ? yClamp : xClamp) ? Math.max(r0, Math.min(r1, point[i])) : point[i]; 1.9272 + if (dragging) { 1.9273 + max = (min += position) + size; 1.9274 + } else { 1.9275 + if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min)); 1.9276 + if (position < min) { 1.9277 + max = min; 1.9278 + min = position; 1.9279 + } else { 1.9280 + max = position; 1.9281 + } 1.9282 + } 1.9283 + if (extent[0] != min || extent[1] != max) { 1.9284 + if (i) yExtentDomain = null; else xExtentDomain = null; 1.9285 + extent[0] = min; 1.9286 + extent[1] = max; 1.9287 + return true; 1.9288 + } 1.9289 + } 1.9290 + function brushend() { 1.9291 + brushmove(); 1.9292 + g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null); 1.9293 + d3.select("body").style("cursor", null); 1.9294 + 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.9295 + dragRestore(); 1.9296 + event_({ 1.9297 + type: "brushend" 1.9298 + }); 1.9299 + } 1.9300 + } 1.9301 + brush.x = function(z) { 1.9302 + if (!arguments.length) return x; 1.9303 + x = z; 1.9304 + resizes = d3_svg_brushResizes[!x << 1 | !y]; 1.9305 + return brush; 1.9306 + }; 1.9307 + brush.y = function(z) { 1.9308 + if (!arguments.length) return y; 1.9309 + y = z; 1.9310 + resizes = d3_svg_brushResizes[!x << 1 | !y]; 1.9311 + return brush; 1.9312 + }; 1.9313 + brush.clamp = function(z) { 1.9314 + if (!arguments.length) return x && y ? [ xClamp, yClamp ] : x ? xClamp : y ? yClamp : null; 1.9315 + if (x && y) xClamp = !!z[0], yClamp = !!z[1]; else if (x) xClamp = !!z; else if (y) yClamp = !!z; 1.9316 + return brush; 1.9317 + }; 1.9318 + brush.extent = function(z) { 1.9319 + var x0, x1, y0, y1, t; 1.9320 + if (!arguments.length) { 1.9321 + if (x) { 1.9322 + if (xExtentDomain) { 1.9323 + x0 = xExtentDomain[0], x1 = xExtentDomain[1]; 1.9324 + } else { 1.9325 + x0 = xExtent[0], x1 = xExtent[1]; 1.9326 + if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); 1.9327 + if (x1 < x0) t = x0, x0 = x1, x1 = t; 1.9328 + } 1.9329 + } 1.9330 + if (y) { 1.9331 + if (yExtentDomain) { 1.9332 + y0 = yExtentDomain[0], y1 = yExtentDomain[1]; 1.9333 + } else { 1.9334 + y0 = yExtent[0], y1 = yExtent[1]; 1.9335 + if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); 1.9336 + if (y1 < y0) t = y0, y0 = y1, y1 = t; 1.9337 + } 1.9338 + } 1.9339 + return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ]; 1.9340 + } 1.9341 + if (x) { 1.9342 + x0 = z[0], x1 = z[1]; 1.9343 + if (y) x0 = x0[0], x1 = x1[0]; 1.9344 + xExtentDomain = [ x0, x1 ]; 1.9345 + if (x.invert) x0 = x(x0), x1 = x(x1); 1.9346 + if (x1 < x0) t = x0, x0 = x1, x1 = t; 1.9347 + if (x0 != xExtent[0] || x1 != xExtent[1]) xExtent = [ x0, x1 ]; 1.9348 + } 1.9349 + if (y) { 1.9350 + y0 = z[0], y1 = z[1]; 1.9351 + if (x) y0 = y0[1], y1 = y1[1]; 1.9352 + yExtentDomain = [ y0, y1 ]; 1.9353 + if (y.invert) y0 = y(y0), y1 = y(y1); 1.9354 + if (y1 < y0) t = y0, y0 = y1, y1 = t; 1.9355 + if (y0 != yExtent[0] || y1 != yExtent[1]) yExtent = [ y0, y1 ]; 1.9356 + } 1.9357 + return brush; 1.9358 + }; 1.9359 + brush.clear = function() { 1.9360 + if (!brush.empty()) { 1.9361 + xExtent = [ 0, 0 ], yExtent = [ 0, 0 ]; 1.9362 + xExtentDomain = yExtentDomain = null; 1.9363 + } 1.9364 + return brush; 1.9365 + }; 1.9366 + brush.empty = function() { 1.9367 + return !!x && xExtent[0] == xExtent[1] || !!y && yExtent[0] == yExtent[1]; 1.9368 + }; 1.9369 + return d3.rebind(brush, event, "on"); 1.9370 + }; 1.9371 + var d3_svg_brushCursor = { 1.9372 + n: "ns-resize", 1.9373 + e: "ew-resize", 1.9374 + s: "ns-resize", 1.9375 + w: "ew-resize", 1.9376 + nw: "nwse-resize", 1.9377 + ne: "nesw-resize", 1.9378 + se: "nwse-resize", 1.9379 + sw: "nesw-resize" 1.9380 + }; 1.9381 + var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ]; 1.9382 + var d3_time_format = d3_time.format = d3_locale_enUS.timeFormat; 1.9383 + var d3_time_formatUtc = d3_time_format.utc; 1.9384 + var d3_time_formatIso = d3_time_formatUtc("%Y-%m-%dT%H:%M:%S.%LZ"); 1.9385 + d3_time_format.iso = Date.prototype.toISOString && +new Date("2000-01-01T00:00:00.000Z") ? d3_time_formatIsoNative : d3_time_formatIso; 1.9386 + function d3_time_formatIsoNative(date) { 1.9387 + return date.toISOString(); 1.9388 + } 1.9389 + d3_time_formatIsoNative.parse = function(string) { 1.9390 + var date = new Date(string); 1.9391 + return isNaN(date) ? null : date; 1.9392 + }; 1.9393 + d3_time_formatIsoNative.toString = d3_time_formatIso.toString; 1.9394 + d3_time.second = d3_time_interval(function(date) { 1.9395 + return new d3_date(Math.floor(date / 1e3) * 1e3); 1.9396 + }, function(date, offset) { 1.9397 + date.setTime(date.getTime() + Math.floor(offset) * 1e3); 1.9398 + }, function(date) { 1.9399 + return date.getSeconds(); 1.9400 + }); 1.9401 + d3_time.seconds = d3_time.second.range; 1.9402 + d3_time.seconds.utc = d3_time.second.utc.range; 1.9403 + d3_time.minute = d3_time_interval(function(date) { 1.9404 + return new d3_date(Math.floor(date / 6e4) * 6e4); 1.9405 + }, function(date, offset) { 1.9406 + date.setTime(date.getTime() + Math.floor(offset) * 6e4); 1.9407 + }, function(date) { 1.9408 + return date.getMinutes(); 1.9409 + }); 1.9410 + d3_time.minutes = d3_time.minute.range; 1.9411 + d3_time.minutes.utc = d3_time.minute.utc.range; 1.9412 + d3_time.hour = d3_time_interval(function(date) { 1.9413 + var timezone = date.getTimezoneOffset() / 60; 1.9414 + return new d3_date((Math.floor(date / 36e5 - timezone) + timezone) * 36e5); 1.9415 + }, function(date, offset) { 1.9416 + date.setTime(date.getTime() + Math.floor(offset) * 36e5); 1.9417 + }, function(date) { 1.9418 + return date.getHours(); 1.9419 + }); 1.9420 + d3_time.hours = d3_time.hour.range; 1.9421 + d3_time.hours.utc = d3_time.hour.utc.range; 1.9422 + d3_time.month = d3_time_interval(function(date) { 1.9423 + date = d3_time.day(date); 1.9424 + date.setDate(1); 1.9425 + return date; 1.9426 + }, function(date, offset) { 1.9427 + date.setMonth(date.getMonth() + offset); 1.9428 + }, function(date) { 1.9429 + return date.getMonth(); 1.9430 + }); 1.9431 + d3_time.months = d3_time.month.range; 1.9432 + d3_time.months.utc = d3_time.month.utc.range; 1.9433 + function d3_time_scale(linear, methods, format) { 1.9434 + function scale(x) { 1.9435 + return linear(x); 1.9436 + } 1.9437 + scale.invert = function(x) { 1.9438 + return d3_time_scaleDate(linear.invert(x)); 1.9439 + }; 1.9440 + scale.domain = function(x) { 1.9441 + if (!arguments.length) return linear.domain().map(d3_time_scaleDate); 1.9442 + linear.domain(x); 1.9443 + return scale; 1.9444 + }; 1.9445 + function tickMethod(extent, count) { 1.9446 + var span = extent[1] - extent[0], target = span / count, i = d3.bisect(d3_time_scaleSteps, target); 1.9447 + return i == d3_time_scaleSteps.length ? [ methods.year, d3_scale_linearTickRange(extent.map(function(d) { 1.9448 + return d / 31536e6; 1.9449 + }), 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.9450 + } 1.9451 + scale.nice = function(interval, skip) { 1.9452 + var domain = scale.domain(), extent = d3_scaleExtent(domain), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" && tickMethod(extent, interval); 1.9453 + if (method) interval = method[0], skip = method[1]; 1.9454 + function skipped(date) { 1.9455 + return !isNaN(date) && !interval.range(date, d3_time_scaleDate(+date + 1), skip).length; 1.9456 + } 1.9457 + return scale.domain(d3_scale_nice(domain, skip > 1 ? { 1.9458 + floor: function(date) { 1.9459 + while (skipped(date = interval.floor(date))) date = d3_time_scaleDate(date - 1); 1.9460 + return date; 1.9461 + }, 1.9462 + ceil: function(date) { 1.9463 + while (skipped(date = interval.ceil(date))) date = d3_time_scaleDate(+date + 1); 1.9464 + return date; 1.9465 + } 1.9466 + } : interval)); 1.9467 + }; 1.9468 + scale.ticks = function(interval, skip) { 1.9469 + var extent = d3_scaleExtent(scale.domain()), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" ? tickMethod(extent, interval) : !interval.range && [ { 1.9470 + range: interval 1.9471 + }, skip ]; 1.9472 + if (method) interval = method[0], skip = method[1]; 1.9473 + return interval.range(extent[0], d3_time_scaleDate(+extent[1] + 1), skip < 1 ? 1 : skip); 1.9474 + }; 1.9475 + scale.tickFormat = function() { 1.9476 + return format; 1.9477 + }; 1.9478 + scale.copy = function() { 1.9479 + return d3_time_scale(linear.copy(), methods, format); 1.9480 + }; 1.9481 + return d3_scale_linearRebind(scale, linear); 1.9482 + } 1.9483 + function d3_time_scaleDate(t) { 1.9484 + return new Date(t); 1.9485 + } 1.9486 + var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ]; 1.9487 + 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.9488 + var d3_time_scaleLocalFormat = d3_time_format.multi([ [ ".%L", function(d) { 1.9489 + return d.getMilliseconds(); 1.9490 + } ], [ ":%S", function(d) { 1.9491 + return d.getSeconds(); 1.9492 + } ], [ "%I:%M", function(d) { 1.9493 + return d.getMinutes(); 1.9494 + } ], [ "%I %p", function(d) { 1.9495 + return d.getHours(); 1.9496 + } ], [ "%a %d", function(d) { 1.9497 + return d.getDay() && d.getDate() != 1; 1.9498 + } ], [ "%b %d", function(d) { 1.9499 + return d.getDate() != 1; 1.9500 + } ], [ "%B", function(d) { 1.9501 + return d.getMonth(); 1.9502 + } ], [ "%Y", d3_true ] ]); 1.9503 + var d3_time_scaleMilliseconds = { 1.9504 + range: function(start, stop, step) { 1.9505 + return d3.range(Math.ceil(start / step) * step, +stop, step).map(d3_time_scaleDate); 1.9506 + }, 1.9507 + floor: d3_identity, 1.9508 + ceil: d3_identity 1.9509 + }; 1.9510 + d3_time_scaleLocalMethods.year = d3_time.year; 1.9511 + d3_time.scale = function() { 1.9512 + return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); 1.9513 + }; 1.9514 + var d3_time_scaleUtcMethods = d3_time_scaleLocalMethods.map(function(m) { 1.9515 + return [ m[0].utc, m[1] ]; 1.9516 + }); 1.9517 + var d3_time_scaleUtcFormat = d3_time_formatUtc.multi([ [ ".%L", function(d) { 1.9518 + return d.getUTCMilliseconds(); 1.9519 + } ], [ ":%S", function(d) { 1.9520 + return d.getUTCSeconds(); 1.9521 + } ], [ "%I:%M", function(d) { 1.9522 + return d.getUTCMinutes(); 1.9523 + } ], [ "%I %p", function(d) { 1.9524 + return d.getUTCHours(); 1.9525 + } ], [ "%a %d", function(d) { 1.9526 + return d.getUTCDay() && d.getUTCDate() != 1; 1.9527 + } ], [ "%b %d", function(d) { 1.9528 + return d.getUTCDate() != 1; 1.9529 + } ], [ "%B", function(d) { 1.9530 + return d.getUTCMonth(); 1.9531 + } ], [ "%Y", d3_true ] ]); 1.9532 + d3_time_scaleUtcMethods.year = d3_time.year.utc; 1.9533 + d3_time.scale.utc = function() { 1.9534 + return d3_time_scale(d3.scale.linear(), d3_time_scaleUtcMethods, d3_time_scaleUtcFormat); 1.9535 + }; 1.9536 + d3.text = d3_xhrType(function(request) { 1.9537 + return request.responseText; 1.9538 + }); 1.9539 + d3.json = function(url, callback) { 1.9540 + return d3_xhr(url, "application/json", d3_json, callback); 1.9541 + }; 1.9542 + function d3_json(request) { 1.9543 + return JSON.parse(request.responseText); 1.9544 + } 1.9545 + d3.html = function(url, callback) { 1.9546 + return d3_xhr(url, "text/html", d3_html, callback); 1.9547 + }; 1.9548 + function d3_html(request) { 1.9549 + var range = d3_document.createRange(); 1.9550 + range.selectNode(d3_document.body); 1.9551 + return range.createContextualFragment(request.responseText); 1.9552 + } 1.9553 + d3.xml = d3_xhrType(function(request) { 1.9554 + return request.responseXML; 1.9555 + }); 1.9556 + if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; 1.9557 +}(); 1.9558 \ No newline at end of file