UNPKG

autograph

Version:

A visual data routing automation tool.

1,510 lines (1,267 loc) 229 kB
d3 = function () { function n(n) { return null != n && !isNaN(n) } function t(n) { return n.length } function e(n) { for (var t = 1; n * t % 1;)t *= 10; return t } function r(n, t) { try { for (var e in t)Object.defineProperty(n.prototype, e, {value: t[e], enumerable: !1}) } catch (r) { n.prototype = t } } function i() { } function u() { } function a(n, t, e) { return function () { var r = e.apply(t, arguments); return r === t ? n : r } } function o(n, t) { if (t in n)return t; t = t.charAt(0).toUpperCase() + t.substring(1); for (var e = 0, r = Ca.length; r > e; ++e) { var i = Ca[e] + t; if (i in n)return i } } function c(n) { for (var t = n.length, e = new Array(t); t--;)e[t] = n[t]; return e } function l(n) { return Array.prototype.slice.call(n) } function s() { } function f() { } function h(n) { function t() { for (var t, r = e, i = -1, u = r.length; ++i < u;)(t = r[i].on) && t.apply(this, arguments); return n } var e = [], r = new i; return t.on = function (t, i) { var u, a = r.get(t); return arguments.length < 2 ? a && a.on : (a && (a.on = null, e = e.slice(0, u = e.indexOf(a)).concat(e.slice(u + 1)), r.remove(t)), i && e.push(r.set(t, {on: i})), n) }, t } function g() { Ma.event.preventDefault() } function p() { for (var n, t = Ma.event; n = t.sourceEvent;)t = n; return t } function m(n) { for (var t = new f, e = 0, r = arguments.length; ++e < r;)t[arguments[e]] = h(t); return t.of = function (e, r) { return function (i) { try { var u = i.sourceEvent = Ma.event; i.target = n, Ma.event = i, t[i.type].apply(e, r) } finally { Ma.event = u } } }, t } function d(n) { return Ha(n, Ya), n } function v(n) { return"function" == typeof n ? n : function () { return Fa(n, this) } } function y(n) { return"function" == typeof n ? n : function () { return Pa(n, this) } } function M(n, t) { function e() { this.removeAttribute(n) } function r() { this.removeAttributeNS(n.space, n.local) } function i() { this.setAttribute(n, t) } function u() { this.setAttributeNS(n.space, n.local, t) } function a() { var e = t.apply(this, arguments); null == e ? this.removeAttribute(n) : this.setAttribute(n, e) } function o() { var e = t.apply(this, arguments); null == e ? this.removeAttributeNS(n.space, n.local) : this.setAttributeNS(n.space, n.local, e) } return n = Ma.ns.qualify(n), null == t ? n.local ? r : e : "function" == typeof t ? n.local ? o : a : n.local ? u : i } function x(n) { return n.trim().replace(/\s+/g, " ") } function b(n) { return new RegExp("(?:^|\\s+)" + Ma.requote(n) + "(?:\\s+|$)", "g") } function _(n, t) { function e() { for (var e = -1; ++e < i;)n[e](this, t) } function r() { for (var e = -1, r = t.apply(this, arguments); ++e < i;)n[e](this, r) } n = n.trim().split(/\s+/).map(w); var i = n.length; return"function" == typeof t ? r : e } function w(n) { var t = b(n); return function (e, r) { if (i = e.classList)return r ? i.add(n) : i.remove(n); var i = e.getAttribute("class") || ""; r ? (t.lastIndex = 0, t.test(i) || e.setAttribute("class", x(i + " " + n))) : e.setAttribute("class", x(i.replace(t, " "))) } } function S(n, t, e) { function r() { this.style.removeProperty(n) } function i() { this.style.setProperty(n, t, e) } function u() { var r = t.apply(this, arguments); null == r ? this.style.removeProperty(n) : this.style.setProperty(n, r, e) } return null == t ? r : "function" == typeof t ? u : i } function E(n, t) { function e() { delete this[n] } function r() { this[n] = t } function i() { var e = t.apply(this, arguments); null == e ? delete this[n] : this[n] = e } return null == t ? e : "function" == typeof t ? i : r } function k(n) { return"function" == typeof n ? n : (n = Ma.ns.qualify(n)).local ? function () { return xa.createElementNS(n.space, n.local) } : function () { return xa.createElementNS(this.namespaceURI, n) } } function A(n) { return{__data__: n} } function N(n) { return function () { return Ra(this, n) } } function T(n) { return arguments.length || (n = Ma.ascending), function (t, e) { return t && e ? n(t.__data__, e.__data__) : !t - !e } } function q(n, t) { for (var e = 0, r = n.length; r > e; e++)for (var i, u = n[e], a = 0, o = u.length; o > a; a++)(i = u[a]) && t(i, a, e); return n } function z(n) { return Ha(n, Ia), n } function C(n) { var t, e; return function (r, i, u) { var a, o = n[u].update, c = o.length; for (u != e && (e = u, t = 0), i >= t && (t = i + 1); !(a = o[t]) && ++t < c;); return a } } function D(n, t, e) { function r() { var t = this[a]; t && (this.removeEventListener(n, t, t.$), delete this[a]) } function i() { var i = c(t, Da(arguments)); r.call(this), this.addEventListener(n, this[a] = i, i.$ = e), i._ = t } function u() { var t, e = new RegExp("^__on([^.]+)" + Ma.requote(n) + "$"); for (var r in this)if (t = r.match(e)) { var i = this[r]; this.removeEventListener(t[1], i, i.$), delete this[r] } } var a = "__on" + n, o = n.indexOf("."), c = j; o > 0 && (n = n.substring(0, o)); var l = Za.get(n); return l && (n = l, c = L), o ? t ? i : r : t ? s : u } function j(n, t) { return function (e) { var r = Ma.event; Ma.event = e, t[0] = this.__data__; try { n.apply(this, t) } finally { Ma.event = r } } } function L(n, t) { var e = j(n, t); return function (n) { var t = this, r = n.relatedTarget; r && (r === t || 8 & r.compareDocumentPosition(t)) || e.call(t, n) } } function H() { var n = ".dragsuppress-" + ++Ba, t = "touchmove" + n, e = "selectstart" + n, r = "dragstart" + n, i = "click" + n, u = Ma.select(_a).on(t, g).on(e, g).on(r, g), a = ba.style, o = a[Xa]; return a[Xa] = "none", function (t) { function e() { u.on(i, null) } u.on(n, null), a[Xa] = o, t && (u.on(i, function () { g(), e() }, !0), setTimeout(e, 0)) } } function F(n, t) { var e = n.ownerSVGElement || n; if (e.createSVGPoint) { var r = e.createSVGPoint(); if (0 > $a && (_a.scrollX || _a.scrollY)) { e = Ma.select("body").append("svg").style({position: "absolute", top: 0, left: 0, margin: 0, padding: 0, border: "none"}, "important"); var i = e[0][0].getScreenCTM(); $a = !(i.f || i.e), e.remove() } return $a ? (r.x = t.pageX, r.y = t.pageY) : (r.x = t.clientX, r.y = t.clientY), r = r.matrixTransform(n.getScreenCTM().inverse()), [r.x, r.y] } var u = n.getBoundingClientRect(); return[t.clientX - u.left - n.clientLeft, t.clientY - u.top - n.clientTop] } function P(n) { return n > 0 ? 1 : 0 > n ? -1 : 0 } function O(n) { return n > 1 ? 0 : -1 > n ? Wa : Math.acos(n) } function R(n) { return n > 1 ? Wa / 2 : -1 > n ? -Wa / 2 : Math.asin(n) } function Y(n) { return(Math.exp(n) - Math.exp(-n)) / 2 } function U(n) { return(Math.exp(n) + Math.exp(-n)) / 2 } function I(n) { return Y(n) / U(n) } function V(n) { return(n = Math.sin(n / 2)) * n } function Z() { } function X(n, t, e) { return new B(n, t, e) } function B(n, t, e) { this.h = n, this.s = t, this.l = e } function $(n, t, e) { function r(n) { return n > 360 ? n -= 360 : 0 > n && (n += 360), 60 > n ? u + (a - u) * n / 60 : 180 > n ? a : 240 > n ? u + (a - u) * (240 - n) / 60 : u } function i(n) { return Math.round(255 * r(n)) } var u, a; return n = isNaN(n) ? 0 : (n %= 360) < 0 ? n + 360 : n, t = isNaN(t) ? 0 : 0 > t ? 0 : t > 1 ? 1 : t, e = 0 > e ? 0 : e > 1 ? 1 : e, a = .5 >= e ? e * (1 + t) : e + t - e * t, u = 2 * e - a, ot(i(n + 120), i(n), i(n - 120)) } function W(n, t, e) { return new J(n, t, e) } function J(n, t, e) { this.h = n, this.c = t, this.l = e } function G(n, t, e) { return isNaN(n) && (n = 0), isNaN(t) && (t = 0), K(e, Math.cos(n *= Ka) * t, Math.sin(n) * t) } function K(n, t, e) { return new Q(n, t, e) } function Q(n, t, e) { this.l = n, this.a = t, this.b = e } function nt(n, t, e) { var r = (n + 16) / 116, i = r + t / 500, u = r - e / 200; return i = et(i) * lo, r = et(r) * so, u = et(u) * fo, ot(it(3.2404542 * i - 1.5371385 * r - .4985314 * u), it(-.969266 * i + 1.8760108 * r + .041556 * u), it(.0556434 * i - .2040259 * r + 1.0572252 * u)) } function tt(n, t, e) { return n > 0 ? W(Math.atan2(e, t) * Qa, Math.sqrt(t * t + e * e), n) : W(0 / 0, 0 / 0, n) } function et(n) { return n > .206893034 ? n * n * n : (n - 4 / 29) / 7.787037 } function rt(n) { return n > .008856 ? Math.pow(n, 1 / 3) : 7.787037 * n + 4 / 29 } function it(n) { return Math.round(255 * (.00304 >= n ? 12.92 * n : 1.055 * Math.pow(n, 1 / 2.4) - .055)) } function ut(n) { return ot(n >> 16, 255 & n >> 8, 255 & n) } function at(n) { return ut(n) + "" } function ot(n, t, e) { return new ct(n, t, e) } function ct(n, t, e) { this.r = n, this.g = t, this.b = e } function lt(n) { return 16 > n ? "0" + Math.max(0, n).toString(16) : Math.min(255, n).toString(16) } function st(n, t, e) { var r, i, u, a = 0, o = 0, c = 0; if (r = /([a-z]+)\((.*)\)/i.exec(n))switch (i = r[2].split(","), r[1]) { case"hsl": return e(parseFloat(i[0]), parseFloat(i[1]) / 100, parseFloat(i[2]) / 100); case"rgb": return t(pt(i[0]), pt(i[1]), pt(i[2])) } return(u = po.get(n)) ? t(u.r, u.g, u.b) : (null != n && "#" === n.charAt(0) && (4 === n.length ? (a = n.charAt(1), a += a, o = n.charAt(2), o += o, c = n.charAt(3), c += c) : 7 === n.length && (a = n.substring(1, 3), o = n.substring(3, 5), c = n.substring(5, 7)), a = parseInt(a, 16), o = parseInt(o, 16), c = parseInt(c, 16)), t(a, o, c)) } function ft(n, t, e) { var r, i, u = Math.min(n /= 255, t /= 255, e /= 255), a = Math.max(n, t, e), o = a - u, c = (a + u) / 2; return o ? (i = .5 > c ? o / (a + u) : o / (2 - a - u), r = n == a ? (t - e) / o + (e > t ? 6 : 0) : t == a ? (e - n) / o + 2 : (n - t) / o + 4, r *= 60) : (r = 0 / 0, i = c > 0 && 1 > c ? 0 : r), X(r, i, c) } function ht(n, t, e) { n = gt(n), t = gt(t), e = gt(e); var r = rt((.4124564 * n + .3575761 * t + .1804375 * e) / lo), i = rt((.2126729 * n + .7151522 * t + .072175 * e) / so), u = rt((.0193339 * n + .119192 * t + .9503041 * e) / fo); return K(116 * i - 16, 500 * (r - i), 200 * (i - u)) } function gt(n) { return(n /= 255) <= .04045 ? n / 12.92 : Math.pow((n + .055) / 1.055, 2.4) } function pt(n) { var t = parseFloat(n); return"%" === n.charAt(n.length - 1) ? Math.round(2.55 * t) : t } function mt(n) { return"function" == typeof n ? n : function () { return n } } function dt(n) { return n } function vt(n) { return function (t, e, r) { return 2 === arguments.length && "function" == typeof e && (r = e, e = null), yt(t, e, n, r) } } function yt(n, t, e, r) { function i() { var n, t = c.status; if (!t && c.responseText || t >= 200 && 300 > t || 304 === t) { try { n = e.call(u, c) } catch (r) { return a.error.call(u, r), void 0 } a.load.call(u, n) } else a.error.call(u, c) } var u = {}, a = Ma.dispatch("beforesend", "progress", "load", "error"), o = {}, c = new XMLHttpRequest, l = null; return!_a.XDomainRequest || "withCredentials"in c || !/^(http(s)?:)?\/\//.test(n) || (c = new XDomainRequest), "onload"in c ? c.onload = c.onerror = i : c.onreadystatechange = function () { c.readyState > 3 && i() }, c.onprogress = function (n) { var t = Ma.event; Ma.event = n; try { a.progress.call(u, c) } finally { Ma.event = t } }, u.header = function (n, t) { return n = (n + "").toLowerCase(), arguments.length < 2 ? o[n] : (null == t ? delete o[n] : o[n] = t + "", u) }, u.mimeType = function (n) { return arguments.length ? (t = null == n ? null : n + "", u) : t }, u.responseType = function (n) { return arguments.length ? (l = n, u) : l }, u.response = function (n) { return e = n, u }, ["get", "post"].forEach(function (n) { u[n] = function () { return u.send.apply(u, [n].concat(Da(arguments))) } }), u.send = function (e, r, i) { if (2 === arguments.length && "function" == typeof r && (i = r, r = null), c.open(e, n, !0), null == t || "accept"in o || (o.accept = t + ",*/*"), c.setRequestHeader)for (var s in o)c.setRequestHeader(s, o[s]); return null != t && c.overrideMimeType && c.overrideMimeType(t), null != l && (c.responseType = l), null != i && u.on("error", i).on("load", function (n) { i(null, n) }), a.beforesend.call(u, c), c.send(null == r ? null : r), u }, u.abort = function () { return c.abort(), u }, Ma.rebind(u, a, "on"), null == r ? u : u.get(Mt(r)) } function Mt(n) { return 1 === n.length ? function (t, e) { n(null == t ? e : null) } : n } function xt() { var n = _t(), t = wt() - n; t > 24 ? (isFinite(t) && (clearTimeout(Mo), Mo = setTimeout(xt, t)), yo = 0) : (yo = 1, bo(xt)) } function bt(n, t, e) { var r = arguments.length; 2 > r && (t = 0), 3 > r && (e = Date.now()), xo.callback = n, xo.time = e + t } function _t() { var n = Date.now(); for (xo = mo; xo;)n >= xo.time && (xo.flush = xo.callback(n - xo.time)), xo = xo.next; return n } function wt() { for (var n, t = mo, e = 1 / 0; t;)t.flush ? t = n ? n.next = t.next : mo = t.next : (t.time < e && (e = t.time), t = (n = t).next); return vo = n, e } function St(n, t) { var e = Math.pow(10, 3 * Math.abs(8 - t)); return{scale: t > 8 ? function (n) { return n / e } : function (n) { return n * e }, symbol: n} } function Et(n, t) { return t - (n ? Math.ceil(Math.log(n) / Math.LN10) : 1) } function kt(n) { return n + "" } function At() { } function Nt(n, t, e) { var r = e.s = n + t, i = r - n, u = r - i; e.t = n - u + (t - i) } function Tt(n, t) { n && Do.hasOwnProperty(n.type) && Do[n.type](n, t) } function qt(n, t, e) { var r = -1, i = n.length - e; for (t.lineStart(); ++r < i;)t.point.apply(t, n[r]); t.lineEnd() } function zt(n, t) { var e = -1, r = n.length; for (t.polygonStart(); ++e < r;)qt(n[e], t, 1); t.polygonEnd() } function Ct(n, t) { return{point: t, sphere: function () { n.sphere() }, lineStart: function () { n.lineStart() }, lineEnd: function () { n.lineEnd() }, polygonStart: function () { n.polygonStart() }, polygonEnd: function () { n.polygonEnd() }} } function Dt() { function n(n, t) { n *= Ka, t = t * Ka / 2 + Wa / 4; var e = n - r, a = Math.cos(t), o = Math.sin(t), c = u * o, l = i * a + c * Math.cos(e), s = c * Math.sin(e); Lo.add(Math.atan2(s, l)), r = n, i = a, u = o } var t, e, r, i, u; Ho.point = function (a, o) { Ho.point = n, r = (t = a) * Ka, i = Math.cos(o = (e = o) * Ka / 2 + Wa / 4), u = Math.sin(o) }, Ho.lineEnd = function () { n(t, e) } } function jt(n) { var t = n[0], e = n[1], r = Math.cos(e); return[r * Math.cos(t), r * Math.sin(t), Math.sin(e)] } function Lt(n, t) { return n[0] * t[0] + n[1] * t[1] + n[2] * t[2] } function Ht(n, t) { return[n[1] * t[2] - n[2] * t[1], n[2] * t[0] - n[0] * t[2], n[0] * t[1] - n[1] * t[0]] } function Ft(n, t) { n[0] += t[0], n[1] += t[1], n[2] += t[2] } function Pt(n, t) { return[n[0] * t, n[1] * t, n[2] * t] } function Ot(n) { var t = Math.sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]); n[0] /= t, n[1] /= t, n[2] /= t } function Rt(n) { return[Math.atan2(n[1], n[0]), R(n[2])] } function Yt(n, t) { return Math.abs(n[0] - t[0]) < Ja && Math.abs(n[1] - t[1]) < Ja } function Ut(n, t) { n *= Ka; var e = Math.cos(t *= Ka); It(e * Math.cos(n), e * Math.sin(n), Math.sin(t)) } function It(n, t, e) { ++Fo, Oo += (n - Oo) / Fo, Ro += (t - Ro) / Fo, Yo += (e - Yo) / Fo } function Vt() { function n(n, i) { n *= Ka; var u = Math.cos(i *= Ka), a = u * Math.cos(n), o = u * Math.sin(n), c = Math.sin(i), l = Math.atan2(Math.sqrt((l = e * c - r * o) * l + (l = r * a - t * c) * l + (l = t * o - e * a) * l), t * a + e * o + r * c); Po += l, Uo += l * (t + (t = a)), Io += l * (e + (e = o)), Vo += l * (r + (r = c)), It(t, e, r) } var t, e, r; $o.point = function (i, u) { i *= Ka; var a = Math.cos(u *= Ka); t = a * Math.cos(i), e = a * Math.sin(i), r = Math.sin(u), $o.point = n, It(t, e, r) } } function Zt() { $o.point = Ut } function Xt() { function n(n, t) { n *= Ka; var e = Math.cos(t *= Ka), a = e * Math.cos(n), o = e * Math.sin(n), c = Math.sin(t), l = i * c - u * o, s = u * a - r * c, f = r * o - i * a, h = Math.sqrt(l * l + s * s + f * f), g = r * a + i * o + u * c, p = h && -O(g) / h, m = Math.atan2(h, g); Zo += p * l, Xo += p * s, Bo += p * f, Po += m, Uo += m * (r + (r = a)), Io += m * (i + (i = o)), Vo += m * (u + (u = c)), It(r, i, u) } var t, e, r, i, u; $o.point = function (a, o) { t = a, e = o, $o.point = n, a *= Ka; var c = Math.cos(o *= Ka); r = c * Math.cos(a), i = c * Math.sin(a), u = Math.sin(o), It(r, i, u) }, $o.lineEnd = function () { n(t, e), $o.lineEnd = Zt, $o.point = Ut } } function Bt() { return!0 } function $t(n, t, e, r, i) { var u = [], a = []; if (n.forEach(function (n) { if (!((t = n.length - 1) <= 0)) { var t, e = n[0], r = n[t]; if (Yt(e, r)) { i.lineStart(); for (var o = 0; t > o; ++o)i.point((e = n[o])[0], e[1]); return i.lineEnd(), void 0 } var c = {point: e, points: n, other: null, visited: !1, entry: !0, subject: !0}, l = {point: e, points: [e], other: c, visited: !1, entry: !1, subject: !1}; c.other = l, u.push(c), a.push(l), c = {point: r, points: [r], other: null, visited: !1, entry: !1, subject: !0}, l = {point: r, points: [r], other: c, visited: !1, entry: !0, subject: !1}, c.other = l, u.push(c), a.push(l) } }), a.sort(t), Wt(u), Wt(a), u.length) { if (e)for (var o = 1, c = !e(a[0].point), l = a.length; l > o; ++o)a[o].entry = c = !c; for (var s, f, h, g = u[0]; ;) { for (s = g; s.visited;)if ((s = s.next) === g)return; f = s.points, i.lineStart(); do { if (s.visited = s.other.visited = !0, s.entry) { if (s.subject)for (var o = 0; o < f.length; o++)i.point((h = f[o])[0], h[1]); else r(s.point, s.next.point, 1, i); s = s.next } else { if (s.subject) { f = s.prev.points; for (var o = f.length; --o >= 0;)i.point((h = f[o])[0], h[1]) } else r(s.point, s.prev.point, -1, i); s = s.prev } s = s.other, f = s.points } while (!s.visited); i.lineEnd() } } } function Wt(n) { if (t = n.length) { for (var t, e, r = 0, i = n[0]; ++r < t;)i.next = e = n[r], e.prev = i, i = e; i.next = e = n[0], e.prev = i } } function Jt(n, t, e, r) { return function (i) { function u(t, e) { n(t, e) && i.point(t, e) } function a(n, t) { m.point(n, t) } function o() { d.point = a, m.lineStart() } function c() { d.point = u, m.lineEnd() } function l(n, t) { y.point(n, t), p.push([n, t]) } function s() { y.lineStart(), p = [] } function f() { l(p[0][0], p[0][1]), y.lineEnd(); var n, t = y.clean(), e = v.buffer(), r = e.length; if (p.pop(), g.push(p), p = null, r) { if (1 & t) { n = e[0]; var u, r = n.length - 1, a = -1; for (i.lineStart(); ++a < r;)i.point((u = n[a])[0], u[1]); return i.lineEnd(), void 0 } r > 1 && 2 & t && e.push(e.pop().concat(e.shift())), h.push(e.filter(Gt)) } } var h, g, p, m = t(i), d = {point: u, lineStart: o, lineEnd: c, polygonStart: function () { d.point = l, d.lineStart = s, d.lineEnd = f, h = [], g = [], i.polygonStart() }, polygonEnd: function () { d.point = u, d.lineStart = o, d.lineEnd = c, h = Ma.merge(h), h.length ? $t(h, Qt, null, e, i) : r(g) && (i.lineStart(), e(null, null, 1, i), i.lineEnd()), i.polygonEnd(), h = g = null }, sphere: function () { i.polygonStart(), i.lineStart(), e(null, null, 1, i), i.lineEnd(), i.polygonEnd() }}, v = Kt(), y = t(v); return d } } function Gt(n) { return n.length > 1 } function Kt() { var n, t = []; return{lineStart: function () { t.push(n = []) }, point: function (t, e) { n.push([t, e]) }, lineEnd: s, buffer: function () { var e = t; return t = [], n = null, e }, rejoin: function () { t.length > 1 && t.push(t.pop().concat(t.shift())) }} } function Qt(n, t) { return((n = n.point)[0] < 0 ? n[1] - Wa / 2 - Ja : Wa / 2 - n[1]) - ((t = t.point)[0] < 0 ? t[1] - Wa / 2 - Ja : Wa / 2 - t[1]) } function ne(n, t) { var e = n[0], r = n[1], i = [Math.sin(e), -Math.cos(e), 0], u = 0, a = !1, o = !1, c = 0; Lo.reset(); for (var l = 0, s = t.length; s > l; ++l) { var f = t[l], h = f.length; if (h) { for (var g = f[0], p = g[0], m = g[1] / 2 + Wa / 4, d = Math.sin(m), v = Math.cos(m), y = 1; ;) { y === h && (y = 0), n = f[y]; var M = n[0], x = n[1] / 2 + Wa / 4, b = Math.sin(x), _ = Math.cos(x), w = M - p, S = Math.abs(w) > Wa, E = d * b; if (Lo.add(Math.atan2(E * Math.sin(w), v * _ + E * Math.cos(w))), Math.abs(x) < Ja && (o = !0), u += S ? w + (w >= 0 ? 2 : -2) * Wa : w, S ^ p >= e ^ M >= e) { var k = Ht(jt(g), jt(n)); Ot(k); var A = Ht(i, k); Ot(A); var N = (S ^ w >= 0 ? -1 : 1) * R(A[2]); r > N && (c += S ^ w >= 0 ? 1 : -1) } if (!y++)break; p = M, d = b, v = _, g = n } Math.abs(u) > Ja && (a = !0) } } return(!o && !a && 0 > Lo || -Ja > u) ^ 1 & c } function te(n) { var t, e = 0 / 0, r = 0 / 0, i = 0 / 0; return{lineStart: function () { n.lineStart(), t = 1 }, point: function (u, a) { var o = u > 0 ? Wa : -Wa, c = Math.abs(u - e); Math.abs(c - Wa) < Ja ? (n.point(e, r = (r + a) / 2 > 0 ? Wa / 2 : -Wa / 2), n.point(i, r), n.lineEnd(), n.lineStart(), n.point(o, r), n.point(u, r), t = 0) : i !== o && c >= Wa && (Math.abs(e - i) < Ja && (e -= i * Ja), Math.abs(u - o) < Ja && (u -= o * Ja), r = ee(e, r, u, a), n.point(i, r), n.lineEnd(), n.lineStart(), n.point(o, r), t = 0), n.point(e = u, r = a), i = o }, lineEnd: function () { n.lineEnd(), e = r = 0 / 0 }, clean: function () { return 2 - t }} } function ee(n, t, e, r) { var i, u, a = Math.sin(n - e); return Math.abs(a) > Ja ? Math.atan((Math.sin(t) * (u = Math.cos(r)) * Math.sin(e) - Math.sin(r) * (i = Math.cos(t)) * Math.sin(n)) / (i * u * a)) : (t + r) / 2 } function re(n, t, e, r) { var i; if (null == n)i = e * Wa / 2, r.point(-Wa, i), r.point(0, i), r.point(Wa, i), r.point(Wa, 0), r.point(Wa, -i), r.point(0, -i), r.point(-Wa, -i), r.point(-Wa, 0), r.point(-Wa, i); else if (Math.abs(n[0] - t[0]) > Ja) { var u = (n[0] < t[0] ? 1 : -1) * Wa; i = e * u / 2, r.point(-u, i), r.point(0, i), r.point(u, i) } else r.point(t[0], t[1]) } function ie(n) { return ne(Jo, n) } function ue(n) { function t(n, t) { return Math.cos(n) * Math.cos(t) > a } function e(n) { var e, u, a, c, s; return{lineStart: function () { c = a = !1, s = 1 }, point: function (f, h) { var g, p = [f, h], m = t(f, h), d = o ? m ? 0 : i(f, h) : m ? i(f + (0 > f ? Wa : -Wa), h) : 0; if (!e && (c = a = m) && n.lineStart(), m !== a && (g = r(e, p), (Yt(e, g) || Yt(p, g)) && (p[0] += Ja, p[1] += Ja, m = t(p[0], p[1]))), m !== a)s = 0, m ? (n.lineStart(), g = r(p, e), n.point(g[0], g[1])) : (g = r(e, p), n.point(g[0], g[1]), n.lineEnd()), e = g; else if (l && e && o ^ m) { var v; d & u || !(v = r(p, e, !0)) || (s = 0, o ? (n.lineStart(), n.point(v[0][0], v[0][1]), n.point(v[1][0], v[1][1]), n.lineEnd()) : (n.point(v[1][0], v[1][1]), n.lineEnd(), n.lineStart(), n.point(v[0][0], v[0][1]))) } !m || e && Yt(e, p) || n.point(p[0], p[1]), e = p, a = m, u = d }, lineEnd: function () { a && n.lineEnd(), e = null }, clean: function () { return s | (c && a) << 1 }} } function r(n, t, e) { var r = jt(n), i = jt(t), u = [1, 0, 0], o = Ht(r, i), c = Lt(o, o), l = o[0], s = c - l * l; if (!s)return!e && n; var f = a * c / s, h = -a * l / s, g = Ht(u, o), p = Pt(u, f), m = Pt(o, h); Ft(p, m); var d = g, v = Lt(p, d), y = Lt(d, d), M = v * v - y * (Lt(p, p) - 1); if (!(0 > M)) { var x = Math.sqrt(M), b = Pt(d, (-v - x) / y); if (Ft(b, p), b = Rt(b), !e)return b; var _, w = n[0], S = t[0], E = n[1], k = t[1]; w > S && (_ = w, w = S, S = _); var A = S - w, N = Math.abs(A - Wa) < Ja, T = N || Ja > A; if (!N && E > k && (_ = E, E = k, k = _), T ? N ? E + k > 0 ^ b[1] < (Math.abs(b[0] - w) < Ja ? E : k) : E <= b[1] && b[1] <= k : A > Wa ^ (w <= b[0] && b[0] <= S)) { var q = Pt(d, (-v + x) / y); return Ft(q, p), [b, Rt(q)] } } } function i(t, e) { var r = o ? n : Wa - n, i = 0; return-r > t ? i |= 1 : t > r && (i |= 2), -r > e ? i |= 4 : e > r && (i |= 8), i } function u(n) { return ne(c, n) } var a = Math.cos(n), o = a > 0, c = [n, 0], l = Math.abs(a) > Ja, s = qe(n, 6 * Ka); return Jt(t, e, s, u) } function ae(n, t, e, r) { function i(r, i) { return Math.abs(r[0] - n) < Ja ? i > 0 ? 0 : 3 : Math.abs(r[0] - e) < Ja ? i > 0 ? 2 : 1 : Math.abs(r[1] - t) < Ja ? i > 0 ? 1 : 0 : i > 0 ? 3 : 2 } function u(n, t) { return a(n.point, t.point) } function a(n, t) { var e = i(n, 1), r = i(t, 1); return e !== r ? e - r : 0 === e ? t[1] - n[1] : 1 === e ? n[0] - t[0] : 2 === e ? n[1] - t[1] : t[0] - n[0] } function o(i, u) { var a = u[0] - i[0], o = u[1] - i[1], c = [0, 1]; return Math.abs(a) < Ja && Math.abs(o) < Ja ? n <= i[0] && i[0] <= e && t <= i[1] && i[1] <= r : oe(n - i[0], a, c) && oe(i[0] - e, -a, c) && oe(t - i[1], o, c) && oe(i[1] - r, -o, c) ? (c[1] < 1 && (u[0] = i[0] + c[1] * a, u[1] = i[1] + c[1] * o), c[0] > 0 && (i[0] += c[0] * a, i[1] += c[0] * o), !0) : !1 } return function (c) { function l(u) { var a = i(u, -1), o = s([0 === a || 3 === a ? n : e, a > 1 ? r : t]); return o } function s(n) { for (var t = 0, e = M.length, r = n[1], i = 0; e > i; ++i)for (var u, a = 1, o = M[i], c = o.length, l = o[0]; c > a; ++a)u = o[a], l[1] <= r ? u[1] > r && f(l, u, n) > 0 && ++t : u[1] <= r && f(l, u, n) < 0 && --t, l = u; return 0 !== t } function f(n, t, e) { return(t[0] - n[0]) * (e[1] - n[1]) - (e[0] - n[0]) * (t[1] - n[1]) } function h(u, o, c, l) { var s = 0, f = 0; if (null == u || (s = i(u, c)) !== (f = i(o, c)) || a(u, o) < 0 ^ c > 0) { do l.point(0 === s || 3 === s ? n : e, s > 1 ? r : t); while ((s = (s + c + 4) % 4) !== f) } else l.point(o[0], o[1]) } function g(i, u) { return i >= n && e >= i && u >= t && r >= u } function p(n, t) { g(n, t) && c.point(n, t) } function m() { q.point = v, M && M.push(x = []), A = !0, k = !1, S = E = 0 / 0 } function d() { y && (v(b, _), w && k && T.rejoin(), y.push(T.buffer())), q.point = p, k && c.lineEnd() } function v(n, t) { n = Math.max(-Go, Math.min(Go, n)), t = Math.max(-Go, Math.min(Go, t)); var e = g(n, t); if (M && x.push([n, t]), A)b = n, _ = t, w = e, A = !1, e && (c.lineStart(), c.point(n, t)); else if (e && k)c.point(n, t); else { var r = [S, E], i = [n, t]; o(r, i) ? (k || (c.lineStart(), c.point(r[0], r[1])), c.point(i[0], i[1]), e || c.lineEnd()) : e && (c.lineStart(), c.point(n, t)) } S = n, E = t, k = e } var y, M, x, b, _, w, S, E, k, A, N = c, T = Kt(), q = {point: p, lineStart: m, lineEnd: d, polygonStart: function () { c = T, y = [], M = [] }, polygonEnd: function () { c = N, (y = Ma.merge(y)).length ? (c.polygonStart(), $t(y, u, l, h, c), c.polygonEnd()) : s([n, t]) && (c.polygonStart(), c.lineStart(), h(null, null, 1, c), c.lineEnd(), c.polygonEnd()), y = M = x = null }}; return q } } function oe(n, t, e) { if (Math.abs(t) < Ja)return 0 >= n; var r = n / t; if (t > 0) { if (r > e[1])return!1; r > e[0] && (e[0] = r) } else { if (r < e[0])return!1; r < e[1] && (e[1] = r) } return!0 } function ce(n, t) { function e(e, r) { return e = n(e, r), t(e[0], e[1]) } return n.invert && t.invert && (e.invert = function (e, r) { return e = t.invert(e, r), e && n.invert(e[0], e[1]) }), e } function le(n) { var t = 0, e = Wa / 3, r = we(n), i = r(t, e); return i.parallels = function (n) { return arguments.length ? r(t = n[0] * Wa / 180, e = n[1] * Wa / 180) : [180 * (t / Wa), 180 * (e / Wa)] }, i } function se(n, t) { function e(n, t) { var e = Math.sqrt(u - 2 * i * Math.sin(t)) / i; return[e * Math.sin(n *= i), a - e * Math.cos(n)] } var r = Math.sin(n), i = (r + Math.sin(t)) / 2, u = 1 + r * (2 * i - r), a = Math.sqrt(u) / i; return e.invert = function (n, t) { var e = a - t; return[Math.atan2(n, e) / i, R((u - (n * n + e * e) * i * i) / (2 * i))] }, e } function fe() { function n(n, t) { Qo += i * n - r * t, r = n, i = t } var t, e, r, i; ic.point = function (u, a) { ic.point = n, t = r = u, e = i = a }, ic.lineEnd = function () { n(t, e) } } function he(n, t) { nc > n && (nc = n), n > ec && (ec = n), tc > t && (tc = t), t > rc && (rc = t) } function ge() { function n(n, t) { a.push("M", n, ",", t, u) } function t(n, t) { a.push("M", n, ",", t), o.point = e } function e(n, t) { a.push("L", n, ",", t) } function r() { o.point = n } function i() { a.push("Z") } var u = pe(4.5), a = [], o = {point: n, lineStart: function () { o.point = t }, lineEnd: r, polygonStart: function () { o.lineEnd = i }, polygonEnd: function () { o.lineEnd = r, o.point = n }, pointRadius: function (n) { return u = pe(n), o }, result: function () { if (a.length) { var n = a.join(""); return a = [], n } }}; return o } function pe(n) { return"m0," + n + "a" + n + "," + n + " 0 1,1 0," + -2 * n + "a" + n + "," + n + " 0 1,1 0," + 2 * n + "z" } function me(n, t) { Oo += n, Ro += t, ++Yo } function de() { function n(n, r) { var i = n - t, u = r - e, a = Math.sqrt(i * i + u * u); Uo += a * (t + n) / 2, Io += a * (e + r) / 2, Vo += a, me(t = n, e = r) } var t, e; ac.point = function (r, i) { ac.point = n, me(t = r, e = i) } } function ve() { ac.point = me } function ye() { function n(n, t) { var e = n - r, u = t - i, a = Math.sqrt(e * e + u * u); Uo += a * (r + n) / 2, Io += a * (i + t) / 2, Vo += a, a = i * n - r * t, Zo += a * (r + n), Xo += a * (i + t), Bo += 3 * a, me(r = n, i = t) } var t, e, r, i; ac.point = function (u, a) { ac.point = n, me(t = r = u, e = i = a) }, ac.lineEnd = function () { n(t, e) } } function Me(n) { function t(t, e) { n.moveTo(t, e), n.arc(t, e, a, 0, 2 * Wa) } function e(t, e) { n.moveTo(t, e), o.point = r } function r(t, e) { n.lineTo(t, e) } function i() { o.point = t } function u() { n.closePath() } var a = 4.5, o = {point: t, lineStart: function () { o.point = e }, lineEnd: i, polygonStart: function () { o.lineEnd = u }, polygonEnd: function () { o.lineEnd = i, o.point = t }, pointRadius: function (n) { return a = n, o }, result: s}; return o } function xe(n) { function t(t) { function r(e, r) { e = n(e, r), t.point(e[0], e[1]) } function i() { M = 0 / 0, S.point = a, t.lineStart() } function a(r, i) { var a = jt([r, i]), o = n(r, i); e(M, x, y, b, _, w, M = o[0], x = o[1], y = r, b = a[0], _ = a[1], w = a[2], u, t), t.point(M, x) } function o() { S.point = r, t.lineEnd() } function c() { i(), S.point = l, S.lineEnd = s } function l(n, t) { a(f = n, h = t), g = M, p = x, m = b, d = _, v = w, S.point = a } function s() { e(M, x, y, b, _, w, g, p, f, m, d, v, u, t), S.lineEnd = o, o() } var f, h, g, p, m, d, v, y, M, x, b, _, w, S = {point: r, lineStart: i, lineEnd: o, polygonStart: function () { t.polygonStart(), S.lineStart = c }, polygonEnd: function () { t.polygonEnd(), S.lineStart = i }}; return S } function e(t, u, a, o, c, l, s, f, h, g, p, m, d, v) { var y = s - t, M = f - u, x = y * y + M * M; if (x > 4 * r && d--) { var b = o + g, _ = c + p, w = l + m, S = Math.sqrt(b * b + _ * _ + w * w), E = Math.asin(w /= S), k = Math.abs(Math.abs(w) - 1) < Ja ? (a + h) / 2 : Math.atan2(_, b), A = n(k, E), N = A[0], T = A[1], q = N - t, z = T - u, C = M * q - y * z; (C * C / x > r || Math.abs((y * q + M * z) / x - .5) > .3 || i > o * g + c * p + l * m) && (e(t, u, a, o, c, l, N, T, k, b /= S, _ /= S, w, d, v), v.point(N, T), e(N, T, k, b, _, w, s, f, h, g, p, m, d, v)) } } var r = .5, i = Math.cos(30 * Ka), u = 16; return t.precision = function (n) { return arguments.length ? (u = (r = n * n) > 0 && 16, t) : Math.sqrt(r) }, t } function be(n) { var t = xe(function (t, e) { return n([t * Qa, e * Qa]) }); return function (n) { return Ct(n = t(n), function (t, e) { n.point(t * Ka, e * Ka) }) } } function _e(n) { return we(function () { return n })() } function we(n) { function t(n) { return n = o(n[0] * Ka, n[1] * Ka), [n[0] * h + c, l - n[1] * h] } function e(n) { return n = o.invert((n[0] - c) / h, (l - n[1]) / h), n && [n[0] * Qa, n[1] * Qa] } function r() { o = ce(a = ke(v, y, M), u); var n = u(m, d); return c = g - n[0] * h, l = p + n[1] * h, i() } function i() { return s && (s.valid = !1, s = null), t } var u, a, o, c, l, s, f = xe(function (n, t) { return n = u(n, t), [n[0] * h + c, l - n[1] * h] }), h = 150, g = 480, p = 250, m = 0, d = 0, v = 0, y = 0, M = 0, x = Wo, b = dt, _ = null, w = null; return t.stream = function (n) { return s && (s.valid = !1), s = Se(a, x(f(b(n)))), s.valid = !0, s }, t.clipAngle = function (n) { return arguments.length ? (x = null == n ? (_ = n, Wo) : ue((_ = +n) * Ka), i()) : _ }, t.clipExtent = function (n) { return arguments.length ? (w = n, b = n ? ae(n[0][0], n[0][1], n[1][0], n[1][1]) : dt, i()) : w }, t.scale = function (n) { return arguments.length ? (h = +n, r()) : h }, t.translate = function (n) { return arguments.length ? (g = +n[0], p = +n[1], r()) : [g, p] }, t.center = function (n) { return arguments.length ? (m = n[0] % 360 * Ka, d = n[1] % 360 * Ka, r()) : [m * Qa, d * Qa] }, t.rotate = function (n) { return arguments.length ? (v = n[0] % 360 * Ka, y = n[1] % 360 * Ka, M = n.length > 2 ? n[2] % 360 * Ka : 0, r()) : [v * Qa, y * Qa, M * Qa] }, Ma.rebind(t, f, "precision"), function () { return u = n.apply(this, arguments), t.invert = u.invert && e, r() } } function Se(n, t) { return Ct(t, function (e, r) { r = n(e * Ka, r * Ka), e = r[0], t.point(e > Wa ? e - 2 * Wa : -Wa > e ? e + 2 * Wa : e, r[1]) }) } function Ee(n, t) { return[n, t] } function ke(n, t, e) { return n ? t || e ? ce(Ne(n), Te(t, e)) : Ne(n) : t || e ? Te(t, e) : Ee } function Ae(n) { return function (t, e) { return t += n, [t > Wa ? t - 2 * Wa : -Wa > t ? t + 2 * Wa : t, e] } } function Ne(n) { var t = Ae(n); return t.invert = Ae(-n), t } function Te(n, t) { function e(n, t) { var e = Math.cos(t), o = Math.cos(n) * e, c = Math.sin(n) * e, l = Math.sin(t), s = l * r + o * i; return[Math.atan2(c * u - s * a, o * r - l * i), R(s * u + c * a)] } var r = Math.cos(n), i = Math.sin(n), u = Math.cos(t), a = Math.sin(t); return e.invert = function (n, t) { var e = Math.cos(t), o = Math.cos(n) * e, c = Math.sin(n) * e, l = Math.sin(t), s = l * u - c * a; return[Math.atan2(c * u + l * a, o * r + s * i), R(s * r - o * i)] }, e } function qe(n, t) { var e = Math.cos(n), r = Math.sin(n); return function (i, u, a, o) { null != i ? (i = ze(e, i), u = ze(e, u), (a > 0 ? u > i : i > u) && (i += 2 * a * Wa)) : (i = n + 2 * a * Wa, u = n); for (var c, l = a * t, s = i; a > 0 ? s > u : u > s; s -= l)o.point((c = Rt([e, -r * Math.cos(s), -r * Math.sin(s)]))[0], c[1]) } } function ze(n, t) { var e = jt(t); e[0] -= n, Ot(e); var r = O(-e[1]); return((-e[2] < 0 ? -r : r) + 2 * Math.PI - Ja) % (2 * Math.PI) } function Ce(n, t, e) { var r = Ma.range(n, t - Ja, e).concat(t); return function (n) { return r.map(function (t) { return[n, t] }) } } function De(n, t, e) { var r = Ma.range(n, t - Ja, e).concat(t); return function (n) { return r.map(function (t) { return[t, n] }) } } function je(n) { return n.source } function Le(n) { return n.target } function He(n, t, e, r) { var i = Math.cos(t), u = Math.sin(t), a = Math.cos(r), o = Math.sin(r), c = i * Math.cos(n), l = i * Math.sin(n), s = a * Math.cos(e), f = a * Math.sin(e), h = 2 * Math.asin(Math.sqrt(V(r - t) + i * a * V(e - n))), g = 1 / Math.sin(h), p = h ? function (n) { var t = Math.sin(n *= h) * g, e = Math.sin(h - n) * g, r = e * c + t * s, i = e * l + t * f, a = e * u + t * o; return[Math.atan2(i, r) * Qa, Math.atan2(a, Math.sqrt(r * r + i * i)) * Qa] } : function () { return[n * Qa, t * Qa] }; return p.distance = h, p } function Fe() { function n(n, i) { var u = Math.sin(i *= Ka), a = Math.cos(i), o = Math.abs((n *= Ka) - t), c = Math.cos(o); oc += Math.atan2(Math.sqrt((o = a * Math.sin(o)) * o + (o = r * u - e * a * c) * o), e * u + r * a * c), t = n, e = u, r = a } var t, e, r; cc.point = function (i, u) { t = i * Ka, e = Math.sin(u *= Ka), r = Math.cos(u), cc.point = n }, cc.lineEnd = function () { cc.point = cc.lineEnd = s } } function Pe(n, t) { function e(t, e) { var r = Math.cos(t), i = Math.cos(e), u = n(r * i); return[u * i * Math.sin(t), u * Math.sin(e)] } return e.invert = function (n, e) { var r = Math.sqrt(n * n + e * e), i = t(r), u = Math.sin(i), a = Math.cos(i); return[Math.atan2(n * u, r * a), Math.asin(r && e * u / r)] }, e } function Oe(n, t) { function e(n, t) { var e = Math.abs(Math.abs(t) - Wa / 2) < Ja ? 0 : a / Math.pow(i(t), u); return[e * Math.sin(u * n), a - e * Math.cos(u * n)] } var r = Math.cos(n), i = function (n) { return Math.tan(Wa / 4 + n / 2) }, u = n === t ? Math.sin(n) : Math.log(r / Math.cos(t)) / Math.log(i(t) / i(n)), a = r * Math.pow(i(n), u) / u; return u ? (e.invert = function (n, t) { var e = a - t, r = P(u) * Math.sqrt(n * n + e * e); return[Math.atan2(n, e) / u, 2 * Math.atan(Math.pow(a / r, 1 / u)) - Wa / 2] }, e) : Ye } function Re(n, t) { function e(n, t) { var e = u - t; return[e * Math.sin(i * n), u - e * Math.cos(i * n)] } var r = Math.cos(n), i = n === t ? Math.sin(n) : (r - Math.cos(t)) / (t - n), u = r / i + n; return Math.abs(i) < Ja ? Ee : (e.invert = function (n, t) { var e = u - t; return[Math.atan2(n, e) / i, u - P(i) * Math.sqrt(n * n + e * e)] }, e) } function Ye(n, t) { return[n, Math.log(Math.tan(Wa / 4 + t / 2))] } function Ue(n) { var t, e = _e(n), r = e.scale, i = e.translate, u = e.clipExtent; return e.scale = function () { var n = r.apply(e, arguments); return n === e ? t ? e.clipExtent(null) : e : n }, e.translate = function () { var n = i.apply(e, arguments); return n === e ? t ? e.clipExtent(null) : e : n }, e.clipExtent = function (n) { var a = u.apply(e, arguments); if (a === e) { if (t = null == n) { var o = Wa * r(), c = i(); u([ [c[0] - o, c[1] - o], [c[0] + o, c[1] + o] ]) } } else t && (a = null); return a }, e.clipExtent(null) } function Ie(n, t) { var e = Math.cos(t) * Math.sin(n); return[Math.log((1 + e) / (1 - e)) / 2, Math.atan2(Math.tan(t), Math.cos(n))] } function Ve(n) { function t(t) { function a() { l.push("M", u(n(s), o)) } for (var c, l = [], s = [], f = -1, h = t.length, g = mt(e), p = mt(r); ++f < h;)i.call(this, c = t[f], f) ? s.push([+g.call(this, c, f), +p.call(this, c, f)]) : s.length && (a(), s = []); return s.length && a(), l.length ? l.join("") : null } var e = Ze, r = Xe, i = Bt, u = Be, a = u.key, o = .7; return t.x = function (n) { return arguments.length ? (e = n, t) : e }, t.y = function (n) { return arguments.length ? (r = n, t) : r }, t.defined = function (n) { return arguments.length ? (i = n, t) : i }, t.interpolate = function (n) { return arguments.length ? (a = "function" == typeof n ? u = n : (u = pc.get(n) || Be).key, t) : a }, t.tension = function (n) { return arguments.length ? (o = n, t) : o }, t } function Ze(n) { return n[0] } function Xe(n) { return n[1] } function Be(n) { return n.join("L") } function $e(n) { return Be(n) + "Z" } function We(n) { for (var t = 0, e = n.length, r = n[0], i = [r[0], ",", r[1]]; ++t < e;)i.push("H", (r[0] + (r = n[t])[0]) / 2, "V", r[1]);