From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id yWHlCinUJmDXGAAA0tVLHw (envelope-from ) for ; Fri, 12 Feb 2021 19:16:57 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 0PEyBinUJmD/GQAAbx9fmQ (envelope-from ) for ; Fri, 12 Feb 2021 19:16:57 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AB8CF2D702 for ; Fri, 12 Feb 2021 20:16:54 +0100 (CET) Received: from localhost ([::1]:39548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAd1w-0006qs-5a for larch@yhetil.org; Fri, 12 Feb 2021 13:19:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAcz5-0005Gj-Dy for bug-guix@gnu.org; Fri, 12 Feb 2021 13:16:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:49626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lAcz5-0002FD-1b for bug-guix@gnu.org; Fri, 12 Feb 2021 13:16:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lAcz4-0007nP-Qk for bug-guix@gnu.org; Fri, 12 Feb 2021 13:16:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#46456: [core-updates] d3.v5.js source checksum changed Resent-From: Leo Famulari Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 12 Feb 2021 18:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46456 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Danny Milosavljevic Received: via spool by 46456-submit@debbugs.gnu.org id=B46456.161315370329866 (code B ref 46456); Fri, 12 Feb 2021 18:16:02 +0000 Received: (at 46456) by debbugs.gnu.org; 12 Feb 2021 18:15:03 +0000 Received: from localhost ([127.0.0.1]:32935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAcy7-0007le-MR for submit@debbugs.gnu.org; Fri, 12 Feb 2021 13:15:03 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:60545) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAcy6-0007kn-C3 for 46456@debbugs.gnu.org; Fri, 12 Feb 2021 13:15:02 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 52EB95C019B; Fri, 12 Feb 2021 13:14:57 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 12 Feb 2021 13:14:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=famulari.name; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=mesmtp; bh=/wPYSHu+JUj1o5MiaXbRO00C 7DY+vJkSA8w2+42RRYk=; b=mcH7TFDb5SswUQE/ciQdVPra9lBlhRuAMNSUqRxX b+ic9KRn23b/Ng67oAfkhsRMs789vEc/NquW1IoDjIzS7KmH7KSy4xbjj54VpINz 0wkDkzB1hL/JX5ddVCSxtuZ3KoZmC4SyB+k5VPEXnkYiPC1PG/4ZNJD+cXIdlX3q BzA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=/wPYSH u+JUj1o5MiaXbRO00C7DY+vJkSA8w2+42RRYk=; b=LK0vaZEvW7BQIcRfRZCEpM lbp+VlAJm0PgtpSgwi0qllzlG5+OiKCVUgsMGWZabN02Xz1ROzFuViSSX2Zd6xbc wjgFpeLJTp3CdL4oR9G9VIQ0EOHBOCIj88Cqu4IR1+g5PnGPIlDgCcrcWNbxWJ5m SAnGHCauwGyyPn0vC5NlsOqU6gnPCv/dF8djKiTNTzhtmy425YHd9wbPp4/w5ZT2 wTv/kcVyqGWitYiAoq0dNdS1wYCiR0gbXclPkf/VDsOU7PzLvSWcqQO7Kp9/Wbh2 wBmyE8t/STj+Dlre8F+YBT59OU2y891kcB6zTh8uozgN0BwFIHeknlxyfstihpGA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledriedugdduudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefnvghoucfh rghmuhhlrghrihcuoehlvghosehfrghmuhhlrghrihdrnhgrmhgvqeenucggtffrrghtth gvrhhnpeetvedtffdtgfeuieelhefguefgleefjeevgfeivdefheelleffhfeftdeggfel teenucffohhmrghinhepugefjhhsrdhorhhgnecukfhppedutddtrdduuddrudeiledrud dukeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehl vghosehfrghmuhhlrghrihdrnhgrmhgv X-ME-Proxy: Received: from localhost (pool-100-11-169-118.phlapa.fios.verizon.net [100.11.169.118]) by mail.messagingengine.com (Postfix) with ESMTPA id EF86424005A; Fri, 12 Feb 2021 13:14:55 -0500 (EST) Date: Fri, 12 Feb 2021 13:14:54 -0500 From: Leo Famulari Message-ID: References: <20210212045315.3f4e0a82@scratchpost.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Ax9lNzlugw8JBjpt" Content-Disposition: inline In-Reply-To: <20210212045315.3f4e0a82@scratchpost.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 46456@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 4.14 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=famulari.name header.s=mesmtp header.b=mcH7TFDb; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b=LK0vaZEv; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: AB8CF2D702 X-Spam-Score: 4.14 X-Migadu-Scanner: scn1.migadu.com X-TUID: LzK3oLgJP7ht --Ax9lNzlugw8JBjpt Content-Type: multipart/mixed; boundary="kLqR5wKUBEbm+NQl" Content-Disposition: inline --kLqR5wKUBEbm+NQl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Feb 12, 2021 at 04:53:15AM +0100, Danny Milosavljevic wrote: > Starting download of /gnu/store/bf496ni94ik19gdxkgp0vddkfxbid2vf-d3.v5.js > From https://d3js.org/d3.v5.js... > downloading from https://d3js.org/d3.v5.js ... > d3.v5.js 2.22GiB/s 00:00 | 504KiB transferred > sha256 hash mismatch for /gnu/store/bf496ni94ik19gdxkgp0vddkfxbid2vf-d3.v5.js: > expected hash: 0kxvx5pfagxn6nhavdwsdnzyd26g0z5dsfi1pi5dvcmb0c8ipcdn Attached. --kLqR5wKUBEbm+NQl Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="bf496ni94ik19gdxkgp0vddkfxbid2vf-d3.v5.js" Content-Transfer-Encoding: quoted-printable // https://d3js.org v5.9.7 Copyright 2019 Mike Bostock (function (global, factory) { typeof exports =3D=3D=3D 'object' && typeof module !=3D=3D 'undefined' ? fa= ctory(exports) : typeof define =3D=3D=3D 'function' && define.amd ? define(['exports'], fact= ory) : (factory((global.d3 =3D global.d3 || {}))); }(this, (function (exports) { 'use strict'; var version =3D "5.9.7"; function ascending(a, b) { return a < b ? -1 : a > b ? 1 : a >=3D b ? 0 : NaN; } function bisector(compare) { if (compare.length =3D=3D=3D 1) compare =3D ascendingComparator(compare); return { left: function(a, x, lo, hi) { if (lo =3D=3D null) lo =3D 0; if (hi =3D=3D null) hi =3D a.length; while (lo < hi) { var mid =3D lo + hi >>> 1; if (compare(a[mid], x) < 0) lo =3D mid + 1; else hi =3D mid; } return lo; }, right: function(a, x, lo, hi) { if (lo =3D=3D null) lo =3D 0; if (hi =3D=3D null) hi =3D a.length; while (lo < hi) { var mid =3D lo + hi >>> 1; if (compare(a[mid], x) > 0) hi =3D mid; else lo =3D mid + 1; } return lo; } }; } function ascendingComparator(f) { return function(d, x) { return ascending(f(d), x); }; } var ascendingBisect =3D bisector(ascending); var bisectRight =3D ascendingBisect.right; var bisectLeft =3D ascendingBisect.left; function pairs(array, f) { if (f =3D=3D null) f =3D pair; var i =3D 0, n =3D array.length - 1, p =3D array[0], pairs =3D new Array(= n < 0 ? 0 : n); while (i < n) pairs[i] =3D f(p, p =3D array[++i]); return pairs; } function pair(a, b) { return [a, b]; } function cross(values0, values1, reduce) { var n0 =3D values0.length, n1 =3D values1.length, values =3D new Array(n0 * n1), i0, i1, i, value0; if (reduce =3D=3D null) reduce =3D pair; for (i0 =3D i =3D 0; i0 < n0; ++i0) { for (value0 =3D values0[i0], i1 =3D 0; i1 < n1; ++i1, ++i) { values[i] =3D reduce(value0, values1[i1]); } } return values; } function descending(a, b) { return b < a ? -1 : b > a ? 1 : b >=3D a ? 0 : NaN; } function number(x) { return x =3D=3D=3D null ? NaN : +x; } function variance(values, valueof) { var n =3D values.length, m =3D 0, i =3D -1, mean =3D 0, value, delta, sum =3D 0; if (valueof =3D=3D null) { while (++i < n) { if (!isNaN(value =3D number(values[i]))) { delta =3D value - mean; mean +=3D delta / ++m; sum +=3D delta * (value - mean); } } } else { while (++i < n) { if (!isNaN(value =3D number(valueof(values[i], i, values)))) { delta =3D value - mean; mean +=3D delta / ++m; sum +=3D delta * (value - mean); } } } if (m > 1) return sum / (m - 1); } function deviation(array, f) { var v =3D variance(array, f); return v ? Math.sqrt(v) : v; } function extent(values, valueof) { var n =3D values.length, i =3D -1, value, min, max; if (valueof =3D=3D null) { while (++i < n) { // Find the first comparable value. if ((value =3D values[i]) !=3D null && value >=3D value) { min =3D max =3D value; while (++i < n) { // Compare the remaining values. if ((value =3D values[i]) !=3D null) { if (min > value) min =3D value; if (max < value) max =3D value; } } } } } else { while (++i < n) { // Find the first comparable value. if ((value =3D valueof(values[i], i, values)) !=3D null && value >=3D= value) { min =3D max =3D value; while (++i < n) { // Compare the remaining values. if ((value =3D valueof(values[i], i, values)) !=3D null) { if (min > value) min =3D value; if (max < value) max =3D value; } } } } } return [min, max]; } var array =3D Array.prototype; var slice =3D array.slice; var map =3D array.map; function constant(x) { return function() { return x; }; } function identity(x) { return x; } function sequence(start, stop, step) { start =3D +start, stop =3D +stop, step =3D (n =3D arguments.length) < 2 ?= (stop =3D start, start =3D 0, 1) : n < 3 ? 1 : +step; var i =3D -1, n =3D Math.max(0, Math.ceil((stop - start) / step)) | 0, range =3D new Array(n); while (++i < n) { range[i] =3D start + i * step; } return range; } var e10 =3D Math.sqrt(50), e5 =3D Math.sqrt(10), e2 =3D Math.sqrt(2); function ticks(start, stop, count) { var reverse, i =3D -1, n, ticks, step; stop =3D +stop, start =3D +start, count =3D +count; if (start =3D=3D=3D stop && count > 0) return [start]; if (reverse =3D stop < start) n =3D start, start =3D stop, stop =3D n; if ((step =3D tickIncrement(start, stop, count)) =3D=3D=3D 0 || !isFinite= (step)) return []; if (step > 0) { start =3D Math.ceil(start / step); stop =3D Math.floor(stop / step); ticks =3D new Array(n =3D Math.ceil(stop - start + 1)); while (++i < n) ticks[i] =3D (start + i) * step; } else { start =3D Math.floor(start * step); stop =3D Math.ceil(stop * step); ticks =3D new Array(n =3D Math.ceil(start - stop + 1)); while (++i < n) ticks[i] =3D (start - i) / step; } if (reverse) ticks.reverse(); return ticks; } function tickIncrement(start, stop, count) { var step =3D (stop - start) / Math.max(0, count), power =3D Math.floor(Math.log(step) / Math.LN10), error =3D step / Math.pow(10, power); return power >=3D 0 ? (error >=3D e10 ? 10 : error >=3D e5 ? 5 : error >=3D e2 ? 2 : 1) *= Math.pow(10, power) : -Math.pow(10, -power) / (error >=3D e10 ? 10 : error >=3D e5 ? 5 : = error >=3D e2 ? 2 : 1); } function tickStep(start, stop, count) { var step0 =3D Math.abs(stop - start) / Math.max(0, count), step1 =3D Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error =3D step0 / step1; if (error >=3D e10) step1 *=3D 10; else if (error >=3D e5) step1 *=3D 5; else if (error >=3D e2) step1 *=3D 2; return stop < start ? -step1 : step1; } function thresholdSturges(values) { return Math.ceil(Math.log(values.length) / Math.LN2) + 1; } function histogram() { var value =3D identity, domain =3D extent, threshold =3D thresholdSturges; function histogram(data) { var i, n =3D data.length, x, values =3D new Array(n); for (i =3D 0; i < n; ++i) { values[i] =3D value(data[i], i, data); } var xz =3D domain(values), x0 =3D xz[0], x1 =3D xz[1], tz =3D threshold(values, x0, x1); // Convert number of thresholds into uniform thresholds. if (!Array.isArray(tz)) { tz =3D tickStep(x0, x1, tz); tz =3D sequence(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive } // Remove any thresholds outside the domain. var m =3D tz.length; while (tz[0] <=3D x0) tz.shift(), --m; while (tz[m - 1] > x1) tz.pop(), --m; var bins =3D new Array(m + 1), bin; // Initialize bins. for (i =3D 0; i <=3D m; ++i) { bin =3D bins[i] =3D []; bin.x0 =3D i > 0 ? tz[i - 1] : x0; bin.x1 =3D i < m ? tz[i] : x1; } // Assign data to bins by value, ignoring any outside the domain. for (i =3D 0; i < n; ++i) { x =3D values[i]; if (x0 <=3D x && x <=3D x1) { bins[bisectRight(tz, x, 0, m)].push(data[i]); } } return bins; } histogram.value =3D function(_) { return arguments.length ? (value =3D typeof _ =3D=3D=3D "function" ? _ = : constant(_), histogram) : value; }; histogram.domain =3D function(_) { return arguments.length ? (domain =3D typeof _ =3D=3D=3D "function" ? _= : constant([_[0], _[1]]), histogram) : domain; }; histogram.thresholds =3D function(_) { return arguments.length ? (threshold =3D typeof _ =3D=3D=3D "function" = ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) = : threshold; }; return histogram; } function threshold(values, p, valueof) { if (valueof =3D=3D null) valueof =3D number; if (!(n =3D values.length)) return; if ((p =3D +p) <=3D 0 || n < 2) return +valueof(values[0], 0, values); if (p >=3D 1) return +valueof(values[n - 1], n - 1, values); var n, i =3D (n - 1) * p, i0 =3D Math.floor(i), value0 =3D +valueof(values[i0], i0, values), value1 =3D +valueof(values[i0 + 1], i0 + 1, values); return value0 + (value1 - value0) * (i - i0); } function freedmanDiaconis(values, min, max) { values =3D map.call(values, number).sort(ascending); return Math.ceil((max - min) / (2 * (threshold(values, 0.75) - threshold(= values, 0.25)) * Math.pow(values.length, -1 / 3))); } function scott(values, min, max) { return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values= =2Elength, -1 / 3))); } function max(values, valueof) { var n =3D values.length, i =3D -1, value, max; if (valueof =3D=3D null) { while (++i < n) { // Find the first comparable value. if ((value =3D values[i]) !=3D null && value >=3D value) { max =3D value; while (++i < n) { // Compare the remaining values. if ((value =3D values[i]) !=3D null && value > max) { max =3D value; } } } } } else { while (++i < n) { // Find the first comparable value. if ((value =3D valueof(values[i], i, values)) !=3D null && value >=3D= value) { max =3D value; while (++i < n) { // Compare the remaining values. if ((value =3D valueof(values[i], i, values)) !=3D null && value = > max) { max =3D value; } } } } } return max; } function mean(values, valueof) { var n =3D values.length, m =3D n, i =3D -1, value, sum =3D 0; if (valueof =3D=3D null) { while (++i < n) { if (!isNaN(value =3D number(values[i]))) sum +=3D value; else --m; } } else { while (++i < n) { if (!isNaN(value =3D number(valueof(values[i], i, values)))) sum +=3D= value; else --m; } } if (m) return sum / m; } function median(values, valueof) { var n =3D values.length, i =3D -1, value, numbers =3D []; if (valueof =3D=3D null) { while (++i < n) { if (!isNaN(value =3D number(values[i]))) { numbers.push(value); } } } else { while (++i < n) { if (!isNaN(value =3D number(valueof(values[i], i, values)))) { numbers.push(value); } } } return threshold(numbers.sort(ascending), 0.5); } function merge(arrays) { var n =3D arrays.length, m, i =3D -1, j =3D 0, merged, array; while (++i < n) j +=3D arrays[i].length; merged =3D new Array(j); while (--n >=3D 0) { array =3D arrays[n]; m =3D array.length; while (--m >=3D 0) { merged[--j] =3D array[m]; } } return merged; } function min(values, valueof) { var n =3D values.length, i =3D -1, value, min; if (valueof =3D=3D null) { while (++i < n) { // Find the first comparable value. if ((value =3D values[i]) !=3D null && value >=3D value) { min =3D value; while (++i < n) { // Compare the remaining values. if ((value =3D values[i]) !=3D null && min > value) { min =3D value; } } } } } else { while (++i < n) { // Find the first comparable value. if ((value =3D valueof(values[i], i, values)) !=3D null && value >=3D= value) { min =3D value; while (++i < n) { // Compare the remaining values. if ((value =3D valueof(values[i], i, values)) !=3D null && min > = value) { min =3D value; } } } } } return min; } function permute(array, indexes) { var i =3D indexes.length, permutes =3D new Array(i); while (i--) permutes[i] =3D array[indexes[i]]; return permutes; } function scan(values, compare) { if (!(n =3D values.length)) return; var n, i =3D 0, j =3D 0, xi, xj =3D values[j]; if (compare =3D=3D null) compare =3D ascending; while (++i < n) { if (compare(xi =3D values[i], xj) < 0 || compare(xj, xj) !=3D=3D 0) { xj =3D xi, j =3D i; } } if (compare(xj, xj) =3D=3D=3D 0) return j; } function shuffle(array, i0, i1) { var m =3D (i1 =3D=3D null ? array.length : i1) - (i0 =3D i0 =3D=3D null ?= 0 : +i0), t, i; while (m) { i =3D Math.random() * m-- | 0; t =3D array[m + i0]; array[m + i0] =3D array[i + i0]; array[i + i0] =3D t; } return array; } function sum(values, valueof) { var n =3D values.length, i =3D -1, value, sum =3D 0; if (valueof =3D=3D null) { while (++i < n) { if (value =3D +values[i]) sum +=3D value; // Note: zero and null are = equivalent. } } else { while (++i < n) { if (value =3D +valueof(values[i], i, values)) sum +=3D value; } } return sum; } function transpose(matrix) { if (!(n =3D matrix.length)) return []; for (var i =3D -1, m =3D min(matrix, length), transpose =3D new Array(m);= ++i < m;) { for (var j =3D -1, n, row =3D transpose[i] =3D new Array(n); ++j < n;) { row[j] =3D matrix[j][i]; } } return transpose; } function length(d) { return d.length; } function zip() { return transpose(arguments); } var slice$1 =3D Array.prototype.slice; function identity$1(x) { return x; } var top =3D 1, right =3D 2, bottom =3D 3, left =3D 4, epsilon =3D 1e-6; function translateX(x) { return "translate(" + (x + 0.5) + ",0)"; } function translateY(y) { return "translate(0," + (y + 0.5) + ")"; } function number$1(scale) { return function(d) { return +scale(d); }; } function center(scale) { var offset =3D Math.max(0, scale.bandwidth() - 1) / 2; // Adjust for 0.5p= x offset. if (scale.round()) offset =3D Math.round(offset); return function(d) { return +scale(d) + offset; }; } function entering() { return !this.__axis; } function axis(orient, scale) { var tickArguments =3D [], tickValues =3D null, tickFormat =3D null, tickSizeInner =3D 6, tickSizeOuter =3D 6, tickPadding =3D 3, k =3D orient =3D=3D=3D top || orient =3D=3D=3D left ? -1 : 1, x =3D orient =3D=3D=3D left || orient =3D=3D=3D right ? "x" : "y", transform =3D orient =3D=3D=3D top || orient =3D=3D=3D bottom ? trans= lateX : translateY; function axis(context) { var values =3D tickValues =3D=3D null ? (scale.ticks ? scale.ticks.appl= y(scale, tickArguments) : scale.domain()) : tickValues, format =3D tickFormat =3D=3D null ? (scale.tickFormat ? scale.tickF= ormat.apply(scale, tickArguments) : identity$1) : tickFormat, spacing =3D Math.max(tickSizeInner, 0) + tickPadding, range =3D scale.range(), range0 =3D +range[0] + 0.5, range1 =3D +range[range.length - 1] + 0.5, position =3D (scale.bandwidth ? center : number$1)(scale.copy()), selection =3D context.selection ? context.selection() : context, path =3D selection.selectAll(".domain").data([null]), tick =3D selection.selectAll(".tick").data(values, scale).order(), tickExit =3D tick.exit(), tickEnter =3D tick.enter().append("g").attr("class", "tick"), line =3D tick.select("line"), text =3D tick.select("text"); path =3D path.merge(path.enter().insert("path", ".tick") .attr("class", "domain") .attr("stroke", "currentColor")); tick =3D tick.merge(tickEnter); line =3D line.merge(tickEnter.append("line") .attr("stroke", "currentColor") .attr(x + "2", k * tickSizeInner)); text =3D text.merge(tickEnter.append("text") .attr("fill", "currentColor") .attr(x, k * spacing) .attr("dy", orient =3D=3D=3D top ? "0em" : orient =3D=3D=3D bottom = ? "0.71em" : "0.32em")); if (context !=3D=3D selection) { path =3D path.transition(context); tick =3D tick.transition(context); line =3D line.transition(context); text =3D text.transition(context); tickExit =3D tickExit.transition(context) .attr("opacity", epsilon) .attr("transform", function(d) { return isFinite(d =3D position(d= )) ? transform(d) : this.getAttribute("transform"); }); tickEnter .attr("opacity", epsilon) .attr("transform", function(d) { var p =3D this.parentNode.__axis= ; return transform(p && isFinite(p =3D p(d)) ? p : position(d)); }); } tickExit.remove(); path .attr("d", orient =3D=3D=3D left || orient =3D=3D right ? (tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H0= =2E5V" + range1 + "H" + k * tickSizeOuter : "M0.5," + range0 + "V" + range1) : (tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V0= =2E5H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + ",0.5H" + range1= )); tick .attr("opacity", 1) .attr("transform", function(d) { return transform(position(d)); }); line .attr(x + "2", k * tickSizeInner); text .attr(x, k * spacing) .text(format); selection.filter(entering) .attr("fill", "none") .attr("font-size", 10) .attr("font-family", "sans-serif") .attr("text-anchor", orient =3D=3D=3D right ? "start" : orient =3D= =3D=3D left ? "end" : "middle"); selection .each(function() { this.__axis =3D position; }); } axis.scale =3D function(_) { return arguments.length ? (scale =3D _, axis) : scale; }; axis.ticks =3D function() { return tickArguments =3D slice$1.call(arguments), axis; }; axis.tickArguments =3D function(_) { return arguments.length ? (tickArguments =3D _ =3D=3D null ? [] : slice= $1.call(_), axis) : tickArguments.slice(); }; axis.tickValues =3D function(_) { return arguments.length ? (tickValues =3D _ =3D=3D null ? null : slice$= 1.call(_), axis) : tickValues && tickValues.slice(); }; axis.tickFormat =3D function(_) { return arguments.length ? (tickFormat =3D _, axis) : tickFormat; }; axis.tickSize =3D function(_) { return arguments.length ? (tickSizeInner =3D tickSizeOuter =3D +_, axis= ) : tickSizeInner; }; axis.tickSizeInner =3D function(_) { return arguments.length ? (tickSizeInner =3D +_, axis) : tickSizeInner; }; axis.tickSizeOuter =3D function(_) { return arguments.length ? (tickSizeOuter =3D +_, axis) : tickSizeOuter; }; axis.tickPadding =3D function(_) { return arguments.length ? (tickPadding =3D +_, axis) : tickPadding; }; return axis; } function axisTop(scale) { return axis(top, scale); } function axisRight(scale) { return axis(right, scale); } function axisBottom(scale) { return axis(bottom, scale); } function axisLeft(scale) { return axis(left, scale); } var noop =3D {value: function() {}}; function dispatch() { for (var i =3D 0, n =3D arguments.length, _ =3D {}, t; i < n; ++i) { if (!(t =3D arguments[i] + "") || (t in _)) throw new Error("illegal ty= pe: " + t); _[t] =3D []; } return new Dispatch(_); } function Dispatch(_) { this._ =3D _; } function parseTypenames(typenames, types) { return typenames.trim().split(/^|\s+/).map(function(t) { var name =3D "", i =3D t.indexOf("."); if (i >=3D 0) name =3D t.slice(i + 1), t =3D t.slice(0, i); if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t= ); return {type: t, name: name}; }); } Dispatch.prototype =3D dispatch.prototype =3D { constructor: Dispatch, on: function(typename, callback) { var _ =3D this._, T =3D parseTypenames(typename + "", _), t, i =3D -1, n =3D T.length; // If no callback was specified, return the callback of the given type = and name. if (arguments.length < 2) { while (++i < n) if ((t =3D (typename =3D T[i]).type) && (t =3D get(_[= t], typename.name))) return t; return; } // If a type was specified, set the callback for the given type and nam= e. // Otherwise, if a null callback was specified, remove callbacks of the= given name. if (callback !=3D null && typeof callback !=3D=3D "function") throw new= Error("invalid callback: " + callback); while (++i < n) { if (t =3D (typename =3D T[i]).type) _[t] =3D set(_[t], typename.name,= callback); else if (callback =3D=3D null) for (t in _) _[t] =3D set(_[t], typena= me.name, null); } return this; }, copy: function() { var copy =3D {}, _ =3D this._; for (var t in _) copy[t] =3D _[t].slice(); return new Dispatch(copy); }, call: function(type, that) { if ((n =3D arguments.length - 2) > 0) for (var args =3D new Array(n), i= =3D 0, n, t; i < n; ++i) args[i] =3D arguments[i + 2]; if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + ty= pe); for (t =3D this._[type], i =3D 0, n =3D t.length; i < n; ++i) t[i].valu= e.apply(that, args); }, apply: function(type, that, args) { if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + ty= pe); for (var t =3D this._[type], i =3D 0, n =3D t.length; i < n; ++i) t[i].= value.apply(that, args); } }; function get(type, name) { for (var i =3D 0, n =3D type.length, c; i < n; ++i) { if ((c =3D type[i]).name =3D=3D=3D name) { return c.value; } } } function set(type, name, callback) { for (var i =3D 0, n =3D type.length; i < n; ++i) { if (type[i].name =3D=3D=3D name) { type[i] =3D noop, type =3D type.slice(0, i).concat(type.slice(i + 1)); break; } } if (callback !=3D null) type.push({name: name, value: callback}); return type; } var xhtml =3D "http://www.w3.org/1999/xhtml"; var namespaces =3D { svg: "http://www.w3.org/2000/svg", xhtml: xhtml, xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace", xmlns: "http://www.w3.org/2000/xmlns/" }; function namespace(name) { var prefix =3D name +=3D "", i =3D prefix.indexOf(":"); if (i >=3D 0 && (prefix =3D name.slice(0, i)) !=3D=3D "xmlns") name =3D n= ame.slice(i + 1); return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], lo= cal: name} : name; } function creatorInherit(name) { return function() { var document =3D this.ownerDocument, uri =3D this.namespaceURI; return uri =3D=3D=3D xhtml && document.documentElement.namespaceURI =3D= =3D=3D xhtml ? document.createElement(name) : document.createElementNS(uri, name); }; } function creatorFixed(fullname) { return function() { return this.ownerDocument.createElementNS(fullname.space, fullname.loca= l); }; } function creator(name) { var fullname =3D namespace(name); return (fullname.local ? creatorFixed : creatorInherit)(fullname); } function none() {} function selector(selector) { return selector =3D=3D null ? none : function() { return this.querySelector(selector); }; } function selection_select(select) { if (typeof select !=3D=3D "function") select =3D selector(select); for (var groups =3D this._groups, m =3D groups.length, subgroups =3D new = Array(m), j =3D 0; j < m; ++j) { for (var group =3D groups[j], n =3D group.length, subgroup =3D subgroup= s[j] =3D new Array(n), node, subnode, i =3D 0; i < n; ++i) { if ((node =3D group[i]) && (subnode =3D select.call(node, node.__data= __, i, group))) { if ("__data__" in node) subnode.__data__ =3D node.__data__; subgroup[i] =3D subnode; } } } return new Selection(subgroups, this._parents); } function empty() { return []; } function selectorAll(selector) { return selector =3D=3D null ? empty : function() { return this.querySelectorAll(selector); }; } function selection_selectAll(select) { if (typeof select !=3D=3D "function") select =3D selectorAll(select); for (var groups =3D this._groups, m =3D groups.length, subgroups =3D [], = parents =3D [], j =3D 0; j < m; ++j) { for (var group =3D groups[j], n =3D group.length, node, i =3D 0; i < n;= ++i) { if (node =3D group[i]) { subgroups.push(select.call(node, node.__data__, i, group)); parents.push(node); } } } return new Selection(subgroups, parents); } function matcher(selector) { return function() { return this.matches(selector); }; } function selection_filter(match) { if (typeof match !=3D=3D "function") match =3D matcher(match); for (var groups =3D this._groups, m =3D groups.length, subgroups =3D new = Array(m), j =3D 0; j < m; ++j) { for (var group =3D groups[j], n =3D group.length, subgroup =3D subgroup= s[j] =3D [], node, i =3D 0; i < n; ++i) { if ((node =3D group[i]) && match.call(node, node.__data__, i, group))= { subgroup.push(node); } } } return new Selection(subgroups, this._parents); } function sparse(update) { return new Array(update.length); } function selection_enter() { return new Selection(this._enter || this._groups.map(sparse), this._paren= ts); } function EnterNode(parent, datum) { this.ownerDocument =3D parent.ownerDocument; this.namespaceURI =3D parent.namespaceURI; this._next =3D null; this._parent =3D parent; this.__data__ =3D datum; } EnterNode.prototype =3D { constructor: EnterNode, appendChild: function(child) { return this._parent.insertBefore(child, th= is._next); }, insertBefore: function(child, next) { return this._parent.insertBefore(ch= ild, next); }, querySelector: function(selector) { return this._parent.querySelector(sel= ector); }, querySelectorAll: function(selector) { return this._parent.querySelectorA= ll(selector); } }; function constant$1(x) { return function() { return x; }; } var keyPrefix =3D "$"; // Protect against keys like =E2=80=9C__proto__=E2= =80=9D. function bindIndex(parent, group, enter, update, exit, data) { var i =3D 0, node, groupLength =3D group.length, dataLength =3D data.length; // Put any non-null nodes that fit into update. // Put any null nodes into enter. // Put any remaining data into enter. for (; i < dataLength; ++i) { if (node =3D group[i]) { node.__data__ =3D data[i]; update[i] =3D node; } else { enter[i] =3D new EnterNode(parent, data[i]); } } // Put any non-null nodes that don=E2=80=99t fit into exit. for (; i < groupLength; ++i) { if (node =3D group[i]) { exit[i] =3D node; } } } function bindKey(parent, group, enter, update, exit, data, key) { var i, node, nodeByKeyValue =3D {}, groupLength =3D group.length, dataLength =3D data.length, keyValues =3D new Array(groupLength), keyValue; // Compute the key for each node. // If multiple nodes have the same key, the duplicates are added to exit. for (i =3D 0; i < groupLength; ++i) { if (node =3D group[i]) { keyValues[i] =3D keyValue =3D keyPrefix + key.call(node, node.__data_= _, i, group); if (keyValue in nodeByKeyValue) { exit[i] =3D node; } else { nodeByKeyValue[keyValue] =3D node; } } } // Compute the key for each datum. // If there a node associated with this key, join and add it to update. // If there is not (or the key is a duplicate), add it to enter. for (i =3D 0; i < dataLength; ++i) { keyValue =3D keyPrefix + key.call(parent, data[i], i, data); if (node =3D nodeByKeyValue[keyValue]) { update[i] =3D node; node.__data__ =3D data[i]; nodeByKeyValue[keyValue] =3D null; } else { enter[i] =3D new EnterNode(parent, data[i]); } } // Add any remaining nodes that were not bound to data to exit. for (i =3D 0; i < groupLength; ++i) { if ((node =3D group[i]) && (nodeByKeyValue[keyValues[i]] =3D=3D=3D node= )) { exit[i] =3D node; } } } function selection_data(value, key) { if (!value) { data =3D new Array(this.size()), j =3D -1; this.each(function(d) { data[++j] =3D d; }); return data; } var bind =3D key ? bindKey : bindIndex, parents =3D this._parents, groups =3D this._groups; if (typeof value !=3D=3D "function") value =3D constant$1(value); for (var m =3D groups.length, update =3D new Array(m), enter =3D new Arra= y(m), exit =3D new Array(m), j =3D 0; j < m; ++j) { var parent =3D parents[j], group =3D groups[j], groupLength =3D group.length, data =3D value.call(parent, parent && parent.__data__, j, parents), dataLength =3D data.length, enterGroup =3D enter[j] =3D new Array(dataLength), updateGroup =3D update[j] =3D new Array(dataLength), exitGroup =3D exit[j] =3D new Array(groupLength); bind(parent, group, enterGroup, updateGroup, exitGroup, data, key); // Now connect the enter nodes to their following update node, such that // appendChild can insert the materialized enter node before this node, // rather than at the end of the parent node. for (var i0 =3D 0, i1 =3D 0, previous, next; i0 < dataLength; ++i0) { if (previous =3D enterGroup[i0]) { if (i0 >=3D i1) i1 =3D i0 + 1; while (!(next =3D updateGroup[i1]) && ++i1 < dataLength); previous._next =3D next || null; } } } update =3D new Selection(update, parents); update._enter =3D enter; update._exit =3D exit; return update; } function selection_exit() { return new Selection(this._exit || this._groups.map(sparse), this._parent= s); } function selection_join(onenter, onupdate, onexit) { var enter =3D this.enter(), update =3D this, exit =3D this.exit(); enter =3D typeof onenter =3D=3D=3D "function" ? onenter(enter) : enter.ap= pend(onenter + ""); if (onupdate !=3D null) update =3D onupdate(update); if (onexit =3D=3D null) exit.remove(); else onexit(exit); return enter && update ? enter.merge(update).order() : update; } function selection_merge(selection$$1) { for (var groups0 =3D this._groups, groups1 =3D selection$$1._groups, m0 = =3D groups0.length, m1 =3D groups1.length, m =3D Math.min(m0, m1), merges = =3D new Array(m0), j =3D 0; j < m; ++j) { for (var group0 =3D groups0[j], group1 =3D groups1[j], n =3D group0.len= gth, merge =3D merges[j] =3D new Array(n), node, i =3D 0; i < n; ++i) { if (node =3D group0[i] || group1[i]) { merge[i] =3D node; } } } for (; j < m0; ++j) { merges[j] =3D groups0[j]; } return new Selection(merges, this._parents); } function selection_order() { for (var groups =3D this._groups, j =3D -1, m =3D groups.length; ++j < m;= ) { for (var group =3D groups[j], i =3D group.length - 1, next =3D group[i]= , node; --i >=3D 0;) { if (node =3D group[i]) { if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode= =2EinsertBefore(node, next); next =3D node; } } } return this; } function selection_sort(compare) { if (!compare) compare =3D ascending$1; function compareNode(a, b) { return a && b ? compare(a.__data__, b.__data__) : !a - !b; } for (var groups =3D this._groups, m =3D groups.length, sortgroups =3D new= Array(m), j =3D 0; j < m; ++j) { for (var group =3D groups[j], n =3D group.length, sortgroup =3D sortgro= ups[j] =3D new Array(n), node, i =3D 0; i < n; ++i) { if (node =3D group[i]) { sortgroup[i] =3D node; } } sortgroup.sort(compareNode); } return new Selection(sortgroups, this._parents).order(); } function ascending$1(a, b) { return a < b ? -1 : a > b ? 1 : a >=3D b ? 0 : NaN; } function selection_call() { var callback =3D arguments[0]; arguments[0] =3D this; callback.apply(null, arguments); return this; } function selection_nodes() { var nodes =3D new Array(this.size()), i =3D -1; this.each(function() { nodes[++i] =3D this; }); return nodes; } function selection_node() { for (var groups =3D this._groups, j =3D 0, m =3D groups.length; j < m; ++= j) { for (var group =3D groups[j], i =3D 0, n =3D group.length; i < n; ++i) { var node =3D group[i]; if (node) return node; } } return null; } function selection_size() { var size =3D 0; this.each(function() { ++size; }); return size; } function selection_empty() { return !this.node(); } function selection_each(callback) { for (var groups =3D this._groups, j =3D 0, m =3D groups.length; j < m; ++= j) { for (var group =3D groups[j], i =3D 0, n =3D group.length, node; i < n;= ++i) { if (node =3D group[i]) callback.call(node, node.__data__, i, group); } } return this; } function attrRemove(name) { return function() { this.removeAttribute(name); }; } function attrRemoveNS(fullname) { return function() { this.removeAttributeNS(fullname.space, fullname.local); }; } function attrConstant(name, value) { return function() { this.setAttribute(name, value); }; } function attrConstantNS(fullname, value) { return function() { this.setAttributeNS(fullname.space, fullname.local, value); }; } function attrFunction(name, value) { return function() { var v =3D value.apply(this, arguments); if (v =3D=3D null) this.removeAttribute(name); else this.setAttribute(name, v); }; } function attrFunctionNS(fullname, value) { return function() { var v =3D value.apply(this, arguments); if (v =3D=3D null) this.removeAttributeNS(fullname.space, fullname.loca= l); else this.setAttributeNS(fullname.space, fullname.local, v); }; } function selection_attr(name, value) { var fullname =3D namespace(name); if (arguments.length < 2) { var node =3D this.node(); return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname); } return this.each((value =3D=3D null ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value =3D=3D= =3D "function" ? (fullname.local ? attrFunctionNS : attrFunction) : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value)= ); } function defaultView(node) { return (node.ownerDocument && node.ownerDocument.defaultView) // node is = a Node || (node.document && node) // node is a Window || node.defaultView; // node is a Document } function styleRemove(name) { return function() { this.style.removeProperty(name); }; } function styleConstant(name, value, priority) { return function() { this.style.setProperty(name, value, priority); }; } function styleFunction(name, value, priority) { return function() { var v =3D value.apply(this, arguments); if (v =3D=3D null) this.style.removeProperty(name); else this.style.setProperty(name, v, priority); }; } function selection_style(name, value, priority) { return arguments.length > 1 ? this.each((value =3D=3D null ? styleRemove : typeof value =3D=3D=3D "function" ? styleFunction : styleConstant)(name, value, priority =3D=3D null ? "" : prior= ity)) : styleValue(this.node(), name); } function styleValue(node, name) { return node.style.getPropertyValue(name) || defaultView(node).getComputedStyle(node, null).getPropertyValue(na= me); } function propertyRemove(name) { return function() { delete this[name]; }; } function propertyConstant(name, value) { return function() { this[name] =3D value; }; } function propertyFunction(name, value) { return function() { var v =3D value.apply(this, arguments); if (v =3D=3D null) delete this[name]; else this[name] =3D v; }; } function selection_property(name, value) { return arguments.length > 1 ? this.each((value =3D=3D null ? propertyRemove : typeof value =3D=3D=3D "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name]; } function classArray(string) { return string.trim().split(/^|\s+/); } function classList(node) { return node.classList || new ClassList(node); } function ClassList(node) { this._node =3D node; this._names =3D classArray(node.getAttribute("class") || ""); } ClassList.prototype =3D { add: function(name) { var i =3D this._names.indexOf(name); if (i < 0) { this._names.push(name); this._node.setAttribute("class", this._names.join(" ")); } }, remove: function(name) { var i =3D this._names.indexOf(name); if (i >=3D 0) { this._names.splice(i, 1); this._node.setAttribute("class", this._names.join(" ")); } }, contains: function(name) { return this._names.indexOf(name) >=3D 0; } }; function classedAdd(node, names) { var list =3D classList(node), i =3D -1, n =3D names.length; while (++i < n) list.add(names[i]); } function classedRemove(node, names) { var list =3D classList(node), i =3D -1, n =3D names.length; while (++i < n) list.remove(names[i]); } function classedTrue(names) { return function() { classedAdd(this, names); }; } function classedFalse(names) { return function() { classedRemove(this, names); }; } function classedFunction(names, value) { return function() { (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names= ); }; } function selection_classed(name, value) { var names =3D classArray(name + ""); if (arguments.length < 2) { var list =3D classList(this.node()), i =3D -1, n =3D names.length; while (++i < n) if (!list.contains(names[i])) return false; return true; } return this.each((typeof value =3D=3D=3D "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value)); } function textRemove() { this.textContent =3D ""; } function textConstant(value) { return function() { this.textContent =3D value; }; } function textFunction(value) { return function() { var v =3D value.apply(this, arguments); this.textContent =3D v =3D=3D null ? "" : v; }; } function selection_text(value) { return arguments.length ? this.each(value =3D=3D null ? textRemove : (typeof value =3D=3D=3D "function" ? textFunction : textConstant)(value)) : this.node().textContent; } function htmlRemove() { this.innerHTML =3D ""; } function htmlConstant(value) { return function() { this.innerHTML =3D value; }; } function htmlFunction(value) { return function() { var v =3D value.apply(this, arguments); this.innerHTML =3D v =3D=3D null ? "" : v; }; } function selection_html(value) { return arguments.length ? this.each(value =3D=3D null ? htmlRemove : (typeof value =3D=3D=3D "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML; } function raise() { if (this.nextSibling) this.parentNode.appendChild(this); } function selection_raise() { return this.each(raise); } function lower() { if (this.previousSibling) this.parentNode.insertBefore(this, this.parentN= ode.firstChild); } function selection_lower() { return this.each(lower); } function selection_append(name) { var create =3D typeof name =3D=3D=3D "function" ? name : creator(name); return this.select(function() { return this.appendChild(create.apply(this, arguments)); }); } function constantNull() { return null; } function selection_insert(name, before) { var create =3D typeof name =3D=3D=3D "function" ? name : creator(name), select =3D before =3D=3D null ? constantNull : typeof before =3D=3D= =3D "function" ? before : selector(before); return this.select(function() { return this.insertBefore(create.apply(this, arguments), select.apply(th= is, arguments) || null); }); } function remove() { var parent =3D this.parentNode; if (parent) parent.removeChild(this); } function selection_remove() { return this.each(remove); } function selection_cloneShallow() { return this.parentNode.insertBefore(this.cloneNode(false), this.nextSibli= ng); } function selection_cloneDeep() { return this.parentNode.insertBefore(this.cloneNode(true), this.nextSiblin= g); } function selection_clone(deep) { return this.select(deep ? selection_cloneDeep : selection_cloneShallow); } function selection_datum(value) { return arguments.length ? this.property("__data__", value) : this.node().__data__; } var filterEvents =3D {}; exports.event =3D null; if (typeof document !=3D=3D "undefined") { var element =3D document.documentElement; if (!("onmouseenter" in element)) { filterEvents =3D {mouseenter: "mouseover", mouseleave: "mouseout"}; } } function filterContextListener(listener, index, group) { listener =3D contextListener(listener, index, group); return function(event) { var related =3D event.relatedTarget; if (!related || (related !=3D=3D this && !(related.compareDocumentPosit= ion(this) & 8))) { listener.call(this, event); } }; } function contextListener(listener, index, group) { return function(event1) { var event0 =3D exports.event; // Events can be reentrant (e.g., focus). exports.event =3D event1; try { listener.call(this, this.__data__, index, group); } finally { exports.event =3D event0; } }; } function parseTypenames$1(typenames) { return typenames.trim().split(/^|\s+/).map(function(t) { var name =3D "", i =3D t.indexOf("."); if (i >=3D 0) name =3D t.slice(i + 1), t =3D t.slice(0, i); return {type: t, name: name}; }); } function onRemove(typename) { return function() { var on =3D this.__on; if (!on) return; for (var j =3D 0, i =3D -1, m =3D on.length, o; j < m; ++j) { if (o =3D on[j], (!typename.type || o.type =3D=3D=3D typename.type) &= & o.name =3D=3D=3D typename.name) { this.removeEventListener(o.type, o.listener, o.capture); } else { on[++i] =3D o; } } if (++i) on.length =3D i; else delete this.__on; }; } function onAdd(typename, value, capture) { var wrap =3D filterEvents.hasOwnProperty(typename.type) ? filterContextLi= stener : contextListener; return function(d, i, group) { var on =3D this.__on, o, listener =3D wrap(value, i, group); if (on) for (var j =3D 0, m =3D on.length; j < m; ++j) { if ((o =3D on[j]).type =3D=3D=3D typename.type && o.name =3D=3D=3D ty= pename.name) { this.removeEventListener(o.type, o.listener, o.capture); this.addEventListener(o.type, o.listener =3D listener, o.capture = =3D capture); o.value =3D value; return; } } this.addEventListener(typename.type, listener, capture); o =3D {type: typename.type, name: typename.name, value: value, listener= : listener, capture: capture}; if (!on) this.__on =3D [o]; else on.push(o); }; } function selection_on(typename, value, capture) { var typenames =3D parseTypenames$1(typename + ""), i, n =3D typenames.len= gth, t; if (arguments.length < 2) { var on =3D this.node().__on; if (on) for (var j =3D 0, m =3D on.length, o; j < m; ++j) { for (i =3D 0, o =3D on[j]; i < n; ++i) { if ((t =3D typenames[i]).type =3D=3D=3D o.type && t.name =3D=3D=3D = o.name) { return o.value; } } } return; } on =3D value ? onAdd : onRemove; if (capture =3D=3D null) capture =3D false; for (i =3D 0; i < n; ++i) this.each(on(typenames[i], value, capture)); return this; } function customEvent(event1, listener, that, args) { var event0 =3D exports.event; event1.sourceEvent =3D exports.event; exports.event =3D event1; try { return listener.apply(that, args); } finally { exports.event =3D event0; } } function dispatchEvent(node, type, params) { var window =3D defaultView(node), event =3D window.CustomEvent; if (typeof event =3D=3D=3D "function") { event =3D new event(type, params); } else { event =3D window.document.createEvent("Event"); if (params) event.initEvent(type, params.bubbles, params.cancelable), e= vent.detail =3D params.detail; else event.initEvent(type, false, false); } node.dispatchEvent(event); } function dispatchConstant(type, params) { return function() { return dispatchEvent(this, type, params); }; } function dispatchFunction(type, params) { return function() { return dispatchEvent(this, type, params.apply(this, arguments)); }; } function selection_dispatch(type, params) { return this.each((typeof params =3D=3D=3D "function" ? dispatchFunction : dispatchConstant)(type, params)); } var root =3D [null]; function Selection(groups, parents) { this._groups =3D groups; this._parents =3D parents; } function selection() { return new Selection([[document.documentElement]], root); } Selection.prototype =3D selection.prototype =3D { constructor: Selection, select: selection_select, selectAll: selection_selectAll, filter: selection_filter, data: selection_data, enter: selection_enter, exit: selection_exit, join: selection_join, merge: selection_merge, order: selection_order, sort: selection_sort, call: selection_call, nodes: selection_nodes, node: selection_node, size: selection_size, empty: selection_empty, each: selection_each, attr: selection_attr, style: selection_style, property: selection_property, classed: selection_classed, text: selection_text, html: selection_html, raise: selection_raise, lower: selection_lower, append: selection_append, insert: selection_insert, remove: selection_remove, clone: selection_clone, datum: selection_datum, on: selection_on, dispatch: selection_dispatch }; function select(selector) { return typeof selector =3D=3D=3D "string" ? new Selection([[document.querySelector(selector)]], [document.docum= entElement]) : new Selection([[selector]], root); } function create(name) { return select(creator(name).call(document.documentElement)); } var nextId =3D 0; function local() { return new Local; } function Local() { this._ =3D "@" + (++nextId).toString(36); } Local.prototype =3D local.prototype =3D { constructor: Local, get: function(node) { var id =3D this._; while (!(id in node)) if (!(node =3D node.parentNode)) return; return node[id]; }, set: function(node, value) { return node[this._] =3D value; }, remove: function(node) { return this._ in node && delete node[this._]; }, toString: function() { return this._; } }; function sourceEvent() { var current =3D exports.event, source; while (source =3D current.sourceEvent) current =3D source; return current; } function point(node, event) { var svg =3D node.ownerSVGElement || node; if (svg.createSVGPoint) { var point =3D svg.createSVGPoint(); point.x =3D event.clientX, point.y =3D event.clientY; point =3D point.matrixTransform(node.getScreenCTM().inverse()); return [point.x, point.y]; } var rect =3D node.getBoundingClientRect(); return [event.clientX - rect.left - node.clientLeft, event.clientY - rect= =2Etop - node.clientTop]; } function mouse(node) { var event =3D sourceEvent(); if (event.changedTouches) event =3D event.changedTouches[0]; return point(node, event); } function selectAll(selector) { return typeof selector =3D=3D=3D "string" ? new Selection([document.querySelectorAll(selector)], [document.docu= mentElement]) : new Selection([selector =3D=3D null ? [] : selector], root); } function touch(node, touches, identifier) { if (arguments.length < 3) identifier =3D touches, touches =3D sourceEvent= ().changedTouches; for (var i =3D 0, n =3D touches ? touches.length : 0, touch; i < n; ++i) { if ((touch =3D touches[i]).identifier =3D=3D=3D identifier) { return point(node, touch); } } return null; } function touches(node, touches) { if (touches =3D=3D null) touches =3D sourceEvent().touches; for (var i =3D 0, n =3D touches ? touches.length : 0, points =3D new Arra= y(n); i < n; ++i) { points[i] =3D point(node, touches[i]); } return points; } function nopropagation() { exports.event.stopImmediatePropagation(); } function noevent() { exports.event.preventDefault(); exports.event.stopImmediatePropagation(); } function dragDisable(view) { var root =3D view.document.documentElement, selection$$1 =3D select(view).on("dragstart.drag", noevent, true); if ("onselectstart" in root) { selection$$1.on("selectstart.drag", noevent, true); } else { root.__noselect =3D root.style.MozUserSelect; root.style.MozUserSelect =3D "none"; } } function yesdrag(view, noclick) { var root =3D view.document.documentElement, selection$$1 =3D select(view).on("dragstart.drag", null); if (noclick) { selection$$1.on("click.drag", noevent, true); setTimeout(function() { selection$$1.on("click.drag", null); }, 0); } if ("onselectstart" in root) { selection$$1.on("selectstart.drag", null); } else { root.style.MozUserSelect =3D root.__noselect; delete root.__noselect; } } function constant$2(x) { return function() { return x; }; } function DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatc= h) { this.target =3D target; this.type =3D type; this.subject =3D subject; this.identifier =3D id; this.active =3D active; this.x =3D x; this.y =3D y; this.dx =3D dx; this.dy =3D dy; this._ =3D dispatch; } DragEvent.prototype.on =3D function() { var value =3D this._.on.apply(this._, arguments); return value =3D=3D=3D this._ ? this : value; }; // Ignore right-click, since that should open the context menu. function defaultFilter() { return !exports.event.button; } function defaultContainer() { return this.parentNode; } function defaultSubject(d) { return d =3D=3D null ? {x: exports.event.x, y: exports.event.y} : d; } function defaultTouchable() { return "ontouchstart" in this; } function drag() { var filter =3D defaultFilter, container =3D defaultContainer, subject =3D defaultSubject, touchable =3D defaultTouchable, gestures =3D {}, listeners =3D dispatch("start", "drag", "end"), active =3D 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 =3D 0; function drag(selection$$1) { selection$$1 .on("mousedown.drag", mousedowned) .filter(touchable) .on("touchstart.drag", touchstarted) .on("touchmove.drag", touchmoved) .on("touchend.drag touchcancel.drag", touchended) .style("touch-action", "none") .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)"); } function mousedowned() { if (touchending || !filter.apply(this, arguments)) return; var gesture =3D beforestart("mouse", container.apply(this, arguments), = mouse, this, arguments); if (!gesture) return; select(exports.event.view).on("mousemove.drag", mousemoved, true).on("m= ouseup.drag", mouseupped, true); dragDisable(exports.event.view); nopropagation(); mousemoving =3D false; mousedownx =3D exports.event.clientX; mousedowny =3D exports.event.clientY; gesture("start"); } function mousemoved() { noevent(); if (!mousemoving) { var dx =3D exports.event.clientX - mousedownx, dy =3D exports.event.c= lientY - mousedowny; mousemoving =3D dx * dx + dy * dy > clickDistance2; } gestures.mouse("drag"); } function mouseupped() { select(exports.event.view).on("mousemove.drag mouseup.drag", null); yesdrag(exports.event.view, mousemoving); noevent(); gestures.mouse("end"); } function touchstarted() { if (!filter.apply(this, arguments)) return; var touches$$1 =3D exports.event.changedTouches, c =3D container.apply(this, arguments), n =3D touches$$1.length, i, gesture; for (i =3D 0; i < n; ++i) { if (gesture =3D beforestart(touches$$1[i].identifier, c, touch, this,= arguments)) { nopropagation(); gesture("start"); } } } function touchmoved() { var touches$$1 =3D exports.event.changedTouches, n =3D touches$$1.length, i, gesture; for (i =3D 0; i < n; ++i) { if (gesture =3D gestures[touches$$1[i].identifier]) { noevent(); gesture("drag"); } } } function touchended() { var touches$$1 =3D exports.event.changedTouches, n =3D touches$$1.length, i, gesture; if (touchending) clearTimeout(touchending); touchending =3D setTimeout(function() { touchending =3D null; }, 500); = // Ghost clicks are delayed! for (i =3D 0; i < n; ++i) { if (gesture =3D gestures[touches$$1[i].identifier]) { nopropagation(); gesture("end"); } } } function beforestart(id, container, point$$1, that, args) { var p =3D point$$1(container, id), s, dx, dy, sublisteners =3D listeners.copy(); if (!customEvent(new DragEvent(drag, "beforestart", s, id, active, p[0]= , p[1], 0, 0, sublisteners), function() { if ((exports.event.subject =3D s =3D subject.apply(that, args)) =3D= =3D null) return false; dx =3D s.x - p[0] || 0; dy =3D s.y - p[1] || 0; return true; })) return; return function gesture(type) { var p0 =3D p, n; switch (type) { case "start": gestures[id] =3D gesture, n =3D active++; break; case "end": delete gestures[id], --active; // nobreak case "drag": p =3D point$$1(container, id), n =3D active; break; } customEvent(new DragEvent(drag, type, s, id, n, p[0] + dx, p[1] + dy,= p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublistener= s, [type, that, args]); }; } drag.filter =3D function(_) { return arguments.length ? (filter =3D typeof _ =3D=3D=3D "function" ? _= : constant$2(!!_), drag) : filter; }; drag.container =3D function(_) { return arguments.length ? (container =3D typeof _ =3D=3D=3D "function" = ? _ : constant$2(_), drag) : container; }; drag.subject =3D function(_) { return arguments.length ? (subject =3D typeof _ =3D=3D=3D "function" ? = _ : constant$2(_), drag) : subject; }; drag.touchable =3D function(_) { return arguments.length ? (touchable =3D typeof _ =3D=3D=3D "function" = ? _ : constant$2(!!_), drag) : touchable; }; drag.on =3D function() { var value =3D listeners.on.apply(listeners, arguments); return value =3D=3D=3D listeners ? drag : value; }; drag.clickDistance =3D function(_) { return arguments.length ? (clickDistance2 =3D (_ =3D +_) * _, drag) : M= ath.sqrt(clickDistance2); }; return drag; } function define(constructor, factory, prototype) { constructor.prototype =3D factory.prototype =3D prototype; prototype.constructor =3D constructor; } function extend(parent, definition) { var prototype =3D Object.create(parent.prototype); for (var key in definition) prototype[key] =3D definition[key]; return prototype; } function Color() {} var darker =3D 0.7; var brighter =3D 1 / darker; var reI =3D "\\s*([+-]?\\d+)\\s*", reN =3D "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP =3D "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex3 =3D /^#([0-9a-f]{3})$/, reHex6 =3D /^#([0-9a-f]{6})$/, reRgbInteger =3D new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"), reRgbPercent =3D new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"), reRgbaInteger =3D new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"= ), reRgbaPercent =3D new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"= ), reHslPercent =3D new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"), reHslaPercent =3D new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$"= ); var named =3D { aliceblue: 0xf0f8ff, antiquewhite: 0xfaebd7, aqua: 0x00ffff, aquamarine: 0x7fffd4, azure: 0xf0ffff, beige: 0xf5f5dc, bisque: 0xffe4c4, black: 0x000000, blanchedalmond: 0xffebcd, blue: 0x0000ff, blueviolet: 0x8a2be2, brown: 0xa52a2a, burlywood: 0xdeb887, cadetblue: 0x5f9ea0, chartreuse: 0x7fff00, chocolate: 0xd2691e, coral: 0xff7f50, cornflowerblue: 0x6495ed, cornsilk: 0xfff8dc, crimson: 0xdc143c, cyan: 0x00ffff, darkblue: 0x00008b, darkcyan: 0x008b8b, darkgoldenrod: 0xb8860b, darkgray: 0xa9a9a9, darkgreen: 0x006400, darkgrey: 0xa9a9a9, darkkhaki: 0xbdb76b, darkmagenta: 0x8b008b, darkolivegreen: 0x556b2f, darkorange: 0xff8c00, darkorchid: 0x9932cc, darkred: 0x8b0000, darksalmon: 0xe9967a, darkseagreen: 0x8fbc8f, darkslateblue: 0x483d8b, darkslategray: 0x2f4f4f, darkslategrey: 0x2f4f4f, darkturquoise: 0x00ced1, darkviolet: 0x9400d3, deeppink: 0xff1493, deepskyblue: 0x00bfff, dimgray: 0x696969, dimgrey: 0x696969, dodgerblue: 0x1e90ff, firebrick: 0xb22222, floralwhite: 0xfffaf0, forestgreen: 0x228b22, fuchsia: 0xff00ff, gainsboro: 0xdcdcdc, ghostwhite: 0xf8f8ff, gold: 0xffd700, goldenrod: 0xdaa520, gray: 0x808080, green: 0x008000, greenyellow: 0xadff2f, grey: 0x808080, honeydew: 0xf0fff0, hotpink: 0xff69b4, indianred: 0xcd5c5c, indigo: 0x4b0082, ivory: 0xfffff0, khaki: 0xf0e68c, lavender: 0xe6e6fa, lavenderblush: 0xfff0f5, lawngreen: 0x7cfc00, lemonchiffon: 0xfffacd, lightblue: 0xadd8e6, lightcoral: 0xf08080, lightcyan: 0xe0ffff, lightgoldenrodyellow: 0xfafad2, lightgray: 0xd3d3d3, lightgreen: 0x90ee90, lightgrey: 0xd3d3d3, lightpink: 0xffb6c1, lightsalmon: 0xffa07a, lightseagreen: 0x20b2aa, lightskyblue: 0x87cefa, lightslategray: 0x778899, lightslategrey: 0x778899, lightsteelblue: 0xb0c4de, lightyellow: 0xffffe0, lime: 0x00ff00, limegreen: 0x32cd32, linen: 0xfaf0e6, magenta: 0xff00ff, maroon: 0x800000, mediumaquamarine: 0x66cdaa, mediumblue: 0x0000cd, mediumorchid: 0xba55d3, mediumpurple: 0x9370db, mediumseagreen: 0x3cb371, mediumslateblue: 0x7b68ee, mediumspringgreen: 0x00fa9a, mediumturquoise: 0x48d1cc, mediumvioletred: 0xc71585, midnightblue: 0x191970, mintcream: 0xf5fffa, mistyrose: 0xffe4e1, moccasin: 0xffe4b5, navajowhite: 0xffdead, navy: 0x000080, oldlace: 0xfdf5e6, olive: 0x808000, olivedrab: 0x6b8e23, orange: 0xffa500, orangered: 0xff4500, orchid: 0xda70d6, palegoldenrod: 0xeee8aa, palegreen: 0x98fb98, paleturquoise: 0xafeeee, palevioletred: 0xdb7093, papayawhip: 0xffefd5, peachpuff: 0xffdab9, peru: 0xcd853f, pink: 0xffc0cb, plum: 0xdda0dd, powderblue: 0xb0e0e6, purple: 0x800080, rebeccapurple: 0x663399, red: 0xff0000, rosybrown: 0xbc8f8f, royalblue: 0x4169e1, saddlebrown: 0x8b4513, salmon: 0xfa8072, sandybrown: 0xf4a460, seagreen: 0x2e8b57, seashell: 0xfff5ee, sienna: 0xa0522d, silver: 0xc0c0c0, skyblue: 0x87ceeb, slateblue: 0x6a5acd, slategray: 0x708090, slategrey: 0x708090, snow: 0xfffafa, springgreen: 0x00ff7f, steelblue: 0x4682b4, tan: 0xd2b48c, teal: 0x008080, thistle: 0xd8bfd8, tomato: 0xff6347, turquoise: 0x40e0d0, violet: 0xee82ee, wheat: 0xf5deb3, white: 0xffffff, whitesmoke: 0xf5f5f5, yellow: 0xffff00, yellowgreen: 0x9acd32 }; define(Color, color, { displayable: function() { return this.rgb().displayable(); }, hex: function() { return this.rgb().hex(); }, toString: function() { return this.rgb() + ""; } }); function color(format) { var m; format =3D (format + "").trim().toLowerCase(); return (m =3D reHex3.exec(format)) ? (m =3D parseInt(m[1], 16), new Rgb((= m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) <= < 4) | (m & 0xf), 1)) // #f00 : (m =3D reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000 : (m =3D reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) //= rgb(255, 0, 0) : (m =3D reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] = * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) : (m =3D reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) /= / rgba(255, 0, 0, 1) : (m =3D reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * = 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) : (m =3D reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 1= 00, 1) // hsl(120, 50%, 50%) : (m =3D reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / = 100, m[4]) // hsla(120, 50%, 50%, 1) : named.hasOwnProperty(format) ? rgbn(named[format]) : format =3D=3D=3D "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; } function rgbn(n) { return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); } function rgba(r, g, b, a) { if (a <=3D 0) r =3D g =3D b =3D NaN; return new Rgb(r, g, b, a); } function rgbConvert(o) { if (!(o instanceof Color)) o =3D color(o); if (!o) return new Rgb; o =3D o.rgb(); return new Rgb(o.r, o.g, o.b, o.opacity); } function rgb(r, g, b, opacity) { return arguments.length =3D=3D=3D 1 ? rgbConvert(r) : new Rgb(r, g, b, op= acity =3D=3D null ? 1 : opacity); } function Rgb(r, g, b, opacity) { this.r =3D +r; this.g =3D +g; this.b =3D +b; this.opacity =3D +opacity; } define(Rgb, rgb, extend(Color, { brighter: function(k) { k =3D k =3D=3D null ? brighter : Math.pow(brighter, k); return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); }, darker: function(k) { k =3D k =3D=3D null ? darker : Math.pow(darker, k); return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); }, rgb: function() { return this; }, displayable: function() { return (-0.5 <=3D this.r && this.r < 255.5) && (-0.5 <=3D this.g && this.g < 255.5) && (-0.5 <=3D this.b && this.b < 255.5) && (0 <=3D this.opacity && this.opacity <=3D 1); }, hex: function() { return "#" + hex(this.r) + hex(this.g) + hex(this.b); }, toString: function() { var a =3D this.opacity; a =3D isNaN(a) ? 1 : Math.max(0, Math.min(1, a)= ); return (a =3D=3D=3D 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a =3D=3D=3D 1 ? ")" : ", " + a + ")"); } })); function hex(value) { value =3D Math.max(0, Math.min(255, Math.round(value) || 0)); return (value < 16 ? "0" : "") + value.toString(16); } function hsla(h, s, l, a) { if (a <=3D 0) h =3D s =3D l =3D NaN; else if (l <=3D 0 || l >=3D 1) h =3D s =3D NaN; else if (s <=3D 0) h =3D NaN; return new Hsl(h, s, l, a); } function hslConvert(o) { if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); if (!(o instanceof Color)) o =3D color(o); if (!o) return new Hsl; if (o instanceof Hsl) return o; o =3D o.rgb(); var r =3D o.r / 255, g =3D o.g / 255, b =3D o.b / 255, min =3D Math.min(r, g, b), max =3D Math.max(r, g, b), h =3D NaN, s =3D max - min, l =3D (max + min) / 2; if (s) { if (r =3D=3D=3D max) h =3D (g - b) / s + (g < b) * 6; else if (g =3D=3D=3D max) h =3D (b - r) / s + 2; else h =3D (r - g) / s + 4; s /=3D l < 0.5 ? max + min : 2 - max - min; h *=3D 60; } else { s =3D l > 0 && l < 1 ? 0 : h; } return new Hsl(h, s, l, o.opacity); } function hsl(h, s, l, opacity) { return arguments.length =3D=3D=3D 1 ? hslConvert(h) : new Hsl(h, s, l, op= acity =3D=3D null ? 1 : opacity); } function Hsl(h, s, l, opacity) { this.h =3D +h; this.s =3D +s; this.l =3D +l; this.opacity =3D +opacity; } define(Hsl, hsl, extend(Color, { brighter: function(k) { k =3D k =3D=3D null ? brighter : Math.pow(brighter, k); return new Hsl(this.h, this.s, this.l * k, this.opacity); }, darker: function(k) { k =3D k =3D=3D null ? darker : Math.pow(darker, k); return new Hsl(this.h, this.s, this.l * k, this.opacity); }, rgb: function() { var h =3D this.h % 360 + (this.h < 0) * 360, s =3D isNaN(h) || isNaN(this.s) ? 0 : this.s, l =3D this.l, m2 =3D l + (l < 0.5 ? l : 1 - l) * s, m1 =3D 2 * l - m2; return new Rgb( hsl2rgb(h >=3D 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity ); }, displayable: function() { return (0 <=3D this.s && this.s <=3D 1 || isNaN(this.s)) && (0 <=3D this.l && this.l <=3D 1) && (0 <=3D this.opacity && this.opacity <=3D 1); } })); /* From FvD 13.37, CSS Color Module Level 3 */ function hsl2rgb(h, m1, m2) { return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255; } var deg2rad =3D Math.PI / 180; var rad2deg =3D 180 / Math.PI; // https://observablehq.com/@mbostock/lab-and-rgb var K =3D 18, Xn =3D 0.96422, Yn =3D 1, Zn =3D 0.82521, t0 =3D 4 / 29, t1 =3D 6 / 29, t2 =3D 3 * t1 * t1, t3 =3D t1 * t1 * t1; function labConvert(o) { if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); if (o instanceof Hcl) return hcl2lab(o); if (!(o instanceof Rgb)) o =3D rgbConvert(o); var r =3D rgb2lrgb(o.r), g =3D rgb2lrgb(o.g), b =3D rgb2lrgb(o.b), y =3D xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), = x, z; if (r =3D=3D=3D g && g =3D=3D=3D b) x =3D z =3D y; else { x =3D xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); z =3D xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn); } return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); } function gray(l, opacity) { return new Lab(l, 0, 0, opacity =3D=3D null ? 1 : opacity); } function lab(l, a, b, opacity) { return arguments.length =3D=3D=3D 1 ? labConvert(l) : new Lab(l, a, b, op= acity =3D=3D null ? 1 : opacity); } function Lab(l, a, b, opacity) { this.l =3D +l; this.a =3D +a; this.b =3D +b; this.opacity =3D +opacity; } define(Lab, lab, extend(Color, { brighter: function(k) { return new Lab(this.l + K * (k =3D=3D null ? 1 : k), this.a, this.b, th= is.opacity); }, darker: function(k) { return new Lab(this.l - K * (k =3D=3D null ? 1 : k), this.a, this.b, th= is.opacity); }, rgb: function() { var y =3D (this.l + 16) / 116, x =3D isNaN(this.a) ? y : y + this.a / 500, z =3D isNaN(this.b) ? y : y - this.b / 200; x =3D Xn * lab2xyz(x); y =3D Yn * lab2xyz(y); z =3D Zn * lab2xyz(z); return new Rgb( lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z), lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z), lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z), this.opacity ); } })); function xyz2lab(t) { return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; } function lab2xyz(t) { return t > t1 ? t * t * t : t2 * (t - t0); } function lrgb2rgb(x) { return 255 * (x <=3D 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4)= - 0.055); } function rgb2lrgb(x) { return (x /=3D 255) <=3D 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.0= 55, 2.4); } function hclConvert(o) { if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); if (!(o instanceof Lab)) o =3D labConvert(o); if (o.a =3D=3D=3D 0 && o.b =3D=3D=3D 0) return new Hcl(NaN, 0 < o.l && o.= l < 100 ? 0 : NaN, o.l, o.opacity); var h =3D Math.atan2(o.b, o.a) * rad2deg; return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l= , o.opacity); } function lch(l, c, h, opacity) { return arguments.length =3D=3D=3D 1 ? hclConvert(l) : new Hcl(h, c, l, op= acity =3D=3D null ? 1 : opacity); } function hcl(h, c, l, opacity) { return arguments.length =3D=3D=3D 1 ? hclConvert(h) : new Hcl(h, c, l, op= acity =3D=3D null ? 1 : opacity); } function Hcl(h, c, l, opacity) { this.h =3D +h; this.c =3D +c; this.l =3D +l; this.opacity =3D +opacity; } function hcl2lab(o) { if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); var h =3D o.h * deg2rad; return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); } define(Hcl, hcl, extend(Color, { brighter: function(k) { return new Hcl(this.h, this.c, this.l + K * (k =3D=3D null ? 1 : k), th= is.opacity); }, darker: function(k) { return new Hcl(this.h, this.c, this.l - K * (k =3D=3D null ? 1 : k), th= is.opacity); }, rgb: function() { return hcl2lab(this).rgb(); } })); var A =3D -0.14861, B =3D +1.78277, C =3D -0.29227, D =3D -0.90649, E =3D +1.97294, ED =3D E * D, EB =3D E * B, BC_DA =3D B * C - D * A; function cubehelixConvert(o) { if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity= ); if (!(o instanceof Rgb)) o =3D rgbConvert(o); var r =3D o.r / 255, g =3D o.g / 255, b =3D o.b / 255, l =3D (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl =3D b - l, k =3D (E * (g - l) - C * bl) / D, s =3D Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=3D0= or l=3D1 h =3D s ? Math.atan2(k, bl) * rad2deg - 120 : NaN; return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); } function cubehelix(h, s, l, opacity) { return arguments.length =3D=3D=3D 1 ? cubehelixConvert(h) : new Cubehelix= (h, s, l, opacity =3D=3D null ? 1 : opacity); } function Cubehelix(h, s, l, opacity) { this.h =3D +h; this.s =3D +s; this.l =3D +l; this.opacity =3D +opacity; } define(Cubehelix, cubehelix, extend(Color, { brighter: function(k) { k =3D k =3D=3D null ? brighter : Math.pow(brighter, k); return new Cubehelix(this.h, this.s, this.l * k, this.opacity); }, darker: function(k) { k =3D k =3D=3D null ? darker : Math.pow(darker, k); return new Cubehelix(this.h, this.s, this.l * k, this.opacity); }, rgb: function() { var h =3D isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, l =3D +this.l, a =3D isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh =3D Math.cos(h), sinh =3D Math.sin(h); return new Rgb( 255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity ); } })); function basis(t1, v0, v1, v2, v3) { var t2 =3D t1 * t1, t3 =3D t2 * t1; return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6; } function basis$1(values) { var n =3D values.length - 1; return function(t) { var i =3D t <=3D 0 ? (t =3D 0) : t >=3D 1 ? (t =3D 1, n - 1) : Math.flo= or(t * n), v1 =3D values[i], v2 =3D values[i + 1], v0 =3D i > 0 ? values[i - 1] : 2 * v1 - v2, v3 =3D i < n - 1 ? values[i + 2] : 2 * v2 - v1; return basis((t - i / n) * n, v0, v1, v2, v3); }; } function basisClosed(values) { var n =3D values.length; return function(t) { var i =3D Math.floor(((t %=3D 1) < 0 ? ++t : t) * n), v0 =3D values[(i + n - 1) % n], v1 =3D values[i % n], v2 =3D values[(i + 1) % n], v3 =3D values[(i + 2) % n]; return basis((t - i / n) * n, v0, v1, v2, v3); }; } function constant$3(x) { return function() { return x; }; } function linear(a, d) { return function(t) { return a + t * d; }; } function exponential(a, b, y) { return a =3D Math.pow(a, y), b =3D Math.pow(b, y) - a, y =3D 1 / y, funct= ion(t) { return Math.pow(a + t * b, y); }; } function hue(a, b) { var d =3D b - a; return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) = : d) : constant$3(isNaN(a) ? b : a); } function gamma(y) { return (y =3D +y) =3D=3D=3D 1 ? nogamma : function(a, b) { return b - a ? exponential(a, b, y) : constant$3(isNaN(a) ? b : a); }; } function nogamma(a, b) { var d =3D b - a; return d ? linear(a, d) : constant$3(isNaN(a) ? b : a); } var interpolateRgb =3D (function rgbGamma(y) { var color$$1 =3D gamma(y); function rgb$$1(start, end) { var r =3D color$$1((start =3D rgb(start)).r, (end =3D rgb(end)).r), g =3D color$$1(start.g, end.g), b =3D color$$1(start.b, end.b), opacity =3D nogamma(start.opacity, end.opacity); return function(t) { start.r =3D r(t); start.g =3D g(t); start.b =3D b(t); start.opacity =3D opacity(t); return start + ""; }; } rgb$$1.gamma =3D rgbGamma; return rgb$$1; })(1); function rgbSpline(spline) { return function(colors) { var n =3D colors.length, r =3D new Array(n), g =3D new Array(n), b =3D new Array(n), i, color$$1; for (i =3D 0; i < n; ++i) { color$$1 =3D rgb(colors[i]); r[i] =3D color$$1.r || 0; g[i] =3D color$$1.g || 0; b[i] =3D color$$1.b || 0; } r =3D spline(r); g =3D spline(g); b =3D spline(b); color$$1.opacity =3D 1; return function(t) { color$$1.r =3D r(t); color$$1.g =3D g(t); color$$1.b =3D b(t); return color$$1 + ""; }; }; } var rgbBasis =3D rgbSpline(basis$1); var rgbBasisClosed =3D rgbSpline(basisClosed); function array$1(a, b) { var nb =3D b ? b.length : 0, na =3D a ? Math.min(nb, a.length) : 0, x =3D new Array(na), c =3D new Array(nb), i; for (i =3D 0; i < na; ++i) x[i] =3D interpolateValue(a[i], b[i]); for (; i < nb; ++i) c[i] =3D b[i]; return function(t) { for (i =3D 0; i < na; ++i) c[i] =3D x[i](t); return c; }; } function date(a, b) { var d =3D new Date; return a =3D +a, b -=3D a, function(t) { return d.setTime(a + b * t), d; }; } function interpolateNumber(a, b) { return a =3D +a, b -=3D a, function(t) { return a + b * t; }; } function object(a, b) { var i =3D {}, c =3D {}, k; if (a =3D=3D=3D null || typeof a !=3D=3D "object") a =3D {}; if (b =3D=3D=3D null || typeof b !=3D=3D "object") b =3D {}; for (k in b) { if (k in a) { i[k] =3D interpolateValue(a[k], b[k]); } else { c[k] =3D b[k]; } } return function(t) { for (k in i) c[k] =3D i[k](t); return c; }; } var reA =3D /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB =3D new RegExp(reA.source, "g"); function zero(b) { return function() { return b; }; } function one(b) { return function(t) { return b(t) + ""; }; } function interpolateString(a, b) { var bi =3D reA.lastIndex =3D reB.lastIndex =3D 0, // scan index for next = number in b am, // current match in a bm, // current match in b bs, // string preceding current number in b, if any i =3D -1, // index in s s =3D [], // string constants and placeholders q =3D []; // number interpolators // Coerce inputs to strings. a =3D a + "", b =3D b + ""; // Interpolate pairs of numbers in a & b. while ((am =3D reA.exec(a)) && (bm =3D reB.exec(b))) { if ((bs =3D bm.index) > bi) { // a string precedes the next number in b bs =3D b.slice(bi, bs); if (s[i]) s[i] +=3D bs; // coalesce with previous string else s[++i] =3D bs; } if ((am =3D am[0]) =3D=3D=3D (bm =3D bm[0])) { // numbers in a & b match if (s[i]) s[i] +=3D bm; // coalesce with previous string else s[++i] =3D bm; } else { // interpolate non-matching numbers s[++i] =3D null; q.push({i: i, x: interpolateNumber(am, bm)}); } bi =3D reB.lastIndex; } // Add remains of b. if (bi < b.length) { bs =3D b.slice(bi); if (s[i]) s[i] +=3D bs; // coalesce with previous string else s[++i] =3D bs; } // Special optimization for only a single match. // Otherwise, interpolate each of the numbers and rejoin the string. return s.length < 2 ? (q[0] ? one(q[0].x) : zero(b)) : (b =3D q.length, function(t) { for (var i =3D 0, o; i < b; ++i) s[(o =3D q[i]).i] =3D o.x(t); return s.join(""); }); } function interpolateValue(a, b) { var t =3D typeof b, c; return b =3D=3D null || t =3D=3D=3D "boolean" ? constant$3(b) : (t =3D=3D=3D "number" ? interpolateNumber : t =3D=3D=3D "string" ? ((c =3D color(b)) ? (b =3D c, interpolateRgb= ) : interpolateString) : b instanceof color ? interpolateRgb : b instanceof Date ? date : Array.isArray(b) ? array$1 : typeof b.valueOf !=3D=3D "function" && typeof b.toString !=3D=3D "f= unction" || isNaN(b) ? object : interpolateNumber)(a, b); } function discrete(range) { var n =3D range.length; return function(t) { return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; }; } function hue$1(a, b) { var i =3D hue(+a, +b); return function(t) { var x =3D i(t); return x - 360 * Math.floor(x / 360); }; } function interpolateRound(a, b) { return a =3D +a, b -=3D a, function(t) { return Math.round(a + b * t); }; } var degrees =3D 180 / Math.PI; var identity$2 =3D { translateX: 0, translateY: 0, rotate: 0, skewX: 0, scaleX: 1, scaleY: 1 }; function decompose(a, b, c, d, e, f) { var scaleX, scaleY, skewX; if (scaleX =3D Math.sqrt(a * a + b * b)) a /=3D scaleX, b /=3D scaleX; if (skewX =3D a * c + b * d) c -=3D a * skewX, d -=3D b * skewX; if (scaleY =3D Math.sqrt(c * c + d * d)) c /=3D scaleY, d /=3D scaleY, sk= ewX /=3D scaleY; if (a * d < b * c) a =3D -a, b =3D -b, skewX =3D -skewX, scaleX =3D -scal= eX; return { translateX: e, translateY: f, rotate: Math.atan2(b, a) * degrees, skewX: Math.atan(skewX) * degrees, scaleX: scaleX, scaleY: scaleY }; } var cssNode, cssRoot, cssView, svgNode; function parseCss(value) { if (value =3D=3D=3D "none") return identity$2; if (!cssNode) cssNode =3D document.createElement("DIV"), cssRoot =3D docu= ment.documentElement, cssView =3D document.defaultView; cssNode.style.transform =3D value; value =3D cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).ge= tPropertyValue("transform"); cssRoot.removeChild(cssNode); value =3D value.slice(7, -1).split(","); return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], += value[5]); } function parseSvg(value) { if (value =3D=3D null) return identity$2; if (!svgNode) svgNode =3D document.createElementNS("http://www.w3.org/200= 0/svg", "g"); svgNode.setAttribute("transform", value); if (!(value =3D svgNode.transform.baseVal.consolidate())) return identity= $2; value =3D value.matrix; return decompose(value.a, value.b, value.c, value.d, value.e, value.f); } function interpolateTransform(parse, pxComma, pxParen, degParen) { function pop(s) { return s.length ? s.pop() + " " : ""; } function translate(xa, ya, xb, yb, s, q) { if (xa !=3D=3D xb || ya !=3D=3D yb) { var i =3D s.push("translate(", null, pxComma, null, pxParen); q.push({i: i - 4, x: interpolateNumber(xa, xb)}, {i: i - 2, x: interp= olateNumber(ya, yb)}); } else if (xb || yb) { s.push("translate(" + xb + pxComma + yb + pxParen); } } function rotate(a, b, s, q) { if (a !=3D=3D b) { if (a - b > 180) b +=3D 360; else if (b - a > 180) a +=3D 360; // sho= rtest path q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: interpo= lateNumber(a, b)}); } else if (b) { s.push(pop(s) + "rotate(" + b + degParen); } } function skewX(a, b, s, q) { if (a !=3D=3D b) { q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: interpol= ateNumber(a, b)}); } else if (b) { s.push(pop(s) + "skewX(" + b + degParen); } } function scale(xa, ya, xb, yb, s, q) { if (xa !=3D=3D xb || ya !=3D=3D yb) { var i =3D s.push(pop(s) + "scale(", null, ",", null, ")"); q.push({i: i - 4, x: interpolateNumber(xa, xb)}, {i: i - 2, x: interp= olateNumber(ya, yb)}); } else if (xb !=3D=3D 1 || yb !=3D=3D 1) { s.push(pop(s) + "scale(" + xb + "," + yb + ")"); } } return function(a, b) { var s =3D [], // string constants and placeholders q =3D []; // number interpolators a =3D parse(a), b =3D parse(b); translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q); rotate(a.rotate, b.rotate, s, q); skewX(a.skewX, b.skewX, s, q); scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q); a =3D b =3D null; // gc return function(t) { var i =3D -1, n =3D q.length, o; while (++i < n) s[(o =3D q[i]).i] =3D o.x(t); return s.join(""); }; }; } var interpolateTransformCss =3D interpolateTransform(parseCss, "px, ", "px)= ", "deg)"); var interpolateTransformSvg =3D interpolateTransform(parseSvg, ", ", ")", "= )"); var rho =3D Math.SQRT2, rho2 =3D 2, rho4 =3D 4, epsilon2 =3D 1e-12; function cosh(x) { return ((x =3D Math.exp(x)) + 1 / x) / 2; } function sinh(x) { return ((x =3D Math.exp(x)) - 1 / x) / 2; } function tanh(x) { return ((x =3D Math.exp(2 * x)) - 1) / (x + 1); } // p0 =3D [ux0, uy0, w0] // p1 =3D [ux1, uy1, w1] function interpolateZoom(p0, p1) { var ux0 =3D p0[0], uy0 =3D p0[1], w0 =3D p0[2], ux1 =3D p1[0], uy1 =3D p1[1], w1 =3D p1[2], dx =3D ux1 - ux0, dy =3D uy1 - uy0, d2 =3D dx * dx + dy * dy, i, S; // Special case for u0 =E2=89=85 u1. if (d2 < epsilon2) { S =3D Math.log(w1 / w0) / rho; i =3D function(t) { return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S) ]; }; } // General case. else { var d1 =3D Math.sqrt(d2), b0 =3D (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 =3D (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 =3D Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 =3D Math.log(Math.sqrt(b1 * b1 + 1) - b1); S =3D (r1 - r0) / rho; i =3D function(t) { var s =3D t * S, coshr0 =3D cosh(r0), u =3D w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0) ]; }; } i.duration =3D S * 1000; return i; } function hsl$1(hue$$1) { return function(start, end) { var h =3D hue$$1((start =3D hsl(start)).h, (end =3D hsl(end)).h), s =3D nogamma(start.s, end.s), l =3D nogamma(start.l, end.l), opacity =3D nogamma(start.opacity, end.opacity); return function(t) { start.h =3D h(t); start.s =3D s(t); start.l =3D l(t); start.opacity =3D opacity(t); return start + ""; }; } } var hsl$2 =3D hsl$1(hue); var hslLong =3D hsl$1(nogamma); function lab$1(start, end) { var l =3D nogamma((start =3D lab(start)).l, (end =3D lab(end)).l), a =3D nogamma(start.a, end.a), b =3D nogamma(start.b, end.b), opacity =3D nogamma(start.opacity, end.opacity); return function(t) { start.l =3D l(t); start.a =3D a(t); start.b =3D b(t); start.opacity =3D opacity(t); return start + ""; }; } function hcl$1(hue$$1) { return function(start, end) { var h =3D hue$$1((start =3D hcl(start)).h, (end =3D hcl(end)).h), c =3D nogamma(start.c, end.c), l =3D nogamma(start.l, end.l), opacity =3D nogamma(start.opacity, end.opacity); return function(t) { start.h =3D h(t); start.c =3D c(t); start.l =3D l(t); start.opacity =3D opacity(t); return start + ""; }; } } var hcl$2 =3D hcl$1(hue); var hclLong =3D hcl$1(nogamma); function cubehelix$1(hue$$1) { return (function cubehelixGamma(y) { y =3D +y; function cubehelix$$1(start, end) { var h =3D hue$$1((start =3D cubehelix(start)).h, (end =3D cubehelix(e= nd)).h), s =3D nogamma(start.s, end.s), l =3D nogamma(start.l, end.l), opacity =3D nogamma(start.opacity, end.opacity); return function(t) { start.h =3D h(t); start.s =3D s(t); start.l =3D l(Math.pow(t, y)); start.opacity =3D opacity(t); return start + ""; }; } cubehelix$$1.gamma =3D cubehelixGamma; return cubehelix$$1; })(1); } var cubehelix$2 =3D cubehelix$1(hue); var cubehelixLong =3D cubehelix$1(nogamma); function piecewise(interpolate, values) { var i =3D 0, n =3D values.length - 1, v =3D values[0], I =3D new Array(n = < 0 ? 0 : n); while (i < n) I[i] =3D interpolate(v, v =3D values[++i]); return function(t) { var i =3D Math.max(0, Math.min(n - 1, Math.floor(t *=3D n))); return I[i](t - i); }; } function quantize(interpolator, n) { var samples =3D new Array(n); for (var i =3D 0; i < n; ++i) samples[i] =3D interpolator(i / (n - 1)); return samples; } var frame =3D 0, // is an animation frame pending? timeout =3D 0, // is a timeout pending? interval =3D 0, // are any timers active? pokeDelay =3D 1000, // how frequently we check for clock skew taskHead, taskTail, clockLast =3D 0, clockNow =3D 0, clockSkew =3D 0, clock =3D typeof performance =3D=3D=3D "object" && performance.now ? pe= rformance : Date, setFrame =3D typeof window =3D=3D=3D "object" && window.requestAnimatio= nFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeo= ut(f, 17); }; function now() { return clockNow || (setFrame(clearNow), clockNow =3D clock.now() + clockS= kew); } function clearNow() { clockNow =3D 0; } function Timer() { this._call =3D this._time =3D this._next =3D null; } Timer.prototype =3D timer.prototype =3D { constructor: Timer, restart: function(callback, delay, time) { if (typeof callback !=3D=3D "function") throw new TypeError("callback i= s not a function"); time =3D (time =3D=3D null ? now() : +time) + (delay =3D=3D null ? 0 : = +delay); if (!this._next && taskTail !=3D=3D this) { if (taskTail) taskTail._next =3D this; else taskHead =3D this; taskTail =3D this; } this._call =3D callback; this._time =3D time; sleep(); }, stop: function() { if (this._call) { this._call =3D null; this._time =3D Infinity; sleep(); } } }; function timer(callback, delay, time) { var t =3D new Timer; t.restart(callback, delay, time); return t; } function timerFlush() { now(); // Get the current time, if not already set. ++frame; // Pretend we=E2=80=99ve set an alarm, if we haven=E2=80=99t alr= eady. var t =3D taskHead, e; while (t) { if ((e =3D clockNow - t._time) >=3D 0) t._call.call(null, e); t =3D t._next; } --frame; } function wake() { clockNow =3D (clockLast =3D clock.now()) + clockSkew; frame =3D timeout =3D 0; try { timerFlush(); } finally { frame =3D 0; nap(); clockNow =3D 0; } } function poke() { var now =3D clock.now(), delay =3D now - clockLast; if (delay > pokeDelay) clockSkew -=3D delay, clockLast =3D now; } function nap() { var t0, t1 =3D taskHead, t2, time =3D Infinity; while (t1) { if (t1._call) { if (time > t1._time) time =3D t1._time; t0 =3D t1, t1 =3D t1._next; } else { t2 =3D t1._next, t1._next =3D null; t1 =3D t0 ? t0._next =3D t2 : taskHead =3D t2; } } taskTail =3D t0; sleep(time); } function sleep(time) { if (frame) return; // Soonest alarm already set, or will be. if (timeout) timeout =3D clearTimeout(timeout); var delay =3D time - clockNow; // Strictly less than if we recomputed clo= ckNow. if (delay > 24) { if (time < Infinity) timeout =3D setTimeout(wake, time - clock.now() - = clockSkew); if (interval) interval =3D clearInterval(interval); } else { if (!interval) clockLast =3D clock.now(), interval =3D setInterval(poke= , pokeDelay); frame =3D 1, setFrame(wake); } } function timeout$1(callback, delay, time) { var t =3D new Timer; delay =3D delay =3D=3D null ? 0 : +delay; t.restart(function(elapsed) { t.stop(); callback(elapsed + delay); }, delay, time); return t; } function interval$1(callback, delay, time) { var t =3D new Timer, total =3D delay; if (delay =3D=3D null) return t.restart(callback, delay, time), t; delay =3D +delay, time =3D time =3D=3D null ? now() : +time; t.restart(function tick(elapsed) { elapsed +=3D total; t.restart(tick, total +=3D delay, time); callback(elapsed); }, delay, time); return t; } var emptyOn =3D dispatch("start", "end", "cancel", "interrupt"); var emptyTween =3D []; var CREATED =3D 0; var SCHEDULED =3D 1; var STARTING =3D 2; var STARTED =3D 3; var RUNNING =3D 4; var ENDING =3D 5; var ENDED =3D 6; function schedule(node, name, id, index, group, timing) { var schedules =3D node.__transition; if (!schedules) node.__transition =3D {}; else if (id in schedules) return; create$1(node, id, { name: name, index: index, // For context during callback. group: group, // For context during callback. on: emptyOn, tween: emptyTween, time: timing.time, delay: timing.delay, duration: timing.duration, ease: timing.ease, timer: null, state: CREATED }); } function init(node, id) { var schedule =3D get$1(node, id); if (schedule.state > CREATED) throw new Error("too late; already schedule= d"); return schedule; } function set$1(node, id) { var schedule =3D get$1(node, id); if (schedule.state > STARTED) throw new Error("too late; already running"= ); return schedule; } function get$1(node, id) { var schedule =3D node.__transition; if (!schedule || !(schedule =3D schedule[id])) throw new Error("transitio= n not found"); return schedule; } function create$1(node, id, self) { var schedules =3D node.__transition, tween; // Initialize the self timer when the transition is created. // Note the actual delay is not known until the first callback! schedules[id] =3D self; self.timer =3D timer(schedule, 0, self.time); function schedule(elapsed) { self.state =3D SCHEDULED; self.timer.restart(start, self.delay, self.time); // If the elapsed delay is less than our first sleep, start immediately. if (self.delay <=3D elapsed) start(elapsed - self.delay); } function start(elapsed) { var i, j, n, o; // If the state is not SCHEDULED, then we previously errored on start. if (self.state !=3D=3D SCHEDULED) return stop(); for (i in schedules) { o =3D schedules[i]; if (o.name !=3D=3D self.name) continue; // While this element already has a starting transition during this f= rame, // defer starting an interrupting transition until that transition ha= s a // chance to tick (and possibly end); see d3/d3-transition#54! if (o.state =3D=3D=3D STARTED) return timeout$1(start); // Interrupt the active transition, if any. if (o.state =3D=3D=3D RUNNING) { o.state =3D ENDED; o.timer.stop(); o.on.call("interrupt", node, node.__data__, o.index, o.group); delete schedules[i]; } // Cancel any pre-empted transitions. else if (+i < id) { o.state =3D ENDED; o.timer.stop(); o.on.call("cancel", node, node.__data__, o.index, o.group); delete schedules[i]; } } // Defer the first tick to end of the current frame; see d3/d3#1576. // Note the transition may be canceled after start and before the first= tick! // Note this must be scheduled before the start event; see d3/d3-transi= tion#16! // Assuming this is successful, subsequent callbacks go straight to tic= k. timeout$1(function() { if (self.state =3D=3D=3D STARTED) { self.state =3D RUNNING; self.timer.restart(tick, self.delay, self.time); tick(elapsed); } }); // Dispatch the start event. // Note this must be done before the tween are initialized. self.state =3D STARTING; self.on.call("start", node, node.__data__, self.index, self.group); if (self.state !=3D=3D STARTING) return; // interrupted self.state =3D STARTED; // Initialize the tween, deleting null tween. tween =3D new Array(n =3D self.tween.length); for (i =3D 0, j =3D -1; i < n; ++i) { if (o =3D self.tween[i].value.call(node, node.__data__, self.index, s= elf.group)) { tween[++j] =3D o; } } tween.length =3D j + 1; } function tick(elapsed) { var t =3D elapsed < self.duration ? self.ease.call(null, elapsed / self= =2Eduration) : (self.timer.restart(stop), self.state =3D ENDING, 1), i =3D -1, n =3D tween.length; while (++i < n) { tween[i].call(node, t); } // Dispatch the end event. if (self.state =3D=3D=3D ENDING) { self.on.call("end", node, node.__data__, self.index, self.group); stop(); } } function stop() { self.state =3D ENDED; self.timer.stop(); delete schedules[id]; for (var i in schedules) return; // eslint-disable-line no-unused-vars delete node.__transition; } } function interrupt(node, name) { var schedules =3D node.__transition, schedule$$1, active, empty =3D true, i; if (!schedules) return; name =3D name =3D=3D null ? null : name + ""; for (i in schedules) { if ((schedule$$1 =3D schedules[i]).name !=3D=3D name) { empty =3D false= ; continue; } active =3D schedule$$1.state > STARTING && schedule$$1.state < ENDING; schedule$$1.state =3D ENDED; schedule$$1.timer.stop(); schedule$$1.on.call(active ? "interrupt" : "cancel", node, node.__data_= _, schedule$$1.index, schedule$$1.group); delete schedules[i]; } if (empty) delete node.__transition; } function selection_interrupt(name) { return this.each(function() { interrupt(this, name); }); } function tweenRemove(id, name) { var tween0, tween1; return function() { var schedule$$1 =3D set$1(this, id), tween =3D schedule$$1.tween; // If this node shared tween with the previous node, // just assign the updated shared tween and we=E2=80=99re done! // Otherwise, copy-on-write. if (tween !=3D=3D tween0) { tween1 =3D tween0 =3D tween; for (var i =3D 0, n =3D tween1.length; i < n; ++i) { if (tween1[i].name =3D=3D=3D name) { tween1 =3D tween1.slice(); tween1.splice(i, 1); break; } } } schedule$$1.tween =3D tween1; }; } function tweenFunction(id, name, value) { var tween0, tween1; if (typeof value !=3D=3D "function") throw new Error; return function() { var schedule$$1 =3D set$1(this, id), tween =3D schedule$$1.tween; // If this node shared tween with the previous node, // just assign the updated shared tween and we=E2=80=99re done! // Otherwise, copy-on-write. if (tween !=3D=3D tween0) { tween1 =3D (tween0 =3D tween).slice(); for (var t =3D {name: name, value: value}, i =3D 0, n =3D tween1.leng= th; i < n; ++i) { if (tween1[i].name =3D=3D=3D name) { tween1[i] =3D t; break; } } if (i =3D=3D=3D n) tween1.push(t); } schedule$$1.tween =3D tween1; }; } function transition_tween(name, value) { var id =3D this._id; name +=3D ""; if (arguments.length < 2) { var tween =3D get$1(this.node(), id).tween; for (var i =3D 0, n =3D tween.length, t; i < n; ++i) { if ((t =3D tween[i]).name =3D=3D=3D name) { return t.value; } } return null; } return this.each((value =3D=3D null ? tweenRemove : tweenFunction)(id, na= me, value)); } function tweenValue(transition, name, value) { var id =3D transition._id; transition.each(function() { var schedule$$1 =3D set$1(this, id); (schedule$$1.value || (schedule$$1.value =3D {}))[name] =3D value.apply= (this, arguments); }); return function(node) { return get$1(node, id).value[name]; }; } function interpolate(a, b) { var c; return (typeof b =3D=3D=3D "number" ? interpolateNumber : b instanceof color ? interpolateRgb : (c =3D color(b)) ? (b =3D c, interpolateRgb) : interpolateString)(a, b); } function attrRemove$1(name) { return function() { this.removeAttribute(name); }; } function attrRemoveNS$1(fullname) { return function() { this.removeAttributeNS(fullname.space, fullname.local); }; } function attrConstant$1(name, interpolate$$1, value1) { var string00, string1 =3D value1 + "", interpolate0; return function() { var string0 =3D this.getAttribute(name); return string0 =3D=3D=3D string1 ? null : string0 =3D=3D=3D string00 ? interpolate0 : interpolate0 =3D interpolate$$1(string00 =3D string0, value1); }; } function attrConstantNS$1(fullname, interpolate$$1, value1) { var string00, string1 =3D value1 + "", interpolate0; return function() { var string0 =3D this.getAttributeNS(fullname.space, fullname.local); return string0 =3D=3D=3D string1 ? null : string0 =3D=3D=3D string00 ? interpolate0 : interpolate0 =3D interpolate$$1(string00 =3D string0, value1); }; } function attrFunction$1(name, interpolate$$1, value) { var string00, string10, interpolate0; return function() { var string0, value1 =3D value(this), string1; if (value1 =3D=3D null) return void this.removeAttribute(name); string0 =3D this.getAttribute(name); string1 =3D value1 + ""; return string0 =3D=3D=3D string1 ? null : string0 =3D=3D=3D string00 && string1 =3D=3D=3D string10 ? interp= olate0 : (string10 =3D string1, interpolate0 =3D interpolate$$1(string00 = =3D string0, value1)); }; } function attrFunctionNS$1(fullname, interpolate$$1, value) { var string00, string10, interpolate0; return function() { var string0, value1 =3D value(this), string1; if (value1 =3D=3D null) return void this.removeAttributeNS(fullname.spa= ce, fullname.local); string0 =3D this.getAttributeNS(fullname.space, fullname.local); string1 =3D value1 + ""; return string0 =3D=3D=3D string1 ? null : string0 =3D=3D=3D string00 && string1 =3D=3D=3D string10 ? interp= olate0 : (string10 =3D string1, interpolate0 =3D interpolate$$1(string00 = =3D string0, value1)); }; } function transition_attr(name, value) { var fullname =3D namespace(name), i =3D fullname =3D=3D=3D "transform" ? = interpolateTransformSvg : interpolate; return this.attrTween(name, typeof value =3D=3D=3D "function" ? (fullname.local ? attrFunctionNS$1 : attrFunction$1)(fullname, i, t= weenValue(this, "attr." + name, value)) : value =3D=3D null ? (fullname.local ? attrRemoveNS$1 : attrRemove$1= )(fullname) : (fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, i, v= alue)); } function attrInterpolate(name, i) { return function(t) { this.setAttribute(name, i(t)); }; } function attrInterpolateNS(fullname, i) { return function(t) { this.setAttributeNS(fullname.space, fullname.local, i(t)); }; } function attrTweenNS(fullname, value) { var t0, i0; function tween() { var i =3D value.apply(this, arguments); if (i !=3D=3D i0) t0 =3D (i0 =3D i) && attrInterpolateNS(fullname, i); return t0; } tween._value =3D value; return tween; } function attrTween(name, value) { var t0, i0; function tween() { var i =3D value.apply(this, arguments); if (i !=3D=3D i0) t0 =3D (i0 =3D i) && attrInterpolate(name, i); return t0; } tween._value =3D value; return tween; } function transition_attrTween(name, value) { var key =3D "attr." + name; if (arguments.length < 2) return (key =3D this.tween(key)) && key._value; if (value =3D=3D null) return this.tween(key, null); if (typeof value !=3D=3D "function") throw new Error; var fullname =3D namespace(name); return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullnam= e, value)); } function delayFunction(id, value) { return function() { init(this, id).delay =3D +value.apply(this, arguments); }; } function delayConstant(id, value) { return value =3D +value, function() { init(this, id).delay =3D value; }; } function transition_delay(value) { var id =3D this._id; return arguments.length ? this.each((typeof value =3D=3D=3D "function" ? delayFunction : delayConstant)(id, value)) : get$1(this.node(), id).delay; } function durationFunction(id, value) { return function() { set$1(this, id).duration =3D +value.apply(this, arguments); }; } function durationConstant(id, value) { return value =3D +value, function() { set$1(this, id).duration =3D value; }; } function transition_duration(value) { var id =3D this._id; return arguments.length ? this.each((typeof value =3D=3D=3D "function" ? durationFunction : durationConstant)(id, value)) : get$1(this.node(), id).duration; } function easeConstant(id, value) { if (typeof value !=3D=3D "function") throw new Error; return function() { set$1(this, id).ease =3D value; }; } function transition_ease(value) { var id =3D this._id; return arguments.length ? this.each(easeConstant(id, value)) : get$1(this.node(), id).ease; } function transition_filter(match) { if (typeof match !=3D=3D "function") match =3D matcher(match); for (var groups =3D this._groups, m =3D groups.length, subgroups =3D new = Array(m), j =3D 0; j < m; ++j) { for (var group =3D groups[j], n =3D group.length, subgroup =3D subgroup= s[j] =3D [], node, i =3D 0; i < n; ++i) { if ((node =3D group[i]) && match.call(node, node.__data__, i, group))= { subgroup.push(node); } } } return new Transition(subgroups, this._parents, this._name, this._id); } function transition_merge(transition$$1) { if (transition$$1._id !=3D=3D this._id) throw new Error; for (var groups0 =3D this._groups, groups1 =3D transition$$1._groups, m0 = =3D groups0.length, m1 =3D groups1.length, m =3D Math.min(m0, m1), merges = =3D new Array(m0), j =3D 0; j < m; ++j) { for (var group0 =3D groups0[j], group1 =3D groups1[j], n =3D group0.len= gth, merge =3D merges[j] =3D new Array(n), node, i =3D 0; i < n; ++i) { if (node =3D group0[i] || group1[i]) { merge[i] =3D node; } } } for (; j < m0; ++j) { merges[j] =3D groups0[j]; } return new Transition(merges, this._parents, this._name, this._id); } function start(name) { return (name + "").trim().split(/^|\s+/).every(function(t) { var i =3D t.indexOf("."); if (i >=3D 0) t =3D t.slice(0, i); return !t || t =3D=3D=3D "start"; }); } function onFunction(id, name, listener) { var on0, on1, sit =3D start(name) ? init : set$1; return function() { var schedule$$1 =3D sit(this, id), on =3D schedule$$1.on; // If this node shared a dispatch with the previous node, // just assign the updated shared dispatch and we=E2=80=99re done! // Otherwise, copy-on-write. if (on !=3D=3D on0) (on1 =3D (on0 =3D on).copy()).on(name, listener); schedule$$1.on =3D on1; }; } function transition_on(name, listener) { var id =3D this._id; return arguments.length < 2 ? get$1(this.node(), id).on.on(name) : this.each(onFunction(id, name, listener)); } function removeFunction(id) { return function() { var parent =3D this.parentNode; for (var i in this.__transition) if (+i !=3D=3D id) return; if (parent) parent.removeChild(this); }; } function transition_remove() { return this.on("end.remove", removeFunction(this._id)); } function transition_select(select$$1) { var name =3D this._name, id =3D this._id; if (typeof select$$1 !=3D=3D "function") select$$1 =3D selector(select$$1= ); for (var groups =3D this._groups, m =3D groups.length, subgroups =3D new = Array(m), j =3D 0; j < m; ++j) { for (var group =3D groups[j], n =3D group.length, subgroup =3D subgroup= s[j] =3D new Array(n), node, subnode, i =3D 0; i < n; ++i) { if ((node =3D group[i]) && (subnode =3D select$$1.call(node, node.__d= ata__, i, group))) { if ("__data__" in node) subnode.__data__ =3D node.__data__; subgroup[i] =3D subnode; schedule(subgroup[i], name, id, i, subgroup, get$1(node, id)); } } } return new Transition(subgroups, this._parents, name, id); } function transition_selectAll(select$$1) { var name =3D this._name, id =3D this._id; if (typeof select$$1 !=3D=3D "function") select$$1 =3D selectorAll(select= $$1); for (var groups =3D this._groups, m =3D groups.length, subgroups =3D [], = parents =3D [], j =3D 0; j < m; ++j) { for (var group =3D groups[j], n =3D group.length, node, i =3D 0; i < n;= ++i) { if (node =3D group[i]) { for (var children =3D select$$1.call(node, node.__data__, i, group)= , child, inherit =3D get$1(node, id), k =3D 0, l =3D children.length; k < l= ; ++k) { if (child =3D children[k]) { schedule(child, name, id, k, children, inherit); } } subgroups.push(children); parents.push(node); } } } return new Transition(subgroups, parents, name, id); } var Selection$1 =3D selection.prototype.constructor; function transition_selection() { return new Selection$1(this._groups, this._parents); } function styleNull(name, interpolate$$1) { var string00, string10, interpolate0; return function() { var string0 =3D styleValue(this, name), string1 =3D (this.style.removeProperty(name), styleValue(this, name= )); return string0 =3D=3D=3D string1 ? null : string0 =3D=3D=3D string00 && string1 =3D=3D=3D string10 ? interp= olate0 : interpolate0 =3D interpolate$$1(string00 =3D string0, string10 = =3D string1); }; } function styleRemove$1(name) { return function() { this.style.removeProperty(name); }; } function styleConstant$1(name, interpolate$$1, value1) { var string00, string1 =3D value1 + "", interpolate0; return function() { var string0 =3D styleValue(this, name); return string0 =3D=3D=3D string1 ? null : string0 =3D=3D=3D string00 ? interpolate0 : interpolate0 =3D interpolate$$1(string00 =3D string0, value1); }; } function styleFunction$1(name, interpolate$$1, value) { var string00, string10, interpolate0; return function() { var string0 =3D styleValue(this, name), value1 =3D value(this), string1 =3D value1 + ""; if (value1 =3D=3D null) string1 =3D value1 =3D (this.style.removeProper= ty(name), styleValue(this, name)); return string0 =3D=3D=3D string1 ? null : string0 =3D=3D=3D string00 && string1 =3D=3D=3D string10 ? interp= olate0 : (string10 =3D string1, interpolate0 =3D interpolate$$1(string00 = =3D string0, value1)); }; } function styleMaybeRemove(id, name) { var on0, on1, listener0, key =3D "style." + name, event =3D "end." + key,= remove; return function() { var schedule$$1 =3D set$1(this, id), on =3D schedule$$1.on, listener =3D schedule$$1.value[key] =3D=3D null ? remove || (remove= =3D styleRemove$1(name)) : undefined; // If this node shared a dispatch with the previous node, // just assign the updated shared dispatch and we=E2=80=99re done! // Otherwise, copy-on-write. if (on !=3D=3D on0 || listener0 !=3D=3D listener) (on1 =3D (on0 =3D on)= =2Ecopy()).on(event, listener0 =3D listener); schedule$$1.on =3D on1; }; } function transition_style(name, value, priority) { var i =3D (name +=3D "") =3D=3D=3D "transform" ? interpolateTransformCss = : interpolate; return value =3D=3D null ? this .styleTween(name, styleNull(name, i)) .on("end.style." + name, styleRemove$1(name)) : typeof value =3D=3D=3D "function" ? this .styleTween(name, styleFunction$1(name, i, tweenValue(this, "style." = + name, value))) .each(styleMaybeRemove(this._id, name)) : this .styleTween(name, styleConstant$1(name, i, value), priority) .on("end.style." + name, null); } function styleInterpolate(name, i, priority) { return function(t) { this.style.setProperty(name, i(t), priority); }; } function styleTween(name, value, priority) { var t, i0; function tween() { var i =3D value.apply(this, arguments); if (i !=3D=3D i0) t =3D (i0 =3D i) && styleInterpolate(name, i, priorit= y); return t; } tween._value =3D value; return tween; } function transition_styleTween(name, value, priority) { var key =3D "style." + (name +=3D ""); if (arguments.length < 2) return (key =3D this.tween(key)) && key._value; if (value =3D=3D null) return this.tween(key, null); if (typeof value !=3D=3D "function") throw new Error; return this.tween(key, styleTween(name, value, priority =3D=3D null ? "" = : priority)); } function textConstant$1(value) { return function() { this.textContent =3D value; }; } function textFunction$1(value) { return function() { var value1 =3D value(this); this.textContent =3D value1 =3D=3D null ? "" : value1; }; } function transition_text(value) { return this.tween("text", typeof value =3D=3D=3D "function" ? textFunction$1(tweenValue(this, "text", value)) : textConstant$1(value =3D=3D null ? "" : value + "")); } function transition_transition() { var name =3D this._name, id0 =3D this._id, id1 =3D newId(); for (var groups =3D this._groups, m =3D groups.length, j =3D 0; j < m; ++= j) { for (var group =3D groups[j], n =3D group.length, node, i =3D 0; i < n;= ++i) { if (node =3D group[i]) { var inherit =3D get$1(node, id0); schedule(node, name, id1, i, group, { time: inherit.time + inherit.delay + inherit.duration, delay: 0, duration: inherit.duration, ease: inherit.ease }); } } } return new Transition(groups, this._parents, name, id1); } function transition_end() { var on0, on1, that =3D this, id =3D that._id, size =3D that.size(); return new Promise(function(resolve, reject) { var cancel =3D {value: reject}, end =3D {value: function() { if (--size =3D=3D=3D 0) resolve(); }}; that.each(function() { var schedule$$1 =3D set$1(this, id), on =3D schedule$$1.on; // If this node shared a dispatch with the previous node, // just assign the updated shared dispatch and we=E2=80=99re done! // Otherwise, copy-on-write. if (on !=3D=3D on0) { on1 =3D (on0 =3D on).copy(); on1._.cancel.push(cancel); on1._.interrupt.push(cancel); on1._.end.push(end); } schedule$$1.on =3D on1; }); }); } var id =3D 0; function Transition(groups, parents, name, id) { this._groups =3D groups; this._parents =3D parents; this._name =3D name; this._id =3D id; } function transition(name) { return selection().transition(name); } function newId() { return ++id; } var selection_prototype =3D selection.prototype; Transition.prototype =3D transition.prototype =3D { constructor: Transition, select: transition_select, selectAll: transition_selectAll, filter: transition_filter, merge: transition_merge, selection: transition_selection, transition: transition_transition, call: selection_prototype.call, nodes: selection_prototype.nodes, node: selection_prototype.node, size: selection_prototype.size, empty: selection_prototype.empty, each: selection_prototype.each, on: transition_on, attr: transition_attr, attrTween: transition_attrTween, style: transition_style, styleTween: transition_styleTween, text: transition_text, remove: transition_remove, tween: transition_tween, delay: transition_delay, duration: transition_duration, ease: transition_ease, end: transition_end }; function linear$1(t) { return +t; } function quadIn(t) { return t * t; } function quadOut(t) { return t * (2 - t); } function quadInOut(t) { return ((t *=3D 2) <=3D 1 ? t * t : --t * (2 - t) + 1) / 2; } function cubicIn(t) { return t * t * t; } function cubicOut(t) { return --t * t * t + 1; } function cubicInOut(t) { return ((t *=3D 2) <=3D 1 ? t * t * t : (t -=3D 2) * t * t + 2) / 2; } var exponent =3D 3; var polyIn =3D (function custom(e) { e =3D +e; function polyIn(t) { return Math.pow(t, e); } polyIn.exponent =3D custom; return polyIn; })(exponent); var polyOut =3D (function custom(e) { e =3D +e; function polyOut(t) { return 1 - Math.pow(1 - t, e); } polyOut.exponent =3D custom; return polyOut; })(exponent); var polyInOut =3D (function custom(e) { e =3D +e; function polyInOut(t) { return ((t *=3D 2) <=3D 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / = 2; } polyInOut.exponent =3D custom; return polyInOut; })(exponent); var pi =3D Math.PI, halfPi =3D pi / 2; function sinIn(t) { return 1 - Math.cos(t * halfPi); } function sinOut(t) { return Math.sin(t * halfPi); } function sinInOut(t) { return (1 - Math.cos(pi * t)) / 2; } function expIn(t) { return Math.pow(2, 10 * t - 10); } function expOut(t) { return 1 - Math.pow(2, -10 * t); } function expInOut(t) { return ((t *=3D 2) <=3D 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10= - 10 * t)) / 2; } function circleIn(t) { return 1 - Math.sqrt(1 - t * t); } function circleOut(t) { return Math.sqrt(1 - --t * t); } function circleInOut(t) { return ((t *=3D 2) <=3D 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= =3D 2) * t) + 1) / 2; } var b1 =3D 4 / 11, b2 =3D 6 / 11, b3 =3D 8 / 11, b4 =3D 3 / 4, b5 =3D 9 / 11, b6 =3D 10 / 11, b7 =3D 15 / 16, b8 =3D 21 / 22, b9 =3D 63 / 64, b0 =3D 1 / b1 / b1; function bounceIn(t) { return 1 - bounceOut(1 - t); } function bounceOut(t) { return (t =3D +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -=3D b2) * t + b4 = : t < b6 ? b0 * (t -=3D b5) * t + b7 : b0 * (t -=3D b8) * t + b9; } function bounceInOut(t) { return ((t *=3D 2) <=3D 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) = / 2; } var overshoot =3D 1.70158; var backIn =3D (function custom(s) { s =3D +s; function backIn(t) { return t * t * ((s + 1) * t - s); } backIn.overshoot =3D custom; return backIn; })(overshoot); var backOut =3D (function custom(s) { s =3D +s; function backOut(t) { return --t * t * ((s + 1) * t + s) + 1; } backOut.overshoot =3D custom; return backOut; })(overshoot); var backInOut =3D (function custom(s) { s =3D +s; function backInOut(t) { return ((t *=3D 2) < 1 ? t * t * ((s + 1) * t - s) : (t -=3D 2) * t * (= (s + 1) * t + s) + 2) / 2; } backInOut.overshoot =3D custom; return backInOut; })(overshoot); var tau =3D 2 * Math.PI, amplitude =3D 1, period =3D 0.3; var elasticIn =3D (function custom(a, p) { var s =3D Math.asin(1 / (a =3D Math.max(1, a))) * (p /=3D tau); function elasticIn(t) { return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p); } elasticIn.amplitude =3D function(a) { return custom(a, p * tau); }; elasticIn.period =3D function(p) { return custom(a, p); }; return elasticIn; })(amplitude, period); var elasticOut =3D (function custom(a, p) { var s =3D Math.asin(1 / (a =3D Math.max(1, a))) * (p /=3D tau); function elasticOut(t) { return 1 - a * Math.pow(2, -10 * (t =3D +t)) * Math.sin((t + s) / p); } elasticOut.amplitude =3D function(a) { return custom(a, p * tau); }; elasticOut.period =3D function(p) { return custom(a, p); }; return elasticOut; })(amplitude, period); var elasticInOut =3D (function custom(a, p) { var s =3D Math.asin(1 / (a =3D Math.max(1, a))) * (p /=3D tau); function elasticInOut(t) { return ((t =3D t * 2 - 1) < 0 ? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p) : 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2; } elasticInOut.amplitude =3D function(a) { return custom(a, p * tau); }; elasticInOut.period =3D function(p) { return custom(a, p); }; return elasticInOut; })(amplitude, period); var defaultTiming =3D { time: null, // Set on use. delay: 0, duration: 250, ease: cubicInOut }; function inherit(node, id) { var timing; while (!(timing =3D node.__transition) || !(timing =3D timing[id])) { if (!(node =3D node.parentNode)) { return defaultTiming.time =3D now(), defaultTiming; } } return timing; } function selection_transition(name) { var id, timing; if (name instanceof Transition) { id =3D name._id, name =3D name._name; } else { id =3D newId(), (timing =3D defaultTiming).time =3D now(), name =3D nam= e =3D=3D null ? null : name + ""; } for (var groups =3D this._groups, m =3D groups.length, j =3D 0; j < m; ++= j) { for (var group =3D groups[j], n =3D group.length, node, i =3D 0; i < n;= ++i) { if (node =3D group[i]) { schedule(node, name, id, i, group, timing || inherit(node, id)); } } } return new Transition(groups, this._parents, name, id); } selection.prototype.interrupt =3D selection_interrupt; selection.prototype.transition =3D selection_transition; var root$1 =3D [null]; function active(node, name) { var schedules =3D node.__transition, schedule$$1, i; if (schedules) { name =3D name =3D=3D null ? null : name + ""; for (i in schedules) { if ((schedule$$1 =3D schedules[i]).state > SCHEDULED && schedule$$1.n= ame =3D=3D=3D name) { return new Transition([[node]], root$1, name, +i); } } } return null; } function constant$4(x) { return function() { return x; }; } function BrushEvent(target, type, selection) { this.target =3D target; this.type =3D type; this.selection =3D selection; } function nopropagation$1() { exports.event.stopImmediatePropagation(); } function noevent$1() { exports.event.preventDefault(); exports.event.stopImmediatePropagation(); } var MODE_DRAG =3D {name: "drag"}, MODE_SPACE =3D {name: "space"}, MODE_HANDLE =3D {name: "handle"}, MODE_CENTER =3D {name: "center"}; var X =3D { name: "x", handles: ["e", "w"].map(type), input: function(x, e) { return x && [[x[0], e[0][1]], [x[1], e[1][1]]]; }, output: function(xy) { return xy && [xy[0][0], xy[1][0]]; } }; var Y =3D { name: "y", handles: ["n", "s"].map(type), input: function(y, e) { return y && [[e[0][0], y[0]], [e[1][0], y[1]]]; }, output: function(xy) { return xy && [xy[0][1], xy[1][1]]; } }; var XY =3D { name: "xy", handles: ["n", "e", "s", "w", "nw", "ne", "se", "sw"].map(type), input: function(xy) { return xy; }, output: function(xy) { return xy; } }; var cursors =3D { overlay: "crosshair", selection: "move", n: "ns-resize", e: "ew-resize", s: "ns-resize", w: "ew-resize", nw: "nwse-resize", ne: "nesw-resize", se: "nwse-resize", sw: "nesw-resize" }; var flipX =3D { e: "w", w: "e", nw: "ne", ne: "nw", se: "sw", sw: "se" }; var flipY =3D { n: "s", s: "n", nw: "sw", ne: "se", se: "ne", sw: "nw" }; var signsX =3D { overlay: +1, selection: +1, n: null, e: +1, s: null, w: -1, nw: -1, ne: +1, se: +1, sw: -1 }; var signsY =3D { overlay: +1, selection: +1, n: -1, e: null, s: +1, w: null, nw: -1, ne: -1, se: +1, sw: +1 }; function type(t) { return {type: t}; } // Ignore right-click, since that should open the context menu. function defaultFilter$1() { return !exports.event.button; } function defaultExtent() { var svg =3D this.ownerSVGElement || this; return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]]; } // Like d3.local, but with the name =E2=80=9C__brush=E2=80=9D rather than a= uto-generated. function local$1(node) { while (!node.__brush) if (!(node =3D node.parentNode)) return; return node.__brush; } function empty$1(extent) { return extent[0][0] =3D=3D=3D extent[1][0] || extent[0][1] =3D=3D=3D extent[1][1]; } function brushSelection(node) { var state =3D node.__brush; return state ? state.dim.output(state.selection) : null; } function brushX() { return brush$1(X); } function brushY() { return brush$1(Y); } function brush() { return brush$1(XY); } function brush$1(dim) { var extent =3D defaultExtent, filter =3D defaultFilter$1, listeners =3D dispatch(brush, "start", "brush", "end"), handleSize =3D 6, touchending; function brush(group) { var overlay =3D group .property("__brush", initialize) .selectAll(".overlay") .data([type("overlay")]); overlay.enter().append("rect") .attr("class", "overlay") .attr("pointer-events", "all") .attr("cursor", cursors.overlay) .merge(overlay) .each(function() { var extent =3D local$1(this).extent; select(this) .attr("x", extent[0][0]) .attr("y", extent[0][1]) .attr("width", extent[1][0] - extent[0][0]) .attr("height", extent[1][1] - extent[0][1]); }); group.selectAll(".selection") .data([type("selection")]) .enter().append("rect") .attr("class", "selection") .attr("cursor", cursors.selection) .attr("fill", "#777") .attr("fill-opacity", 0.3) .attr("stroke", "#fff") .attr("shape-rendering", "crispEdges"); var handle =3D group.selectAll(".handle") .data(dim.handles, function(d) { return d.type; }); handle.exit().remove(); handle.enter().append("rect") .attr("class", function(d) { return "handle handle--" + d.type; }) .attr("cursor", function(d) { return cursors[d.type]; }); group .each(redraw) .attr("fill", "none") .attr("pointer-events", "all") .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)") .on("mousedown.brush touchstart.brush", started); } brush.move =3D function(group, selection$$1) { if (group.selection) { group .on("start.brush", function() { emitter(this, arguments).beforest= art().start(); }) .on("interrupt.brush end.brush", function() { emitter(this, argum= ents).end(); }) .tween("brush", function() { var that =3D this, state =3D that.__brush, emit =3D emitter(that, arguments), selection0 =3D state.selection, selection1 =3D dim.input(typeof selection$$1 =3D=3D=3D "fun= ction" ? selection$$1.apply(this, arguments) : selection$$1, state.extent), i =3D interpolateValue(selection0, selection1); function tween(t) { state.selection =3D t =3D=3D=3D 1 && empty$1(selection1) ? nu= ll : i(t); redraw.call(that); emit.brush(); } return selection0 && selection1 ? tween : tween(1); }); } else { group .each(function() { var that =3D this, args =3D arguments, state =3D that.__brush, selection1 =3D dim.input(typeof selection$$1 =3D=3D=3D "fun= ction" ? selection$$1.apply(that, args) : selection$$1, state.extent), emit =3D emitter(that, args).beforestart(); interrupt(that); state.selection =3D selection1 =3D=3D null || empty$1(selection= 1) ? null : selection1; redraw.call(that); emit.start().brush().end(); }); } }; function redraw() { var group =3D select(this), selection$$1 =3D local$1(this).selection; if (selection$$1) { group.selectAll(".selection") .style("display", null) .attr("x", selection$$1[0][0]) .attr("y", selection$$1[0][1]) .attr("width", selection$$1[1][0] - selection$$1[0][0]) .attr("height", selection$$1[1][1] - selection$$1[0][1]); group.selectAll(".handle") .style("display", null) .attr("x", function(d) { return d.type[d.type.length - 1] =3D=3D= =3D "e" ? selection$$1[1][0] - handleSize / 2 : selection$$1[0][0] - handle= Size / 2; }) .attr("y", function(d) { return d.type[0] =3D=3D=3D "s" ? selecti= on$$1[1][1] - handleSize / 2 : selection$$1[0][1] - handleSize / 2; }) .attr("width", function(d) { return d.type =3D=3D=3D "n" || d.typ= e =3D=3D=3D "s" ? selection$$1[1][0] - selection$$1[0][0] + handleSize : ha= ndleSize; }) .attr("height", function(d) { return d.type =3D=3D=3D "e" || d.ty= pe =3D=3D=3D "w" ? selection$$1[1][1] - selection$$1[0][1] + handleSize : h= andleSize; }); } else { group.selectAll(".selection,.handle") .style("display", "none") .attr("x", null) .attr("y", null) .attr("width", null) .attr("height", null); } } function emitter(that, args) { return that.__brush.emitter || new Emitter(that, args); } function Emitter(that, args) { this.that =3D that; this.args =3D args; this.state =3D that.__brush; this.active =3D 0; } Emitter.prototype =3D { beforestart: function() { if (++this.active =3D=3D=3D 1) this.state.emitter =3D this, this.star= ting =3D true; return this; }, start: function() { if (this.starting) this.starting =3D false, this.emit("start"); return this; }, brush: function() { this.emit("brush"); return this; }, end: function() { if (--this.active =3D=3D=3D 0) delete this.state.emitter, this.emit("= end"); return this; }, emit: function(type) { customEvent(new BrushEvent(brush, type, dim.output(this.state.selecti= on)), listeners.apply, listeners, [type, this.that, this.args]); } }; function started() { if (exports.event.touches) { if (exports.event.changedTouches.length < = exports.event.touches.length) return noevent$1(); } else if (touchending) return; if (!filter.apply(this, arguments)) return; var that =3D this, type =3D exports.event.target.__data__.type, mode =3D (exports.event.metaKey ? type =3D "overlay" : type) =3D=3D= =3D "selection" ? MODE_DRAG : (exports.event.altKey ? MODE_CENTER : MODE_HA= NDLE), signX =3D dim =3D=3D=3D Y ? null : signsX[type], signY =3D dim =3D=3D=3D X ? null : signsY[type], state =3D local$1(that), extent =3D state.extent, selection$$1 =3D state.selection, W =3D extent[0][0], w0, w1, N =3D extent[0][1], n0, n1, E =3D extent[1][0], e0, e1, S =3D extent[1][1], s0, s1, dx, dy, moving, shifting =3D signX && signY && exports.event.shiftKey, lockX, lockY, point0 =3D mouse(that), point$$1 =3D point0, emit =3D emitter(that, arguments).beforestart(); if (type =3D=3D=3D "overlay") { state.selection =3D selection$$1 =3D [ [w0 =3D dim =3D=3D=3D Y ? W : point0[0], n0 =3D dim =3D=3D=3D X ? N= : point0[1]], [e0 =3D dim =3D=3D=3D Y ? E : w0, s0 =3D dim =3D=3D=3D X ? S : n0] ]; } else { w0 =3D selection$$1[0][0]; n0 =3D selection$$1[0][1]; e0 =3D selection$$1[1][0]; s0 =3D selection$$1[1][1]; } w1 =3D w0; n1 =3D n0; e1 =3D e0; s1 =3D s0; var group =3D select(that) .attr("pointer-events", "none"); var overlay =3D group.selectAll(".overlay") .attr("cursor", cursors[type]); if (exports.event.touches) { group .on("touchmove.brush", moved, true) .on("touchend.brush touchcancel.brush", ended, true); } else { var view =3D select(exports.event.view) .on("keydown.brush", keydowned, true) .on("keyup.brush", keyupped, true) .on("mousemove.brush", moved, true) .on("mouseup.brush", ended, true); dragDisable(exports.event.view); } nopropagation$1(); interrupt(that); redraw.call(that); emit.start(); function moved() { var point1 =3D mouse(that); if (shifting && !lockX && !lockY) { if (Math.abs(point1[0] - point$$1[0]) > Math.abs(point1[1] - point$= $1[1])) lockY =3D true; else lockX =3D true; } point$$1 =3D point1; moving =3D true; noevent$1(); move(); } function move() { var t; dx =3D point$$1[0] - point0[0]; dy =3D point$$1[1] - point0[1]; switch (mode) { case MODE_SPACE: case MODE_DRAG: { if (signX) dx =3D Math.max(W - w0, Math.min(E - e0, dx)), w1 =3D = w0 + dx, e1 =3D e0 + dx; if (signY) dy =3D Math.max(N - n0, Math.min(S - s0, dy)), n1 =3D = n0 + dy, s1 =3D s0 + dy; break; } case MODE_HANDLE: { if (signX < 0) dx =3D Math.max(W - w0, Math.min(E - w0, dx)), w1 = =3D w0 + dx, e1 =3D e0; else if (signX > 0) dx =3D Math.max(W - e0, Math.min(E - e0, dx))= , w1 =3D w0, e1 =3D e0 + dx; if (signY < 0) dy =3D Math.max(N - n0, Math.min(S - n0, dy)), n1 = =3D n0 + dy, s1 =3D s0; else if (signY > 0) dy =3D Math.max(N - s0, Math.min(S - s0, dy))= , n1 =3D n0, s1 =3D s0 + dy; break; } case MODE_CENTER: { if (signX) w1 =3D Math.max(W, Math.min(E, w0 - dx * signX)), e1 = =3D Math.max(W, Math.min(E, e0 + dx * signX)); if (signY) n1 =3D Math.max(N, Math.min(S, n0 - dy * signY)), s1 = =3D Math.max(N, Math.min(S, s0 + dy * signY)); break; } } if (e1 < w1) { signX *=3D -1; t =3D w0, w0 =3D e0, e0 =3D t; t =3D w1, w1 =3D e1, e1 =3D t; if (type in flipX) overlay.attr("cursor", cursors[type =3D flipX[ty= pe]]); } if (s1 < n1) { signY *=3D -1; t =3D n0, n0 =3D s0, s0 =3D t; t =3D n1, n1 =3D s1, s1 =3D t; if (type in flipY) overlay.attr("cursor", cursors[type =3D flipY[ty= pe]]); } if (state.selection) selection$$1 =3D state.selection; // May be set = by brush.move! if (lockX) w1 =3D selection$$1[0][0], e1 =3D selection$$1[1][0]; if (lockY) n1 =3D selection$$1[0][1], s1 =3D selection$$1[1][1]; if (selection$$1[0][0] !=3D=3D w1 || selection$$1[0][1] !=3D=3D n1 || selection$$1[1][0] !=3D=3D e1 || selection$$1[1][1] !=3D=3D s1) { state.selection =3D [[w1, n1], [e1, s1]]; redraw.call(that); emit.brush(); } } function ended() { nopropagation$1(); if (exports.event.touches) { if (exports.event.touches.length) return; if (touchending) clearTimeout(touchending); touchending =3D setTimeout(function() { touchending =3D null; }, 50= 0); // Ghost clicks are delayed! group.on("touchmove.brush touchend.brush touchcancel.brush", null); } else { yesdrag(exports.event.view, moving); view.on("keydown.brush keyup.brush mousemove.brush mouseup.brush", = null); } group.attr("pointer-events", "all"); overlay.attr("cursor", cursors.overlay); if (state.selection) selection$$1 =3D state.selection; // May be set = by brush.move (on start)! if (empty$1(selection$$1)) state.selection =3D null, redraw.call(that= ); emit.end(); } function keydowned() { switch (exports.event.keyCode) { case 16: { // SHIFT shifting =3D signX && signY; break; } case 18: { // ALT if (mode =3D=3D=3D MODE_HANDLE) { if (signX) e0 =3D e1 - dx * signX, w0 =3D w1 + dx * signX; if (signY) s0 =3D s1 - dy * signY, n0 =3D n1 + dy * signY; mode =3D MODE_CENTER; move(); } break; } case 32: { // SPACE; takes priority over ALT if (mode =3D=3D=3D MODE_HANDLE || mode =3D=3D=3D MODE_CENTER) { if (signX < 0) e0 =3D e1 - dx; else if (signX > 0) w0 =3D w1 - = dx; if (signY < 0) s0 =3D s1 - dy; else if (signY > 0) n0 =3D n1 - = dy; mode =3D MODE_SPACE; overlay.attr("cursor", cursors.selection); move(); } break; } default: return; } noevent$1(); } function keyupped() { switch (exports.event.keyCode) { case 16: { // SHIFT if (shifting) { lockX =3D lockY =3D shifting =3D false; move(); } break; } case 18: { // ALT if (mode =3D=3D=3D MODE_CENTER) { if (signX < 0) e0 =3D e1; else if (signX > 0) w0 =3D w1; if (signY < 0) s0 =3D s1; else if (signY > 0) n0 =3D n1; mode =3D MODE_HANDLE; move(); } break; } case 32: { // SPACE if (mode =3D=3D=3D MODE_SPACE) { if (exports.event.altKey) { if (signX) e0 =3D e1 - dx * signX, w0 =3D w1 + dx * signX; if (signY) s0 =3D s1 - dy * signY, n0 =3D n1 + dy * signY; mode =3D MODE_CENTER; } else { if (signX < 0) e0 =3D e1; else if (signX > 0) w0 =3D w1; if (signY < 0) s0 =3D s1; else if (signY > 0) n0 =3D n1; mode =3D MODE_HANDLE; } overlay.attr("cursor", cursors[type]); move(); } break; } default: return; } noevent$1(); } } function initialize() { var state =3D this.__brush || {selection: null}; state.extent =3D extent.apply(this, arguments); state.dim =3D dim; return state; } brush.extent =3D function(_) { return arguments.length ? (extent =3D typeof _ =3D=3D=3D "function" ? _= : constant$4([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), brush) : exten= t; }; brush.filter =3D function(_) { return arguments.length ? (filter =3D typeof _ =3D=3D=3D "function" ? _= : constant$4(!!_), brush) : filter; }; brush.handleSize =3D function(_) { return arguments.length ? (handleSize =3D +_, brush) : handleSize; }; brush.on =3D function() { var value =3D listeners.on.apply(listeners, arguments); return value =3D=3D=3D listeners ? brush : value; }; return brush; } var cos =3D Math.cos; var sin =3D Math.sin; var pi$1 =3D Math.PI; var halfPi$1 =3D pi$1 / 2; var tau$1 =3D pi$1 * 2; var max$1 =3D Math.max; function compareValue(compare) { return function(a, b) { return compare( a.source.value + a.target.value, b.source.value + b.target.value ); }; } function chord() { var padAngle =3D 0, sortGroups =3D null, sortSubgroups =3D null, sortChords =3D null; function chord(matrix) { var n =3D matrix.length, groupSums =3D [], groupIndex =3D sequence(n), subgroupIndex =3D [], chords =3D [], groups =3D chords.groups =3D new Array(n), subgroups =3D new Array(n * n), k, x, x0, dx, i, j; // Compute the sum. k =3D 0, i =3D -1; while (++i < n) { x =3D 0, j =3D -1; while (++j < n) { x +=3D matrix[i][j]; } groupSums.push(x); subgroupIndex.push(sequence(n)); k +=3D x; } // Sort groups=E2=80=A6 if (sortGroups) groupIndex.sort(function(a, b) { return sortGroups(groupSums[a], groupSums[b]); }); // Sort subgroups=E2=80=A6 if (sortSubgroups) subgroupIndex.forEach(function(d, i) { d.sort(function(a, b) { return sortSubgroups(matrix[i][a], matrix[i][b]); }); }); // Convert the sum to scaling factor for [0, 2pi]. // TODO Allow start and end angle to be specified? // TODO Allow padding to be specified as percentage? k =3D max$1(0, tau$1 - padAngle * n) / k; dx =3D k ? padAngle : tau$1 / n; // Compute the start and end angle for each group and subgroup. // Note: Opera has a bug reordering object literal properties! x =3D 0, i =3D -1; while (++i < n) { x0 =3D x, j =3D -1; while (++j < n) { var di =3D groupIndex[i], dj =3D subgroupIndex[di][j], v =3D matrix[di][dj], a0 =3D x, a1 =3D x +=3D v * k; subgroups[dj * n + di] =3D { index: di, subindex: dj, startAngle: a0, endAngle: a1, value: v }; } groups[di] =3D { index: di, startAngle: x0, endAngle: x, value: groupSums[di] }; x +=3D dx; } // Generate chords for each (non-empty) subgroup-subgroup link. i =3D -1; while (++i < n) { j =3D i - 1; while (++j < n) { var source =3D subgroups[j * n + i], target =3D subgroups[i * n + j]; if (source.value || target.value) { chords.push(source.value < target.value ? {source: target, target: source} : {source: source, target: target}); } } } return sortChords ? chords.sort(sortChords) : chords; } chord.padAngle =3D function(_) { return arguments.length ? (padAngle =3D max$1(0, _), chord) : padAngle; }; chord.sortGroups =3D function(_) { return arguments.length ? (sortGroups =3D _, chord) : sortGroups; }; chord.sortSubgroups =3D function(_) { return arguments.length ? (sortSubgroups =3D _, chord) : sortSubgroups; }; chord.sortChords =3D function(_) { return arguments.length ? (_ =3D=3D null ? sortChords =3D null : (sortC= hords =3D compareValue(_))._ =3D _, chord) : sortChords && sortChords._; }; return chord; } var slice$2 =3D Array.prototype.slice; function constant$5(x) { return function() { return x; }; } var pi$2 =3D Math.PI, tau$2 =3D 2 * pi$2, epsilon$1 =3D 1e-6, tauEpsilon =3D tau$2 - epsilon$1; function Path() { this._x0 =3D this._y0 =3D // start of current subpath this._x1 =3D this._y1 =3D null; // end of current subpath this._ =3D ""; } function path() { return new Path; } Path.prototype =3D path.prototype =3D { constructor: Path, moveTo: function(x, y) { this._ +=3D "M" + (this._x0 =3D this._x1 =3D +x) + "," + (this._y0 =3D = this._y1 =3D +y); }, closePath: function() { if (this._x1 !=3D=3D null) { this._x1 =3D this._x0, this._y1 =3D this._y0; this._ +=3D "Z"; } }, lineTo: function(x, y) { this._ +=3D "L" + (this._x1 =3D +x) + "," + (this._y1 =3D +y); }, quadraticCurveTo: function(x1, y1, x, y) { this._ +=3D "Q" + (+x1) + "," + (+y1) + "," + (this._x1 =3D +x) + "," += (this._y1 =3D +y); }, bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._ +=3D "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + ","= + (this._x1 =3D +x) + "," + (this._y1 =3D +y); }, arcTo: function(x1, y1, x2, y2, r) { x1 =3D +x1, y1 =3D +y1, x2 =3D +x2, y2 =3D +y2, r =3D +r; var x0 =3D this._x1, y0 =3D this._y1, x21 =3D x2 - x1, y21 =3D y2 - y1, x01 =3D x0 - x1, y01 =3D y0 - y1, l01_2 =3D x01 * x01 + y01 * y01; // Is the radius negative? Error. if (r < 0) throw new Error("negative radius: " + r); // Is this path empty? Move to (x1,y1). if (this._x1 =3D=3D=3D null) { this._ +=3D "M" + (this._x1 =3D x1) + "," + (this._y1 =3D y1); } // Or, is (x1,y1) coincident with (x0,y0)? Do nothing. else if (!(l01_2 > epsilon$1)); // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear? // Equivalently, is (x1,y1) coincident with (x2,y2)? // Or, is the radius zero? Line to (x1,y1). else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$1) || !r) { this._ +=3D "L" + (this._x1 =3D x1) + "," + (this._y1 =3D y1); } // Otherwise, draw an arc! else { var x20 =3D x2 - x0, y20 =3D y2 - y0, l21_2 =3D x21 * x21 + y21 * y21, l20_2 =3D x20 * x20 + y20 * y20, l21 =3D Math.sqrt(l21_2), l01 =3D Math.sqrt(l01_2), l =3D r * Math.tan((pi$2 - Math.acos((l21_2 + l01_2 - l20_2) / (2= * l21 * l01))) / 2), t01 =3D l / l01, t21 =3D l / l21; // If the start tangent is not coincident with (x0,y0), line to. if (Math.abs(t01 - 1) > epsilon$1) { this._ +=3D "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01); } this._ +=3D "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) = + "," + (this._x1 =3D x1 + t21 * x21) + "," + (this._y1 =3D y1 + t21 * y21); } }, arc: function(x, y, r, a0, a1, ccw) { x =3D +x, y =3D +y, r =3D +r; var dx =3D r * Math.cos(a0), dy =3D r * Math.sin(a0), x0 =3D x + dx, y0 =3D y + dy, cw =3D 1 ^ ccw, da =3D ccw ? a0 - a1 : a1 - a0; // Is the radius negative? Error. if (r < 0) throw new Error("negative radius: " + r); // Is this path empty? Move to (x0,y0). if (this._x1 =3D=3D=3D null) { this._ +=3D "M" + x0 + "," + y0; } // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y= 0). else if (Math.abs(this._x1 - x0) > epsilon$1 || Math.abs(this._y1 - y0)= > epsilon$1) { this._ +=3D "L" + x0 + "," + y0; } // Is this arc empty? We=E2=80=99re done. if (!r) return; // Does the angle go the wrong way? Flip the direction. if (da < 0) da =3D da % tau$2 + tau$2; // Is this a complete circle? Draw two arcs to complete the circle. if (da > tauEpsilon) { this._ +=3D "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," += (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 =3D x0) + ",= " + (this._y1 =3D y0); } // Is this arc non-empty? Draw an arc! else if (da > epsilon$1) { this._ +=3D "A" + r + "," + r + ",0," + (+(da >=3D pi$2)) + "," + cw = + "," + (this._x1 =3D x + r * Math.cos(a1)) + "," + (this._y1 =3D y + r * M= ath.sin(a1)); } }, rect: function(x, y, w, h) { this._ +=3D "M" + (this._x0 =3D this._x1 =3D +x) + "," + (this._y0 =3D = this._y1 =3D +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z"; }, toString: function() { return this._; } }; function defaultSource(d) { return d.source; } function defaultTarget(d) { return d.target; } function defaultRadius(d) { return d.radius; } function defaultStartAngle(d) { return d.startAngle; } function defaultEndAngle(d) { return d.endAngle; } function ribbon() { var source =3D defaultSource, target =3D defaultTarget, radius =3D defaultRadius, startAngle =3D defaultStartAngle, endAngle =3D defaultEndAngle, context =3D null; function ribbon() { var buffer, argv =3D slice$2.call(arguments), s =3D source.apply(this, argv), t =3D target.apply(this, argv), sr =3D +radius.apply(this, (argv[0] =3D s, argv)), sa0 =3D startAngle.apply(this, argv) - halfPi$1, sa1 =3D endAngle.apply(this, argv) - halfPi$1, sx0 =3D sr * cos(sa0), sy0 =3D sr * sin(sa0), tr =3D +radius.apply(this, (argv[0] =3D t, argv)), ta0 =3D startAngle.apply(this, argv) - halfPi$1, ta1 =3D endAngle.apply(this, argv) - halfPi$1; if (!context) context =3D buffer =3D path(); context.moveTo(sx0, sy0); context.arc(0, 0, sr, sa0, sa1); if (sa0 !=3D=3D ta0 || sa1 !=3D=3D ta1) { // TODO sr !=3D=3D tr? context.quadraticCurveTo(0, 0, tr * cos(ta0), tr * sin(ta0)); context.arc(0, 0, tr, ta0, ta1); } context.quadraticCurveTo(0, 0, sx0, sy0); context.closePath(); if (buffer) return context =3D null, buffer + "" || null; } ribbon.radius =3D function(_) { return arguments.length ? (radius =3D typeof _ =3D=3D=3D "function" ? _= : constant$5(+_), ribbon) : radius; }; ribbon.startAngle =3D function(_) { return arguments.length ? (startAngle =3D typeof _ =3D=3D=3D "function"= ? _ : constant$5(+_), ribbon) : startAngle; }; ribbon.endAngle =3D function(_) { return arguments.length ? (endAngle =3D typeof _ =3D=3D=3D "function" ?= _ : constant$5(+_), ribbon) : endAngle; }; ribbon.source =3D function(_) { return arguments.length ? (source =3D _, ribbon) : source; }; ribbon.target =3D function(_) { return arguments.length ? (target =3D _, ribbon) : target; }; ribbon.context =3D function(_) { return arguments.length ? ((context =3D _ =3D=3D null ? null : _), ribb= on) : context; }; return ribbon; } var prefix =3D "$"; function Map() {} Map.prototype =3D map$1.prototype =3D { constructor: Map, has: function(key) { return (prefix + key) in this; }, get: function(key) { return this[prefix + key]; }, set: function(key, value) { this[prefix + key] =3D value; return this; }, remove: function(key) { var property =3D prefix + key; return property in this && delete this[property]; }, clear: function() { for (var property in this) if (property[0] =3D=3D=3D prefix) delete thi= s[property]; }, keys: function() { var keys =3D []; for (var property in this) if (property[0] =3D=3D=3D prefix) keys.push(= property.slice(1)); return keys; }, values: function() { var values =3D []; for (var property in this) if (property[0] =3D=3D=3D prefix) values.pus= h(this[property]); return values; }, entries: function() { var entries =3D []; for (var property in this) if (property[0] =3D=3D=3D prefix) entries.pu= sh({key: property.slice(1), value: this[property]}); return entries; }, size: function() { var size =3D 0; for (var property in this) if (property[0] =3D=3D=3D prefix) ++size; return size; }, empty: function() { for (var property in this) if (property[0] =3D=3D=3D prefix) return fal= se; return true; }, each: function(f) { for (var property in this) if (property[0] =3D=3D=3D prefix) f(this[pro= perty], property.slice(1), this); } }; function map$1(object, f) { var map =3D new Map; // Copy constructor. if (object instanceof Map) object.each(function(value, key) { map.set(key= , value); }); // Index array by numeric index or specified key function. else if (Array.isArray(object)) { var i =3D -1, n =3D object.length, o; if (f =3D=3D null) while (++i < n) map.set(i, object[i]); else while (++i < n) map.set(f(o =3D object[i], i, object), o); } // Convert object to map. else if (object) for (var key in object) map.set(key, object[key]); return map; } function nest() { var keys =3D [], sortKeys =3D [], sortValues, rollup, nest; function apply(array, depth, createResult, setResult) { if (depth >=3D keys.length) { if (sortValues !=3D null) array.sort(sortValues); return rollup !=3D null ? rollup(array) : array; } var i =3D -1, n =3D array.length, key =3D keys[depth++], keyValue, value, valuesByKey =3D map$1(), values, result =3D createResult(); while (++i < n) { if (values =3D valuesByKey.get(keyValue =3D key(value =3D array[i]) += "")) { values.push(value); } else { valuesByKey.set(keyValue, [value]); } } valuesByKey.each(function(values, key) { setResult(result, key, apply(values, depth, createResult, setResult)); }); return result; } function entries(map, depth) { if (++depth > keys.length) return map; var array, sortKey =3D sortKeys[depth - 1]; if (rollup !=3D null && depth >=3D keys.length) array =3D map.entries(); else array =3D [], map.each(function(v, k) { array.push({key: k, values= : entries(v, depth)}); }); return sortKey !=3D null ? array.sort(function(a, b) { return sortKey(a= =2Ekey, b.key); }) : array; } return nest =3D { object: function(array) { return apply(array, 0, createObject, setObjec= t); }, map: function(array) { return apply(array, 0, createMap, setMap); }, entries: function(array) { return entries(apply(array, 0, createMap, se= tMap), 0); }, key: function(d) { keys.push(d); return nest; }, sortKeys: function(order) { sortKeys[keys.length - 1] =3D order; return= nest; }, sortValues: function(order) { sortValues =3D order; return nest; }, rollup: function(f) { rollup =3D f; return nest; } }; } function createObject() { return {}; } function setObject(object, key, value) { object[key] =3D value; } function createMap() { return map$1(); } function setMap(map, key, value) { map.set(key, value); } function Set() {} var proto =3D map$1.prototype; Set.prototype =3D set$2.prototype =3D { constructor: Set, has: proto.has, add: function(value) { value +=3D ""; this[prefix + value] =3D value; return this; }, remove: proto.remove, clear: proto.clear, values: proto.keys, size: proto.size, empty: proto.empty, each: proto.each }; function set$2(object, f) { var set =3D new Set; // Copy constructor. if (object instanceof Set) object.each(function(value) { set.add(value); = }); // Otherwise, assume it=E2=80=99s an array. else if (object) { var i =3D -1, n =3D object.length; if (f =3D=3D null) while (++i < n) set.add(object[i]); else while (++i < n) set.add(f(object[i], i, object)); } return set; } function keys(map) { var keys =3D []; for (var key in map) keys.push(key); return keys; } function values(map) { var values =3D []; for (var key in map) values.push(map[key]); return values; } function entries(map) { var entries =3D []; for (var key in map) entries.push({key: key, value: map[key]}); return entries; } var array$2 =3D Array.prototype; var slice$3 =3D array$2.slice; function ascending$2(a, b) { return a - b; } function area(ring) { var i =3D 0, n =3D ring.length, area =3D ring[n - 1][1] * ring[0][0] - ri= ng[n - 1][0] * ring[0][1]; while (++i < n) area +=3D ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * = ring[i][1]; return area; } function constant$6(x) { return function() { return x; }; } function contains(ring, hole) { var i =3D -1, n =3D hole.length, c; while (++i < n) if (c =3D ringContains(ring, hole[i])) return c; return 0; } function ringContains(ring, point) { var x =3D point[0], y =3D point[1], contains =3D -1; for (var i =3D 0, n =3D ring.length, j =3D n - 1; i < n; j =3D i++) { var pi =3D ring[i], xi =3D pi[0], yi =3D pi[1], pj =3D ring[j], xj =3D = pj[0], yj =3D pj[1]; if (segmentContains(pi, pj, point)) return 0; if (((yi > y) !=3D=3D (yj > y)) && ((x < (xj - xi) * (y - yi) / (yj - y= i) + xi))) contains =3D -contains; } return contains; } function segmentContains(a, b, c) { var i; return collinear(a, b, c) && within(a[i =3D +(a[0] =3D=3D=3D b[0])= ], c[i], b[i]); } function collinear(a, b, c) { return (b[0] - a[0]) * (c[1] - a[1]) =3D=3D=3D (c[0] - a[0]) * (b[1] - a[= 1]); } function within(p, q, r) { return p <=3D q && q <=3D r || r <=3D q && q <=3D p; } function noop$1() {} var cases =3D [ [], [[[1.0, 1.5], [0.5, 1.0]]], [[[1.5, 1.0], [1.0, 1.5]]], [[[1.5, 1.0], [0.5, 1.0]]], [[[1.0, 0.5], [1.5, 1.0]]], [[[1.0, 1.5], [0.5, 1.0]], [[1.0, 0.5], [1.5, 1.0]]], [[[1.0, 0.5], [1.0, 1.5]]], [[[1.0, 0.5], [0.5, 1.0]]], [[[0.5, 1.0], [1.0, 0.5]]], [[[1.0, 1.5], [1.0, 0.5]]], [[[0.5, 1.0], [1.0, 0.5]], [[1.5, 1.0], [1.0, 1.5]]], [[[1.5, 1.0], [1.0, 0.5]]], [[[0.5, 1.0], [1.5, 1.0]]], [[[1.0, 1.5], [1.5, 1.0]]], [[[0.5, 1.0], [1.0, 1.5]]], [] ]; function contours() { var dx =3D 1, dy =3D 1, threshold$$1 =3D thresholdSturges, smooth =3D smoothLinear; function contours(values) { var tz =3D threshold$$1(values); // Convert number of thresholds into uniform thresholds. if (!Array.isArray(tz)) { var domain =3D extent(values), start =3D domain[0], stop =3D domain[1= ]; tz =3D tickStep(start, stop, tz); tz =3D sequence(Math.floor(start / tz) * tz, Math.floor(stop / tz) * = tz, tz); } else { tz =3D tz.slice().sort(ascending$2); } return tz.map(function(value) { return contour(values, value); }); } // Accumulate, smooth contour rings, assign holes to exterior rings. // Based on https://github.com/mbostock/shapefile/blob/v0.6.2/shp/polygon= =2Ejs function contour(values, value) { var polygons =3D [], holes =3D []; isorings(values, value, function(ring) { smooth(ring, values, value); if (area(ring) > 0) polygons.push([ring]); else holes.push(ring); }); holes.forEach(function(hole) { for (var i =3D 0, n =3D polygons.length, polygon; i < n; ++i) { if (contains((polygon =3D polygons[i])[0], hole) !=3D=3D -1) { polygon.push(hole); return; } } }); return { type: "MultiPolygon", value: value, coordinates: polygons }; } // Marching squares with isolines stitched into rings. // Based on https://github.com/topojson/topojson-client/blob/v3.0.0/src/s= titch.js function isorings(values, value, callback) { var fragmentByStart =3D new Array, fragmentByEnd =3D new Array, x, y, t0, t1, t2, t3; // Special case for the first row (y =3D -1, t2 =3D t3 =3D 0). x =3D y =3D -1; t1 =3D values[0] >=3D value; cases[t1 << 1].forEach(stitch); while (++x < dx - 1) { t0 =3D t1, t1 =3D values[x + 1] >=3D value; cases[t0 | t1 << 1].forEach(stitch); } cases[t1 << 0].forEach(stitch); // General case for the intermediate rows. while (++y < dy - 1) { x =3D -1; t1 =3D values[y * dx + dx] >=3D value; t2 =3D values[y * dx] >=3D value; cases[t1 << 1 | t2 << 2].forEach(stitch); while (++x < dx - 1) { t0 =3D t1, t1 =3D values[y * dx + dx + x + 1] >=3D value; t3 =3D t2, t2 =3D values[y * dx + x + 1] >=3D value; cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch); } cases[t1 | t2 << 3].forEach(stitch); } // Special case for the last row (y =3D dy - 1, t0 =3D t1 =3D 0). x =3D -1; t2 =3D values[y * dx] >=3D value; cases[t2 << 2].forEach(stitch); while (++x < dx - 1) { t3 =3D t2, t2 =3D values[y * dx + x + 1] >=3D value; cases[t2 << 2 | t3 << 3].forEach(stitch); } cases[t2 << 3].forEach(stitch); function stitch(line) { var start =3D [line[0][0] + x, line[0][1] + y], end =3D [line[1][0] + x, line[1][1] + y], startIndex =3D index(start), endIndex =3D index(end), f, g; if (f =3D fragmentByEnd[startIndex]) { if (g =3D fragmentByStart[endIndex]) { delete fragmentByEnd[f.end]; delete fragmentByStart[g.start]; if (f =3D=3D=3D g) { f.ring.push(end); callback(f.ring); } else { fragmentByStart[f.start] =3D fragmentByEnd[g.end] =3D {start: f= =2Estart, end: g.end, ring: f.ring.concat(g.ring)}; } } else { delete fragmentByEnd[f.end]; f.ring.push(end); fragmentByEnd[f.end =3D endIndex] =3D f; } } else if (f =3D fragmentByStart[endIndex]) { if (g =3D fragmentByEnd[startIndex]) { delete fragmentByStart[f.start]; delete fragmentByEnd[g.end]; if (f =3D=3D=3D g) { f.ring.push(end); callback(f.ring); } else { fragmentByStart[g.start] =3D fragmentByEnd[f.end] =3D {start: g= =2Estart, end: f.end, ring: g.ring.concat(f.ring)}; } } else { delete fragmentByStart[f.start]; f.ring.unshift(start); fragmentByStart[f.start =3D startIndex] =3D f; } } else { fragmentByStart[startIndex] =3D fragmentByEnd[endIndex] =3D {start:= startIndex, end: endIndex, ring: [start, end]}; } } } function index(point) { return point[0] * 2 + point[1] * (dx + 1) * 4; } function smoothLinear(ring, values, value) { ring.forEach(function(point) { var x =3D point[0], y =3D point[1], xt =3D x | 0, yt =3D y | 0, v0, v1 =3D values[yt * dx + xt]; if (x > 0 && x < dx && xt =3D=3D=3D x) { v0 =3D values[yt * dx + xt - 1]; point[0] =3D x + (value - v0) / (v1 - v0) - 0.5; } if (y > 0 && y < dy && yt =3D=3D=3D y) { v0 =3D values[(yt - 1) * dx + xt]; point[1] =3D y + (value - v0) / (v1 - v0) - 0.5; } }); } contours.contour =3D contour; contours.size =3D function(_) { if (!arguments.length) return [dx, dy]; var _0 =3D Math.ceil(_[0]), _1 =3D Math.ceil(_[1]); if (!(_0 > 0) || !(_1 > 0)) throw new Error("invalid size"); return dx =3D _0, dy =3D _1, contours; }; contours.thresholds =3D function(_) { return arguments.length ? (threshold$$1 =3D typeof _ =3D=3D=3D "functio= n" ? _ : Array.isArray(_) ? constant$6(slice$3.call(_)) : constant$6(_), co= ntours) : threshold$$1; }; contours.smooth =3D function(_) { return arguments.length ? (smooth =3D _ ? smoothLinear : noop$1, contou= rs) : smooth =3D=3D=3D smoothLinear; }; return contours; } // TODO Optimize edge cases. // TODO Optimize index calculation. // TODO Optimize arguments. function blurX(source, target, r) { var n =3D source.width, m =3D source.height, w =3D (r << 1) + 1; for (var j =3D 0; j < m; ++j) { for (var i =3D 0, sr =3D 0; i < n + r; ++i) { if (i < n) { sr +=3D source.data[i + j * n]; } if (i >=3D r) { if (i >=3D w) { sr -=3D source.data[i - w + j * n]; } target.data[i - r + j * n] =3D sr / Math.min(i + 1, n - 1 + w - i, = w); } } } } // TODO Optimize edge cases. // TODO Optimize index calculation. // TODO Optimize arguments. function blurY(source, target, r) { var n =3D source.width, m =3D source.height, w =3D (r << 1) + 1; for (var i =3D 0; i < n; ++i) { for (var j =3D 0, sr =3D 0; j < m + r; ++j) { if (j < m) { sr +=3D source.data[i + j * n]; } if (j >=3D r) { if (j >=3D w) { sr -=3D source.data[i + (j - w) * n]; } target.data[i + (j - r) * n] =3D sr / Math.min(j + 1, m - 1 + w - j= , w); } } } } function defaultX(d) { return d[0]; } function defaultY(d) { return d[1]; } function defaultWeight() { return 1; } function density() { var x =3D defaultX, y =3D defaultY, weight =3D defaultWeight, dx =3D 960, dy =3D 500, r =3D 20, // blur radius k =3D 2, // log2(grid cell size) o =3D r * 3, // grid offset, to pad for blur n =3D (dx + o * 2) >> k, // grid width m =3D (dy + o * 2) >> k, // grid height threshold$$1 =3D constant$6(20); function density(data) { var values0 =3D new Float32Array(n * m), values1 =3D new Float32Array(n * m); data.forEach(function(d, i, data) { var xi =3D (+x(d, i, data) + o) >> k, yi =3D (+y(d, i, data) + o) >> k, wi =3D +weight(d, i, data); if (xi >=3D 0 && xi < n && yi >=3D 0 && yi < m) { values0[xi + yi * n] +=3D wi; } }); // TODO Optimize. blurX({width: n, height: m, data: values0}, {width: n, height: m, data:= values1}, r >> k); blurY({width: n, height: m, data: values1}, {width: n, height: m, data:= values0}, r >> k); blurX({width: n, height: m, data: values0}, {width: n, height: m, data:= values1}, r >> k); blurY({width: n, height: m, data: values1}, {width: n, height: m, data:= values0}, r >> k); blurX({width: n, height: m, data: values0}, {width: n, height: m, data:= values1}, r >> k); blurY({width: n, height: m, data: values1}, {width: n, height: m, data:= values0}, r >> k); var tz =3D threshold$$1(values0); // Convert number of thresholds into uniform thresholds. if (!Array.isArray(tz)) { var stop =3D max(values0); tz =3D tickStep(0, stop, tz); tz =3D sequence(0, Math.floor(stop / tz) * tz, tz); tz.shift(); } return contours() .thresholds(tz) .size([n, m]) (values0) .map(transform); } function transform(geometry) { geometry.value *=3D Math.pow(2, -2 * k); // Density in points per squar= e pixel. geometry.coordinates.forEach(transformPolygon); return geometry; } function transformPolygon(coordinates) { coordinates.forEach(transformRing); } function transformRing(coordinates) { coordinates.forEach(transformPoint); } // TODO Optimize. function transformPoint(coordinates) { coordinates[0] =3D coordinates[0] * Math.pow(2, k) - o; coordinates[1] =3D coordinates[1] * Math.pow(2, k) - o; } function resize() { o =3D r * 3; n =3D (dx + o * 2) >> k; m =3D (dy + o * 2) >> k; return density; } density.x =3D function(_) { return arguments.length ? (x =3D typeof _ =3D=3D=3D "function" ? _ : co= nstant$6(+_), density) : x; }; density.y =3D function(_) { return arguments.length ? (y =3D typeof _ =3D=3D=3D "function" ? _ : co= nstant$6(+_), density) : y; }; density.weight =3D function(_) { return arguments.length ? (weight =3D typeof _ =3D=3D=3D "function" ? _= : constant$6(+_), density) : weight; }; density.size =3D function(_) { if (!arguments.length) return [dx, dy]; var _0 =3D Math.ceil(_[0]), _1 =3D Math.ceil(_[1]); if (!(_0 >=3D 0) && !(_0 >=3D 0)) throw new Error("invalid size"); return dx =3D _0, dy =3D _1, resize(); }; density.cellSize =3D function(_) { if (!arguments.length) return 1 << k; if (!((_ =3D +_) >=3D 1)) throw new Error("invalid cell size"); return k =3D Math.floor(Math.log(_) / Math.LN2), resize(); }; density.thresholds =3D function(_) { return arguments.length ? (threshold$$1 =3D typeof _ =3D=3D=3D "functio= n" ? _ : Array.isArray(_) ? constant$6(slice$3.call(_)) : constant$6(_), de= nsity) : threshold$$1; }; density.bandwidth =3D function(_) { if (!arguments.length) return Math.sqrt(r * (r + 1)); if (!((_ =3D +_) >=3D 0)) throw new Error("invalid bandwidth"); return r =3D Math.round((Math.sqrt(4 * _ * _ + 1) - 1) / 2), resize(); }; return density; } var EOL =3D {}, EOF =3D {}, QUOTE =3D 34, NEWLINE =3D 10, RETURN =3D 13; function objectConverter(columns) { return new Function("d", "return {" + columns.map(function(name, i) { return JSON.stringify(name) + ": d[" + i + "]"; }).join(",") + "}"); } function customConverter(columns, f) { var object =3D objectConverter(columns); return function(row, i) { return f(object(row), i, columns); }; } // Compute unique columns in order of discovery. function inferColumns(rows) { var columnSet =3D Object.create(null), columns =3D []; rows.forEach(function(row) { for (var column in row) { if (!(column in columnSet)) { columns.push(columnSet[column] =3D column); } } }); return columns; } function pad(value, width) { var s =3D value + "", length =3D s.length; return length < width ? new Array(width - length + 1).join(0) + s : s; } function formatYear(year) { return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4); } function formatDate(date) { var hours =3D date.getUTCHours(), minutes =3D date.getUTCMinutes(), seconds =3D date.getUTCSeconds(), milliseconds =3D date.getUTCMilliseconds(); return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear(), 4) + "-" + pad(date.getUTCMonth()= + 1, 2) + "-" + pad(date.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" += pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(s= econds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : ""); } function dsvFormat(delimiter) { var reFormat =3D new RegExp("[\"" + delimiter + "\n\r]"), DELIMITER =3D delimiter.charCodeAt(0); function parse(text, f) { var convert, columns, rows =3D parseRows(text, function(row, i) { if (convert) return convert(row, i - 1); columns =3D row, convert =3D f ? customConverter(row, f) : objectConv= erter(row); }); rows.columns =3D columns || []; return rows; } function parseRows(text, f) { var rows =3D [], // output rows N =3D text.length, I =3D 0, // current character index n =3D 0, // current line number t, // current token eof =3D N <=3D 0, // current token followed by EOF? eol =3D false; // current token followed by EOL? // Strip the trailing newline. if (text.charCodeAt(N - 1) =3D=3D=3D NEWLINE) --N; if (text.charCodeAt(N - 1) =3D=3D=3D RETURN) --N; function token() { if (eof) return EOF; if (eol) return eol =3D false, EOL; // Unescape quotes. var i, j =3D I, c; if (text.charCodeAt(j) =3D=3D=3D QUOTE) { while (I++ < N && text.charCodeAt(I) !=3D=3D QUOTE || text.charCode= At(++I) =3D=3D=3D QUOTE); if ((i =3D I) >=3D N) eof =3D true; else if ((c =3D text.charCodeAt(I++)) =3D=3D=3D NEWLINE) eol =3D tr= ue; else if (c =3D=3D=3D RETURN) { eol =3D true; if (text.charCodeAt(I)= =3D=3D=3D NEWLINE) ++I; } return text.slice(j + 1, i - 1).replace(/""/g, "\""); } // Find next delimiter or newline. while (I < N) { if ((c =3D text.charCodeAt(i =3D I++)) =3D=3D=3D NEWLINE) eol =3D t= rue; else if (c =3D=3D=3D RETURN) { eol =3D true; if (text.charCodeAt(I)= =3D=3D=3D NEWLINE) ++I; } else if (c !=3D=3D DELIMITER) continue; return text.slice(j, i); } // Return last token before EOF. return eof =3D true, text.slice(j, N); } while ((t =3D token()) !=3D=3D EOF) { var row =3D []; while (t !=3D=3D EOL && t !=3D=3D EOF) row.push(t), t =3D token(); if (f && (row =3D f(row, n++)) =3D=3D null) continue; rows.push(row); } return rows; } function preformatBody(rows, columns) { return rows.map(function(row) { return columns.map(function(column) { return formatValue(row[column]); }).join(delimiter); }); } function format(rows, columns) { if (columns =3D=3D null) columns =3D inferColumns(rows); return [columns.map(formatValue).join(delimiter)].concat(preformatBody(= rows, columns)).join("\n"); } function formatBody(rows, columns) { if (columns =3D=3D null) columns =3D inferColumns(rows); return preformatBody(rows, columns).join("\n"); } function formatRows(rows) { return rows.map(formatRow).join("\n"); } function formatRow(row) { return row.map(formatValue).join(delimiter); } function formatValue(value) { return value =3D=3D null ? "" : value instanceof Date ? formatDate(value) : reFormat.test(value +=3D "") ? "\"" + value.replace(/"/g, "\"\"")= + "\"" : value; } return { parse: parse, parseRows: parseRows, format: format, formatBody: formatBody, formatRows: formatRows }; } var csv =3D dsvFormat(","); var csvParse =3D csv.parse; var csvParseRows =3D csv.parseRows; var csvFormat =3D csv.format; var csvFormatBody =3D csv.formatBody; var csvFormatRows =3D csv.formatRows; var tsv =3D dsvFormat("\t"); var tsvParse =3D tsv.parse; var tsvParseRows =3D tsv.parseRows; var tsvFormat =3D tsv.format; var tsvFormatBody =3D tsv.formatBody; var tsvFormatRows =3D tsv.formatRows; function autoType(object) { for (var key in object) { var value =3D object[key].trim(), number; if (!value) value =3D null; else if (value =3D=3D=3D "true") value =3D true; else if (value =3D=3D=3D "false") value =3D false; else if (value =3D=3D=3D "NaN") value =3D NaN; else if (!isNaN(number =3D +value)) value =3D number; else if (/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d= {3})?)?(Z|[-+]\d{2}:\d{2})?)?$/.test(value)) value =3D new Date(value); else continue; object[key] =3D value; } return object; } function responseBlob(response) { if (!response.ok) throw new Error(response.status + " " + response.status= Text); return response.blob(); } function blob(input, init) { return fetch(input, init).then(responseBlob); } function responseArrayBuffer(response) { if (!response.ok) throw new Error(response.status + " " + response.status= Text); return response.arrayBuffer(); } function buffer(input, init) { return fetch(input, init).then(responseArrayBuffer); } function responseText(response) { if (!response.ok) throw new Error(response.status + " " + response.status= Text); return response.text(); } function text(input, init) { return fetch(input, init).then(responseText); } function dsvParse(parse) { return function(input, init, row) { if (arguments.length =3D=3D=3D 2 && typeof init =3D=3D=3D "function") r= ow =3D init, init =3D undefined; return text(input, init).then(function(response) { return parse(response, row); }); }; } function dsv(delimiter, input, init, row) { if (arguments.length =3D=3D=3D 3 && typeof init =3D=3D=3D "function") row= =3D init, init =3D undefined; var format =3D dsvFormat(delimiter); return text(input, init).then(function(response) { return format.parse(response, row); }); } var csv$1 =3D dsvParse(csvParse); var tsv$1 =3D dsvParse(tsvParse); function image(input, init) { return new Promise(function(resolve, reject) { var image =3D new Image; for (var key in init) image[key] =3D init[key]; image.onerror =3D reject; image.onload =3D function() { resolve(image); }; image.src =3D input; }); } function responseJson(response) { if (!response.ok) throw new Error(response.status + " " + response.status= Text); return response.json(); } function json(input, init) { return fetch(input, init).then(responseJson); } function parser(type) { return function(input, init) { return text(input, init).then(function(text$$1) { return (new DOMParser).parseFromString(text$$1, type); }); }; } var xml =3D parser("application/xml"); var html =3D parser("text/html"); var svg =3D parser("image/svg+xml"); function center$1(x, y) { var nodes; if (x =3D=3D null) x =3D 0; if (y =3D=3D null) y =3D 0; function force() { var i, n =3D nodes.length, node, sx =3D 0, sy =3D 0; for (i =3D 0; i < n; ++i) { node =3D nodes[i], sx +=3D node.x, sy +=3D node.y; } for (sx =3D sx / n - x, sy =3D sy / n - y, i =3D 0; i < n; ++i) { node =3D nodes[i], node.x -=3D sx, node.y -=3D sy; } } force.initialize =3D function(_) { nodes =3D _; }; force.x =3D function(_) { return arguments.length ? (x =3D +_, force) : x; }; force.y =3D function(_) { return arguments.length ? (y =3D +_, force) : y; }; return force; } function constant$7(x) { return function() { return x; }; } function jiggle() { return (Math.random() - 0.5) * 1e-6; } function tree_add(d) { var x =3D +this._x.call(null, d), y =3D +this._y.call(null, d); return add(this.cover(x, y), x, y, d); } function add(tree, x, y, d) { if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points var parent, node =3D tree._root, leaf =3D {data: d}, x0 =3D tree._x0, y0 =3D tree._y0, x1 =3D tree._x1, y1 =3D tree._y1, xm, ym, xp, yp, right, bottom, i, j; // If the tree is empty, initialize the root as a leaf. if (!node) return tree._root =3D leaf, tree; // Find the existing leaf for the new point, or add it. while (node.length) { if (right =3D x >=3D (xm =3D (x0 + x1) / 2)) x0 =3D xm; else x1 =3D xm; if (bottom =3D y >=3D (ym =3D (y0 + y1) / 2)) y0 =3D ym; else y1 =3D ym; if (parent =3D node, !(node =3D node[i =3D bottom << 1 | right])) retur= n parent[i] =3D leaf, tree; } // Is the new point is exactly coincident with the existing point? xp =3D +tree._x.call(null, node.data); yp =3D +tree._y.call(null, node.data); if (x =3D=3D=3D xp && y =3D=3D=3D yp) return leaf.next =3D node, parent ?= parent[i] =3D leaf : tree._root =3D leaf, tree; // Otherwise, split the leaf node until the old and new point are separat= ed. do { parent =3D parent ? parent[i] =3D new Array(4) : tree._root =3D new Arr= ay(4); if (right =3D x >=3D (xm =3D (x0 + x1) / 2)) x0 =3D xm; else x1 =3D xm; if (bottom =3D y >=3D (ym =3D (y0 + y1) / 2)) y0 =3D ym; else y1 =3D ym; } while ((i =3D bottom << 1 | right) =3D=3D=3D (j =3D (yp >=3D ym) << 1 |= (xp >=3D xm))); return parent[j] =3D node, parent[i] =3D leaf, tree; } function addAll(data) { var d, i, n =3D data.length, x, y, xz =3D new Array(n), yz =3D new Array(n), x0 =3D Infinity, y0 =3D Infinity, x1 =3D -Infinity, y1 =3D -Infinity; // Compute the points and their extent. for (i =3D 0; i < n; ++i) { if (isNaN(x =3D +this._x.call(null, d =3D data[i])) || isNaN(y =3D +thi= s._y.call(null, d))) continue; xz[i] =3D x; yz[i] =3D y; if (x < x0) x0 =3D x; if (x > x1) x1 =3D x; if (y < y0) y0 =3D y; if (y > y1) y1 =3D y; } // If there were no (valid) points, abort. if (x0 > x1 || y0 > y1) return this; // Expand the tree to cover the new points. this.cover(x0, y0).cover(x1, y1); // Add the new points. for (i =3D 0; i < n; ++i) { add(this, xz[i], yz[i], data[i]); } return this; } function tree_cover(x, y) { if (isNaN(x =3D +x) || isNaN(y =3D +y)) return this; // ignore invalid po= ints var x0 =3D this._x0, y0 =3D this._y0, x1 =3D this._x1, y1 =3D this._y1; // If the quadtree has no extent, initialize them. // Integer extent are necessary so that if we later double the extent, // the existing quadrant boundaries don=E2=80=99t change due to floating = point error! if (isNaN(x0)) { x1 =3D (x0 =3D Math.floor(x)) + 1; y1 =3D (y0 =3D Math.floor(y)) + 1; } // Otherwise, double repeatedly to cover. else { var z =3D x1 - x0, node =3D this._root, parent, i; while (x0 > x || x >=3D x1 || y0 > y || y >=3D y1) { i =3D (y < y0) << 1 | (x < x0); parent =3D new Array(4), parent[i] =3D node, node =3D parent, z *=3D = 2; switch (i) { case 0: x1 =3D x0 + z, y1 =3D y0 + z; break; case 1: x0 =3D x1 - z, y1 =3D y0 + z; break; case 2: x1 =3D x0 + z, y0 =3D y1 - z; break; case 3: x0 =3D x1 - z, y0 =3D y1 - z; break; } } if (this._root && this._root.length) this._root =3D node; } this._x0 =3D x0; this._y0 =3D y0; this._x1 =3D x1; this._y1 =3D y1; return this; } function tree_data() { var data =3D []; this.visit(function(node) { if (!node.length) do data.push(node.data); while (node =3D node.next) }); return data; } function tree_extent(_) { return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, thi= s._y1]]; } function Quad(node, x0, y0, x1, y1) { this.node =3D node; this.x0 =3D x0; this.y0 =3D y0; this.x1 =3D x1; this.y1 =3D y1; } function tree_find(x, y, radius) { var data, x0 =3D this._x0, y0 =3D this._y0, x1, y1, x2, y2, x3 =3D this._x1, y3 =3D this._y1, quads =3D [], node =3D this._root, q, i; if (node) quads.push(new Quad(node, x0, y0, x3, y3)); if (radius =3D=3D null) radius =3D Infinity; else { x0 =3D x - radius, y0 =3D y - radius; x3 =3D x + radius, y3 =3D y + radius; radius *=3D radius; } while (q =3D quads.pop()) { // Stop searching if this quadrant can=E2=80=99t contain a closer node. if (!(node =3D q.node) || (x1 =3D q.x0) > x3 || (y1 =3D q.y0) > y3 || (x2 =3D q.x1) < x0 || (y2 =3D q.y1) < y0) continue; // Bisect the current quadrant. if (node.length) { var xm =3D (x1 + x2) / 2, ym =3D (y1 + y2) / 2; quads.push( new Quad(node[3], xm, ym, x2, y2), new Quad(node[2], x1, ym, xm, y2), new Quad(node[1], xm, y1, x2, ym), new Quad(node[0], x1, y1, xm, ym) ); // Visit the closest quadrant first. if (i =3D (y >=3D ym) << 1 | (x >=3D xm)) { q =3D quads[quads.length - 1]; quads[quads.length - 1] =3D quads[quads.length - 1 - i]; quads[quads.length - 1 - i] =3D q; } } // Visit this point. (Visiting coincident points isn=E2=80=99t necessar= y!) else { var dx =3D x - +this._x.call(null, node.data), dy =3D y - +this._y.call(null, node.data), d2 =3D dx * dx + dy * dy; if (d2 < radius) { var d =3D Math.sqrt(radius =3D d2); x0 =3D x - d, y0 =3D y - d; x3 =3D x + d, y3 =3D y + d; data =3D node.data; } } } return data; } function tree_remove(d) { if (isNaN(x =3D +this._x.call(null, d)) || isNaN(y =3D +this._y.call(null= , d))) return this; // ignore invalid points var parent, node =3D this._root, retainer, previous, next, x0 =3D this._x0, y0 =3D this._y0, x1 =3D this._x1, y1 =3D this._y1, x, y, xm, ym, right, bottom, i, j; // If the tree is empty, initialize the root as a leaf. if (!node) return this; // Find the leaf node for the point. // While descending, also retain the deepest parent with a non-removed si= bling. if (node.length) while (true) { if (right =3D x >=3D (xm =3D (x0 + x1) / 2)) x0 =3D xm; else x1 =3D xm; if (bottom =3D y >=3D (ym =3D (y0 + y1) / 2)) y0 =3D ym; else y1 =3D ym; if (!(parent =3D node, node =3D node[i =3D bottom << 1 | right])) retur= n this; if (!node.length) break; if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) = retainer =3D parent, j =3D i; } // Find the point to remove. while (node.data !=3D=3D d) if (!(previous =3D node, node =3D node.next))= return this; if (next =3D node.next) delete node.next; // If there are multiple coincident points, remove just the point. if (previous) return (next ? previous.next =3D next : delete previous.nex= t), this; // If this is the root point, remove it. if (!parent) return this._root =3D next, this; // Remove this leaf. next ? parent[i] =3D next : delete parent[i]; // If the parent now contains exactly one leaf, collapse superfluous pare= nts. if ((node =3D parent[0] || parent[1] || parent[2] || parent[3]) && node =3D=3D=3D (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) { if (retainer) retainer[j] =3D node; else this._root =3D node; } return this; } function removeAll(data) { for (var i =3D 0, n =3D data.length; i < n; ++i) this.remove(data[i]); return this; } function tree_root() { return this._root; } function tree_size() { var size =3D 0; this.visit(function(node) { if (!node.length) do ++size; while (node =3D node.next) }); return size; } function tree_visit(callback) { var quads =3D [], q, node =3D this._root, child, x0, y0, x1, y1; if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y= 1)); while (q =3D quads.pop()) { if (!callback(node =3D q.node, x0 =3D q.x0, y0 =3D q.y0, x1 =3D q.x1, y= 1 =3D q.y1) && node.length) { var xm =3D (x0 + x1) / 2, ym =3D (y0 + y1) / 2; if (child =3D node[3]) quads.push(new Quad(child, xm, ym, x1, y1)); if (child =3D node[2]) quads.push(new Quad(child, x0, ym, xm, y1)); if (child =3D node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); if (child =3D node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); } } return this; } function tree_visitAfter(callback) { var quads =3D [], next =3D [], q; if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this.= _x1, this._y1)); while (q =3D quads.pop()) { var node =3D q.node; if (node.length) { var child, x0 =3D q.x0, y0 =3D q.y0, x1 =3D q.x1, y1 =3D q.y1, xm =3D= (x0 + x1) / 2, ym =3D (y0 + y1) / 2; if (child =3D node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); if (child =3D node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); if (child =3D node[2]) quads.push(new Quad(child, x0, ym, xm, y1)); if (child =3D node[3]) quads.push(new Quad(child, xm, ym, x1, y1)); } next.push(q); } while (q =3D next.pop()) { callback(q.node, q.x0, q.y0, q.x1, q.y1); } return this; } function defaultX$1(d) { return d[0]; } function tree_x(_) { return arguments.length ? (this._x =3D _, this) : this._x; } function defaultY$1(d) { return d[1]; } function tree_y(_) { return arguments.length ? (this._y =3D _, this) : this._y; } function quadtree(nodes, x, y) { var tree =3D new Quadtree(x =3D=3D null ? defaultX$1 : x, y =3D=3D null ?= defaultY$1 : y, NaN, NaN, NaN, NaN); return nodes =3D=3D null ? tree : tree.addAll(nodes); } function Quadtree(x, y, x0, y0, x1, y1) { this._x =3D x; this._y =3D y; this._x0 =3D x0; this._y0 =3D y0; this._x1 =3D x1; this._y1 =3D y1; this._root =3D undefined; } function leaf_copy(leaf) { var copy =3D {data: leaf.data}, next =3D copy; while (leaf =3D leaf.next) next =3D next.next =3D {data: leaf.data}; return copy; } var treeProto =3D quadtree.prototype =3D Quadtree.prototype; treeProto.copy =3D function() { var copy =3D new Quadtree(this._x, this._y, this._x0, this._y0, this._x1,= this._y1), node =3D this._root, nodes, child; if (!node) return copy; if (!node.length) return copy._root =3D leaf_copy(node), copy; nodes =3D [{source: node, target: copy._root =3D new Array(4)}]; while (node =3D nodes.pop()) { for (var i =3D 0; i < 4; ++i) { if (child =3D node.source[i]) { if (child.length) nodes.push({source: child, target: node.target[i]= =3D new Array(4)}); else node.target[i] =3D leaf_copy(child); } } } return copy; }; treeProto.add =3D tree_add; treeProto.addAll =3D addAll; treeProto.cover =3D tree_cover; treeProto.data =3D tree_data; treeProto.extent =3D tree_extent; treeProto.find =3D tree_find; treeProto.remove =3D tree_remove; treeProto.removeAll =3D removeAll; treeProto.root =3D tree_root; treeProto.size =3D tree_size; treeProto.visit =3D tree_visit; treeProto.visitAfter =3D tree_visitAfter; treeProto.x =3D tree_x; treeProto.y =3D tree_y; function x(d) { return d.x + d.vx; } function y(d) { return d.y + d.vy; } function collide(radius) { var nodes, radii, strength =3D 1, iterations =3D 1; if (typeof radius !=3D=3D "function") radius =3D constant$7(radius =3D=3D= null ? 1 : +radius); function force() { var i, n =3D nodes.length, tree, node, xi, yi, ri, ri2; for (var k =3D 0; k < iterations; ++k) { tree =3D quadtree(nodes, x, y).visitAfter(prepare); for (i =3D 0; i < n; ++i) { node =3D nodes[i]; ri =3D radii[node.index], ri2 =3D ri * ri; xi =3D node.x + node.vx; yi =3D node.y + node.vy; tree.visit(apply); } } function apply(quad, x0, y0, x1, y1) { var data =3D quad.data, rj =3D quad.r, r =3D ri + rj; if (data) { if (data.index > node.index) { var x =3D xi - data.x - data.vx, y =3D yi - data.y - data.vy, l =3D x * x + y * y; if (l < r * r) { if (x =3D=3D=3D 0) x =3D jiggle(), l +=3D x * x; if (y =3D=3D=3D 0) y =3D jiggle(), l +=3D y * y; l =3D (r - (l =3D Math.sqrt(l))) / l * strength; node.vx +=3D (x *=3D l) * (r =3D (rj *=3D rj) / (ri2 + rj)); node.vy +=3D (y *=3D l) * r; data.vx -=3D x * (r =3D 1 - r); data.vy -=3D y * r; } } return; } return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r; } } function prepare(quad) { if (quad.data) return quad.r =3D radii[quad.data.index]; for (var i =3D quad.r =3D 0; i < 4; ++i) { if (quad[i] && quad[i].r > quad.r) { quad.r =3D quad[i].r; } } } function initialize() { if (!nodes) return; var i, n =3D nodes.length, node; radii =3D new Array(n); for (i =3D 0; i < n; ++i) node =3D nodes[i], radii[node.index] =3D +rad= ius(node, i, nodes); } force.initialize =3D function(_) { nodes =3D _; initialize(); }; force.iterations =3D function(_) { return arguments.length ? (iterations =3D +_, force) : iterations; }; force.strength =3D function(_) { return arguments.length ? (strength =3D +_, force) : strength; }; force.radius =3D function(_) { return arguments.length ? (radius =3D typeof _ =3D=3D=3D "function" ? _= : constant$7(+_), initialize(), force) : radius; }; return force; } function index(d) { return d.index; } function find(nodeById, nodeId) { var node =3D nodeById.get(nodeId); if (!node) throw new Error("missing: " + nodeId); return node; } function link(links) { var id =3D index, strength =3D defaultStrength, strengths, distance =3D constant$7(30), distances, nodes, count, bias, iterations =3D 1; if (links =3D=3D null) links =3D []; function defaultStrength(link) { return 1 / Math.min(count[link.source.index], count[link.target.index]); } function force(alpha) { for (var k =3D 0, n =3D links.length; k < iterations; ++k) { for (var i =3D 0, link, source, target, x, y, l, b; i < n; ++i) { link =3D links[i], source =3D link.source, target =3D link.target; x =3D target.x + target.vx - source.x - source.vx || jiggle(); y =3D target.y + target.vy - source.y - source.vy || jiggle(); l =3D Math.sqrt(x * x + y * y); l =3D (l - distances[i]) / l * alpha * strengths[i]; x *=3D l, y *=3D l; target.vx -=3D x * (b =3D bias[i]); target.vy -=3D y * b; source.vx +=3D x * (b =3D 1 - b); source.vy +=3D y * b; } } } function initialize() { if (!nodes) return; var i, n =3D nodes.length, m =3D links.length, nodeById =3D map$1(nodes, id), link; for (i =3D 0, count =3D new Array(n); i < m; ++i) { link =3D links[i], link.index =3D i; if (typeof link.source !=3D=3D "object") link.source =3D find(nodeByI= d, link.source); if (typeof link.target !=3D=3D "object") link.target =3D find(nodeByI= d, link.target); count[link.source.index] =3D (count[link.source.index] || 0) + 1; count[link.target.index] =3D (count[link.target.index] || 0) + 1; } for (i =3D 0, bias =3D new Array(m); i < m; ++i) { link =3D links[i], bias[i] =3D count[link.source.index] / (count[link= =2Esource.index] + count[link.target.index]); } strengths =3D new Array(m), initializeStrength(); distances =3D new Array(m), initializeDistance(); } function initializeStrength() { if (!nodes) return; for (var i =3D 0, n =3D links.length; i < n; ++i) { strengths[i] =3D +strength(links[i], i, links); } } function initializeDistance() { if (!nodes) return; for (var i =3D 0, n =3D links.length; i < n; ++i) { distances[i] =3D +distance(links[i], i, links); } } force.initialize =3D function(_) { nodes =3D _; initialize(); }; force.links =3D function(_) { return arguments.length ? (links =3D _, initialize(), force) : links; }; force.id =3D function(_) { return arguments.length ? (id =3D _, force) : id; }; force.iterations =3D function(_) { return arguments.length ? (iterations =3D +_, force) : iterations; }; force.strength =3D function(_) { return arguments.length ? (strength =3D typeof _ =3D=3D=3D "function" ?= _ : constant$7(+_), initializeStrength(), force) : strength; }; force.distance =3D function(_) { return arguments.length ? (distance =3D typeof _ =3D=3D=3D "function" ?= _ : constant$7(+_), initializeDistance(), force) : distance; }; return force; } function x$1(d) { return d.x; } function y$1(d) { return d.y; } var initialRadius =3D 10, initialAngle =3D Math.PI * (3 - Math.sqrt(5)); function simulation(nodes) { var simulation, alpha =3D 1, alphaMin =3D 0.001, alphaDecay =3D 1 - Math.pow(alphaMin, 1 / 300), alphaTarget =3D 0, velocityDecay =3D 0.6, forces =3D map$1(), stepper =3D timer(step), event =3D dispatch("tick", "end"); if (nodes =3D=3D null) nodes =3D []; function step() { tick(); event.call("tick", simulation); if (alpha < alphaMin) { stepper.stop(); event.call("end", simulation); } } function tick(iterations) { var i, n =3D nodes.length, node; if (iterations =3D=3D=3D undefined) iterations =3D 1; for (var k =3D 0; k < iterations; ++k) { alpha +=3D (alphaTarget - alpha) * alphaDecay; forces.each(function (force) { force(alpha); }); for (i =3D 0; i < n; ++i) { node =3D nodes[i]; if (node.fx =3D=3D null) node.x +=3D node.vx *=3D velocityDecay; else node.x =3D node.fx, node.vx =3D 0; if (node.fy =3D=3D null) node.y +=3D node.vy *=3D velocityDecay; else node.y =3D node.fy, node.vy =3D 0; } } return simulation; } function initializeNodes() { for (var i =3D 0, n =3D nodes.length, node; i < n; ++i) { node =3D nodes[i], node.index =3D i; if (node.fx !=3D null) node.x =3D node.fx; if (node.fy !=3D null) node.y =3D node.fy; if (isNaN(node.x) || isNaN(node.y)) { var radius =3D initialRadius * Math.sqrt(i), angle =3D i * initialA= ngle; node.x =3D radius * Math.cos(angle); node.y =3D radius * Math.sin(angle); } if (isNaN(node.vx) || isNaN(node.vy)) { node.vx =3D node.vy =3D 0; } } } function initializeForce(force) { if (force.initialize) force.initialize(nodes); return force; } initializeNodes(); return simulation =3D { tick: tick, restart: function() { return stepper.restart(step), simulation; }, stop: function() { return stepper.stop(), simulation; }, nodes: function(_) { return arguments.length ? (nodes =3D _, initializeNodes(), forces.eac= h(initializeForce), simulation) : nodes; }, alpha: function(_) { return arguments.length ? (alpha =3D +_, simulation) : alpha; }, alphaMin: function(_) { return arguments.length ? (alphaMin =3D +_, simulation) : alphaMin; }, alphaDecay: function(_) { return arguments.length ? (alphaDecay =3D +_, simulation) : +alphaDec= ay; }, alphaTarget: function(_) { return arguments.length ? (alphaTarget =3D +_, simulation) : alphaTar= get; }, velocityDecay: function(_) { return arguments.length ? (velocityDecay =3D 1 - _, simulation) : 1 -= velocityDecay; }, force: function(name, _) { return arguments.length > 1 ? ((_ =3D=3D null ? forces.remove(name) := forces.set(name, initializeForce(_))), simulation) : forces.get(name); }, find: function(x, y, radius) { var i =3D 0, n =3D nodes.length, dx, dy, d2, node, closest; if (radius =3D=3D null) radius =3D Infinity; else radius *=3D radius; for (i =3D 0; i < n; ++i) { node =3D nodes[i]; dx =3D x - node.x; dy =3D y - node.y; d2 =3D dx * dx + dy * dy; if (d2 < radius) closest =3D node, radius =3D d2; } return closest; }, on: function(name, _) { return arguments.length > 1 ? (event.on(name, _), simulation) : event= =2Eon(name); } }; } function manyBody() { var nodes, node, alpha, strength =3D constant$7(-30), strengths, distanceMin2 =3D 1, distanceMax2 =3D Infinity, theta2 =3D 0.81; function force(_) { var i, n =3D nodes.length, tree =3D quadtree(nodes, x$1, y$1).visitAfte= r(accumulate); for (alpha =3D _, i =3D 0; i < n; ++i) node =3D nodes[i], tree.visit(ap= ply); } function initialize() { if (!nodes) return; var i, n =3D nodes.length, node; strengths =3D new Array(n); for (i =3D 0; i < n; ++i) node =3D nodes[i], strengths[node.index] =3D = +strength(node, i, nodes); } function accumulate(quad) { var strength =3D 0, q, c, weight =3D 0, x, y, i; // For internal nodes, accumulate forces from child quadrants. if (quad.length) { for (x =3D y =3D i =3D 0; i < 4; ++i) { if ((q =3D quad[i]) && (c =3D Math.abs(q.value))) { strength +=3D q.value, weight +=3D c, x +=3D c * q.x, y +=3D c * = q.y; } } quad.x =3D x / weight; quad.y =3D y / weight; } // For leaf nodes, accumulate forces from coincident quadrants. else { q =3D quad; q.x =3D q.data.x; q.y =3D q.data.y; do strength +=3D strengths[q.data.index]; while (q =3D q.next); } quad.value =3D strength; } function apply(quad, x1, _, x2) { if (!quad.value) return true; var x =3D quad.x - node.x, y =3D quad.y - node.y, w =3D x2 - x1, l =3D x * x + y * y; // Apply the Barnes-Hut approximation if possible. // Limit forces for very close nodes; randomize direction if coincident. if (w * w / theta2 < l) { if (l < distanceMax2) { if (x =3D=3D=3D 0) x =3D jiggle(), l +=3D x * x; if (y =3D=3D=3D 0) y =3D jiggle(), l +=3D y * y; if (l < distanceMin2) l =3D Math.sqrt(distanceMin2 * l); node.vx +=3D x * quad.value * alpha / l; node.vy +=3D y * quad.value * alpha / l; } return true; } // Otherwise, process points directly. else if (quad.length || l >=3D distanceMax2) return; // Limit forces for very close nodes; randomize direction if coincident. if (quad.data !=3D=3D node || quad.next) { if (x =3D=3D=3D 0) x =3D jiggle(), l +=3D x * x; if (y =3D=3D=3D 0) y =3D jiggle(), l +=3D y * y; if (l < distanceMin2) l =3D Math.sqrt(distanceMin2 * l); } do if (quad.data !=3D=3D node) { w =3D strengths[quad.data.index] * alpha / l; node.vx +=3D x * w; node.vy +=3D y * w; } while (quad =3D quad.next); } force.initialize =3D function(_) { nodes =3D _; initialize(); }; force.strength =3D function(_) { return arguments.length ? (strength =3D typeof _ =3D=3D=3D "function" ?= _ : constant$7(+_), initialize(), force) : strength; }; force.distanceMin =3D function(_) { return arguments.length ? (distanceMin2 =3D _ * _, force) : Math.sqrt(d= istanceMin2); }; force.distanceMax =3D function(_) { return arguments.length ? (distanceMax2 =3D _ * _, force) : Math.sqrt(d= istanceMax2); }; force.theta =3D function(_) { return arguments.length ? (theta2 =3D _ * _, force) : Math.sqrt(theta2); }; return force; } function radial(radius, x, y) { var nodes, strength =3D constant$7(0.1), strengths, radiuses; if (typeof radius !=3D=3D "function") radius =3D constant$7(+radius); if (x =3D=3D null) x =3D 0; if (y =3D=3D null) y =3D 0; function force(alpha) { for (var i =3D 0, n =3D nodes.length; i < n; ++i) { var node =3D nodes[i], dx =3D node.x - x || 1e-6, dy =3D node.y - y || 1e-6, r =3D Math.sqrt(dx * dx + dy * dy), k =3D (radiuses[i] - r) * strengths[i] * alpha / r; node.vx +=3D dx * k; node.vy +=3D dy * k; } } function initialize() { if (!nodes) return; var i, n =3D nodes.length; strengths =3D new Array(n); radiuses =3D new Array(n); for (i =3D 0; i < n; ++i) { radiuses[i] =3D +radius(nodes[i], i, nodes); strengths[i] =3D isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, node= s); } } force.initialize =3D function(_) { nodes =3D _, initialize(); }; force.strength =3D function(_) { return arguments.length ? (strength =3D typeof _ =3D=3D=3D "function" ?= _ : constant$7(+_), initialize(), force) : strength; }; force.radius =3D function(_) { return arguments.length ? (radius =3D typeof _ =3D=3D=3D "function" ? _= : constant$7(+_), initialize(), force) : radius; }; force.x =3D function(_) { return arguments.length ? (x =3D +_, force) : x; }; force.y =3D function(_) { return arguments.length ? (y =3D +_, force) : y; }; return force; } function x$2(x) { var strength =3D constant$7(0.1), nodes, strengths, xz; if (typeof x !=3D=3D "function") x =3D constant$7(x =3D=3D null ? 0 : +x); function force(alpha) { for (var i =3D 0, n =3D nodes.length, node; i < n; ++i) { node =3D nodes[i], node.vx +=3D (xz[i] - node.x) * strengths[i] * alp= ha; } } function initialize() { if (!nodes) return; var i, n =3D nodes.length; strengths =3D new Array(n); xz =3D new Array(n); for (i =3D 0; i < n; ++i) { strengths[i] =3D isNaN(xz[i] =3D +x(nodes[i], i, nodes)) ? 0 : +stren= gth(nodes[i], i, nodes); } } force.initialize =3D function(_) { nodes =3D _; initialize(); }; force.strength =3D function(_) { return arguments.length ? (strength =3D typeof _ =3D=3D=3D "function" ?= _ : constant$7(+_), initialize(), force) : strength; }; force.x =3D function(_) { return arguments.length ? (x =3D typeof _ =3D=3D=3D "function" ? _ : co= nstant$7(+_), initialize(), force) : x; }; return force; } function y$2(y) { var strength =3D constant$7(0.1), nodes, strengths, yz; if (typeof y !=3D=3D "function") y =3D constant$7(y =3D=3D null ? 0 : +y); function force(alpha) { for (var i =3D 0, n =3D nodes.length, node; i < n; ++i) { node =3D nodes[i], node.vy +=3D (yz[i] - node.y) * strengths[i] * alp= ha; } } function initialize() { if (!nodes) return; var i, n =3D nodes.length; strengths =3D new Array(n); yz =3D new Array(n); for (i =3D 0; i < n; ++i) { strengths[i] =3D isNaN(yz[i] =3D +y(nodes[i], i, nodes)) ? 0 : +stren= gth(nodes[i], i, nodes); } } force.initialize =3D function(_) { nodes =3D _; initialize(); }; force.strength =3D function(_) { return arguments.length ? (strength =3D typeof _ =3D=3D=3D "function" ?= _ : constant$7(+_), initialize(), force) : strength; }; force.y =3D function(_) { return arguments.length ? (y =3D typeof _ =3D=3D=3D "function" ? _ : co= nstant$7(+_), initialize(), force) : y; }; return force; } // Computes the decimal coefficient and exponent of the specified number x = with // significant digits p, where x is positive and p is in [1, 21] or undefin= ed. // For example, formatDecimal(1.23) returns ["123", 0]. function formatDecimal(x, p) { if ((i =3D (x =3D p ? x.toExponential(p - 1) : x.toExponential()).indexOf= ("e")) < 0) return null; // NaN, =C2=B1Infinity var i, coefficient =3D x.slice(0, i); // The string returned by toExponential either has the form \d\.\d+e[-+]\= d+ // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). return [ coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coeffi= cient, +x.slice(i + 1) ]; } function exponent$1(x) { return x =3D formatDecimal(Math.abs(x)), x ? x[1] : NaN; } function formatGroup(grouping, thousands) { return function(value, width) { var i =3D value.length, t =3D [], j =3D 0, g =3D grouping[0], length =3D 0; while (i > 0 && g > 0) { if (length + g + 1 > width) g =3D Math.max(1, width - length); t.push(value.substring(i -=3D g, i + g)); if ((length +=3D g + 1) > width) break; g =3D grouping[j =3D (j + 1) % grouping.length]; } return t.reverse().join(thousands); }; } function formatNumerals(numerals) { return function(value) { return value.replace(/[0-9]/g, function(i) { return numerals[+i]; }); }; } // [[fill]align][sign][symbol][0][width][,][.precision][~][type] var re =3D /^(?:(.)?([<>=3D^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?= ([a-z%])?$/i; function formatSpecifier(specifier) { return new FormatSpecifier(specifier); } formatSpecifier.prototype =3D FormatSpecifier.prototype; // instanceof function FormatSpecifier(specifier) { if (!(match =3D re.exec(specifier))) throw new Error("invalid format: " += specifier); var match; this.fill =3D match[1] || " "; this.align =3D match[2] || ">"; this.sign =3D match[3] || "-"; this.symbol =3D match[4] || ""; this.zero =3D !!match[5]; this.width =3D match[6] && +match[6]; this.comma =3D !!match[7]; this.precision =3D match[8] && +match[8].slice(1); this.trim =3D !!match[9]; this.type =3D match[10] || ""; } FormatSpecifier.prototype.toString =3D function() { return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width =3D=3D null ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision =3D=3D null ? "" : "." + Math.max(0, this.precision= | 0)) + (this.trim ? "~" : "") + this.type; }; // Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. function formatTrim(s) { out: for (var n =3D s.length, i =3D 1, i0 =3D -1, i1; i < n; ++i) { switch (s[i]) { case ".": i0 =3D i1 =3D i; break; case "0": if (i0 =3D=3D=3D 0) i0 =3D i; i1 =3D i; break; default: if (i0 > 0) { if (!+s[i]) break out; i0 =3D 0; } break; } } return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; } var prefixExponent; function formatPrefixAuto(x, p) { var d =3D formatDecimal(x, p); if (!d) return x + ""; var coefficient =3D d[0], exponent =3D d[1], i =3D exponent - (prefixExponent =3D Math.max(-8, Math.min(8, Math.fl= oor(exponent / 3))) * 3) + 1, n =3D coefficient.length; return i =3D=3D=3D n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p = + i - 1))[0]; // less than 1y! } function formatRounded(x, p) { var d =3D formatDecimal(x, p); if (!d) return x + ""; var coefficient =3D d[0], exponent =3D d[1]; return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent += 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"= ); } var formatTypes =3D { "%": function(x, p) { return (x * 100).toFixed(p); }, "b": function(x) { return Math.round(x).toString(2); }, "c": function(x) { return x + ""; }, "d": function(x) { return Math.round(x).toString(10); }, "e": function(x, p) { return x.toExponential(p); }, "f": function(x, p) { return x.toFixed(p); }, "g": function(x, p) { return x.toPrecision(p); }, "o": function(x) { return Math.round(x).toString(8); }, "p": function(x, p) { return formatRounded(x * 100, p); }, "r": formatRounded, "s": formatPrefixAuto, "X": function(x) { return Math.round(x).toString(16).toUpperCase(); }, "x": function(x) { return Math.round(x).toString(16); } }; function identity$3(x) { return x; } var prefixes =3D ["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P"= ,"E","Z","Y"]; function formatLocale(locale) { var group =3D locale.grouping && locale.thousands ? formatGroup(locale.gr= ouping, locale.thousands) : identity$3, currency =3D locale.currency, decimal =3D locale.decimal, numerals =3D locale.numerals ? formatNumerals(locale.numerals) : iden= tity$3, percent =3D locale.percent || "%"; function newFormat(specifier) { specifier =3D formatSpecifier(specifier); var fill =3D specifier.fill, align =3D specifier.align, sign =3D specifier.sign, symbol =3D specifier.symbol, zero =3D specifier.zero, width =3D specifier.width, comma =3D specifier.comma, precision =3D specifier.precision, trim =3D specifier.trim, type =3D specifier.type; // The "n" type is an alias for ",g". if (type =3D=3D=3D "n") comma =3D true, type =3D "g"; // The "" type, and any invalid type, is an alias for ".12~g". else if (!formatTypes[type]) precision =3D=3D null && (precision =3D 12= ), trim =3D true, type =3D "g"; // If zero fill is specified, padding goes after sign and before digits. if (zero || (fill =3D=3D=3D "0" && align =3D=3D=3D "=3D")) zero =3D tru= e, fill =3D "0", align =3D "=3D"; // Compute the prefix and suffix. // For SI-prefix, the suffix is lazily computed. var prefix =3D symbol =3D=3D=3D "$" ? currency[0] : symbol =3D=3D=3D "#= " && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix =3D symbol =3D=3D=3D "$" ? currency[1] : /[%p]/.test(type) ?= percent : ""; // What format function should we use? // Is this an integer type? // Can this type generate exponential notation? var formatType =3D formatTypes[type], maybeSuffix =3D /[defgprs%]/.test(type); // Set the default precision if not specified, // or clamp the specified precision to the supported range. // For significant precision, it must be in [1, 21]. // For fixed precision, it must be in [0, 20]. precision =3D precision =3D=3D null ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); function format(value) { var valuePrefix =3D prefix, valueSuffix =3D suffix, i, n, c; if (type =3D=3D=3D "c") { valueSuffix =3D formatType(value) + valueSuffix; value =3D ""; } else { value =3D +value; // Perform the initial formatting. var valueNegative =3D value < 0; value =3D formatType(Math.abs(value), precision); // Trim insignificant zeros. if (trim) value =3D formatTrim(value); // If a negative value rounds to zero during formatting, treat as p= ositive. if (valueNegative && +value =3D=3D=3D 0) valueNegative =3D false; // Compute the prefix and suffix. valuePrefix =3D (valueNegative ? (sign =3D=3D=3D "(" ? sign : "-") = : sign =3D=3D=3D "-" || sign =3D=3D=3D "(" ? "" : sign) + valuePrefix; valueSuffix =3D (type =3D=3D=3D "s" ? prefixes[8 + prefixExponent /= 3] : "") + valueSuffix + (valueNegative && sign =3D=3D=3D "(" ? ")" : ""); // Break the formatted value into the integer =E2=80=9Cvalue=E2=80= =9D part that can be // grouped, and fractional or exponential =E2=80=9Csuffix=E2=80=9D = part that is not. if (maybeSuffix) { i =3D -1, n =3D value.length; while (++i < n) { if (c =3D value.charCodeAt(i), 48 > c || c > 57) { valueSuffix =3D (c =3D=3D=3D 46 ? decimal + value.slice(i + 1= ) : value.slice(i)) + valueSuffix; value =3D value.slice(0, i); break; } } } } // If the fill character is not "0", grouping is applied before paddi= ng. if (comma && !zero) value =3D group(value, Infinity); // Compute the padding. var length =3D valuePrefix.length + value.length + valueSuffix.length, padding =3D length < width ? new Array(width - length + 1).join(f= ill) : ""; // If the fill character is "0", grouping is applied after padding. if (comma && zero) value =3D group(padding + value, padding.length ? = width - valueSuffix.length : Infinity), padding =3D ""; // Reconstruct the final output based on the desired alignment. switch (align) { case "<": value =3D valuePrefix + value + valueSuffix + padding; br= eak; case "=3D": value =3D valuePrefix + padding + value + valueSuffix; = break; case "^": value =3D padding.slice(0, length =3D padding.length >> 1= ) + valuePrefix + value + valueSuffix + padding.slice(length); break; default: value =3D padding + valuePrefix + value + valueSuffix; bre= ak; } return numerals(value); } format.toString =3D function() { return specifier + ""; }; return format; } function formatPrefix(specifier, value) { var f =3D newFormat((specifier =3D formatSpecifier(specifier), specifie= r.type =3D "f", specifier)), e =3D Math.max(-8, Math.min(8, Math.floor(exponent$1(value) / 3))) = * 3, k =3D Math.pow(10, -e), prefix =3D prefixes[8 + e / 3]; return function(value) { return f(k * value) + prefix; }; } return { format: newFormat, formatPrefix: formatPrefix }; } var locale; defaultLocale({ decimal: ".", thousands: ",", grouping: [3], currency: ["$", ""] }); function defaultLocale(definition) { locale =3D formatLocale(definition); exports.format =3D locale.format; exports.formatPrefix =3D locale.formatPrefix; return locale; } function precisionFixed(step) { return Math.max(0, -exponent$1(Math.abs(step))); } function precisionPrefix(step, value) { return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent$1(value) = / 3))) * 3 - exponent$1(Math.abs(step))); } function precisionRound(step, max) { step =3D Math.abs(step), max =3D Math.abs(max) - step; return Math.max(0, exponent$1(max) - exponent$1(step)) + 1; } // Adds floating point numbers with twice the normal precision. // Reference: J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic = and // Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3) // 305=E2=80=93363 (1997). // Code adapted from GeographicLib by Charles F. F. Karney, // http://geographiclib.sourceforge.net/ function adder() { return new Adder; } function Adder() { this.reset(); } Adder.prototype =3D { constructor: Adder, reset: function() { this.s =3D // rounded value this.t =3D 0; // exact error }, add: function(y) { add$1(temp, y, this.t); add$1(this, temp.s, this.s); if (this.s) this.t +=3D temp.t; else this.s =3D temp.t; }, valueOf: function() { return this.s; } }; var temp =3D new Adder; function add$1(adder, a, b) { var x =3D adder.s =3D a + b, bv =3D x - a, av =3D x - bv; adder.t =3D (a - av) + (b - bv); } var epsilon$2 =3D 1e-6; var epsilon2$1 =3D 1e-12; var pi$3 =3D Math.PI; var halfPi$2 =3D pi$3 / 2; var quarterPi =3D pi$3 / 4; var tau$3 =3D pi$3 * 2; var degrees$1 =3D 180 / pi$3; var radians =3D pi$3 / 180; var abs =3D Math.abs; var atan =3D Math.atan; var atan2 =3D Math.atan2; var cos$1 =3D Math.cos; var ceil =3D Math.ceil; var exp =3D Math.exp; var log =3D Math.log; var pow =3D Math.pow; var sin$1 =3D Math.sin; var sign =3D Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; = }; var sqrt =3D Math.sqrt; var tan =3D Math.tan; function acos(x) { return x > 1 ? 0 : x < -1 ? pi$3 : Math.acos(x); } function asin(x) { return x > 1 ? halfPi$2 : x < -1 ? -halfPi$2 : Math.asin(x); } function haversin(x) { return (x =3D sin$1(x / 2)) * x; } function noop$2() {} function streamGeometry(geometry, stream) { if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) { streamGeometryType[geometry.type](geometry, stream); } } var streamObjectType =3D { Feature: function(object, stream) { streamGeometry(object.geometry, stream); }, FeatureCollection: function(object, stream) { var features =3D object.features, i =3D -1, n =3D features.length; while (++i < n) streamGeometry(features[i].geometry, stream); } }; var streamGeometryType =3D { Sphere: function(object, stream) { stream.sphere(); }, Point: function(object, stream) { object =3D object.coordinates; stream.point(object[0], object[1], object[2]); }, MultiPoint: function(object, stream) { var coordinates =3D object.coordinates, i =3D -1, n =3D coordinates.len= gth; while (++i < n) object =3D coordinates[i], stream.point(object[0], obje= ct[1], object[2]); }, LineString: function(object, stream) { streamLine(object.coordinates, stream, 0); }, MultiLineString: function(object, stream) { var coordinates =3D object.coordinates, i =3D -1, n =3D coordinates.len= gth; while (++i < n) streamLine(coordinates[i], stream, 0); }, Polygon: function(object, stream) { streamPolygon(object.coordinates, stream); }, MultiPolygon: function(object, stream) { var coordinates =3D object.coordinates, i =3D -1, n =3D coordinates.len= gth; while (++i < n) streamPolygon(coordinates[i], stream); }, GeometryCollection: function(object, stream) { var geometries =3D object.geometries, i =3D -1, n =3D geometries.length; while (++i < n) streamGeometry(geometries[i], stream); } }; function streamLine(coordinates, stream, closed) { var i =3D -1, n =3D coordinates.length - closed, coordinate; stream.lineStart(); while (++i < n) coordinate =3D coordinates[i], stream.point(coordinate[0]= , coordinate[1], coordinate[2]); stream.lineEnd(); } function streamPolygon(coordinates, stream) { var i =3D -1, n =3D coordinates.length; stream.polygonStart(); while (++i < n) streamLine(coordinates[i], stream, 1); stream.polygonEnd(); } function geoStream(object, stream) { if (object && streamObjectType.hasOwnProperty(object.type)) { streamObjectType[object.type](object, stream); } else { streamGeometry(object, stream); } } var areaRingSum =3D adder(); var areaSum =3D adder(), lambda00, phi00, lambda0, cosPhi0, sinPhi0; var areaStream =3D { point: noop$2, lineStart: noop$2, lineEnd: noop$2, polygonStart: function() { areaRingSum.reset(); areaStream.lineStart =3D areaRingStart; areaStream.lineEnd =3D areaRingEnd; }, polygonEnd: function() { var areaRing =3D +areaRingSum; areaSum.add(areaRing < 0 ? tau$3 + areaRing : areaRing); this.lineStart =3D this.lineEnd =3D this.point =3D noop$2; }, sphere: function() { areaSum.add(tau$3); } }; function areaRingStart() { areaStream.point =3D areaPointFirst; } function areaRingEnd() { areaPoint(lambda00, phi00); } function areaPointFirst(lambda, phi) { areaStream.point =3D areaPoint; lambda00 =3D lambda, phi00 =3D phi; lambda *=3D radians, phi *=3D radians; lambda0 =3D lambda, cosPhi0 =3D cos$1(phi =3D phi / 2 + quarterPi), sinPh= i0 =3D sin$1(phi); } function areaPoint(lambda, phi) { lambda *=3D radians, phi *=3D radians; phi =3D phi / 2 + quarterPi; // half the angular distance from south pole // Spherical excess E for a spherical triangle with vertices: south pole, // previous point, current point. Uses a formula derived from Cagnoli=E2= =80=99s // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2). var dLambda =3D lambda - lambda0, sdLambda =3D dLambda >=3D 0 ? 1 : -1, adLambda =3D sdLambda * dLambda, cosPhi =3D cos$1(phi), sinPhi =3D sin$1(phi), k =3D sinPhi0 * sinPhi, u =3D cosPhi0 * cosPhi + k * cos$1(adLambda), v =3D k * sdLambda * sin$1(adLambda); areaRingSum.add(atan2(v, u)); // Advance the previous points. lambda0 =3D lambda, cosPhi0 =3D cosPhi, sinPhi0 =3D sinPhi; } function area$1(object) { areaSum.reset(); geoStream(object, areaStream); return areaSum * 2; } function spherical(cartesian) { return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])]; } function cartesian(spherical) { var lambda =3D spherical[0], phi =3D spherical[1], cosPhi =3D cos$1(phi); return [cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi)]; } function cartesianDot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } function cartesianCross(a, b) { 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]]; } // TODO return a function cartesianAddInPlace(a, b) { a[0] +=3D b[0], a[1] +=3D b[1], a[2] +=3D b[2]; } function cartesianScale(vector, k) { return [vector[0] * k, vector[1] * k, vector[2] * k]; } // TODO return d function cartesianNormalizeInPlace(d) { var l =3D sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); d[0] /=3D l, d[1] /=3D l, d[2] /=3D l; } var lambda0$1, phi0, lambda1, phi1, // bounds lambda2, // previous lambda-coordinate lambda00$1, phi00$1, // first point p0, // previous 3D point deltaSum =3D adder(), ranges, range; var boundsStream =3D { point: boundsPoint, lineStart: boundsLineStart, lineEnd: boundsLineEnd, polygonStart: function() { boundsStream.point =3D boundsRingPoint; boundsStream.lineStart =3D boundsRingStart; boundsStream.lineEnd =3D boundsRingEnd; deltaSum.reset(); areaStream.polygonStart(); }, polygonEnd: function() { areaStream.polygonEnd(); boundsStream.point =3D boundsPoint; boundsStream.lineStart =3D boundsLineStart; boundsStream.lineEnd =3D boundsLineEnd; if (areaRingSum < 0) lambda0$1 =3D -(lambda1 =3D 180), phi0 =3D -(phi1 = =3D 90); else if (deltaSum > epsilon$2) phi1 =3D 90; else if (deltaSum < -epsilon$2) phi0 =3D -90; range[0] =3D lambda0$1, range[1] =3D lambda1; }, sphere: function() { lambda0$1 =3D -(lambda1 =3D 180), phi0 =3D -(phi1 =3D 90); } }; function boundsPoint(lambda, phi) { ranges.push(range =3D [lambda0$1 =3D lambda, lambda1 =3D lambda]); if (phi < phi0) phi0 =3D phi; if (phi > phi1) phi1 =3D phi; } function linePoint(lambda, phi) { var p =3D cartesian([lambda * radians, phi * radians]); if (p0) { var normal =3D cartesianCross(p0, p), equatorial =3D [normal[1], -normal[0], 0], inflection =3D cartesianCross(equatorial, normal); cartesianNormalizeInPlace(inflection); inflection =3D spherical(inflection); var delta =3D lambda - lambda2, sign$$1 =3D delta > 0 ? 1 : -1, lambdai =3D inflection[0] * degrees$1 * sign$$1, phii, antimeridian =3D abs(delta) > 180; if (antimeridian ^ (sign$$1 * lambda2 < lambdai && lambdai < sign$$1 * = lambda)) { phii =3D inflection[1] * degrees$1; if (phii > phi1) phi1 =3D phii; } else if (lambdai =3D (lambdai + 360) % 360 - 180, antimeridian ^ (sig= n$$1 * lambda2 < lambdai && lambdai < sign$$1 * lambda)) { phii =3D -inflection[1] * degrees$1; if (phii < phi0) phi0 =3D phii; } else { if (phi < phi0) phi0 =3D phi; if (phi > phi1) phi1 =3D phi; } if (antimeridian) { if (lambda < lambda2) { if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = =3D lambda; } else { if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = =3D lambda; } } else { if (lambda1 >=3D lambda0$1) { if (lambda < lambda0$1) lambda0$1 =3D lambda; if (lambda > lambda1) lambda1 =3D lambda; } else { if (lambda > lambda2) { if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1= =3D lambda; } else { if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1= =3D lambda; } } } } else { ranges.push(range =3D [lambda0$1 =3D lambda, lambda1 =3D lambda]); } if (phi < phi0) phi0 =3D phi; if (phi > phi1) phi1 =3D phi; p0 =3D p, lambda2 =3D lambda; } function boundsLineStart() { boundsStream.point =3D linePoint; } function boundsLineEnd() { range[0] =3D lambda0$1, range[1] =3D lambda1; boundsStream.point =3D boundsPoint; p0 =3D null; } function boundsRingPoint(lambda, phi) { if (p0) { var delta =3D lambda - lambda2; deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delt= a); } else { lambda00$1 =3D lambda, phi00$1 =3D phi; } areaStream.point(lambda, phi); linePoint(lambda, phi); } function boundsRingStart() { areaStream.lineStart(); } function boundsRingEnd() { boundsRingPoint(lambda00$1, phi00$1); areaStream.lineEnd(); if (abs(deltaSum) > epsilon$2) lambda0$1 =3D -(lambda1 =3D 180); range[0] =3D lambda0$1, range[1] =3D lambda1; p0 =3D null; } // Finds the left-right distance between two longitudes. // This is almost the same as (lambda1 - lambda0 + 360=C2=B0) % 360=C2=B0, = except that we want // the distance between =C2=B1180=C2=B0 to be 360=C2=B0. function angle(lambda0, lambda1) { return (lambda1 -=3D lambda0) < 0 ? lambda1 + 360 : lambda1; } function rangeCompare(a, b) { return a[0] - b[0]; } function rangeContains(range, x) { return range[0] <=3D range[1] ? range[0] <=3D x && x <=3D range[1] : x < = range[0] || range[1] < x; } function bounds(feature) { var i, n, a, b, merged, deltaMax, delta; phi1 =3D lambda1 =3D -(lambda0$1 =3D phi0 =3D Infinity); ranges =3D []; geoStream(feature, boundsStream); // First, sort ranges by their minimum longitudes. if (n =3D ranges.length) { ranges.sort(rangeCompare); // Then, merge any ranges that overlap. for (i =3D 1, a =3D ranges[0], merged =3D [a]; i < n; ++i) { b =3D ranges[i]; if (rangeContains(a, b[0]) || rangeContains(a, b[1])) { if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] =3D b[1]; if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] =3D b[0]; } else { merged.push(a =3D b); } } // Finally, find the largest gap between the merged ranges. // The final bounding box will be the inverse of this gap. for (deltaMax =3D -Infinity, n =3D merged.length - 1, i =3D 0, a =3D me= rged[n]; i <=3D n; a =3D b, ++i) { b =3D merged[i]; if ((delta =3D angle(a[1], b[0])) > deltaMax) deltaMax =3D delta, lam= bda0$1 =3D b[0], lambda1 =3D a[1]; } } ranges =3D range =3D null; return lambda0$1 =3D=3D=3D Infinity || phi0 =3D=3D=3D Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda0$1, phi0], [lambda1, phi1]]; } var W0, W1, X0, Y0, Z0, X1, Y1, Z1, X2, Y2, Z2, lambda00$2, phi00$2, // first point x0, y0, z0; // previous point var centroidStream =3D { sphere: noop$2, point: centroidPoint, lineStart: centroidLineStart, lineEnd: centroidLineEnd, polygonStart: function() { centroidStream.lineStart =3D centroidRingStart; centroidStream.lineEnd =3D centroidRingEnd; }, polygonEnd: function() { centroidStream.lineStart =3D centroidLineStart; centroidStream.lineEnd =3D centroidLineEnd; } }; // Arithmetic mean of Cartesian vectors. function centroidPoint(lambda, phi) { lambda *=3D radians, phi *=3D radians; var cosPhi =3D cos$1(phi); centroidPointCartesian(cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), si= n$1(phi)); } function centroidPointCartesian(x, y, z) { ++W0; X0 +=3D (x - X0) / W0; Y0 +=3D (y - Y0) / W0; Z0 +=3D (z - Z0) / W0; } function centroidLineStart() { centroidStream.point =3D centroidLinePointFirst; } function centroidLinePointFirst(lambda, phi) { lambda *=3D radians, phi *=3D radians; var cosPhi =3D cos$1(phi); x0 =3D cosPhi * cos$1(lambda); y0 =3D cosPhi * sin$1(lambda); z0 =3D sin$1(phi); centroidStream.point =3D centroidLinePoint; centroidPointCartesian(x0, y0, z0); } function centroidLinePoint(lambda, phi) { lambda *=3D radians, phi *=3D radians; var cosPhi =3D cos$1(phi), x =3D cosPhi * cos$1(lambda), y =3D cosPhi * sin$1(lambda), z =3D sin$1(phi), w =3D atan2(sqrt((w =3D y0 * z - z0 * y) * w + (w =3D z0 * x - x0 * z= ) * w + (w =3D x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); W1 +=3D w; X1 +=3D w * (x0 + (x0 =3D x)); Y1 +=3D w * (y0 + (y0 =3D y)); Z1 +=3D w * (z0 + (z0 =3D z)); centroidPointCartesian(x0, y0, z0); } function centroidLineEnd() { centroidStream.point =3D centroidPoint; } // See J. E. Brock, The Inertia Tensor for a Spherical Triangle, // J. Applied Mechanics 42, 239 (1975). function centroidRingStart() { centroidStream.point =3D centroidRingPointFirst; } function centroidRingEnd() { centroidRingPoint(lambda00$2, phi00$2); centroidStream.point =3D centroidPoint; } function centroidRingPointFirst(lambda, phi) { lambda00$2 =3D lambda, phi00$2 =3D phi; lambda *=3D radians, phi *=3D radians; centroidStream.point =3D centroidRingPoint; var cosPhi =3D cos$1(phi); x0 =3D cosPhi * cos$1(lambda); y0 =3D cosPhi * sin$1(lambda); z0 =3D sin$1(phi); centroidPointCartesian(x0, y0, z0); } function centroidRingPoint(lambda, phi) { lambda *=3D radians, phi *=3D radians; var cosPhi =3D cos$1(phi), x =3D cosPhi * cos$1(lambda), y =3D cosPhi * sin$1(lambda), z =3D sin$1(phi), cx =3D y0 * z - z0 * y, cy =3D z0 * x - x0 * z, cz =3D x0 * y - y0 * x, m =3D sqrt(cx * cx + cy * cy + cz * cz), w =3D asin(m), // line weight =3D angle v =3D m && -w / m; // area weight multiplier X2 +=3D v * cx; Y2 +=3D v * cy; Z2 +=3D v * cz; W1 +=3D w; X1 +=3D w * (x0 + (x0 =3D x)); Y1 +=3D w * (y0 + (y0 =3D y)); Z1 +=3D w * (z0 + (z0 =3D z)); centroidPointCartesian(x0, y0, z0); } function centroid(object) { W0 =3D W1 =3D X0 =3D Y0 =3D Z0 =3D X1 =3D Y1 =3D Z1 =3D X2 =3D Y2 =3D Z2 =3D 0; geoStream(object, centroidStream); var x =3D X2, y =3D Y2, z =3D Z2, m =3D x * x + y * y + z * z; // If the area-weighted ccentroid is undefined, fall back to length-weigh= ted ccentroid. if (m < epsilon2$1) { x =3D X1, y =3D Y1, z =3D Z1; // If the feature has zero length, fall back to arithmetic mean of poin= t vectors. if (W1 < epsilon$2) x =3D X0, y =3D Y0, z =3D Z0; m =3D x * x + y * y + z * z; // If the feature still has an undefined ccentroid, then return. if (m < epsilon2$1) return [NaN, NaN]; } return [atan2(y, x) * degrees$1, asin(z / sqrt(m)) * degrees$1]; } function constant$8(x) { return function() { return x; }; } function compose(a, b) { function compose(x, y) { return x =3D a(x, y), b(x[0], x[1]); } if (a.invert && b.invert) compose.invert =3D function(x, y) { return x =3D b.invert(x, y), x && a.invert(x[0], x[1]); }; return compose; } function rotationIdentity(lambda, phi) { return [abs(lambda) > pi$3 ? lambda + Math.round(-lambda / tau$3) * tau$3= : lambda, phi]; } rotationIdentity.invert =3D rotationIdentity; function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { return (deltaLambda %=3D tau$3) ? (deltaPhi || deltaGamma ? compose(rotat= ionLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda)) : (deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity); } function forwardRotationLambda(deltaLambda) { return function(lambda, phi) { return lambda +=3D deltaLambda, [lambda > pi$3 ? lambda - tau$3 : lambd= a < -pi$3 ? lambda + tau$3 : lambda, phi]; }; } function rotationLambda(deltaLambda) { var rotation =3D forwardRotationLambda(deltaLambda); rotation.invert =3D forwardRotationLambda(-deltaLambda); return rotation; } function rotationPhiGamma(deltaPhi, deltaGamma) { var cosDeltaPhi =3D cos$1(deltaPhi), sinDeltaPhi =3D sin$1(deltaPhi), cosDeltaGamma =3D cos$1(deltaGamma), sinDeltaGamma =3D sin$1(deltaGamma); function rotation(lambda, phi) { var cosPhi =3D cos$1(phi), x =3D cos$1(lambda) * cosPhi, y =3D sin$1(lambda) * cosPhi, z =3D sin$1(phi), k =3D z * cosDeltaPhi + x * sinDeltaPhi; return [ atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * si= nDeltaPhi), asin(k * cosDeltaGamma + y * sinDeltaGamma) ]; } rotation.invert =3D function(lambda, phi) { var cosPhi =3D cos$1(phi), x =3D cos$1(lambda) * cosPhi, y =3D sin$1(lambda) * cosPhi, z =3D sin$1(phi), k =3D z * cosDeltaGamma - y * sinDeltaGamma; return [ atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * si= nDeltaPhi), asin(k * cosDeltaPhi - x * sinDeltaPhi) ]; }; return rotation; } function rotation(rotate) { rotate =3D rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate= =2Elength > 2 ? rotate[2] * radians : 0); function forward(coordinates) { coordinates =3D rotate(coordinates[0] * radians, coordinates[1] * radia= ns); return coordinates[0] *=3D degrees$1, coordinates[1] *=3D degrees$1, co= ordinates; } forward.invert =3D function(coordinates) { coordinates =3D rotate.invert(coordinates[0] * radians, coordinates[1] = * radians); return coordinates[0] *=3D degrees$1, coordinates[1] *=3D degrees$1, co= ordinates; }; return forward; } // Generates a circle centered at [0=C2=B0, 0=C2=B0], with a given radius a= nd precision. function circleStream(stream, radius, delta, direction, t0, t1) { if (!delta) return; var cosRadius =3D cos$1(radius), sinRadius =3D sin$1(radius), step =3D direction * delta; if (t0 =3D=3D null) { t0 =3D radius + direction * tau$3; t1 =3D radius - step / 2; } else { t0 =3D circleRadius(cosRadius, t0); t1 =3D circleRadius(cosRadius, t1); if (direction > 0 ? t0 < t1 : t0 > t1) t0 +=3D direction * tau$3; } for (var point, t =3D t0; direction > 0 ? t > t1 : t < t1; t -=3D step) { point =3D spherical([cosRadius, -sinRadius * cos$1(t), -sinRadius * sin= $1(t)]); stream.point(point[0], point[1]); } } // Returns the signed angle of a cartesian point relative to [cosRadius, 0,= 0]. function circleRadius(cosRadius, point) { point =3D cartesian(point), point[0] -=3D cosRadius; cartesianNormalizeInPlace(point); var radius =3D acos(-point[1]); return ((-point[2] < 0 ? -radius : radius) + tau$3 - epsilon$2) % tau$3; } function circle() { var center =3D constant$8([0, 0]), radius =3D constant$8(90), precision =3D constant$8(6), ring, rotate, stream =3D {point: point}; function point(x, y) { ring.push(x =3D rotate(x, y)); x[0] *=3D degrees$1, x[1] *=3D degrees$1; } function circle() { var c =3D center.apply(this, arguments), r =3D radius.apply(this, arguments) * radians, p =3D precision.apply(this, arguments) * radians; ring =3D []; rotate =3D rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert; circleStream(stream, r, p, 1); c =3D {type: "Polygon", coordinates: [ring]}; ring =3D rotate =3D null; return c; } circle.center =3D function(_) { return arguments.length ? (center =3D typeof _ =3D=3D=3D "function" ? _= : constant$8([+_[0], +_[1]]), circle) : center; }; circle.radius =3D function(_) { return arguments.length ? (radius =3D typeof _ =3D=3D=3D "function" ? _= : constant$8(+_), circle) : radius; }; circle.precision =3D function(_) { return arguments.length ? (precision =3D typeof _ =3D=3D=3D "function" = ? _ : constant$8(+_), circle) : precision; }; return circle; } function clipBuffer() { var lines =3D [], line; return { point: function(x, y) { line.push([x, y]); }, lineStart: function() { lines.push(line =3D []); }, lineEnd: noop$2, rejoin: function() { if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); }, result: function() { var result =3D lines; lines =3D []; line =3D null; return result; } }; } function pointEqual(a, b) { return abs(a[0] - b[0]) < epsilon$2 && abs(a[1] - b[1]) < epsilon$2; } function Intersection(point, points, other, entry) { this.x =3D point; this.z =3D points; this.o =3D other; // another intersection this.e =3D entry; // is an entry? this.v =3D false; // visited this.n =3D this.p =3D null; // next & previous } // A generalized polygon clipping algorithm: given a polygon that has been = cut // into its visible line segments, and rejoins the segments by interpolating // along the clip edge. function clipRejoin(segments, compareIntersection, startInside, interpolate= , stream) { var subject =3D [], clip =3D [], i, n; segments.forEach(function(segment) { if ((n =3D segment.length - 1) <=3D 0) return; var n, p0 =3D segment[0], p1 =3D segment[n], x; // If the first and last points of a segment are coincident, then treat= as a // closed ring. TODO if all rings are closed, then the winding order of= the // exterior ring should be checked. if (pointEqual(p0, p1)) { stream.lineStart(); for (i =3D 0; i < n; ++i) stream.point((p0 =3D segment[i])[0], p0[1]); stream.lineEnd(); return; } subject.push(x =3D new Intersection(p0, segment, null, true)); clip.push(x.o =3D new Intersection(p0, null, x, false)); subject.push(x =3D new Intersection(p1, segment, null, false)); clip.push(x.o =3D new Intersection(p1, null, x, true)); }); if (!subject.length) return; clip.sort(compareIntersection); link$1(subject); link$1(clip); for (i =3D 0, n =3D clip.length; i < n; ++i) { clip[i].e =3D startInside =3D !startInside; } var start =3D subject[0], points, point; while (1) { // Find first unvisited intersection. var current =3D start, isSubject =3D true; while (current.v) if ((current =3D current.n) =3D=3D=3D start) return; points =3D current.z; stream.lineStart(); do { current.v =3D current.o.v =3D true; if (current.e) { if (isSubject) { for (i =3D 0, n =3D points.length; i < n; ++i) stream.point((poin= t =3D points[i])[0], point[1]); } else { interpolate(current.x, current.n.x, 1, stream); } current =3D current.n; } else { if (isSubject) { points =3D current.p.z; for (i =3D points.length - 1; i >=3D 0; --i) stream.point((point = =3D points[i])[0], point[1]); } else { interpolate(current.x, current.p.x, -1, stream); } current =3D current.p; } current =3D current.o; points =3D current.z; isSubject =3D !isSubject; } while (!current.v); stream.lineEnd(); } } function link$1(array) { if (!(n =3D array.length)) return; var n, i =3D 0, a =3D array[0], b; while (++i < n) { a.n =3D b =3D array[i]; b.p =3D a; a =3D b; } a.n =3D b =3D array[0]; b.p =3D a; } var sum$1 =3D adder(); function longitude(point) { if (abs(point[0]) <=3D pi$3) return point[0]; else return sign(point[0]) * ((abs(point[0]) + pi$3) % tau$3 - pi$3); } function polygonContains(polygon, point) { var lambda =3D longitude(point), phi =3D point[1], sinPhi =3D sin$1(phi), normal =3D [sin$1(lambda), -cos$1(lambda), 0], angle =3D 0, winding =3D 0; sum$1.reset(); if (sinPhi =3D=3D=3D 1) phi =3D halfPi$2 + epsilon$2; else if (sinPhi =3D=3D=3D -1) phi =3D -halfPi$2 - epsilon$2; for (var i =3D 0, n =3D polygon.length; i < n; ++i) { if (!(m =3D (ring =3D polygon[i]).length)) continue; var ring, m, point0 =3D ring[m - 1], lambda0 =3D longitude(point0), phi0 =3D point0[1] / 2 + quarterPi, sinPhi0 =3D sin$1(phi0), cosPhi0 =3D cos$1(phi0); for (var j =3D 0; j < m; ++j, lambda0 =3D lambda1, sinPhi0 =3D sinPhi1,= cosPhi0 =3D cosPhi1, point0 =3D point1) { var point1 =3D ring[j], lambda1 =3D longitude(point1), phi1 =3D point1[1] / 2 + quarterPi, sinPhi1 =3D sin$1(phi1), cosPhi1 =3D cos$1(phi1), delta =3D lambda1 - lambda0, sign$$1 =3D delta >=3D 0 ? 1 : -1, absDelta =3D sign$$1 * delta, antimeridian =3D absDelta > pi$3, k =3D sinPhi0 * sinPhi1; sum$1.add(atan2(k * sign$$1 * sin$1(absDelta), cosPhi0 * cosPhi1 + k = * cos$1(absDelta))); angle +=3D antimeridian ? delta + sign$$1 * tau$3 : delta; // Are the longitudes either side of the point=E2=80=99s meridian (la= mbda), // and are the latitudes smaller than the parallel (phi)? if (antimeridian ^ lambda0 >=3D lambda ^ lambda1 >=3D lambda) { var arc =3D cartesianCross(cartesian(point0), cartesian(point1)); cartesianNormalizeInPlace(arc); var intersection =3D cartesianCross(normal, arc); cartesianNormalizeInPlace(intersection); var phiArc =3D (antimeridian ^ delta >=3D 0 ? -1 : 1) * asin(inters= ection[2]); if (phi > phiArc || phi =3D=3D=3D phiArc && (arc[0] || arc[1])) { winding +=3D antimeridian ^ delta >=3D 0 ? 1 : -1; } } } } // First, determine whether the South pole is inside or outside: // // It is inside if: // * the polygon winds around it in a clockwise direction. // * the polygon does not (cumulatively) wind around it, but has a negati= ve // (counter-clockwise) area. // // Second, count the (signed) number of times a segment crosses a lambda // from the point to the South pole. If it is zero, then the point is the // same side as the South pole. return (angle < -epsilon$2 || angle < epsilon$2 && sum$1 < -epsilon$2) ^ = (winding & 1); } function clip(pointVisible, clipLine, interpolate, start) { return function(sink) { var line =3D clipLine(sink), ringBuffer =3D clipBuffer(), ringSink =3D clipLine(ringBuffer), polygonStarted =3D false, polygon, segments, ring; var clip =3D { point: point, lineStart: lineStart, lineEnd: lineEnd, polygonStart: function() { clip.point =3D pointRing; clip.lineStart =3D ringStart; clip.lineEnd =3D ringEnd; segments =3D []; polygon =3D []; }, polygonEnd: function() { clip.point =3D point; clip.lineStart =3D lineStart; clip.lineEnd =3D lineEnd; segments =3D merge(segments); var startInside =3D polygonContains(polygon, start); if (segments.length) { if (!polygonStarted) sink.polygonStart(), polygonStarted =3D true; clipRejoin(segments, compareIntersection, startInside, interpolat= e, sink); } else if (startInside) { if (!polygonStarted) sink.polygonStart(), polygonStarted =3D true; sink.lineStart(); interpolate(null, null, 1, sink); sink.lineEnd(); } if (polygonStarted) sink.polygonEnd(), polygonStarted =3D false; segments =3D polygon =3D null; }, sphere: function() { sink.polygonStart(); sink.lineStart(); interpolate(null, null, 1, sink); sink.lineEnd(); sink.polygonEnd(); } }; function point(lambda, phi) { if (pointVisible(lambda, phi)) sink.point(lambda, phi); } function pointLine(lambda, phi) { line.point(lambda, phi); } function lineStart() { clip.point =3D pointLine; line.lineStart(); } function lineEnd() { clip.point =3D point; line.lineEnd(); } function pointRing(lambda, phi) { ring.push([lambda, phi]); ringSink.point(lambda, phi); } function ringStart() { ringSink.lineStart(); ring =3D []; } function ringEnd() { pointRing(ring[0][0], ring[0][1]); ringSink.lineEnd(); var clean =3D ringSink.clean(), ringSegments =3D ringBuffer.result(), i, n =3D ringSegments.length, m, segment, point; ring.pop(); polygon.push(ring); ring =3D null; if (!n) return; // No intersections. if (clean & 1) { segment =3D ringSegments[0]; if ((m =3D segment.length - 1) > 0) { if (!polygonStarted) sink.polygonStart(), polygonStarted =3D true; sink.lineStart(); for (i =3D 0; i < m; ++i) sink.point((point =3D segment[i])[0], p= oint[1]); sink.lineEnd(); } return; } // Rejoin connected segments. // TODO reuse ringBuffer.rejoin()? if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(r= ingSegments.shift())); segments.push(ringSegments.filter(validSegment)); } return clip; }; } function validSegment(segment) { return segment.length > 1; } // Intersections are sorted along the clip edge. For both antimeridian cutt= ing // and circle clipping, the same comparison is used. function compareIntersection(a, b) { return ((a =3D a.x)[0] < 0 ? a[1] - halfPi$2 - epsilon$2 : halfPi$2 - a[1= ]) - ((b =3D b.x)[0] < 0 ? b[1] - halfPi$2 - epsilon$2 : halfPi$2 - b[1= ]); } var clipAntimeridian =3D clip( function() { return true; }, clipAntimeridianLine, clipAntimeridianInterpolate, [-pi$3, -halfPi$2] ); // Takes a line and cuts into visible segments. Return values: 0 - there we= re // intersections or the line was empty; 1 - no intersections; 2 - there were // intersections, and the first and last segments should be rejoined. function clipAntimeridianLine(stream) { var lambda0 =3D NaN, phi0 =3D NaN, sign0 =3D NaN, clean; // no intersections return { lineStart: function() { stream.lineStart(); clean =3D 1; }, point: function(lambda1, phi1) { var sign1 =3D lambda1 > 0 ? pi$3 : -pi$3, delta =3D abs(lambda1 - lambda0); if (abs(delta - pi$3) < epsilon$2) { // line crosses a pole stream.point(lambda0, phi0 =3D (phi0 + phi1) / 2 > 0 ? halfPi$2 : -= halfPi$2); stream.point(sign0, phi0); stream.lineEnd(); stream.lineStart(); stream.point(sign1, phi0); stream.point(lambda1, phi0); clean =3D 0; } else if (sign0 !=3D=3D sign1 && delta >=3D pi$3) { // line crosses = antimeridian if (abs(lambda0 - sign0) < epsilon$2) lambda0 -=3D sign0 * epsilon$= 2; // handle degeneracies if (abs(lambda1 - sign1) < epsilon$2) lambda1 -=3D sign1 * epsilon$= 2; phi0 =3D clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1); stream.point(sign0, phi0); stream.lineEnd(); stream.lineStart(); stream.point(sign1, phi0); clean =3D 0; } stream.point(lambda0 =3D lambda1, phi0 =3D phi1); sign0 =3D sign1; }, lineEnd: function() { stream.lineEnd(); lambda0 =3D phi0 =3D NaN; }, clean: function() { return 2 - clean; // if intersections, rejoin first and last segments } }; } function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) { var cosPhi0, cosPhi1, sinLambda0Lambda1 =3D sin$1(lambda0 - lambda1); return abs(sinLambda0Lambda1) > epsilon$2 ? atan((sin$1(phi0) * (cosPhi1 =3D cos$1(phi1)) * sin$1(lambda1) - sin$1(phi1) * (cosPhi0 =3D cos$1(phi0)) * sin$1(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2; } function clipAntimeridianInterpolate(from, to, direction, stream) { var phi; if (from =3D=3D null) { phi =3D direction * halfPi$2; stream.point(-pi$3, phi); stream.point(0, phi); stream.point(pi$3, phi); stream.point(pi$3, 0); stream.point(pi$3, -phi); stream.point(0, -phi); stream.point(-pi$3, -phi); stream.point(-pi$3, 0); stream.point(-pi$3, phi); } else if (abs(from[0] - to[0]) > epsilon$2) { var lambda =3D from[0] < to[0] ? pi$3 : -pi$3; phi =3D direction * lambda / 2; stream.point(-lambda, phi); stream.point(0, phi); stream.point(lambda, phi); } else { stream.point(to[0], to[1]); } } function clipCircle(radius) { var cr =3D cos$1(radius), delta =3D 6 * radians, smallRadius =3D cr > 0, notHemisphere =3D abs(cr) > epsilon$2; // TODO optimise for this comm= on case function interpolate(from, to, direction, stream) { circleStream(stream, radius, delta, direction, from, to); } function visible(lambda, phi) { return cos$1(lambda) * cos$1(phi) > cr; } // Takes a line and cuts into visible segments. Return values used for po= lygon // clipping: 0 - there were intersections or the line was empty; 1 - no // intersections 2 - there were intersections, and the first and last seg= ments // should be rejoined. function clipLine(stream) { var point0, // previous point c0, // code for previous point v0, // visibility of previous point v00, // visibility of first point clean; // no intersections return { lineStart: function() { v00 =3D v0 =3D false; clean =3D 1; }, point: function(lambda, phi) { var point1 =3D [lambda, phi], point2, v =3D visible(lambda, phi), c =3D smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi$3 : -pi$3), phi) : 0; if (!point0 && (v00 =3D v0 =3D v)) stream.lineStart(); // Handle degeneracies. // TODO ignore if not clipping polygons. if (v !=3D=3D v0) { point2 =3D intersect(point0, point1); if (!point2 || pointEqual(point0, point2) || pointEqual(point1, p= oint2)) { point1[0] +=3D epsilon$2; point1[1] +=3D epsilon$2; v =3D visible(point1[0], point1[1]); } } if (v !=3D=3D v0) { clean =3D 0; if (v) { // outside going in stream.lineStart(); point2 =3D intersect(point1, point0); stream.point(point2[0], point2[1]); } else { // inside going out point2 =3D intersect(point0, point1); stream.point(point2[0], point2[1]); stream.lineEnd(); } point0 =3D point2; } else if (notHemisphere && point0 && smallRadius ^ v) { var t; // If the codes for two points are different, or are both zero, // and there this segment intersects with the small circle. if (!(c & c0) && (t =3D intersect(point1, point0, true))) { clean =3D 0; if (smallRadius) { stream.lineStart(); stream.point(t[0][0], t[0][1]); stream.point(t[1][0], t[1][1]); stream.lineEnd(); } else { stream.point(t[1][0], t[1][1]); stream.lineEnd(); stream.lineStart(); stream.point(t[0][0], t[0][1]); } } } if (v && (!point0 || !pointEqual(point0, point1))) { stream.point(point1[0], point1[1]); } point0 =3D point1, v0 =3D v, c0 =3D c; }, lineEnd: function() { if (v0) stream.lineEnd(); point0 =3D null; }, // Rejoin first and last segments if there were intersections and the= first // and last points were visible. clean: function() { return clean | ((v00 && v0) << 1); } }; } // Intersects the great circle between a and b with the clip circle. function intersect(a, b, two) { var pa =3D cartesian(a), pb =3D cartesian(b); // We have two planes, n1.p =3D d1 and n2.p =3D d2. // Find intersection line p(t) =3D c1 n1 + c2 n2 + t (n1 =E2=A8=AF n2). var n1 =3D [1, 0, 0], // normal n2 =3D cartesianCross(pa, pb), n2n2 =3D cartesianDot(n2, n2), n1n2 =3D n2[0], // cartesianDot(n1, n2), determinant =3D n2n2 - n1n2 * n1n2; // Two polar points. if (!determinant) return !two && a; var c1 =3D cr * n2n2 / determinant, c2 =3D -cr * n1n2 / determinant, n1xn2 =3D cartesianCross(n1, n2), A =3D cartesianScale(n1, c1), B =3D cartesianScale(n2, c2); cartesianAddInPlace(A, B); // Solve |p(t)|^2 =3D 1. var u =3D n1xn2, w =3D cartesianDot(A, u), uu =3D cartesianDot(u, u), t2 =3D w * w - uu * (cartesianDot(A, A) - 1); if (t2 < 0) return; var t =3D sqrt(t2), q =3D cartesianScale(u, (-w - t) / uu); cartesianAddInPlace(q, A); q =3D spherical(q); if (!two) return q; // Two intersection points. var lambda0 =3D a[0], lambda1 =3D b[0], phi0 =3D a[1], phi1 =3D b[1], z; if (lambda1 < lambda0) z =3D lambda0, lambda0 =3D lambda1, lambda1 =3D = z; var delta =3D lambda1 - lambda0, polar =3D abs(delta - pi$3) < epsilon$2, meridian =3D polar || delta < epsilon$2; if (!polar && phi1 < phi0) z =3D phi0, phi0 =3D phi1, phi1 =3D z; // Check that the first point is between a and b. if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon$2 ? phi= 0 : phi1) : phi0 <=3D q[1] && q[1] <=3D phi1 : delta > pi$3 ^ (lambda0 <=3D q[0] && q[0] <=3D lambda1)) { var q1 =3D cartesianScale(u, (-w + t) / uu); cartesianAddInPlace(q1, A); return [q, spherical(q1)]; } } // Generates a 4-bit vector representing the location of a point relative= to // the small circle's bounding box. function code(lambda, phi) { var r =3D smallRadius ? radius : pi$3 - radius, code =3D 0; if (lambda < -r) code |=3D 1; // left else if (lambda > r) code |=3D 2; // right if (phi < -r) code |=3D 4; // below else if (phi > r) code |=3D 8; // above return code; } return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : = [-pi$3, radius - pi$3]); } function clipLine(a, b, x0, y0, x1, y1) { var ax =3D a[0], ay =3D a[1], bx =3D b[0], by =3D b[1], t0 =3D 0, t1 =3D 1, dx =3D bx - ax, dy =3D by - ay, r; r =3D x0 - ax; if (!dx && r > 0) return; r /=3D dx; if (dx < 0) { if (r < t0) return; if (r < t1) t1 =3D r; } else if (dx > 0) { if (r > t1) return; if (r > t0) t0 =3D r; } r =3D x1 - ax; if (!dx && r < 0) return; r /=3D dx; if (dx < 0) { if (r > t1) return; if (r > t0) t0 =3D r; } else if (dx > 0) { if (r < t0) return; if (r < t1) t1 =3D r; } r =3D y0 - ay; if (!dy && r > 0) return; r /=3D dy; if (dy < 0) { if (r < t0) return; if (r < t1) t1 =3D r; } else if (dy > 0) { if (r > t1) return; if (r > t0) t0 =3D r; } r =3D y1 - ay; if (!dy && r < 0) return; r /=3D dy; if (dy < 0) { if (r > t1) return; if (r > t0) t0 =3D r; } else if (dy > 0) { if (r < t0) return; if (r < t1) t1 =3D r; } if (t0 > 0) a[0] =3D ax + t0 * dx, a[1] =3D ay + t0 * dy; if (t1 < 1) b[0] =3D ax + t1 * dx, b[1] =3D ay + t1 * dy; return true; } var clipMax =3D 1e9, clipMin =3D -clipMax; // TODO Use d3-polygon=E2=80=99s polygonContains here for the ring check? // TODO Eliminate duplicate buffering in clipBuffer and polygon.push? function clipRectangle(x0, y0, x1, y1) { function visible(x, y) { return x0 <=3D x && x <=3D x1 && y0 <=3D y && y <=3D y1; } function interpolate(from, to, direction, stream) { var a =3D 0, a1 =3D 0; if (from =3D=3D null || (a =3D corner(from, direction)) !=3D=3D (a1 =3D corner(to, direc= tion)) || comparePoint(from, to) < 0 ^ direction > 0) { do stream.point(a =3D=3D=3D 0 || a =3D=3D=3D 3 ? x0 : x1, a > 1 ? y1 = : y0); while ((a =3D (a + direction + 4) % 4) !=3D=3D a1); } else { stream.point(to[0], to[1]); } } function corner(p, direction) { return abs(p[0] - x0) < epsilon$2 ? direction > 0 ? 0 : 3 : abs(p[0] - x1) < epsilon$2 ? direction > 0 ? 2 : 1 : abs(p[1] - y0) < epsilon$2 ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon } function compareIntersection(a, b) { return comparePoint(a.x, b.x); } function comparePoint(a, b) { var ca =3D corner(a, 1), cb =3D corner(b, 1); return ca !=3D=3D cb ? ca - cb : ca =3D=3D=3D 0 ? b[1] - a[1] : ca =3D=3D=3D 1 ? a[0] - b[0] : ca =3D=3D=3D 2 ? a[1] - b[1] : b[0] - a[0]; } return function(stream) { var activeStream =3D stream, bufferStream =3D clipBuffer(), segments, polygon, ring, x__, y__, v__, // first point x_, y_, v_, // previous point first, clean; var clipStream =3D { point: point, lineStart: lineStart, lineEnd: lineEnd, polygonStart: polygonStart, polygonEnd: polygonEnd }; function point(x, y) { if (visible(x, y)) activeStream.point(x, y); } function polygonInside() { var winding =3D 0; for (var i =3D 0, n =3D polygon.length; i < n; ++i) { for (var ring =3D polygon[i], j =3D 1, m =3D ring.length, point =3D= ring[0], a0, a1, b0 =3D point[0], b1 =3D point[1]; j < m; ++j) { a0 =3D b0, a1 =3D b1, point =3D ring[j], b0 =3D point[0], b1 =3D = point[1]; if (a1 <=3D y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1= ) * (x0 - a0)) ++winding; } else { if (b1 <=3D y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 = - a0)) --winding; } } } return winding; } // Buffer geometry within a polygon and then clip it en masse. function polygonStart() { activeStream =3D bufferStream, segments =3D [], polygon =3D [], clean= =3D true; } function polygonEnd() { var startInside =3D polygonInside(), cleanInside =3D clean && startInside, visible =3D (segments =3D merge(segments)).length; if (cleanInside || visible) { stream.polygonStart(); if (cleanInside) { stream.lineStart(); interpolate(null, null, 1, stream); stream.lineEnd(); } if (visible) { clipRejoin(segments, compareIntersection, startInside, interpolat= e, stream); } stream.polygonEnd(); } activeStream =3D stream, segments =3D polygon =3D ring =3D null; } function lineStart() { clipStream.point =3D linePoint; if (polygon) polygon.push(ring =3D []); first =3D true; v_ =3D false; x_ =3D y_ =3D NaN; } // TODO rather than special-case polygons, simply handle them separatel= y. // Ideally, coincident intersection points should be jittered to avoid // clipping issues. function lineEnd() { if (segments) { linePoint(x__, y__); if (v__ && v_) bufferStream.rejoin(); segments.push(bufferStream.result()); } clipStream.point =3D point; if (v_) activeStream.lineEnd(); } function linePoint(x, y) { var v =3D visible(x, y); if (polygon) ring.push([x, y]); if (first) { x__ =3D x, y__ =3D y, v__ =3D v; first =3D false; if (v) { activeStream.lineStart(); activeStream.point(x, y); } } else { if (v && v_) activeStream.point(x, y); else { var a =3D [x_ =3D Math.max(clipMin, Math.min(clipMax, x_)), y_ = =3D Math.max(clipMin, Math.min(clipMax, y_))], b =3D [x =3D Math.max(clipMin, Math.min(clipMax, x)), y =3D M= ath.max(clipMin, Math.min(clipMax, y))]; if (clipLine(a, b, x0, y0, x1, y1)) { if (!v_) { activeStream.lineStart(); activeStream.point(a[0], a[1]); } activeStream.point(b[0], b[1]); if (!v) activeStream.lineEnd(); clean =3D false; } else if (v) { activeStream.lineStart(); activeStream.point(x, y); clean =3D false; } } } x_ =3D x, y_ =3D y, v_ =3D v; } return clipStream; }; } function extent$1() { var x0 =3D 0, y0 =3D 0, x1 =3D 960, y1 =3D 500, cache, cacheStream, clip; return clip =3D { stream: function(stream) { return cache && cacheStream =3D=3D=3D stream ? cache : cache =3D clip= Rectangle(x0, y0, x1, y1)(cacheStream =3D stream); }, extent: function(_) { return arguments.length ? (x0 =3D +_[0][0], y0 =3D +_[0][1], x1 =3D += _[1][0], y1 =3D +_[1][1], cache =3D cacheStream =3D null, clip) : [[x0, y0]= , [x1, y1]]; } }; } var lengthSum =3D adder(), lambda0$2, sinPhi0$1, cosPhi0$1; var lengthStream =3D { sphere: noop$2, point: noop$2, lineStart: lengthLineStart, lineEnd: noop$2, polygonStart: noop$2, polygonEnd: noop$2 }; function lengthLineStart() { lengthStream.point =3D lengthPointFirst; lengthStream.lineEnd =3D lengthLineEnd; } function lengthLineEnd() { lengthStream.point =3D lengthStream.lineEnd =3D noop$2; } function lengthPointFirst(lambda, phi) { lambda *=3D radians, phi *=3D radians; lambda0$2 =3D lambda, sinPhi0$1 =3D sin$1(phi), cosPhi0$1 =3D cos$1(phi); lengthStream.point =3D lengthPoint; } function lengthPoint(lambda, phi) { lambda *=3D radians, phi *=3D radians; var sinPhi =3D sin$1(phi), cosPhi =3D cos$1(phi), delta =3D abs(lambda - lambda0$2), cosDelta =3D cos$1(delta), sinDelta =3D sin$1(delta), x =3D cosPhi * sinDelta, y =3D cosPhi0$1 * sinPhi - sinPhi0$1 * cosPhi * cosDelta, z =3D sinPhi0$1 * sinPhi + cosPhi0$1 * cosPhi * cosDelta; lengthSum.add(atan2(sqrt(x * x + y * y), z)); lambda0$2 =3D lambda, sinPhi0$1 =3D sinPhi, cosPhi0$1 =3D cosPhi; } function length$1(object) { lengthSum.reset(); geoStream(object, lengthStream); return +lengthSum; } var coordinates =3D [null, null], object$1 =3D {type: "LineString", coordinates: coordinates}; function distance(a, b) { coordinates[0] =3D a; coordinates[1] =3D b; return length$1(object$1); } var containsObjectType =3D { Feature: function(object, point) { return containsGeometry(object.geometry, point); }, FeatureCollection: function(object, point) { var features =3D object.features, i =3D -1, n =3D features.length; while (++i < n) if (containsGeometry(features[i].geometry, point)) retu= rn true; return false; } }; var containsGeometryType =3D { Sphere: function() { return true; }, Point: function(object, point) { return containsPoint(object.coordinates, point); }, MultiPoint: function(object, point) { var coordinates =3D object.coordinates, i =3D -1, n =3D coordinates.len= gth; while (++i < n) if (containsPoint(coordinates[i], point)) return true; return false; }, LineString: function(object, point) { return containsLine(object.coordinates, point); }, MultiLineString: function(object, point) { var coordinates =3D object.coordinates, i =3D -1, n =3D coordinates.len= gth; while (++i < n) if (containsLine(coordinates[i], point)) return true; return false; }, Polygon: function(object, point) { return containsPolygon(object.coordinates, point); }, MultiPolygon: function(object, point) { var coordinates =3D object.coordinates, i =3D -1, n =3D coordinates.len= gth; while (++i < n) if (containsPolygon(coordinates[i], point)) return true; return false; }, GeometryCollection: function(object, point) { var geometries =3D object.geometries, i =3D -1, n =3D geometries.length; while (++i < n) if (containsGeometry(geometries[i], point)) return true; return false; } }; function containsGeometry(geometry, point) { return geometry && containsGeometryType.hasOwnProperty(geometry.type) ? containsGeometryType[geometry.type](geometry, point) : false; } function containsPoint(coordinates, point) { return distance(coordinates, point) =3D=3D=3D 0; } function containsLine(coordinates, point) { var ao, bo, ab; for (var i =3D 0, n =3D coordinates.length; i < n; i++) { bo =3D distance(coordinates[i], point); if (bo =3D=3D=3D 0) return true; if (i > 0) { ab =3D distance(coordinates[i], coordinates[i - 1]); if ( ab > 0 && ao <=3D ab && bo <=3D ab && (ao + bo - ab) * (1 - Math.pow((ao - bo) / ab, 2)) < epsilon2$1 * ab ) return true; } ao =3D bo; } return false; } function containsPolygon(coordinates, point) { return !!polygonContains(coordinates.map(ringRadians), pointRadians(point= )); } function ringRadians(ring) { return ring =3D ring.map(pointRadians), ring.pop(), ring; } function pointRadians(point) { return [point[0] * radians, point[1] * radians]; } function contains$1(object, point) { return (object && containsObjectType.hasOwnProperty(object.type) ? containsObjectType[object.type] : containsGeometry)(object, point); } function graticuleX(y0, y1, dy) { var y =3D sequence(y0, y1 - epsilon$2, dy).concat(y1); return function(x) { return y.map(function(y) { return [x, y]; }); }; } function graticuleY(x0, x1, dx) { var x =3D sequence(x0, x1 - epsilon$2, dx).concat(x1); return function(y) { return x.map(function(x) { return [x, y]; }); }; } function graticule() { var x1, x0, X1, X0, y1, y0, Y1, Y0, dx =3D 10, dy =3D dx, DX =3D 90, DY =3D 360, x, y, X, Y, precision =3D 2.5; function graticule() { return {type: "MultiLineString", coordinates: lines()}; } function lines() { return sequence(ceil(X0 / DX) * DX, X1, DX).map(X) .concat(sequence(ceil(Y0 / DY) * DY, Y1, DY).map(Y)) .concat(sequence(ceil(x0 / dx) * dx, x1, dx).filter(function(x) { r= eturn abs(x % DX) > epsilon$2; }).map(x)) .concat(sequence(ceil(y0 / dy) * dy, y1, dy).filter(function(y) { r= eturn abs(y % DY) > epsilon$2; }).map(y)); } graticule.lines =3D function() { return lines().map(function(coordinates) { return {type: "LineString", = coordinates: coordinates}; }); }; graticule.outline =3D function() { return { type: "Polygon", coordinates: [ X(X0).concat( Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ] }; }; graticule.extent =3D function(_) { if (!arguments.length) return graticule.extentMinor(); return graticule.extentMajor(_).extentMinor(_); }; graticule.extentMajor =3D function(_) { if (!arguments.length) return [[X0, Y0], [X1, Y1]]; X0 =3D +_[0][0], X1 =3D +_[1][0]; Y0 =3D +_[0][1], Y1 =3D +_[1][1]; if (X0 > X1) _ =3D X0, X0 =3D X1, X1 =3D _; if (Y0 > Y1) _ =3D Y0, Y0 =3D Y1, Y1 =3D _; return graticule.precision(precision); }; graticule.extentMinor =3D function(_) { if (!arguments.length) return [[x0, y0], [x1, y1]]; x0 =3D +_[0][0], x1 =3D +_[1][0]; y0 =3D +_[0][1], y1 =3D +_[1][1]; if (x0 > x1) _ =3D x0, x0 =3D x1, x1 =3D _; if (y0 > y1) _ =3D y0, y0 =3D y1, y1 =3D _; return graticule.precision(precision); }; graticule.step =3D function(_) { if (!arguments.length) return graticule.stepMinor(); return graticule.stepMajor(_).stepMinor(_); }; graticule.stepMajor =3D function(_) { if (!arguments.length) return [DX, DY]; DX =3D +_[0], DY =3D +_[1]; return graticule; }; graticule.stepMinor =3D function(_) { if (!arguments.length) return [dx, dy]; dx =3D +_[0], dy =3D +_[1]; return graticule; }; graticule.precision =3D function(_) { if (!arguments.length) return precision; precision =3D +_; x =3D graticuleX(y0, y1, 90); y =3D graticuleY(x0, x1, precision); X =3D graticuleX(Y0, Y1, 90); Y =3D graticuleY(X0, X1, precision); return graticule; }; return graticule .extentMajor([[-180, -90 + epsilon$2], [180, 90 - epsilon$2]]) .extentMinor([[-180, -80 - epsilon$2], [180, 80 + epsilon$2]]); } function graticule10() { return graticule()(); } function interpolate$1(a, b) { var x0 =3D a[0] * radians, y0 =3D a[1] * radians, x1 =3D b[0] * radians, y1 =3D b[1] * radians, cy0 =3D cos$1(y0), sy0 =3D sin$1(y0), cy1 =3D cos$1(y1), sy1 =3D sin$1(y1), kx0 =3D cy0 * cos$1(x0), ky0 =3D cy0 * sin$1(x0), kx1 =3D cy1 * cos$1(x1), ky1 =3D cy1 * sin$1(x1), d =3D 2 * asin(sqrt(haversin(y1 - y0) + cy0 * cy1 * haversin(x1 - x0)= )), k =3D sin$1(d); var interpolate =3D d ? function(t) { var B =3D sin$1(t *=3D d) / k, A =3D sin$1(d - t) / k, x =3D A * kx0 + B * kx1, y =3D A * ky0 + B * ky1, z =3D A * sy0 + B * sy1; return [ atan2(y, x) * degrees$1, atan2(z, sqrt(x * x + y * y)) * degrees$1 ]; } : function() { return [x0 * degrees$1, y0 * degrees$1]; }; interpolate.distance =3D d; return interpolate; } function identity$4(x) { return x; } var areaSum$1 =3D adder(), areaRingSum$1 =3D adder(), x00, y00, x0$1, y0$1; var areaStream$1 =3D { point: noop$2, lineStart: noop$2, lineEnd: noop$2, polygonStart: function() { areaStream$1.lineStart =3D areaRingStart$1; areaStream$1.lineEnd =3D areaRingEnd$1; }, polygonEnd: function() { areaStream$1.lineStart =3D areaStream$1.lineEnd =3D areaStream$1.point = =3D noop$2; areaSum$1.add(abs(areaRingSum$1)); areaRingSum$1.reset(); }, result: function() { var area =3D areaSum$1 / 2; areaSum$1.reset(); return area; } }; function areaRingStart$1() { areaStream$1.point =3D areaPointFirst$1; } function areaPointFirst$1(x, y) { areaStream$1.point =3D areaPoint$1; x00 =3D x0$1 =3D x, y00 =3D y0$1 =3D y; } function areaPoint$1(x, y) { areaRingSum$1.add(y0$1 * x - x0$1 * y); x0$1 =3D x, y0$1 =3D y; } function areaRingEnd$1() { areaPoint$1(x00, y00); } var x0$2 =3D Infinity, y0$2 =3D x0$2, x1 =3D -x0$2, y1 =3D x1; var boundsStream$1 =3D { point: boundsPoint$1, lineStart: noop$2, lineEnd: noop$2, polygonStart: noop$2, polygonEnd: noop$2, result: function() { var bounds =3D [[x0$2, y0$2], [x1, y1]]; x1 =3D y1 =3D -(y0$2 =3D x0$2 =3D Infinity); return bounds; } }; function boundsPoint$1(x, y) { if (x < x0$2) x0$2 =3D x; if (x > x1) x1 =3D x; if (y < y0$2) y0$2 =3D y; if (y > y1) y1 =3D y; } // TODO Enforce positive area for exterior, negative area for interior? var X0$1 =3D 0, Y0$1 =3D 0, Z0$1 =3D 0, X1$1 =3D 0, Y1$1 =3D 0, Z1$1 =3D 0, X2$1 =3D 0, Y2$1 =3D 0, Z2$1 =3D 0, x00$1, y00$1, x0$3, y0$3; var centroidStream$1 =3D { point: centroidPoint$1, lineStart: centroidLineStart$1, lineEnd: centroidLineEnd$1, polygonStart: function() { centroidStream$1.lineStart =3D centroidRingStart$1; centroidStream$1.lineEnd =3D centroidRingEnd$1; }, polygonEnd: function() { centroidStream$1.point =3D centroidPoint$1; centroidStream$1.lineStart =3D centroidLineStart$1; centroidStream$1.lineEnd =3D centroidLineEnd$1; }, result: function() { var centroid =3D Z2$1 ? [X2$1 / Z2$1, Y2$1 / Z2$1] : Z1$1 ? [X1$1 / Z1$1, Y1$1 / Z1$1] : Z0$1 ? [X0$1 / Z0$1, Y0$1 / Z0$1] : [NaN, NaN]; X0$1 =3D Y0$1 =3D Z0$1 =3D X1$1 =3D Y1$1 =3D Z1$1 =3D X2$1 =3D Y2$1 =3D Z2$1 =3D 0; return centroid; } }; function centroidPoint$1(x, y) { X0$1 +=3D x; Y0$1 +=3D y; ++Z0$1; } function centroidLineStart$1() { centroidStream$1.point =3D centroidPointFirstLine; } function centroidPointFirstLine(x, y) { centroidStream$1.point =3D centroidPointLine; centroidPoint$1(x0$3 =3D x, y0$3 =3D y); } function centroidPointLine(x, y) { var dx =3D x - x0$3, dy =3D y - y0$3, z =3D sqrt(dx * dx + dy * dy); X1$1 +=3D z * (x0$3 + x) / 2; Y1$1 +=3D z * (y0$3 + y) / 2; Z1$1 +=3D z; centroidPoint$1(x0$3 =3D x, y0$3 =3D y); } function centroidLineEnd$1() { centroidStream$1.point =3D centroidPoint$1; } function centroidRingStart$1() { centroidStream$1.point =3D centroidPointFirstRing; } function centroidRingEnd$1() { centroidPointRing(x00$1, y00$1); } function centroidPointFirstRing(x, y) { centroidStream$1.point =3D centroidPointRing; centroidPoint$1(x00$1 =3D x0$3 =3D x, y00$1 =3D y0$3 =3D y); } function centroidPointRing(x, y) { var dx =3D x - x0$3, dy =3D y - y0$3, z =3D sqrt(dx * dx + dy * dy); X1$1 +=3D z * (x0$3 + x) / 2; Y1$1 +=3D z * (y0$3 + y) / 2; Z1$1 +=3D z; z =3D y0$3 * x - x0$3 * y; X2$1 +=3D z * (x0$3 + x); Y2$1 +=3D z * (y0$3 + y); Z2$1 +=3D z * 3; centroidPoint$1(x0$3 =3D x, y0$3 =3D y); } function PathContext(context) { this._context =3D context; } PathContext.prototype =3D { _radius: 4.5, pointRadius: function(_) { return this._radius =3D _, this; }, polygonStart: function() { this._line =3D 0; }, polygonEnd: function() { this._line =3D NaN; }, lineStart: function() { this._point =3D 0; }, lineEnd: function() { if (this._line =3D=3D=3D 0) this._context.closePath(); this._point =3D NaN; }, point: function(x, y) { switch (this._point) { case 0: { this._context.moveTo(x, y); this._point =3D 1; break; } case 1: { this._context.lineTo(x, y); break; } default: { this._context.moveTo(x + this._radius, y); this._context.arc(x, y, this._radius, 0, tau$3); break; } } }, result: noop$2 }; var lengthSum$1 =3D adder(), lengthRing, x00$2, y00$2, x0$4, y0$4; var lengthStream$1 =3D { point: noop$2, lineStart: function() { lengthStream$1.point =3D lengthPointFirst$1; }, lineEnd: function() { if (lengthRing) lengthPoint$1(x00$2, y00$2); lengthStream$1.point =3D noop$2; }, polygonStart: function() { lengthRing =3D true; }, polygonEnd: function() { lengthRing =3D null; }, result: function() { var length =3D +lengthSum$1; lengthSum$1.reset(); return length; } }; function lengthPointFirst$1(x, y) { lengthStream$1.point =3D lengthPoint$1; x00$2 =3D x0$4 =3D x, y00$2 =3D y0$4 =3D y; } function lengthPoint$1(x, y) { x0$4 -=3D x, y0$4 -=3D y; lengthSum$1.add(sqrt(x0$4 * x0$4 + y0$4 * y0$4)); x0$4 =3D x, y0$4 =3D y; } function PathString() { this._string =3D []; } PathString.prototype =3D { _radius: 4.5, _circle: circle$1(4.5), pointRadius: function(_) { if ((_ =3D +_) !=3D=3D this._radius) this._radius =3D _, this._circle = =3D null; return this; }, polygonStart: function() { this._line =3D 0; }, polygonEnd: function() { this._line =3D NaN; }, lineStart: function() { this._point =3D 0; }, lineEnd: function() { if (this._line =3D=3D=3D 0) this._string.push("Z"); this._point =3D NaN; }, point: function(x, y) { switch (this._point) { case 0: { this._string.push("M", x, ",", y); this._point =3D 1; break; } case 1: { this._string.push("L", x, ",", y); break; } default: { if (this._circle =3D=3D null) this._circle =3D circle$1(this._radiu= s); this._string.push("M", x, ",", y, this._circle); break; } } }, result: function() { if (this._string.length) { var result =3D this._string.join(""); this._string =3D []; return result; } else { return null; } } }; function circle$1(radius) { return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z"; } function index$1(projection, context) { var pointRadius =3D 4.5, projectionStream, contextStream; function path(object) { if (object) { if (typeof pointRadius =3D=3D=3D "function") contextStream.pointRadiu= s(+pointRadius.apply(this, arguments)); geoStream(object, projectionStream(contextStream)); } return contextStream.result(); } path.area =3D function(object) { geoStream(object, projectionStream(areaStream$1)); return areaStream$1.result(); }; path.measure =3D function(object) { geoStream(object, projectionStream(lengthStream$1)); return lengthStream$1.result(); }; path.bounds =3D function(object) { geoStream(object, projectionStream(boundsStream$1)); return boundsStream$1.result(); }; path.centroid =3D function(object) { geoStream(object, projectionStream(centroidStream$1)); return centroidStream$1.result(); }; path.projection =3D function(_) { return arguments.length ? (projectionStream =3D _ =3D=3D null ? (projec= tion =3D null, identity$4) : (projection =3D _).stream, path) : projection; }; path.context =3D function(_) { if (!arguments.length) return context; contextStream =3D _ =3D=3D null ? (context =3D null, new PathString) : = new PathContext(context =3D _); if (typeof pointRadius !=3D=3D "function") contextStream.pointRadius(po= intRadius); return path; }; path.pointRadius =3D function(_) { if (!arguments.length) return pointRadius; pointRadius =3D typeof _ =3D=3D=3D "function" ? _ : (contextStream.poin= tRadius(+_), +_); return path; }; return path.projection(projection).context(context); } function transform(methods) { return { stream: transformer(methods) }; } function transformer(methods) { return function(stream) { var s =3D new TransformStream; for (var key in methods) s[key] =3D methods[key]; s.stream =3D stream; return s; }; } function TransformStream() {} TransformStream.prototype =3D { constructor: TransformStream, point: function(x, y) { this.stream.point(x, y); }, sphere: function() { this.stream.sphere(); }, lineStart: function() { this.stream.lineStart(); }, lineEnd: function() { this.stream.lineEnd(); }, polygonStart: function() { this.stream.polygonStart(); }, polygonEnd: function() { this.stream.polygonEnd(); } }; function fit(projection, fitBounds, object) { var clip =3D projection.clipExtent && projection.clipExtent(); projection.scale(150).translate([0, 0]); if (clip !=3D null) projection.clipExtent(null); geoStream(object, projection.stream(boundsStream$1)); fitBounds(boundsStream$1.result()); if (clip !=3D null) projection.clipExtent(clip); return projection; } function fitExtent(projection, extent, object) { return fit(projection, function(b) { var w =3D extent[1][0] - extent[0][0], h =3D extent[1][1] - extent[0][1], k =3D Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x =3D +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y =3D +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2; projection.scale(150 * k).translate([x, y]); }, object); } function fitSize(projection, size, object) { return fitExtent(projection, [[0, 0], size], object); } function fitWidth(projection, width, object) { return fit(projection, function(b) { var w =3D +width, k =3D w / (b[1][0] - b[0][0]), x =3D (w - k * (b[1][0] + b[0][0])) / 2, y =3D -k * b[0][1]; projection.scale(150 * k).translate([x, y]); }, object); } function fitHeight(projection, height, object) { return fit(projection, function(b) { var h =3D +height, k =3D h / (b[1][1] - b[0][1]), x =3D -k * b[0][0], y =3D (h - k * (b[1][1] + b[0][1])) / 2; projection.scale(150 * k).translate([x, y]); }, object); } var maxDepth =3D 16, // maximum depth of subdivision cosMinDistance =3D cos$1(30 * radians); // cos(minimum angular distance) function resample(project, delta2) { return +delta2 ? resample$1(project, delta2) : resampleNone(project); } function resampleNone(project) { return transformer({ point: function(x, y) { x =3D project(x, y); this.stream.point(x[0], x[1]); } }); } function resample$1(project, delta2) { function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1,= b1, c1, depth, stream) { var dx =3D x1 - x0, dy =3D y1 - y0, d2 =3D dx * dx + dy * dy; if (d2 > 4 * delta2 && depth--) { var a =3D a0 + a1, b =3D b0 + b1, c =3D c0 + c1, m =3D sqrt(a * a + b * b + c * c), phi2 =3D asin(c /=3D m), lambda2 =3D abs(abs(c) - 1) < epsilon$2 || abs(lambda0 - lambda1)= < epsilon$2 ? (lambda0 + lambda1) / 2 : atan2(b, a), p =3D project(lambda2, phi2), x2 =3D p[0], y2 =3D p[1], dx2 =3D x2 - x0, dy2 =3D y2 - y0, dz =3D dy * dx2 - dx * dy2; if (dz * dz / d2 > delta2 // perpendicular projected distance || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close = to an end || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { // angular dis= tance resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /=3D= m, b /=3D m, c, depth, stream); stream.point(x2, y2); resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c= 1, depth, stream); } } } return function(stream) { var lambda00, x00, y00, a00, b00, c00, // first point lambda0, x0, y0, a0, b0, c0; // previous point var resampleStream =3D { point: point, lineStart: lineStart, lineEnd: lineEnd, polygonStart: function() { stream.polygonStart(); resampleStream.line= Start =3D ringStart; }, polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStar= t =3D lineStart; } }; function point(x, y) { x =3D project(x, y); stream.point(x[0], x[1]); } function lineStart() { x0 =3D NaN; resampleStream.point =3D linePoint; stream.lineStart(); } function linePoint(lambda, phi) { var c =3D cartesian([lambda, phi]), p =3D project(lambda, phi); resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 =3D p[0], y0 =3D p[1],= lambda0 =3D lambda, a0 =3D c[0], b0 =3D c[1], c0 =3D c[2], maxDepth, strea= m); stream.point(x0, y0); } function lineEnd() { resampleStream.point =3D point; stream.lineEnd(); } function ringStart() { lineStart(); resampleStream.point =3D ringPoint; resampleStream.lineEnd =3D ringEnd; } function ringPoint(lambda, phi) { linePoint(lambda00 =3D lambda, phi), x00 =3D x0, y00 =3D y0, a00 =3D = a0, b00 =3D b0, c00 =3D c0; resampleStream.point =3D linePoint; } function ringEnd() { resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, = b00, c00, maxDepth, stream); resampleStream.lineEnd =3D lineEnd; lineEnd(); } return resampleStream; }; } var transformRadians =3D transformer({ point: function(x, y) { this.stream.point(x * radians, y * radians); } }); function transformRotate(rotate) { return transformer({ point: function(x, y) { var r =3D rotate(x, y); return this.stream.point(r[0], r[1]); } }); } function scaleTranslate(k, dx, dy) { function transform$$1(x, y) { return [dx + k * x, dy - k * y]; } transform$$1.invert =3D function(x, y) { return [(x - dx) / k, (dy - y) / k]; }; return transform$$1; } function scaleTranslateRotate(k, dx, dy, alpha) { var cosAlpha =3D cos$1(alpha), sinAlpha =3D sin$1(alpha), a =3D cosAlpha * k, b =3D sinAlpha * k, ai =3D cosAlpha / k, bi =3D sinAlpha / k, ci =3D (sinAlpha * dy - cosAlpha * dx) / k, fi =3D (sinAlpha * dx + cosAlpha * dy) / k; function transform$$1(x, y) { return [a * x - b * y + dx, dy - b * x - a * y]; } transform$$1.invert =3D function(x, y) { return [ai * x - bi * y + ci, fi - bi * x - ai * y]; }; return transform$$1; } function projection(project) { return projectionMutator(function() { return project; })(); } function projectionMutator(projectAt) { var project, k =3D 150, // scale x =3D 480, y =3D 250, // translate lambda =3D 0, phi =3D 0, // center deltaLambda =3D 0, deltaPhi =3D 0, deltaGamma =3D 0, rotate, // pre-r= otate alpha =3D 0, // post-rotate theta =3D null, preclip =3D clipAntimeridian, // pre-clip angle x0 =3D null, y0, x1, y1, postclip =3D identity$4, // post-clip extent delta2 =3D 0.5, // precision projectResample, projectTransform, projectRotateTransform, cache, cacheStream; function projection(point) { return projectRotateTransform(point[0] * radians, point[1] * radians); } function invert(point) { point =3D projectRotateTransform.invert(point[0], point[1]); return point && [point[0] * degrees$1, point[1] * degrees$1]; } projection.stream =3D function(stream) { return cache && cacheStream =3D=3D=3D stream ? cache : cache =3D transf= ormRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheSt= ream =3D stream))))); }; projection.preclip =3D function(_) { return arguments.length ? (preclip =3D _, theta =3D undefined, reset())= : preclip; }; projection.postclip =3D function(_) { return arguments.length ? (postclip =3D _, x0 =3D y0 =3D x1 =3D y1 =3D = null, reset()) : postclip; }; projection.clipAngle =3D function(_) { return arguments.length ? (preclip =3D +_ ? clipCircle(theta =3D _ * ra= dians) : (theta =3D null, clipAntimeridian), reset()) : theta * degrees$1; }; projection.clipExtent =3D function(_) { return arguments.length ? (postclip =3D _ =3D=3D null ? (x0 =3D y0 =3D = x1 =3D y1 =3D null, identity$4) : clipRectangle(x0 =3D +_[0][0], y0 =3D +_[= 0][1], x1 =3D +_[1][0], y1 =3D +_[1][1]), reset()) : x0 =3D=3D null ? null = : [[x0, y0], [x1, y1]]; }; projection.scale =3D function(_) { return arguments.length ? (k =3D +_, recenter()) : k; }; projection.translate =3D function(_) { return arguments.length ? (x =3D +_[0], y =3D +_[1], recenter()) : [x, = y]; }; projection.center =3D function(_) { return arguments.length ? (lambda =3D _[0] % 360 * radians, phi =3D _[1= ] % 360 * radians, recenter()) : [lambda * degrees$1, phi * degrees$1]; }; projection.rotate =3D function(_) { return arguments.length ? (deltaLambda =3D _[0] % 360 * radians, deltaP= hi =3D _[1] % 360 * radians, deltaGamma =3D _.length > 2 ? _[2] % 360 * rad= ians : 0, recenter()) : [deltaLambda * degrees$1, deltaPhi * degrees$1, del= taGamma * degrees$1]; }; projection.angle =3D function(_) { return arguments.length ? (alpha =3D _ % 360 * radians, recenter()) : a= lpha * degrees$1; }; projection.precision =3D function(_) { return arguments.length ? (projectResample =3D resample(projectTransfor= m, delta2 =3D _ * _), reset()) : sqrt(delta2); }; projection.fitExtent =3D function(extent, object) { return fitExtent(projection, extent, object); }; projection.fitSize =3D function(size, object) { return fitSize(projection, size, object); }; projection.fitWidth =3D function(width, object) { return fitWidth(projection, width, object); }; projection.fitHeight =3D function(height, object) { return fitHeight(projection, height, object); }; function recenter() { var center =3D scaleTranslateRotate(k, 0, 0, alpha).apply(null, project= (lambda, phi)), transform$$1 =3D (alpha ? scaleTranslateRotate : scaleTranslate)(k,= x - center[0], y - center[1], alpha); rotate =3D rotateRadians(deltaLambda, deltaPhi, deltaGamma); projectTransform =3D compose(project, transform$$1); projectRotateTransform =3D compose(rotate, projectTransform); projectResample =3D resample(projectTransform, delta2); return reset(); } function reset() { cache =3D cacheStream =3D null; return projection; } return function() { project =3D projectAt.apply(this, arguments); projection.invert =3D project.invert && invert; return recenter(); }; } function conicProjection(projectAt) { var phi0 =3D 0, phi1 =3D pi$3 / 3, m =3D projectionMutator(projectAt), p =3D m(phi0, phi1); p.parallels =3D function(_) { return arguments.length ? m(phi0 =3D _[0] * radians, phi1 =3D _[1] * ra= dians) : [phi0 * degrees$1, phi1 * degrees$1]; }; return p; } function cylindricalEqualAreaRaw(phi0) { var cosPhi0 =3D cos$1(phi0); function forward(lambda, phi) { return [lambda * cosPhi0, sin$1(phi) / cosPhi0]; } forward.invert =3D function(x, y) { return [x / cosPhi0, asin(y * cosPhi0)]; }; return forward; } function conicEqualAreaRaw(y0, y1) { var sy0 =3D sin$1(y0), n =3D (sy0 + sin$1(y1)) / 2; // Are the parallels symmetrical around the Equator? if (abs(n) < epsilon$2) return cylindricalEqualAreaRaw(y0); var c =3D 1 + sy0 * (2 * n - sy0), r0 =3D sqrt(c) / n; function project(x, y) { var r =3D sqrt(c - 2 * n * sin$1(y)) / n; return [r * sin$1(x *=3D n), r0 - r * cos$1(x)]; } project.invert =3D function(x, y) { var r0y =3D r0 - y; return [atan2(x, abs(r0y)) / n * sign(r0y), asin((c - (x * x + r0y * r0= y) * n * n) / (2 * n))]; }; return project; } function conicEqualArea() { return conicProjection(conicEqualAreaRaw) .scale(155.424) .center([0, 33.6442]); } function albers() { return conicEqualArea() .parallels([29.5, 45.5]) .scale(1070) .translate([480, 250]) .rotate([96, 0]) .center([-0.6, 38.7]); } // The projections must have mutually exclusive clip regions on the sphere, // as this will avoid emitting interleaving lines and polygons. function multiplex(streams) { var n =3D streams.length; return { point: function(x, y) { var i =3D -1; while (++i < n) streams[i].point(= x, y); }, sphere: function() { var i =3D -1; while (++i < n) streams[i].sphere();= }, lineStart: function() { var i =3D -1; while (++i < n) streams[i].lineSt= art(); }, lineEnd: function() { var i =3D -1; while (++i < n) streams[i].lineEnd(= ); }, polygonStart: function() { var i =3D -1; while (++i < n) streams[i].pol= ygonStart(); }, polygonEnd: function() { var i =3D -1; while (++i < n) streams[i].polyg= onEnd(); } }; } // A composite projection for the United States, configured by default for // 960=C3=97500. The projection also works quite well at 960=C3=97600 if yo= u change the // scale to 1285 and adjust the translate accordingly. The set of standard // parallels for each region comes from USGS, which is published here: // http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers function albersUsa() { var cache, cacheStream, lower48 =3D albers(), lower48Point, alaska =3D conicEqualArea().rotate([154, 0]).center([-2, 58.5]).paral= lels([55, 65]), alaskaPoint, // EPSG:3338 hawaii =3D conicEqualArea().rotate([157, 0]).center([-3, 19.9]).paral= lels([8, 18]), hawaiiPoint, // ESRI:102007 point, pointStream =3D {point: function(x, y) { point =3D [x, y]; }}; function albersUsa(coordinates) { var x =3D coordinates[0], y =3D coordinates[1]; return point =3D null, (lower48Point.point(x, y), point) || (alaskaPoint.point(x, y), point) || (hawaiiPoint.point(x, y), point); } albersUsa.invert =3D function(coordinates) { var k =3D lower48.scale(), t =3D lower48.translate(), x =3D (coordinates[0] - t[0]) / k, y =3D (coordinates[1] - t[1]) / k; return (y >=3D 0.120 && y < 0.234 && x >=3D -0.425 && x < -0.214 ? alas= ka : y >=3D 0.166 && y < 0.234 && x >=3D -0.214 && x < -0.115 ? hawaii : lower48).invert(coordinates); }; albersUsa.stream =3D function(stream) { return cache && cacheStream =3D=3D=3D stream ? cache : cache =3D multip= lex([lower48.stream(cacheStream =3D stream), alaska.stream(stream), hawaii.= stream(stream)]); }; albersUsa.precision =3D function(_) { if (!arguments.length) return lower48.precision(); lower48.precision(_), alaska.precision(_), hawaii.precision(_); return reset(); }; albersUsa.scale =3D function(_) { if (!arguments.length) return lower48.scale(); lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_); return albersUsa.translate(lower48.translate()); }; albersUsa.translate =3D function(_) { if (!arguments.length) return lower48.translate(); var k =3D lower48.scale(), x =3D +_[0], y =3D +_[1]; lower48Point =3D lower48 .translate(_) .clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.= 238 * k]]) .stream(pointStream); alaskaPoint =3D alaska .translate([x - 0.307 * k, y + 0.201 * k]) .clipExtent([[x - 0.425 * k + epsilon$2, y + 0.120 * k + epsilon$2]= , [x - 0.214 * k - epsilon$2, y + 0.234 * k - epsilon$2]]) .stream(pointStream); hawaiiPoint =3D hawaii .translate([x - 0.205 * k, y + 0.212 * k]) .clipExtent([[x - 0.214 * k + epsilon$2, y + 0.166 * k + epsilon$2]= , [x - 0.115 * k - epsilon$2, y + 0.234 * k - epsilon$2]]) .stream(pointStream); return reset(); }; albersUsa.fitExtent =3D function(extent, object) { return fitExtent(albersUsa, extent, object); }; albersUsa.fitSize =3D function(size, object) { return fitSize(albersUsa, size, object); }; albersUsa.fitWidth =3D function(width, object) { return fitWidth(albersUsa, width, object); }; albersUsa.fitHeight =3D function(height, object) { return fitHeight(albersUsa, height, object); }; function reset() { cache =3D cacheStream =3D null; return albersUsa; } return albersUsa.scale(1070); } function azimuthalRaw(scale) { return function(x, y) { var cx =3D cos$1(x), cy =3D cos$1(y), k =3D scale(cx * cy); return [ k * cy * sin$1(x), k * sin$1(y) ]; } } function azimuthalInvert(angle) { return function(x, y) { var z =3D sqrt(x * x + y * y), c =3D angle(z), sc =3D sin$1(c), cc =3D cos$1(c); return [ atan2(x * sc, z * cc), asin(z && y * sc / z) ]; } } var azimuthalEqualAreaRaw =3D azimuthalRaw(function(cxcy) { return sqrt(2 / (1 + cxcy)); }); azimuthalEqualAreaRaw.invert =3D azimuthalInvert(function(z) { return 2 * asin(z / 2); }); function azimuthalEqualArea() { return projection(azimuthalEqualAreaRaw) .scale(124.75) .clipAngle(180 - 1e-3); } var azimuthalEquidistantRaw =3D azimuthalRaw(function(c) { return (c =3D acos(c)) && c / sin$1(c); }); azimuthalEquidistantRaw.invert =3D azimuthalInvert(function(z) { return z; }); function azimuthalEquidistant() { return projection(azimuthalEquidistantRaw) .scale(79.4188) .clipAngle(180 - 1e-3); } function mercatorRaw(lambda, phi) { return [lambda, log(tan((halfPi$2 + phi) / 2))]; } mercatorRaw.invert =3D function(x, y) { return [x, 2 * atan(exp(y)) - halfPi$2]; }; function mercator() { return mercatorProjection(mercatorRaw) .scale(961 / tau$3); } function mercatorProjection(project) { var m =3D projection(project), center =3D m.center, scale =3D m.scale, translate =3D m.translate, clipExtent =3D m.clipExtent, x0 =3D null, y0, x1, y1; // clip extent m.scale =3D function(_) { return arguments.length ? (scale(_), reclip()) : scale(); }; m.translate =3D function(_) { return arguments.length ? (translate(_), reclip()) : translate(); }; m.center =3D function(_) { return arguments.length ? (center(_), reclip()) : center(); }; m.clipExtent =3D function(_) { return arguments.length ? ((_ =3D=3D null ? x0 =3D y0 =3D x1 =3D y1 =3D= null : (x0 =3D +_[0][0], y0 =3D +_[0][1], x1 =3D +_[1][0], y1 =3D +_[1][1]= )), reclip()) : x0 =3D=3D null ? null : [[x0, y0], [x1, y1]]; }; function reclip() { var k =3D pi$3 * scale(), t =3D m(rotation(m.rotate()).invert([0, 0])); return clipExtent(x0 =3D=3D null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project =3D=3D=3D = mercatorRaw ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]] : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]); } return reclip(); } function tany(y) { return tan((halfPi$2 + y) / 2); } function conicConformalRaw(y0, y1) { var cy0 =3D cos$1(y0), n =3D y0 =3D=3D=3D y1 ? sin$1(y0) : log(cy0 / cos$1(y1)) / log(tany(y= 1) / tany(y0)), f =3D cy0 * pow(tany(y0), n) / n; if (!n) return mercatorRaw; function project(x, y) { if (f > 0) { if (y < -halfPi$2 + epsilon$2) y =3D -halfPi$2 + epsilon$2= ; } else { if (y > halfPi$2 - epsilon$2) y =3D halfPi$2 - epsilon$2; } var r =3D f / pow(tany(y), n); return [r * sin$1(n * x), f - r * cos$1(n * x)]; } project.invert =3D function(x, y) { var fy =3D f - y, r =3D sign(n) * sqrt(x * x + fy * fy); return [atan2(x, abs(fy)) / n * sign(fy), 2 * atan(pow(f / r, 1 / n)) -= halfPi$2]; }; return project; } function conicConformal() { return conicProjection(conicConformalRaw) .scale(109.5) .parallels([30, 30]); } function equirectangularRaw(lambda, phi) { return [lambda, phi]; } equirectangularRaw.invert =3D equirectangularRaw; function equirectangular() { return projection(equirectangularRaw) .scale(152.63); } function conicEquidistantRaw(y0, y1) { var cy0 =3D cos$1(y0), n =3D y0 =3D=3D=3D y1 ? sin$1(y0) : (cy0 - cos$1(y1)) / (y1 - y0), g =3D cy0 / n + y0; if (abs(n) < epsilon$2) return equirectangularRaw; function project(x, y) { var gy =3D g - y, nx =3D n * x; return [gy * sin$1(nx), g - gy * cos$1(nx)]; } project.invert =3D function(x, y) { var gy =3D g - y; return [atan2(x, abs(gy)) / n * sign(gy), g - sign(n) * sqrt(x * x + gy= * gy)]; }; return project; } function conicEquidistant() { return conicProjection(conicEquidistantRaw) .scale(131.154) .center([0, 13.9389]); } var A1 =3D 1.340264, A2 =3D -0.081106, A3 =3D 0.000893, A4 =3D 0.003796, M =3D sqrt(3) / 2, iterations =3D 12; function equalEarthRaw(lambda, phi) { var l =3D asin(M * sin$1(phi)), l2 =3D l * l, l6 =3D l2 * l2 * l2; return [ lambda * cos$1(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2= ))), l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) ]; } equalEarthRaw.invert =3D function(x, y) { var l =3D y, l2 =3D l * l, l6 =3D l2 * l2 * l2; for (var i =3D 0, delta, fy, fpy; i < iterations; ++i) { fy =3D l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y; fpy =3D A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); l -=3D delta =3D fy / fpy, l2 =3D l * l, l6 =3D l2 * l2 * l2; if (abs(delta) < epsilon2$1) break; } return [ M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos$1(l), asin(sin$1(l) / M) ]; }; function equalEarth() { return projection(equalEarthRaw) .scale(177.158); } function gnomonicRaw(x, y) { var cy =3D cos$1(y), k =3D cos$1(x) * cy; return [cy * sin$1(x) / k, sin$1(y) / k]; } gnomonicRaw.invert =3D azimuthalInvert(atan); function gnomonic() { return projection(gnomonicRaw) .scale(144.049) .clipAngle(60); } function scaleTranslate$1(kx, ky, tx, ty) { return kx =3D=3D=3D 1 && ky =3D=3D=3D 1 && tx =3D=3D=3D 0 && ty =3D=3D=3D= 0 ? identity$4 : transformer({ point: function(x, y) { this.stream.point(x * kx + tx, y * ky + ty); } }); } function identity$5() { var k =3D 1, tx =3D 0, ty =3D 0, sx =3D 1, sy =3D 1, transform$$1 =3D ide= ntity$4, // scale, translate and reflect x0 =3D null, y0, x1, y1, // clip extent postclip =3D identity$4, cache, cacheStream, projection; function reset() { cache =3D cacheStream =3D null; return projection; } return projection =3D { stream: function(stream) { return cache && cacheStream =3D=3D=3D stream ? cache : cache =3D tran= sform$$1(postclip(cacheStream =3D stream)); }, postclip: function(_) { return arguments.length ? (postclip =3D _, x0 =3D y0 =3D x1 =3D y1 = =3D null, reset()) : postclip; }, clipExtent: function(_) { return arguments.length ? (postclip =3D _ =3D=3D null ? (x0 =3D y0 = =3D x1 =3D y1 =3D null, identity$4) : clipRectangle(x0 =3D +_[0][0], y0 =3D= +_[0][1], x1 =3D +_[1][0], y1 =3D +_[1][1]), reset()) : x0 =3D=3D null ? n= ull : [[x0, y0], [x1, y1]]; }, scale: function(_) { return arguments.length ? (transform$$1 =3D scaleTranslate$1((k =3D += _) * sx, k * sy, tx, ty), reset()) : k; }, translate: function(_) { return arguments.length ? (transform$$1 =3D scaleTranslate$1(k * sx, = k * sy, tx =3D +_[0], ty =3D +_[1]), reset()) : [tx, ty]; }, reflectX: function(_) { return arguments.length ? (transform$$1 =3D scaleTranslate$1(k * (sx = =3D _ ? -1 : 1), k * sy, tx, ty), reset()) : sx < 0; }, reflectY: function(_) { return arguments.length ? (transform$$1 =3D scaleTranslate$1(k * sx, = k * (sy =3D _ ? -1 : 1), tx, ty), reset()) : sy < 0; }, fitExtent: function(extent, object) { return fitExtent(projection, extent, object); }, fitSize: function(size, object) { return fitSize(projection, size, object); }, fitWidth: function(width, object) { return fitWidth(projection, width, object); }, fitHeight: function(height, object) { return fitHeight(projection, height, object); } }; } function naturalEarth1Raw(lambda, phi) { var phi2 =3D phi * phi, phi4 =3D phi2 * phi2; return [ lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.0039= 71 * phi2 - 0.001529 * phi4))), phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi= 2 - 0.005916 * phi4))) ]; } naturalEarth1Raw.invert =3D function(x, y) { var phi =3D y, i =3D 25, delta; do { var phi2 =3D phi * phi, phi4 =3D phi2 * phi2; phi -=3D delta =3D (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044= 475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) / (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874= * 9 * phi2 - 0.005916 * 11 * phi4))); } while (abs(delta) > epsilon$2 && --i > 0); return [ x / (0.8707 + (phi2 =3D phi * phi) * (-0.131979 + phi2 * (-0.013791 + p= hi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))), phi ]; }; function naturalEarth1() { return projection(naturalEarth1Raw) .scale(175.295); } function orthographicRaw(x, y) { return [cos$1(y) * sin$1(x), sin$1(y)]; } orthographicRaw.invert =3D azimuthalInvert(asin); function orthographic() { return projection(orthographicRaw) .scale(249.5) .clipAngle(90 + epsilon$2); } function stereographicRaw(x, y) { var cy =3D cos$1(y), k =3D 1 + cos$1(x) * cy; return [cy * sin$1(x) / k, sin$1(y) / k]; } stereographicRaw.invert =3D azimuthalInvert(function(z) { return 2 * atan(z); }); function stereographic() { return projection(stereographicRaw) .scale(250) .clipAngle(142); } function transverseMercatorRaw(lambda, phi) { return [log(tan((halfPi$2 + phi) / 2)), -lambda]; } transverseMercatorRaw.invert =3D function(x, y) { return [-y, 2 * atan(exp(x)) - halfPi$2]; }; function transverseMercator() { var m =3D mercatorProjection(transverseMercatorRaw), center =3D m.center, rotate =3D m.rotate; m.center =3D function(_) { return arguments.length ? center([-_[1], _[0]]) : (_ =3D center(), [_[1= ], -_[0]]); }; m.rotate =3D function(_) { return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 = : 90]) : (_ =3D rotate(), [_[0], _[1], _[2] - 90]); }; return rotate([0, 0, 90]) .scale(159.155); } function defaultSeparation(a, b) { return a.parent =3D=3D=3D b.parent ? 1 : 2; } function meanX(children) { return children.reduce(meanXReduce, 0) / children.length; } function meanXReduce(x, c) { return x + c.x; } function maxY(children) { return 1 + children.reduce(maxYReduce, 0); } function maxYReduce(y, c) { return Math.max(y, c.y); } function leafLeft(node) { var children; while (children =3D node.children) node =3D children[0]; return node; } function leafRight(node) { var children; while (children =3D node.children) node =3D children[children.length - 1]; return node; } function cluster() { var separation =3D defaultSeparation, dx =3D 1, dy =3D 1, nodeSize =3D false; function cluster(root) { var previousNode, x =3D 0; // First walk, computing the initial x & y values. root.eachAfter(function(node) { var children =3D node.children; if (children) { node.x =3D meanX(children); node.y =3D maxY(children); } else { node.x =3D previousNode ? x +=3D separation(node, previousNode) : 0; node.y =3D 0; previousNode =3D node; } }); var left =3D leafLeft(root), right =3D leafRight(root), x0 =3D left.x - separation(left, right) / 2, x1 =3D right.x + separation(right, left) / 2; // Second walk, normalizing x & y to the desired size. return root.eachAfter(nodeSize ? function(node) { node.x =3D (node.x - root.x) * dx; node.y =3D (root.y - node.y) * dy; } : function(node) { node.x =3D (node.x - x0) / (x1 - x0) * dx; node.y =3D (1 - (root.y ? node.y / root.y : 1)) * dy; }); } cluster.separation =3D function(x) { return arguments.length ? (separation =3D x, cluster) : separation; }; cluster.size =3D function(x) { return arguments.length ? (nodeSize =3D false, dx =3D +x[0], dy =3D +x[= 1], cluster) : (nodeSize ? null : [dx, dy]); }; cluster.nodeSize =3D function(x) { return arguments.length ? (nodeSize =3D true, dx =3D +x[0], dy =3D +x[1= ], cluster) : (nodeSize ? [dx, dy] : null); }; return cluster; } function count(node) { var sum =3D 0, children =3D node.children, i =3D children && children.length; if (!i) sum =3D 1; else while (--i >=3D 0) sum +=3D children[i].value; node.value =3D sum; } function node_count() { return this.eachAfter(count); } function node_each(callback) { var node =3D this, current, next =3D [node], children, i, n; do { current =3D next.reverse(), next =3D []; while (node =3D current.pop()) { callback(node), children =3D node.children; if (children) for (i =3D 0, n =3D children.length; i < n; ++i) { next.push(children[i]); } } } while (next.length); return this; } function node_eachBefore(callback) { var node =3D this, nodes =3D [node], children, i; while (node =3D nodes.pop()) { callback(node), children =3D node.children; if (children) for (i =3D children.length - 1; i >=3D 0; --i) { nodes.push(children[i]); } } return this; } function node_eachAfter(callback) { var node =3D this, nodes =3D [node], next =3D [], children, i, n; while (node =3D nodes.pop()) { next.push(node), children =3D node.children; if (children) for (i =3D 0, n =3D children.length; i < n; ++i) { nodes.push(children[i]); } } while (node =3D next.pop()) { callback(node); } return this; } function node_sum(value) { return this.eachAfter(function(node) { var sum =3D +value(node.data) || 0, children =3D node.children, i =3D children && children.length; while (--i >=3D 0) sum +=3D children[i].value; node.value =3D sum; }); } function node_sort(compare) { return this.eachBefore(function(node) { if (node.children) { node.children.sort(compare); } }); } function node_path(end) { var start =3D this, ancestor =3D leastCommonAncestor(start, end), nodes =3D [start]; while (start !=3D=3D ancestor) { start =3D start.parent; nodes.push(start); } var k =3D nodes.length; while (end !=3D=3D ancestor) { nodes.splice(k, 0, end); end =3D end.parent; } return nodes; } function leastCommonAncestor(a, b) { if (a =3D=3D=3D b) return a; var aNodes =3D a.ancestors(), bNodes =3D b.ancestors(), c =3D null; a =3D aNodes.pop(); b =3D bNodes.pop(); while (a =3D=3D=3D b) { c =3D a; a =3D aNodes.pop(); b =3D bNodes.pop(); } return c; } function node_ancestors() { var node =3D this, nodes =3D [node]; while (node =3D node.parent) { nodes.push(node); } return nodes; } function node_descendants() { var nodes =3D []; this.each(function(node) { nodes.push(node); }); return nodes; } function node_leaves() { var leaves =3D []; this.eachBefore(function(node) { if (!node.children) { leaves.push(node); } }); return leaves; } function node_links() { var root =3D this, links =3D []; root.each(function(node) { if (node !=3D=3D root) { // Don=E2=80=99t include the root=E2=80=99s pa= rent, if any. links.push({source: node.parent, target: node}); } }); return links; } function hierarchy(data, children) { var root =3D new Node(data), valued =3D +data.value && (root.value =3D data.value), node, nodes =3D [root], child, childs, i, n; if (children =3D=3D null) children =3D defaultChildren; while (node =3D nodes.pop()) { if (valued) node.value =3D +node.data.value; if ((childs =3D children(node.data)) && (n =3D childs.length)) { node.children =3D new Array(n); for (i =3D n - 1; i >=3D 0; --i) { nodes.push(child =3D node.children[i] =3D new Node(childs[i])); child.parent =3D node; child.depth =3D node.depth + 1; } } } return root.eachBefore(computeHeight); } function node_copy() { return hierarchy(this).eachBefore(copyData); } function defaultChildren(d) { return d.children; } function copyData(node) { node.data =3D node.data.data; } function computeHeight(node) { var height =3D 0; do node.height =3D height; while ((node =3D node.parent) && (node.height < ++height)); } function Node(data) { this.data =3D data; this.depth =3D this.height =3D 0; this.parent =3D null; } Node.prototype =3D hierarchy.prototype =3D { constructor: Node, count: node_count, each: node_each, eachAfter: node_eachAfter, eachBefore: node_eachBefore, sum: node_sum, sort: node_sort, path: node_path, ancestors: node_ancestors, descendants: node_descendants, leaves: node_leaves, links: node_links, copy: node_copy }; var slice$4 =3D Array.prototype.slice; function shuffle$1(array) { var m =3D array.length, t, i; while (m) { i =3D Math.random() * m-- | 0; t =3D array[m]; array[m] =3D array[i]; array[i] =3D t; } return array; } function enclose(circles) { var i =3D 0, n =3D (circles =3D shuffle$1(slice$4.call(circles))).length,= B =3D [], p, e; while (i < n) { p =3D circles[i]; if (e && enclosesWeak(e, p)) ++i; else e =3D encloseBasis(B =3D extendBasis(B, p)), i =3D 0; } return e; } function extendBasis(B, p) { var i, j; if (enclosesWeakAll(p, B)) return [p]; // If we get here then B must have at least one element. for (i =3D 0; i < B.length; ++i) { if (enclosesNot(p, B[i]) && enclosesWeakAll(encloseBasis2(B[i], p), B)) { return [B[i], p]; } } // If we get here then B must have at least two elements. for (i =3D 0; i < B.length - 1; ++i) { for (j =3D i + 1; j < B.length; ++j) { if (enclosesNot(encloseBasis2(B[i], B[j]), p) && enclosesNot(encloseBasis2(B[i], p), B[j]) && enclosesNot(encloseBasis2(B[j], p), B[i]) && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) { return [B[i], B[j], p]; } } } // If we get here then something is very wrong. throw new Error; } function enclosesNot(a, b) { var dr =3D a.r - b.r, dx =3D b.x - a.x, dy =3D b.y - a.y; return dr < 0 || dr * dr < dx * dx + dy * dy; } function enclosesWeak(a, b) { var dr =3D a.r - b.r + 1e-6, dx =3D b.x - a.x, dy =3D b.y - a.y; return dr > 0 && dr * dr > dx * dx + dy * dy; } function enclosesWeakAll(a, B) { for (var i =3D 0; i < B.length; ++i) { if (!enclosesWeak(a, B[i])) { return false; } } return true; } function encloseBasis(B) { switch (B.length) { case 1: return encloseBasis1(B[0]); case 2: return encloseBasis2(B[0], B[1]); case 3: return encloseBasis3(B[0], B[1], B[2]); } } function encloseBasis1(a) { return { x: a.x, y: a.y, r: a.r }; } function encloseBasis2(a, b) { var x1 =3D a.x, y1 =3D a.y, r1 =3D a.r, x2 =3D b.x, y2 =3D b.y, r2 =3D b.r, x21 =3D x2 - x1, y21 =3D y2 - y1, r21 =3D r2 - r1, l =3D Math.sqrt(x21 * x21 + y21 * y21); return { x: (x1 + x2 + x21 / l * r21) / 2, y: (y1 + y2 + y21 / l * r21) / 2, r: (l + r1 + r2) / 2 }; } function encloseBasis3(a, b, c) { var x1 =3D a.x, y1 =3D a.y, r1 =3D a.r, x2 =3D b.x, y2 =3D b.y, r2 =3D b.r, x3 =3D c.x, y3 =3D c.y, r3 =3D c.r, a2 =3D x1 - x2, a3 =3D x1 - x3, b2 =3D y1 - y2, b3 =3D y1 - y3, c2 =3D r2 - r1, c3 =3D r3 - r1, d1 =3D x1 * x1 + y1 * y1 - r1 * r1, d2 =3D d1 - x2 * x2 - y2 * y2 + r2 * r2, d3 =3D d1 - x3 * x3 - y3 * y3 + r3 * r3, ab =3D a3 * b2 - a2 * b3, xa =3D (b2 * d3 - b3 * d2) / (ab * 2) - x1, xb =3D (b3 * c2 - b2 * c3) / ab, ya =3D (a3 * d2 - a2 * d3) / (ab * 2) - y1, yb =3D (a2 * c3 - a3 * c2) / ab, A =3D xb * xb + yb * yb - 1, B =3D 2 * (r1 + xa * xb + ya * yb), C =3D xa * xa + ya * ya - r1 * r1, r =3D -(A ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B); return { x: x1 + xa + xb * r, y: y1 + ya + yb * r, r: r }; } function place(b, a, c) { var dx =3D b.x - a.x, x, a2, dy =3D b.y - a.y, y, b2, d2 =3D dx * dx + dy * dy; if (d2) { a2 =3D a.r + c.r, a2 *=3D a2; b2 =3D b.r + c.r, b2 *=3D b2; if (a2 > b2) { x =3D (d2 + b2 - a2) / (2 * d2); y =3D Math.sqrt(Math.max(0, b2 / d2 - x * x)); c.x =3D b.x - x * dx - y * dy; c.y =3D b.y - x * dy + y * dx; } else { x =3D (d2 + a2 - b2) / (2 * d2); y =3D Math.sqrt(Math.max(0, a2 / d2 - x * x)); c.x =3D a.x + x * dx - y * dy; c.y =3D a.y + x * dy + y * dx; } } else { c.x =3D a.x + c.r; c.y =3D a.y; } } function intersects(a, b) { var dr =3D a.r + b.r - 1e-6, dx =3D b.x - a.x, dy =3D b.y - a.y; return dr > 0 && dr * dr > dx * dx + dy * dy; } function score(node) { var a =3D node._, b =3D node.next._, ab =3D a.r + b.r, dx =3D (a.x * b.r + b.x * a.r) / ab, dy =3D (a.y * b.r + b.y * a.r) / ab; return dx * dx + dy * dy; } function Node$1(circle) { this._ =3D circle; this.next =3D null; this.previous =3D null; } function packEnclose(circles) { if (!(n =3D circles.length)) return 0; var a, b, c, n, aa, ca, i, j, k, sj, sk; // Place the first circle. a =3D circles[0], a.x =3D 0, a.y =3D 0; if (!(n > 1)) return a.r; // Place the second circle. b =3D circles[1], a.x =3D -b.r, b.x =3D a.r, b.y =3D 0; if (!(n > 2)) return a.r + b.r; // Place the third circle. place(b, a, c =3D circles[2]); // Initialize the front-chain using the first three circles a, b and c. a =3D new Node$1(a), b =3D new Node$1(b), c =3D new Node$1(c); a.next =3D c.previous =3D b; b.next =3D a.previous =3D c; c.next =3D b.previous =3D a; // Attempt to place each remaining circle=E2=80=A6 pack: for (i =3D 3; i < n; ++i) { place(a._, b._, c =3D circles[i]), c =3D new Node$1(c); // Find the closest intersecting circle on the front-chain, if any. // =E2=80=9CCloseness=E2=80=9D is determined by linear distance along t= he front-chain. // =E2=80=9CAhead=E2=80=9D or =E2=80=9Cbehind=E2=80=9D is likewise dete= rmined by linear distance. j =3D b.next, k =3D a.previous, sj =3D b._.r, sk =3D a._.r; do { if (sj <=3D sk) { if (intersects(j._, c._)) { b =3D j, a.next =3D b, b.previous =3D a, --i; continue pack; } sj +=3D j._.r, j =3D j.next; } else { if (intersects(k._, c._)) { a =3D k, a.next =3D b, b.previous =3D a, --i; continue pack; } sk +=3D k._.r, k =3D k.previous; } } while (j !=3D=3D k.next); // Success! Insert the new circle c between a and b. c.previous =3D a, c.next =3D b, a.next =3D b.previous =3D b =3D c; // Compute the new closest circle pair to the centroid. aa =3D score(a); while ((c =3D c.next) !=3D=3D b) { if ((ca =3D score(c)) < aa) { a =3D c, aa =3D ca; } } b =3D a.next; } // Compute the enclosing circle of the front chain. a =3D [b._], c =3D b; while ((c =3D c.next) !=3D=3D b) a.push(c._); c =3D= enclose(a); // Translate the circles to put the enclosing circle around the origin. for (i =3D 0; i < n; ++i) a =3D circles[i], a.x -=3D c.x, a.y -=3D c.y; return c.r; } function siblings(circles) { packEnclose(circles); return circles; } function optional(f) { return f =3D=3D null ? null : required(f); } function required(f) { if (typeof f !=3D=3D "function") throw new Error; return f; } function constantZero() { return 0; } function constant$9(x) { return function() { return x; }; } function defaultRadius$1(d) { return Math.sqrt(d.value); } function index$2() { var radius =3D null, dx =3D 1, dy =3D 1, padding =3D constantZero; function pack(root) { root.x =3D dx / 2, root.y =3D dy / 2; if (radius) { root.eachBefore(radiusLeaf(radius)) .eachAfter(packChildren(padding, 0.5)) .eachBefore(translateChild(1)); } else { root.eachBefore(radiusLeaf(defaultRadius$1)) .eachAfter(packChildren(constantZero, 1)) .eachAfter(packChildren(padding, root.r / Math.min(dx, dy))) .eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r))); } return root; } pack.radius =3D function(x) { return arguments.length ? (radius =3D optional(x), pack) : radius; }; pack.size =3D function(x) { return arguments.length ? (dx =3D +x[0], dy =3D +x[1], pack) : [dx, dy]; }; pack.padding =3D function(x) { return arguments.length ? (padding =3D typeof x =3D=3D=3D "function" ? = x : constant$9(+x), pack) : padding; }; return pack; } function radiusLeaf(radius) { return function(node) { if (!node.children) { node.r =3D Math.max(0, +radius(node) || 0); } }; } function packChildren(padding, k) { return function(node) { if (children =3D node.children) { var children, i, n =3D children.length, r =3D padding(node) * k || 0, e; if (r) for (i =3D 0; i < n; ++i) children[i].r +=3D r; e =3D packEnclose(children); if (r) for (i =3D 0; i < n; ++i) children[i].r -=3D r; node.r =3D e + r; } }; } function translateChild(k) { return function(node) { var parent =3D node.parent; node.r *=3D k; if (parent) { node.x =3D parent.x + k * node.x; node.y =3D parent.y + k * node.y; } }; } function roundNode(node) { node.x0 =3D Math.round(node.x0); node.y0 =3D Math.round(node.y0); node.x1 =3D Math.round(node.x1); node.y1 =3D Math.round(node.y1); } function treemapDice(parent, x0, y0, x1, y1) { var nodes =3D parent.children, node, i =3D -1, n =3D nodes.length, k =3D parent.value && (x1 - x0) / parent.value; while (++i < n) { node =3D nodes[i], node.y0 =3D y0, node.y1 =3D y1; node.x0 =3D x0, node.x1 =3D x0 +=3D node.value * k; } } function partition() { var dx =3D 1, dy =3D 1, padding =3D 0, round =3D false; function partition(root) { var n =3D root.height + 1; root.x0 =3D root.y0 =3D padding; root.x1 =3D dx; root.y1 =3D dy / n; root.eachBefore(positionNode(dy, n)); if (round) root.eachBefore(roundNode); return root; } function positionNode(dy, n) { return function(node) { if (node.children) { treemapDice(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy *= (node.depth + 2) / n); } var x0 =3D node.x0, y0 =3D node.y0, x1 =3D node.x1 - padding, y1 =3D node.y1 - padding; if (x1 < x0) x0 =3D x1 =3D (x0 + x1) / 2; if (y1 < y0) y0 =3D y1 =3D (y0 + y1) / 2; node.x0 =3D x0; node.y0 =3D y0; node.x1 =3D x1; node.y1 =3D y1; }; } partition.round =3D function(x) { return arguments.length ? (round =3D !!x, partition) : round; }; partition.size =3D function(x) { return arguments.length ? (dx =3D +x[0], dy =3D +x[1], partition) : [dx= , dy]; }; partition.padding =3D function(x) { return arguments.length ? (padding =3D +x, partition) : padding; }; return partition; } var keyPrefix$1 =3D "$", // Protect against keys like =E2=80=9C__proto__=E2= =80=9D. preroot =3D {depth: -1}, ambiguous =3D {}; function defaultId(d) { return d.id; } function defaultParentId(d) { return d.parentId; } function stratify() { var id =3D defaultId, parentId =3D defaultParentId; function stratify(data) { var d, i, n =3D data.length, root, parent, node, nodes =3D new Array(n), nodeId, nodeKey, nodeByKey =3D {}; for (i =3D 0; i < n; ++i) { d =3D data[i], node =3D nodes[i] =3D new Node(d); if ((nodeId =3D id(d, i, data)) !=3D null && (nodeId +=3D "")) { nodeKey =3D keyPrefix$1 + (node.id =3D nodeId); nodeByKey[nodeKey] =3D nodeKey in nodeByKey ? ambiguous : node; } } for (i =3D 0; i < n; ++i) { node =3D nodes[i], nodeId =3D parentId(data[i], i, data); if (nodeId =3D=3D null || !(nodeId +=3D "")) { if (root) throw new Error("multiple roots"); root =3D node; } else { parent =3D nodeByKey[keyPrefix$1 + nodeId]; if (!parent) throw new Error("missing: " + nodeId); if (parent =3D=3D=3D ambiguous) throw new Error("ambiguous: " + nod= eId); if (parent.children) parent.children.push(node); else parent.children =3D [node]; node.parent =3D parent; } } if (!root) throw new Error("no root"); root.parent =3D preroot; root.eachBefore(function(node) { node.depth =3D node.parent.depth + 1; = --n; }).eachBefore(computeHeight); root.parent =3D null; if (n > 0) throw new Error("cycle"); return root; } stratify.id =3D function(x) { return arguments.length ? (id =3D required(x), stratify) : id; }; stratify.parentId =3D function(x) { return arguments.length ? (parentId =3D required(x), stratify) : parent= Id; }; return stratify; } function defaultSeparation$1(a, b) { return a.parent =3D=3D=3D b.parent ? 1 : 2; } // function radialSeparation(a, b) { // return (a.parent =3D=3D=3D b.parent ? 1 : 2) / a.depth; // } // This function is used to traverse the left contour of a subtree (or // subforest). It returns the successor of v on this contour. This successo= r is // either given by the leftmost child of v or by the thread of v. The funct= ion // returns null if and only if v is on the highest level of its subtree. function nextLeft(v) { var children =3D v.children; return children ? children[0] : v.t; } // This function works analogously to nextLeft. function nextRight(v) { var children =3D v.children; return children ? children[children.length - 1] : v.t; } // Shifts the current subtree rooted at w+. This is done by increasing // prelim(w+) and mod(w+) by shift. function moveSubtree(wm, wp, shift) { var change =3D shift / (wp.i - wm.i); wp.c -=3D change; wp.s +=3D shift; wm.c +=3D change; wp.z +=3D shift; wp.m +=3D shift; } // All other shifts, applied to the smaller subtrees between w- and w+, are // performed by this function. To prepare the shifts, we have to adjust // change(w+), shift(w+), and change(w-). function executeShifts(v) { var shift =3D 0, change =3D 0, children =3D v.children, i =3D children.length, w; while (--i >=3D 0) { w =3D children[i]; w.z +=3D shift; w.m +=3D shift; shift +=3D w.s + (change +=3D w.c); } } // If vi-=E2=80=99s ancestor is a sibling of v, returns vi-=E2=80=99s ances= tor. Otherwise, // returns the specified (default) ancestor. function nextAncestor(vim, v, ancestor) { return vim.a.parent =3D=3D=3D v.parent ? vim.a : ancestor; } function TreeNode(node, i) { this._ =3D node; this.parent =3D null; this.children =3D null; this.A =3D null; // default ancestor this.a =3D this; // ancestor this.z =3D 0; // prelim this.m =3D 0; // mod this.c =3D 0; // change this.s =3D 0; // shift this.t =3D null; // thread this.i =3D i; // number } TreeNode.prototype =3D Object.create(Node.prototype); function treeRoot(root) { var tree =3D new TreeNode(root, 0), node, nodes =3D [tree], child, children, i, n; while (node =3D nodes.pop()) { if (children =3D node._.children) { node.children =3D new Array(n =3D children.length); for (i =3D n - 1; i >=3D 0; --i) { nodes.push(child =3D node.children[i] =3D new TreeNode(children[i],= i)); child.parent =3D node; } } } (tree.parent =3D new TreeNode(null, 0)).children =3D [tree]; return tree; } // Node-link tree diagram using the Reingold-Tilford "tidy" algorithm function tree() { var separation =3D defaultSeparation$1, dx =3D 1, dy =3D 1, nodeSize =3D null; function tree(root) { var t =3D treeRoot(root); // Compute the layout using Buchheim et al.=E2=80=99s algorithm. t.eachAfter(firstWalk), t.parent.m =3D -t.z; t.eachBefore(secondWalk); // If a fixed node size is specified, scale x and y. if (nodeSize) root.eachBefore(sizeNode); // If a fixed tree size is specified, scale x and y based on the extent. // Compute the left-most, right-most, and depth-most nodes for extents. else { var left =3D root, right =3D root, bottom =3D root; root.eachBefore(function(node) { if (node.x < left.x) left =3D node; if (node.x > right.x) right =3D node; if (node.depth > bottom.depth) bottom =3D node; }); var s =3D left =3D=3D=3D right ? 1 : separation(left, right) / 2, tx =3D s - left.x, kx =3D dx / (right.x + s + tx), ky =3D dy / (bottom.depth || 1); root.eachBefore(function(node) { node.x =3D (node.x + tx) * kx; node.y =3D node.depth * ky; }); } return root; } // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is // applied recursively to the children of v, as well as the function // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, t= he // node v is placed to the midpoint of its outermost children. function firstWalk(v) { var children =3D v.children, siblings =3D v.parent.children, w =3D v.i ? siblings[v.i - 1] : null; if (children) { executeShifts(v); var midpoint =3D (children[0].z + children[children.length - 1].z) / = 2; if (w) { v.z =3D w.z + separation(v._, w._); v.m =3D v.z - midpoint; } else { v.z =3D midpoint; } } else if (w) { v.z =3D w.z + separation(v._, w._); } v.parent.A =3D apportion(v, w, v.parent.A || siblings[0]); } // Computes all real x-coordinates by summing up the modifiers recursivel= y. function secondWalk(v) { v._.x =3D v.z + v.parent.m; v.m +=3D v.parent.m; } // The core of the algorithm. Here, a new subtree is combined with the // previous subtrees. Threads are used to traverse the inside and outside // contours of the left and right subtree up to the highest common level.= The // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the // superscript o means outside and i means inside, the subscript - means = left // subtree and + means right subtree. For summing up the modifiers along = the // contour, we use respective variables si+, si-, so-, and so+. Whenever = two // nodes of the inside contours conflict, we compute the left one of the // greatest uncommon ancestors using the function ANCESTOR and call MOVE // SUBTREE to shift the subtree and prepare the shifts of smaller subtree= s. // Finally, we add a new thread (if necessary). function apportion(v, w, ancestor) { if (w) { var vip =3D v, vop =3D v, vim =3D w, vom =3D vip.parent.children[0], sip =3D vip.m, sop =3D vop.m, sim =3D vim.m, som =3D vom.m, shift; while (vim =3D nextRight(vim), vip =3D nextLeft(vip), vim && vip) { vom =3D nextLeft(vom); vop =3D nextRight(vop); vop.a =3D v; shift =3D vim.z + sim - vip.z - sip + separation(vim._, vip._); if (shift > 0) { moveSubtree(nextAncestor(vim, v, ancestor), v, shift); sip +=3D shift; sop +=3D shift; } sim +=3D vim.m; sip +=3D vip.m; som +=3D vom.m; sop +=3D vop.m; } if (vim && !nextRight(vop)) { vop.t =3D vim; vop.m +=3D sim - sop; } if (vip && !nextLeft(vom)) { vom.t =3D vip; vom.m +=3D sip - som; ancestor =3D v; } } return ancestor; } function sizeNode(node) { node.x *=3D dx; node.y =3D node.depth * dy; } tree.separation =3D function(x) { return arguments.length ? (separation =3D x, tree) : separation; }; tree.size =3D function(x) { return arguments.length ? (nodeSize =3D false, dx =3D +x[0], dy =3D +x[= 1], tree) : (nodeSize ? null : [dx, dy]); }; tree.nodeSize =3D function(x) { return arguments.length ? (nodeSize =3D true, dx =3D +x[0], dy =3D +x[1= ], tree) : (nodeSize ? [dx, dy] : null); }; return tree; } function treemapSlice(parent, x0, y0, x1, y1) { var nodes =3D parent.children, node, i =3D -1, n =3D nodes.length, k =3D parent.value && (y1 - y0) / parent.value; while (++i < n) { node =3D nodes[i], node.x0 =3D x0, node.x1 =3D x1; node.y0 =3D y0, node.y1 =3D y0 +=3D node.value * k; } } var phi =3D (1 + Math.sqrt(5)) / 2; function squarifyRatio(ratio, parent, x0, y0, x1, y1) { var rows =3D [], nodes =3D parent.children, row, nodeValue, i0 =3D 0, i1 =3D 0, n =3D nodes.length, dx, dy, value =3D parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta; while (i0 < n) { dx =3D x1 - x0, dy =3D y1 - y0; // Find the next non-empty node. do sumValue =3D nodes[i1++].value; while (!sumValue && i1 < n); minValue =3D maxValue =3D sumValue; alpha =3D Math.max(dy / dx, dx / dy) / (value * ratio); beta =3D sumValue * sumValue * alpha; minRatio =3D Math.max(maxValue / beta, beta / minValue); // Keep adding nodes while the aspect ratio maintains or improves. for (; i1 < n; ++i1) { sumValue +=3D nodeValue =3D nodes[i1].value; if (nodeValue < minValue) minValue =3D nodeValue; if (nodeValue > maxValue) maxValue =3D nodeValue; beta =3D sumValue * sumValue * alpha; newRatio =3D Math.max(maxValue / beta, beta / minValue); if (newRatio > minRatio) { sumValue -=3D nodeValue; break; } minRatio =3D newRatio; } // Position and record the row orientation. rows.push(row =3D {value: sumValue, dice: dx < dy, children: nodes.slic= e(i0, i1)}); if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 +=3D dy * sumValu= e / value : y1); else treemapSlice(row, x0, y0, value ? x0 +=3D dx * sumValue / value : = x1, y1); value -=3D sumValue, i0 =3D i1; } return rows; } var squarify =3D (function custom(ratio) { function squarify(parent, x0, y0, x1, y1) { squarifyRatio(ratio, parent, x0, y0, x1, y1); } squarify.ratio =3D function(x) { return custom((x =3D +x) > 1 ? x : 1); }; return squarify; })(phi); function index$3() { var tile =3D squarify, round =3D false, dx =3D 1, dy =3D 1, paddingStack =3D [0], paddingInner =3D constantZero, paddingTop =3D constantZero, paddingRight =3D constantZero, paddingBottom =3D constantZero, paddingLeft =3D constantZero; function treemap(root) { root.x0 =3D root.y0 =3D 0; root.x1 =3D dx; root.y1 =3D dy; root.eachBefore(positionNode); paddingStack =3D [0]; if (round) root.eachBefore(roundNode); return root; } function positionNode(node) { var p =3D paddingStack[node.depth], x0 =3D node.x0 + p, y0 =3D node.y0 + p, x1 =3D node.x1 - p, y1 =3D node.y1 - p; if (x1 < x0) x0 =3D x1 =3D (x0 + x1) / 2; if (y1 < y0) y0 =3D y1 =3D (y0 + y1) / 2; node.x0 =3D x0; node.y0 =3D y0; node.x1 =3D x1; node.y1 =3D y1; if (node.children) { p =3D paddingStack[node.depth + 1] =3D paddingInner(node) / 2; x0 +=3D paddingLeft(node) - p; y0 +=3D paddingTop(node) - p; x1 -=3D paddingRight(node) - p; y1 -=3D paddingBottom(node) - p; if (x1 < x0) x0 =3D x1 =3D (x0 + x1) / 2; if (y1 < y0) y0 =3D y1 =3D (y0 + y1) / 2; tile(node, x0, y0, x1, y1); } } treemap.round =3D function(x) { return arguments.length ? (round =3D !!x, treemap) : round; }; treemap.size =3D function(x) { return arguments.length ? (dx =3D +x[0], dy =3D +x[1], treemap) : [dx, = dy]; }; treemap.tile =3D function(x) { return arguments.length ? (tile =3D required(x), treemap) : tile; }; treemap.padding =3D function(x) { return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : tre= emap.paddingInner(); }; treemap.paddingInner =3D function(x) { return arguments.length ? (paddingInner =3D typeof x =3D=3D=3D "functio= n" ? x : constant$9(+x), treemap) : paddingInner; }; treemap.paddingOuter =3D function(x) { return arguments.length ? treemap.paddingTop(x).paddingRight(x).padding= Bottom(x).paddingLeft(x) : treemap.paddingTop(); }; treemap.paddingTop =3D function(x) { return arguments.length ? (paddingTop =3D typeof x =3D=3D=3D "function"= ? x : constant$9(+x), treemap) : paddingTop; }; treemap.paddingRight =3D function(x) { return arguments.length ? (paddingRight =3D typeof x =3D=3D=3D "functio= n" ? x : constant$9(+x), treemap) : paddingRight; }; treemap.paddingBottom =3D function(x) { return arguments.length ? (paddingBottom =3D typeof x =3D=3D=3D "functi= on" ? x : constant$9(+x), treemap) : paddingBottom; }; treemap.paddingLeft =3D function(x) { return arguments.length ? (paddingLeft =3D typeof x =3D=3D=3D "function= " ? x : constant$9(+x), treemap) : paddingLeft; }; return treemap; } function binary(parent, x0, y0, x1, y1) { var nodes =3D parent.children, i, n =3D nodes.length, sum, sums =3D new Array(n + 1); for (sums[0] =3D sum =3D i =3D 0; i < n; ++i) { sums[i + 1] =3D sum +=3D nodes[i].value; } partition(0, n, parent.value, x0, y0, x1, y1); function partition(i, j, value, x0, y0, x1, y1) { if (i >=3D j - 1) { var node =3D nodes[i]; node.x0 =3D x0, node.y0 =3D y0; node.x1 =3D x1, node.y1 =3D y1; return; } var valueOffset =3D sums[i], valueTarget =3D (value / 2) + valueOffset, k =3D i + 1, hi =3D j - 1; while (k < hi) { var mid =3D k + hi >>> 1; if (sums[mid] < valueTarget) k =3D mid + 1; else hi =3D mid; } if ((valueTarget - sums[k - 1]) < (sums[k] - valueTarget) && i + 1 < k)= --k; var valueLeft =3D sums[k] - valueOffset, valueRight =3D value - valueLeft; if ((x1 - x0) > (y1 - y0)) { var xk =3D (x0 * valueRight + x1 * valueLeft) / value; partition(i, k, valueLeft, x0, y0, xk, y1); partition(k, j, valueRight, xk, y0, x1, y1); } else { var yk =3D (y0 * valueRight + y1 * valueLeft) / value; partition(i, k, valueLeft, x0, y0, x1, yk); partition(k, j, valueRight, x0, yk, x1, y1); } } } function sliceDice(parent, x0, y0, x1, y1) { (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x0, y0, x1, y1); } var resquarify =3D (function custom(ratio) { function resquarify(parent, x0, y0, x1, y1) { if ((rows =3D parent._squarify) && (rows.ratio =3D=3D=3D ratio)) { var rows, row, nodes, i, j =3D -1, n, m =3D rows.length, value =3D parent.value; while (++j < m) { row =3D rows[j], nodes =3D row.children; for (i =3D row.value =3D 0, n =3D nodes.length; i < n; ++i) row.val= ue +=3D nodes[i].value; if (row.dice) treemapDice(row, x0, y0, x1, y0 +=3D (y1 - y0) * row.= value / value); else treemapSlice(row, x0, y0, x0 +=3D (x1 - x0) * row.value / valu= e, y1); value -=3D row.value; } } else { parent._squarify =3D rows =3D squarifyRatio(ratio, parent, x0, y0, x1= , y1); rows.ratio =3D ratio; } } resquarify.ratio =3D function(x) { return custom((x =3D +x) > 1 ? x : 1); }; return resquarify; })(phi); function area$2(polygon) { var i =3D -1, n =3D polygon.length, a, b =3D polygon[n - 1], area =3D 0; while (++i < n) { a =3D b; b =3D polygon[i]; area +=3D a[1] * b[0] - a[0] * b[1]; } return area / 2; } function centroid$1(polygon) { var i =3D -1, n =3D polygon.length, x =3D 0, y =3D 0, a, b =3D polygon[n - 1], c, k =3D 0; while (++i < n) { a =3D b; b =3D polygon[i]; k +=3D c =3D a[0] * b[1] - b[0] * a[1]; x +=3D (a[0] + b[0]) * c; y +=3D (a[1] + b[1]) * c; } return k *=3D 3, [x / k, y / k]; } // Returns the 2D cross product of AB and AC vectors, i.e., the z-component= of // the 3D cross product in a quadrant I Cartesian coordinate system (+x is // right, +y is up). Returns a positive value if ABC is counter-clockwise, // negative if clockwise, and zero if the points are collinear. function cross$1(a, b, c) { return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]); } function lexicographicOrder(a, b) { return a[0] - b[0] || a[1] - b[1]; } // Computes the upper convex hull per the monotone chain algorithm. // Assumes points.length >=3D 3, is sorted by x, unique in y. // Returns an array of indices into points in left-to-right order. function computeUpperHullIndexes(points) { var n =3D points.length, indexes =3D [0, 1], size =3D 2; for (var i =3D 2; i < n; ++i) { while (size > 1 && cross$1(points[indexes[size - 2]], points[indexes[si= ze - 1]], points[i]) <=3D 0) --size; indexes[size++] =3D i; } return indexes.slice(0, size); // remove popped points } function hull(points) { if ((n =3D points.length) < 3) return null; var i, n, sortedPoints =3D new Array(n), flippedPoints =3D new Array(n); for (i =3D 0; i < n; ++i) sortedPoints[i] =3D [+points[i][0], +points[i][= 1], i]; sortedPoints.sort(lexicographicOrder); for (i =3D 0; i < n; ++i) flippedPoints[i] =3D [sortedPoints[i][0], -sort= edPoints[i][1]]; var upperIndexes =3D computeUpperHullIndexes(sortedPoints), lowerIndexes =3D computeUpperHullIndexes(flippedPoints); // Construct the hull polygon, removing possible duplicate endpoints. var skipLeft =3D lowerIndexes[0] =3D=3D=3D upperIndexes[0], skipRight =3D lowerIndexes[lowerIndexes.length - 1] =3D=3D=3D upperIn= dexes[upperIndexes.length - 1], hull =3D []; // Add upper hull in right-to-l order. // Then add lower hull in left-to-right order. for (i =3D upperIndexes.length - 1; i >=3D 0; --i) hull.push(points[sorte= dPoints[upperIndexes[i]][2]]); for (i =3D +skipLeft; i < lowerIndexes.length - skipRight; ++i) hull.push= (points[sortedPoints[lowerIndexes[i]][2]]); return hull; } function contains$2(polygon, point) { var n =3D polygon.length, p =3D polygon[n - 1], x =3D point[0], y =3D point[1], x0 =3D p[0], y0 =3D p[1], x1, y1, inside =3D false; for (var i =3D 0; i < n; ++i) { p =3D polygon[i], x1 =3D p[0], y1 =3D p[1]; if (((y1 > y) !=3D=3D (y0 > y)) && (x < (x0 - x1) * (y - y1) / (y0 - y1= ) + x1)) inside =3D !inside; x0 =3D x1, y0 =3D y1; } return inside; } function length$2(polygon) { var i =3D -1, n =3D polygon.length, b =3D polygon[n - 1], xa, ya, xb =3D b[0], yb =3D b[1], perimeter =3D 0; while (++i < n) { xa =3D xb; ya =3D yb; b =3D polygon[i]; xb =3D b[0]; yb =3D b[1]; xa -=3D xb; ya -=3D yb; perimeter +=3D Math.sqrt(xa * xa + ya * ya); } return perimeter; } function defaultSource$1() { return Math.random(); } var uniform =3D (function sourceRandomUniform(source) { function randomUniform(min, max) { min =3D min =3D=3D null ? 0 : +min; max =3D max =3D=3D null ? 1 : +max; if (arguments.length =3D=3D=3D 1) max =3D min, min =3D 0; else max -=3D min; return function() { return source() * max + min; }; } randomUniform.source =3D sourceRandomUniform; return randomUniform; })(defaultSource$1); var normal =3D (function sourceRandomNormal(source) { function randomNormal(mu, sigma) { var x, r; mu =3D mu =3D=3D null ? 0 : +mu; sigma =3D sigma =3D=3D null ? 1 : +sigma; return function() { var y; // If available, use the second previously-generated uniform random. if (x !=3D null) y =3D x, x =3D null; // Otherwise, generate a new x and y. else do { x =3D source() * 2 - 1; y =3D source() * 2 - 1; r =3D x * x + y * y; } while (!r || r > 1); return mu + sigma * y * Math.sqrt(-2 * Math.log(r) / r); }; } randomNormal.source =3D sourceRandomNormal; return randomNormal; })(defaultSource$1); var logNormal =3D (function sourceRandomLogNormal(source) { function randomLogNormal() { var randomNormal =3D normal.source(source).apply(this, arguments); return function() { return Math.exp(randomNormal()); }; } randomLogNormal.source =3D sourceRandomLogNormal; return randomLogNormal; })(defaultSource$1); var irwinHall =3D (function sourceRandomIrwinHall(source) { function randomIrwinHall(n) { return function() { for (var sum =3D 0, i =3D 0; i < n; ++i) sum +=3D source(); return sum; }; } randomIrwinHall.source =3D sourceRandomIrwinHall; return randomIrwinHall; })(defaultSource$1); var bates =3D (function sourceRandomBates(source) { function randomBates(n) { var randomIrwinHall =3D irwinHall.source(source)(n); return function() { return randomIrwinHall() / n; }; } randomBates.source =3D sourceRandomBates; return randomBates; })(defaultSource$1); var exponential$1 =3D (function sourceRandomExponential(source) { function randomExponential(lambda) { return function() { return -Math.log(1 - source()) / lambda; }; } randomExponential.source =3D sourceRandomExponential; return randomExponential; })(defaultSource$1); function initRange(domain, range) { switch (arguments.length) { case 0: break; case 1: this.range(domain); break; default: this.range(range).domain(domain); break; } return this; } function initInterpolator(domain, interpolator) { switch (arguments.length) { case 0: break; case 1: this.interpolator(domain); break; default: this.interpolator(interpolator).domain(domain); break; } return this; } var array$3 =3D Array.prototype; var map$2 =3D array$3.map; var slice$5 =3D array$3.slice; var implicit =3D {name: "implicit"}; function ordinal() { var index =3D map$1(), domain =3D [], range =3D [], unknown =3D implicit; function scale(d) { var key =3D d + "", i =3D index.get(key); if (!i) { if (unknown !=3D=3D implicit) return unknown; index.set(key, i =3D domain.push(d)); } return range[(i - 1) % range.length]; } scale.domain =3D function(_) { if (!arguments.length) return domain.slice(); domain =3D [], index =3D map$1(); var i =3D -1, n =3D _.length, d, key; while (++i < n) if (!index.has(key =3D (d =3D _[i]) + "")) index.set(ke= y, domain.push(d)); return scale; }; scale.range =3D function(_) { return arguments.length ? (range =3D slice$5.call(_), scale) : range.sl= ice(); }; scale.unknown =3D function(_) { return arguments.length ? (unknown =3D _, scale) : unknown; }; scale.copy =3D function() { return ordinal(domain, range).unknown(unknown); }; initRange.apply(scale, arguments); return scale; } function band() { var scale =3D ordinal().unknown(undefined), domain =3D scale.domain, ordinalRange =3D scale.range, range$$1 =3D [0, 1], step, bandwidth, round =3D false, paddingInner =3D 0, paddingOuter =3D 0, align =3D 0.5; delete scale.unknown; function rescale() { var n =3D domain().length, reverse =3D range$$1[1] < range$$1[0], start =3D range$$1[reverse - 0], stop =3D range$$1[1 - reverse]; step =3D (stop - start) / Math.max(1, n - paddingInner + paddingOuter *= 2); if (round) step =3D Math.floor(step); start +=3D (stop - start - step * (n - paddingInner)) * align; bandwidth =3D step * (1 - paddingInner); if (round) start =3D Math.round(start), bandwidth =3D Math.round(bandwi= dth); var values =3D sequence(n).map(function(i) { return start + step * i; }= ); return ordinalRange(reverse ? values.reverse() : values); } scale.domain =3D function(_) { return arguments.length ? (domain(_), rescale()) : domain(); }; scale.range =3D function(_) { return arguments.length ? (range$$1 =3D [+_[0], +_[1]], rescale()) : ra= nge$$1.slice(); }; scale.rangeRound =3D function(_) { return range$$1 =3D [+_[0], +_[1]], round =3D true, rescale(); }; scale.bandwidth =3D function() { return bandwidth; }; scale.step =3D function() { return step; }; scale.round =3D function(_) { return arguments.length ? (round =3D !!_, rescale()) : round; }; scale.padding =3D function(_) { return arguments.length ? (paddingInner =3D Math.min(1, paddingOuter = =3D +_), rescale()) : paddingInner; }; scale.paddingInner =3D function(_) { return arguments.length ? (paddingInner =3D Math.min(1, _), rescale()) = : paddingInner; }; scale.paddingOuter =3D function(_) { return arguments.length ? (paddingOuter =3D +_, rescale()) : paddingOut= er; }; scale.align =3D function(_) { return arguments.length ? (align =3D Math.max(0, Math.min(1, _)), resca= le()) : align; }; scale.copy =3D function() { return band(domain(), range$$1) .round(round) .paddingInner(paddingInner) .paddingOuter(paddingOuter) .align(align); }; return initRange.apply(rescale(), arguments); } function pointish(scale) { var copy =3D scale.copy; scale.padding =3D scale.paddingOuter; delete scale.paddingInner; delete scale.paddingOuter; scale.copy =3D function() { return pointish(copy()); }; return scale; } function point$1() { return pointish(band.apply(null, arguments).paddingInner(1)); } function constant$a(x) { return function() { return x; }; } function number$2(x) { return +x; } var unit =3D [0, 1]; function identity$6(x) { return x; } function normalize(a, b) { return (b -=3D (a =3D +a)) ? function(x) { return (x - a) / b; } : constant$a(isNaN(b) ? NaN : 0.5); } function clamper(domain) { var a =3D domain[0], b =3D domain[domain.length - 1], t; if (a > b) t =3D a, a =3D b, b =3D t; return function(x) { return Math.max(a, Math.min(b, x)); }; } // normalize(a, b)(x) takes a domain value x in [a,b] and returns the corre= sponding parameter t in [0,1]. // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corres= ponding range value x in [a,b]. function bimap(domain, range, interpolate$$1) { var d0 =3D domain[0], d1 =3D domain[1], r0 =3D range[0], r1 =3D range[1]; if (d1 < d0) d0 =3D normalize(d1, d0), r0 =3D interpolate$$1(r1, r0); else d0 =3D normalize(d0, d1), r0 =3D interpolate$$1(r0, r1); return function(x) { return r0(d0(x)); }; } function polymap(domain, range, interpolate$$1) { var j =3D Math.min(domain.length, range.length) - 1, d =3D new Array(j), r =3D new Array(j), i =3D -1; // Reverse descending domains. if (domain[j] < domain[0]) { domain =3D domain.slice().reverse(); range =3D range.slice().reverse(); } while (++i < j) { d[i] =3D normalize(domain[i], domain[i + 1]); r[i] =3D interpolate$$1(range[i], range[i + 1]); } return function(x) { var i =3D bisectRight(domain, x, 1, j) - 1; return r[i](d[i](x)); }; } function copy(source, target) { return target .domain(source.domain()) .range(source.range()) .interpolate(source.interpolate()) .clamp(source.clamp()) .unknown(source.unknown()); } function transformer$1() { var domain =3D unit, range =3D unit, interpolate$$1 =3D interpolateValue, transform, untransform, unknown, clamp =3D identity$6, piecewise$$1, output, input; function rescale() { piecewise$$1 =3D Math.min(domain.length, range.length) > 2 ? polymap : = bimap; output =3D input =3D null; return scale; } function scale(x) { return isNaN(x =3D +x) ? unknown : (output || (output =3D piecewise$$1(= domain.map(transform), range, interpolate$$1)))(transform(clamp(x))); } scale.invert =3D function(y) { return clamp(untransform((input || (input =3D piecewise$$1(range, domai= n.map(transform), interpolateNumber)))(y))); }; scale.domain =3D function(_) { return arguments.length ? (domain =3D map$2.call(_, number$2), clamp = =3D=3D=3D identity$6 || (clamp =3D clamper(domain)), rescale()) : domain.sl= ice(); }; scale.range =3D function(_) { return arguments.length ? (range =3D slice$5.call(_), rescale()) : rang= e.slice(); }; scale.rangeRound =3D function(_) { return range =3D slice$5.call(_), interpolate$$1 =3D interpolateRound, = rescale(); }; scale.clamp =3D function(_) { return arguments.length ? (clamp =3D _ ? clamper(domain) : identity$6, = scale) : clamp !=3D=3D identity$6; }; scale.interpolate =3D function(_) { return arguments.length ? (interpolate$$1 =3D _, rescale()) : interpola= te$$1; }; scale.unknown =3D function(_) { return arguments.length ? (unknown =3D _, scale) : unknown; }; return function(t, u) { transform =3D t, untransform =3D u; return rescale(); }; } function continuous(transform, untransform) { return transformer$1()(transform, untransform); } function tickFormat(start, stop, count, specifier) { var step =3D tickStep(start, stop, count), precision; specifier =3D formatSpecifier(specifier =3D=3D null ? ",f" : specifier); switch (specifier.type) { case "s": { var value =3D Math.max(Math.abs(start), Math.abs(stop)); if (specifier.precision =3D=3D null && !isNaN(precision =3D precision= Prefix(step, value))) specifier.precision =3D precision; return exports.formatPrefix(specifier, value); } case "": case "e": case "g": case "p": case "r": { if (specifier.precision =3D=3D null && !isNaN(precision =3D precision= Round(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precisio= n =3D precision - (specifier.type =3D=3D=3D "e"); break; } case "f": case "%": { if (specifier.precision =3D=3D null && !isNaN(precision =3D precision= Fixed(step))) specifier.precision =3D precision - (specifier.type =3D=3D=3D= "%") * 2; break; } } return exports.format(specifier); } function linearish(scale) { var domain =3D scale.domain; scale.ticks =3D function(count) { var d =3D domain(); return ticks(d[0], d[d.length - 1], count =3D=3D null ? 10 : count); }; scale.tickFormat =3D function(count, specifier) { var d =3D domain(); return tickFormat(d[0], d[d.length - 1], count =3D=3D null ? 10 : count= , specifier); }; scale.nice =3D function(count) { if (count =3D=3D null) count =3D 10; var d =3D domain(), i0 =3D 0, i1 =3D d.length - 1, start =3D d[i0], stop =3D d[i1], step; if (stop < start) { step =3D start, start =3D stop, stop =3D step; step =3D i0, i0 =3D i1, i1 =3D step; } step =3D tickIncrement(start, stop, count); if (step > 0) { start =3D Math.floor(start / step) * step; stop =3D Math.ceil(stop / step) * step; step =3D tickIncrement(start, stop, count); } else if (step < 0) { start =3D Math.ceil(start * step) / step; stop =3D Math.floor(stop * step) / step; step =3D tickIncrement(start, stop, count); } if (step > 0) { d[i0] =3D Math.floor(start / step) * step; d[i1] =3D Math.ceil(stop / step) * step; domain(d); } else if (step < 0) { d[i0] =3D Math.ceil(start * step) / step; d[i1] =3D Math.floor(stop * step) / step; domain(d); } return scale; }; return scale; } function linear$2() { var scale =3D continuous(identity$6, identity$6); scale.copy =3D function() { return copy(scale, linear$2()); }; initRange.apply(scale, arguments); return linearish(scale); } function identity$7(domain) { var unknown; function scale(x) { return isNaN(x =3D +x) ? unknown : x; } scale.invert =3D scale; scale.domain =3D scale.range =3D function(_) { return arguments.length ? (domain =3D map$2.call(_, number$2), scale) := domain.slice(); }; scale.unknown =3D function(_) { return arguments.length ? (unknown =3D _, scale) : unknown; }; scale.copy =3D function() { return identity$7(domain).unknown(unknown); }; domain =3D arguments.length ? map$2.call(domain, number$2) : [0, 1]; return linearish(scale); } function nice(domain, interval) { domain =3D domain.slice(); var i0 =3D 0, i1 =3D domain.length - 1, x0 =3D domain[i0], x1 =3D domain[i1], t; if (x1 < x0) { t =3D i0, i0 =3D i1, i1 =3D t; t =3D x0, x0 =3D x1, x1 =3D t; } domain[i0] =3D interval.floor(x0); domain[i1] =3D interval.ceil(x1); return domain; } function transformLog(x) { return Math.log(x); } function transformExp(x) { return Math.exp(x); } function transformLogn(x) { return -Math.log(-x); } function transformExpn(x) { return -Math.exp(-x); } function pow10(x) { return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x; } function powp(base) { return base =3D=3D=3D 10 ? pow10 : base =3D=3D=3D Math.E ? Math.exp : function(x) { return Math.pow(base, x); }; } function logp(base) { return base =3D=3D=3D Math.E ? Math.log : base =3D=3D=3D 10 && Math.log10 || base =3D=3D=3D 2 && Math.log2 || (base =3D Math.log(base), function(x) { return Math.log(x) / base;= }); } function reflect(f) { return function(x) { return -f(-x); }; } function loggish(transform) { var scale =3D transform(transformLog, transformExp), domain =3D scale.domain, base =3D 10, logs, pows; function rescale() { logs =3D logp(base), pows =3D powp(base); if (domain()[0] < 0) { logs =3D reflect(logs), pows =3D reflect(pows); transform(transformLogn, transformExpn); } else { transform(transformLog, transformExp); } return scale; } scale.base =3D function(_) { return arguments.length ? (base =3D +_, rescale()) : base; }; scale.domain =3D function(_) { return arguments.length ? (domain(_), rescale()) : domain(); }; scale.ticks =3D function(count) { var d =3D domain(), u =3D d[0], v =3D d[d.length - 1], r; if (r =3D v < u) i =3D u, u =3D v, v =3D i; var i =3D logs(u), j =3D logs(v), p, k, t, n =3D count =3D=3D null ? 10 : +count, z =3D []; if (!(base % 1) && j - i < n) { i =3D Math.round(i) - 1, j =3D Math.round(j) + 1; if (u > 0) for (; i < j; ++i) { for (k =3D 1, p =3D pows(i); k < base; ++k) { t =3D p * k; if (t < u) continue; if (t > v) break; z.push(t); } } else for (; i < j; ++i) { for (k =3D base - 1, p =3D pows(i); k >=3D 1; --k) { t =3D p * k; if (t < u) continue; if (t > v) break; z.push(t); } } } else { z =3D ticks(i, j, Math.min(j - i, n)).map(pows); } return r ? z.reverse() : z; }; scale.tickFormat =3D function(count, specifier) { if (specifier =3D=3D null) specifier =3D base =3D=3D=3D 10 ? ".0e" : ",= "; if (typeof specifier !=3D=3D "function") specifier =3D exports.format(s= pecifier); if (count =3D=3D=3D Infinity) return specifier; if (count =3D=3D null) count =3D 10; var k =3D Math.max(1, base * count / scale.ticks().length); // TODO fas= t estimate? return function(d) { var i =3D d / pows(Math.round(logs(d))); if (i * base < base - 0.5) i *=3D base; return i <=3D k ? specifier(d) : ""; }; }; scale.nice =3D function() { return domain(nice(domain(), { floor: function(x) { return pows(Math.floor(logs(x))); }, ceil: function(x) { return pows(Math.ceil(logs(x))); } })); }; return scale; } function log$1() { var scale =3D loggish(transformer$1()).domain([1, 10]); scale.copy =3D function() { return copy(scale, log$1()).base(scale.base()); }; initRange.apply(scale, arguments); return scale; } function transformSymlog(c) { return function(x) { return Math.sign(x) * Math.log1p(Math.abs(x / c)); }; } function transformSymexp(c) { return function(x) { return Math.sign(x) * Math.expm1(Math.abs(x)) * c; }; } function symlogish(transform) { var c =3D 1, scale =3D transform(transformSymlog(c), transformSymexp(c)); scale.constant =3D function(_) { return arguments.length ? transform(transformSymlog(c =3D +_), transfor= mSymexp(c)) : c; }; return linearish(scale); } function symlog() { var scale =3D symlogish(transformer$1()); scale.copy =3D function() { return copy(scale, symlog()).constant(scale.constant()); }; return initRange.apply(scale, arguments); } function transformPow(exponent) { return function(x) { return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); }; } function transformSqrt(x) { return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x); } function transformSquare(x) { return x < 0 ? -x * x : x * x; } function powish(transform) { var scale =3D transform(identity$6, identity$6), exponent =3D 1; function rescale() { return exponent =3D=3D=3D 1 ? transform(identity$6, identity$6) : exponent =3D=3D=3D 0.5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent)); } scale.exponent =3D function(_) { return arguments.length ? (exponent =3D +_, rescale()) : exponent; }; return linearish(scale); } function pow$1() { var scale =3D powish(transformer$1()); scale.copy =3D function() { return copy(scale, pow$1()).exponent(scale.exponent()); }; initRange.apply(scale, arguments); return scale; } function sqrt$1() { return pow$1.apply(null, arguments).exponent(0.5); } function quantile$$1() { var domain =3D [], range =3D [], thresholds =3D [], unknown; function rescale() { var i =3D 0, n =3D Math.max(1, range.length); thresholds =3D new Array(n - 1); while (++i < n) thresholds[i - 1] =3D threshold(domain, i / n); return scale; } function scale(x) { return isNaN(x =3D +x) ? unknown : range[bisectRight(thresholds, x)]; } scale.invertExtent =3D function(y) { var i =3D range.indexOf(y); return i < 0 ? [NaN, NaN] : [ i > 0 ? thresholds[i - 1] : domain[0], i < thresholds.length ? thresholds[i] : domain[domain.length - 1] ]; }; scale.domain =3D function(_) { if (!arguments.length) return domain.slice(); domain =3D []; for (var i =3D 0, n =3D _.length, d; i < n; ++i) if (d =3D _[i], d !=3D= null && !isNaN(d =3D +d)) domain.push(d); domain.sort(ascending); return rescale(); }; scale.range =3D function(_) { return arguments.length ? (range =3D slice$5.call(_), rescale()) : rang= e.slice(); }; scale.unknown =3D function(_) { return arguments.length ? (unknown =3D _, scale) : unknown; }; scale.quantiles =3D function() { return thresholds.slice(); }; scale.copy =3D function() { return quantile$$1() .domain(domain) .range(range) .unknown(unknown); }; return initRange.apply(scale, arguments); } function quantize$1() { var x0 =3D 0, x1 =3D 1, n =3D 1, domain =3D [0.5], range =3D [0, 1], unknown; function scale(x) { return x <=3D x ? range[bisectRight(domain, x, 0, n)] : unknown; } function rescale() { var i =3D -1; domain =3D new Array(n); while (++i < n) domain[i] =3D ((i + 1) * x1 - (i - n) * x0) / (n + 1); return scale; } scale.domain =3D function(_) { return arguments.length ? (x0 =3D +_[0], x1 =3D +_[1], rescale()) : [x0= , x1]; }; scale.range =3D function(_) { return arguments.length ? (n =3D (range =3D slice$5.call(_)).length - 1= , rescale()) : range.slice(); }; scale.invertExtent =3D function(y) { var i =3D range.indexOf(y); return i < 0 ? [NaN, NaN] : i < 1 ? [x0, domain[0]] : i >=3D n ? [domain[n - 1], x1] : [domain[i - 1], domain[i]]; }; scale.unknown =3D function(_) { return arguments.length ? (unknown =3D _, scale) : scale; }; scale.thresholds =3D function() { return domain.slice(); }; scale.copy =3D function() { return quantize$1() .domain([x0, x1]) .range(range) .unknown(unknown); }; return initRange.apply(linearish(scale), arguments); } function threshold$1() { var domain =3D [0.5], range =3D [0, 1], unknown, n =3D 1; function scale(x) { return x <=3D x ? range[bisectRight(domain, x, 0, n)] : unknown; } scale.domain =3D function(_) { return arguments.length ? (domain =3D slice$5.call(_), n =3D Math.min(d= omain.length, range.length - 1), scale) : domain.slice(); }; scale.range =3D function(_) { return arguments.length ? (range =3D slice$5.call(_), n =3D Math.min(do= main.length, range.length - 1), scale) : range.slice(); }; scale.invertExtent =3D function(y) { var i =3D range.indexOf(y); return [domain[i - 1], domain[i]]; }; scale.unknown =3D function(_) { return arguments.length ? (unknown =3D _, scale) : unknown; }; scale.copy =3D function() { return threshold$1() .domain(domain) .range(range) .unknown(unknown); }; return initRange.apply(scale, arguments); } var t0$1 =3D new Date, t1$1 =3D new Date; function newInterval(floori, offseti, count, field) { function interval(date) { return floori(date =3D new Date(+date)), date; } interval.floor =3D interval; interval.ceil =3D function(date) { return floori(date =3D new Date(date - 1)), offseti(date, 1), floori(da= te), date; }; interval.round =3D function(date) { var d0 =3D interval(date), d1 =3D interval.ceil(date); return date - d0 < d1 - date ? d0 : d1; }; interval.offset =3D function(date, step) { return offseti(date =3D new Date(+date), step =3D=3D null ? 1 : Math.fl= oor(step)), date; }; interval.range =3D function(start, stop, step) { var range =3D [], previous; start =3D interval.ceil(start); step =3D step =3D=3D null ? 1 : Math.floor(step); if (!(start < stop) || !(step > 0)) return range; // also handles Inval= id Date do range.push(previous =3D new Date(+start)), offseti(start, step), flo= ori(start); while (previous < start && start < stop); return range; }; interval.filter =3D function(test) { return newInterval(function(date) { if (date >=3D date) while (floori(date), !test(date)) date.setTime(da= te - 1); }, function(date, step) { if (date >=3D date) { if (step < 0) while (++step <=3D 0) { while (offseti(date, -1), !test(date)) {} // eslint-disable-line = no-empty } else while (--step >=3D 0) { while (offseti(date, +1), !test(date)) {} // eslint-disable-line = no-empty } } }); }; if (count) { interval.count =3D function(start, end) { t0$1.setTime(+start), t1$1.setTime(+end); floori(t0$1), floori(t1$1); return Math.floor(count(t0$1, t1$1)); }; interval.every =3D function(step) { step =3D Math.floor(step); return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? function(d) { return field(d) % step =3D=3D=3D 0; } : function(d) { return interval.count(0, d) % step =3D=3D=3D = 0; }); }; } return interval; } var millisecond =3D newInterval(function() { // noop }, function(date, step) { date.setTime(+date + step); }, function(start, end) { return end - start; }); // An optimized implementation for this simple case. millisecond.every =3D function(k) { k =3D Math.floor(k); if (!isFinite(k) || !(k > 0)) return null; if (!(k > 1)) return millisecond; return newInterval(function(date) { date.setTime(Math.floor(date / k) * k); }, function(date, step) { date.setTime(+date + step * k); }, function(start, end) { return (end - start) / k; }); }; var milliseconds =3D millisecond.range; var durationSecond =3D 1e3; var durationMinute =3D 6e4; var durationHour =3D 36e5; var durationDay =3D 864e5; var durationWeek =3D 6048e5; var second =3D newInterval(function(date) { date.setTime(date - date.getMilliseconds()); }, function(date, step) { date.setTime(+date + step * durationSecond); }, function(start, end) { return (end - start) / durationSecond; }, function(date) { return date.getUTCSeconds(); }); var seconds =3D second.range; var minute =3D newInterval(function(date) { date.setTime(date - date.getMilliseconds() - date.getSeconds() * duration= Second); }, function(date, step) { date.setTime(+date + step * durationMinute); }, function(start, end) { return (end - start) / durationMinute; }, function(date) { return date.getMinutes(); }); var minutes =3D minute.range; var hour =3D newInterval(function(date) { date.setTime(date - date.getMilliseconds() - date.getSeconds() * duration= Second - date.getMinutes() * durationMinute); }, function(date, step) { date.setTime(+date + step * durationHour); }, function(start, end) { return (end - start) / durationHour; }, function(date) { return date.getHours(); }); var hours =3D hour.range; var day =3D newInterval(function(date) { date.setHours(0, 0, 0, 0); }, function(date, step) { date.setDate(date.getDate() + step); }, function(start, end) { return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset(= )) * durationMinute) / durationDay; }, function(date) { return date.getDate() - 1; }); var days =3D day.range; function weekday(i) { return newInterval(function(date) { date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setDate(date.getDate() + step * 7); }, function(start, end) { return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffse= t()) * durationMinute) / durationWeek; }); } var sunday =3D weekday(0); var monday =3D weekday(1); var tuesday =3D weekday(2); var wednesday =3D weekday(3); var thursday =3D weekday(4); var friday =3D weekday(5); var saturday =3D weekday(6); var sundays =3D sunday.range; var mondays =3D monday.range; var tuesdays =3D tuesday.range; var wednesdays =3D wednesday.range; var thursdays =3D thursday.range; var fridays =3D friday.range; var saturdays =3D saturday.range; var month =3D newInterval(function(date) { date.setDate(1); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setMonth(date.getMonth() + step); }, function(start, end) { return end.getMonth() - start.getMonth() + (end.getFullYear() - start.get= FullYear()) * 12; }, function(date) { return date.getMonth(); }); var months =3D month.range; var year =3D newInterval(function(date) { date.setMonth(0, 1); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setFullYear(date.getFullYear() + step); }, function(start, end) { return end.getFullYear() - start.getFullYear(); }, function(date) { return date.getFullYear(); }); // An optimized implementation for this simple case. year.every =3D function(k) { return !isFinite(k =3D Math.floor(k)) || !(k > 0) ? null : newInterval(fu= nction(date) { date.setFullYear(Math.floor(date.getFullYear() / k) * k); date.setMonth(0, 1); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setFullYear(date.getFullYear() + step * k); }); }; var years =3D year.range; var utcMinute =3D newInterval(function(date) { date.setUTCSeconds(0, 0); }, function(date, step) { date.setTime(+date + step * durationMinute); }, function(start, end) { return (end - start) / durationMinute; }, function(date) { return date.getUTCMinutes(); }); var utcMinutes =3D utcMinute.range; var utcHour =3D newInterval(function(date) { date.setUTCMinutes(0, 0, 0); }, function(date, step) { date.setTime(+date + step * durationHour); }, function(start, end) { return (end - start) / durationHour; }, function(date) { return date.getUTCHours(); }); var utcHours =3D utcHour.range; var utcDay =3D newInterval(function(date) { date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCDate(date.getUTCDate() + step); }, function(start, end) { return (end - start) / durationDay; }, function(date) { return date.getUTCDate() - 1; }); var utcDays =3D utcDay.range; function utcWeekday(i) { return newInterval(function(date) { date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCDate(date.getUTCDate() + step * 7); }, function(start, end) { return (end - start) / durationWeek; }); } var utcSunday =3D utcWeekday(0); var utcMonday =3D utcWeekday(1); var utcTuesday =3D utcWeekday(2); var utcWednesday =3D utcWeekday(3); var utcThursday =3D utcWeekday(4); var utcFriday =3D utcWeekday(5); var utcSaturday =3D utcWeekday(6); var utcSundays =3D utcSunday.range; var utcMondays =3D utcMonday.range; var utcTuesdays =3D utcTuesday.range; var utcWednesdays =3D utcWednesday.range; var utcThursdays =3D utcThursday.range; var utcFridays =3D utcFriday.range; var utcSaturdays =3D utcSaturday.range; var utcMonth =3D newInterval(function(date) { date.setUTCDate(1); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCMonth(date.getUTCMonth() + step); }, function(start, end) { return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - = start.getUTCFullYear()) * 12; }, function(date) { return date.getUTCMonth(); }); var utcMonths =3D utcMonth.range; var utcYear =3D newInterval(function(date) { date.setUTCMonth(0, 1); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCFullYear(date.getUTCFullYear() + step); }, function(start, end) { return end.getUTCFullYear() - start.getUTCFullYear(); }, function(date) { return date.getUTCFullYear(); }); // An optimized implementation for this simple case. utcYear.every =3D function(k) { return !isFinite(k =3D Math.floor(k)) || !(k > 0) ? null : newInterval(fu= nction(date) { date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k); date.setUTCMonth(0, 1); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCFullYear(date.getUTCFullYear() + step * k); }); }; var utcYears =3D utcYear.range; function localDate(d) { if (0 <=3D d.y && d.y < 100) { var date =3D new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); date.setFullYear(d.y); return date; } return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); } function utcDate(d) { if (0 <=3D d.y && d.y < 100) { var date =3D new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); date.setUTCFullYear(d.y); return date; } return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); } function newYear(y) { return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0}; } function formatLocale$1(locale) { var locale_dateTime =3D locale.dateTime, locale_date =3D locale.date, locale_time =3D locale.time, locale_periods =3D locale.periods, locale_weekdays =3D locale.days, locale_shortWeekdays =3D locale.shortDays, locale_months =3D locale.months, locale_shortMonths =3D locale.shortMonths; var periodRe =3D formatRe(locale_periods), periodLookup =3D formatLookup(locale_periods), weekdayRe =3D formatRe(locale_weekdays), weekdayLookup =3D formatLookup(locale_weekdays), shortWeekdayRe =3D formatRe(locale_shortWeekdays), shortWeekdayLookup =3D formatLookup(locale_shortWeekdays), monthRe =3D formatRe(locale_months), monthLookup =3D formatLookup(locale_months), shortMonthRe =3D formatRe(locale_shortMonths), shortMonthLookup =3D formatLookup(locale_shortMonths); var formats =3D { "a": formatShortWeekday, "A": formatWeekday, "b": formatShortMonth, "B": formatMonth, "c": null, "d": formatDayOfMonth, "e": formatDayOfMonth, "f": formatMicroseconds, "H": formatHour24, "I": formatHour12, "j": formatDayOfYear, "L": formatMilliseconds, "m": formatMonthNumber, "M": formatMinutes, "p": formatPeriod, "Q": formatUnixTimestamp, "s": formatUnixTimestampSeconds, "S": formatSeconds, "u": formatWeekdayNumberMonday, "U": formatWeekNumberSunday, "V": formatWeekNumberISO, "w": formatWeekdayNumberSunday, "W": formatWeekNumberMonday, "x": null, "X": null, "y": formatYear$1, "Y": formatFullYear, "Z": formatZone, "%": formatLiteralPercent }; var utcFormats =3D { "a": formatUTCShortWeekday, "A": formatUTCWeekday, "b": formatUTCShortMonth, "B": formatUTCMonth, "c": null, "d": formatUTCDayOfMonth, "e": formatUTCDayOfMonth, "f": formatUTCMicroseconds, "H": formatUTCHour24, "I": formatUTCHour12, "j": formatUTCDayOfYear, "L": formatUTCMilliseconds, "m": formatUTCMonthNumber, "M": formatUTCMinutes, "p": formatUTCPeriod, "Q": formatUnixTimestamp, "s": formatUnixTimestampSeconds, "S": formatUTCSeconds, "u": formatUTCWeekdayNumberMonday, "U": formatUTCWeekNumberSunday, "V": formatUTCWeekNumberISO, "w": formatUTCWeekdayNumberSunday, "W": formatUTCWeekNumberMonday, "x": null, "X": null, "y": formatUTCYear, "Y": formatUTCFullYear, "Z": formatUTCZone, "%": formatLiteralPercent }; var parses =3D { "a": parseShortWeekday, "A": parseWeekday, "b": parseShortMonth, "B": parseMonth, "c": parseLocaleDateTime, "d": parseDayOfMonth, "e": parseDayOfMonth, "f": parseMicroseconds, "H": parseHour24, "I": parseHour24, "j": parseDayOfYear, "L": parseMilliseconds, "m": parseMonthNumber, "M": parseMinutes, "p": parsePeriod, "Q": parseUnixTimestamp, "s": parseUnixTimestampSeconds, "S": parseSeconds, "u": parseWeekdayNumberMonday, "U": parseWeekNumberSunday, "V": parseWeekNumberISO, "w": parseWeekdayNumberSunday, "W": parseWeekNumberMonday, "x": parseLocaleDate, "X": parseLocaleTime, "y": parseYear, "Y": parseFullYear, "Z": parseZone, "%": parseLiteralPercent }; // These recursive directive definitions must be deferred. formats.x =3D newFormat(locale_date, formats); formats.X =3D newFormat(locale_time, formats); formats.c =3D newFormat(locale_dateTime, formats); utcFormats.x =3D newFormat(locale_date, utcFormats); utcFormats.X =3D newFormat(locale_time, utcFormats); utcFormats.c =3D newFormat(locale_dateTime, utcFormats); function newFormat(specifier, formats) { return function(date) { var string =3D [], i =3D -1, j =3D 0, n =3D specifier.length, c, pad, format; if (!(date instanceof Date)) date =3D new Date(+date); while (++i < n) { if (specifier.charCodeAt(i) =3D=3D=3D 37) { string.push(specifier.slice(j, i)); if ((pad =3D pads[c =3D specifier.charAt(++i)]) !=3D null) c =3D = specifier.charAt(++i); else pad =3D c =3D=3D=3D "e" ? " " : "0"; if (format =3D formats[c]) c =3D format(date, pad); string.push(c); j =3D i + 1; } } string.push(specifier.slice(j, i)); return string.join(""); }; } function newParse(specifier, newDate) { return function(string) { var d =3D newYear(1900), i =3D parseSpecifier(d, specifier, string +=3D "", 0), week, day$$1; if (i !=3D string.length) return null; // If a UNIX timestamp is specified, return it. if ("Q" in d) return new Date(d.Q); // The am-pm flag is 0 for AM, and 1 for PM. if ("p" in d) d.H =3D d.H % 12 + d.p * 12; // Convert day-of-week and week-of-year to day-of-year. if ("V" in d) { if (d.V < 1 || d.V > 53) return null; if (!("w" in d)) d.w =3D 1; if ("Z" in d) { week =3D utcDate(newYear(d.y)), day$$1 =3D week.getUTCDay(); week =3D day$$1 > 4 || day$$1 =3D=3D=3D 0 ? utcMonday.ceil(week) = : utcMonday(week); week =3D utcDay.offset(week, (d.V - 1) * 7); d.y =3D week.getUTCFullYear(); d.m =3D week.getUTCMonth(); d.d =3D week.getUTCDate() + (d.w + 6) % 7; } else { week =3D newDate(newYear(d.y)), day$$1 =3D week.getDay(); week =3D day$$1 > 4 || day$$1 =3D=3D=3D 0 ? monday.ceil(week) : m= onday(week); week =3D day.offset(week, (d.V - 1) * 7); d.y =3D week.getFullYear(); d.m =3D week.getMonth(); d.d =3D week.getDate() + (d.w + 6) % 7; } } else if ("W" in d || "U" in d) { if (!("w" in d)) d.w =3D "u" in d ? d.u % 7 : "W" in d ? 1 : 0; day$$1 =3D "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(n= ewYear(d.y)).getDay(); d.m =3D 0; d.d =3D "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day$$1 + 5) % 7 : d.w= + d.U * 7 - (day$$1 + 6) % 7; } // If a time zone is specified, all fields are interpreted as UTC and= then // offset according to the specified time zone. if ("Z" in d) { d.H +=3D d.Z / 100 | 0; d.M +=3D d.Z % 100; return utcDate(d); } // Otherwise, all fields are in local time. return newDate(d); }; } function parseSpecifier(d, specifier, string, j) { var i =3D 0, n =3D specifier.length, m =3D string.length, c, parse; while (i < n) { if (j >=3D m) return -1; c =3D specifier.charCodeAt(i++); if (c =3D=3D=3D 37) { c =3D specifier.charAt(i++); parse =3D parses[c in pads ? specifier.charAt(i++) : c]; if (!parse || ((j =3D parse(d, string, j)) < 0)) return -1; } else if (c !=3D string.charCodeAt(j++)) { return -1; } } return j; } function parsePeriod(d, string, i) { var n =3D periodRe.exec(string.slice(i)); return n ? (d.p =3D periodLookup[n[0].toLowerCase()], i + n[0].length) = : -1; } function parseShortWeekday(d, string, i) { var n =3D shortWeekdayRe.exec(string.slice(i)); return n ? (d.w =3D shortWeekdayLookup[n[0].toLowerCase()], i + n[0].le= ngth) : -1; } function parseWeekday(d, string, i) { var n =3D weekdayRe.exec(string.slice(i)); return n ? (d.w =3D weekdayLookup[n[0].toLowerCase()], i + n[0].length)= : -1; } function parseShortMonth(d, string, i) { var n =3D shortMonthRe.exec(string.slice(i)); return n ? (d.m =3D shortMonthLookup[n[0].toLowerCase()], i + n[0].leng= th) : -1; } function parseMonth(d, string, i) { var n =3D monthRe.exec(string.slice(i)); return n ? (d.m =3D monthLookup[n[0].toLowerCase()], i + n[0].length) := -1; } function parseLocaleDateTime(d, string, i) { return parseSpecifier(d, locale_dateTime, string, i); } function parseLocaleDate(d, string, i) { return parseSpecifier(d, locale_date, string, i); } function parseLocaleTime(d, string, i) { return parseSpecifier(d, locale_time, string, i); } function formatShortWeekday(d) { return locale_shortWeekdays[d.getDay()]; } function formatWeekday(d) { return locale_weekdays[d.getDay()]; } function formatShortMonth(d) { return locale_shortMonths[d.getMonth()]; } function formatMonth(d) { return locale_months[d.getMonth()]; } function formatPeriod(d) { return locale_periods[+(d.getHours() >=3D 12)]; } function formatUTCShortWeekday(d) { return locale_shortWeekdays[d.getUTCDay()]; } function formatUTCWeekday(d) { return locale_weekdays[d.getUTCDay()]; } function formatUTCShortMonth(d) { return locale_shortMonths[d.getUTCMonth()]; } function formatUTCMonth(d) { return locale_months[d.getUTCMonth()]; } function formatUTCPeriod(d) { return locale_periods[+(d.getUTCHours() >=3D 12)]; } return { format: function(specifier) { var f =3D newFormat(specifier +=3D "", formats); f.toString =3D function() { return specifier; }; return f; }, parse: function(specifier) { var p =3D newParse(specifier +=3D "", localDate); p.toString =3D function() { return specifier; }; return p; }, utcFormat: function(specifier) { var f =3D newFormat(specifier +=3D "", utcFormats); f.toString =3D function() { return specifier; }; return f; }, utcParse: function(specifier) { var p =3D newParse(specifier, utcDate); p.toString =3D function() { return specifier; }; return p; } }; } var pads =3D {"-": "", "_": " ", "0": "0"}, numberRe =3D /^\s*\d+/, // note: ignores next directive percentRe =3D /^%/, requoteRe =3D /[\\^$*+?|[\]().{}]/g; function pad$1(value, fill, width) { var sign =3D value < 0 ? "-" : "", string =3D (sign ? -value : value) + "", length =3D string.length; return sign + (length < width ? new Array(width - length + 1).join(fill) = + string : string); } function requote(s) { return s.replace(requoteRe, "\\$&"); } function formatRe(names) { return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); } function formatLookup(names) { var map =3D {}, i =3D -1, n =3D names.length; while (++i < n) map[names[i].toLowerCase()] =3D i; return map; } function parseWeekdayNumberSunday(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 1)); return n ? (d.w =3D +n[0], i + n[0].length) : -1; } function parseWeekdayNumberMonday(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 1)); return n ? (d.u =3D +n[0], i + n[0].length) : -1; } function parseWeekNumberSunday(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 2)); return n ? (d.U =3D +n[0], i + n[0].length) : -1; } function parseWeekNumberISO(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 2)); return n ? (d.V =3D +n[0], i + n[0].length) : -1; } function parseWeekNumberMonday(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 2)); return n ? (d.W =3D +n[0], i + n[0].length) : -1; } function parseFullYear(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 4)); return n ? (d.y =3D +n[0], i + n[0].length) : -1; } function parseYear(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 2)); return n ? (d.y =3D +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) = : -1; } function parseZone(d, string, i) { var n =3D /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); return n ? (d.Z =3D n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length)= : -1; } function parseMonthNumber(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 2)); return n ? (d.m =3D n[0] - 1, i + n[0].length) : -1; } function parseDayOfMonth(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 2)); return n ? (d.d =3D +n[0], i + n[0].length) : -1; } function parseDayOfYear(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 3)); return n ? (d.m =3D 0, d.d =3D +n[0], i + n[0].length) : -1; } function parseHour24(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 2)); return n ? (d.H =3D +n[0], i + n[0].length) : -1; } function parseMinutes(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 2)); return n ? (d.M =3D +n[0], i + n[0].length) : -1; } function parseSeconds(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 2)); return n ? (d.S =3D +n[0], i + n[0].length) : -1; } function parseMilliseconds(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 3)); return n ? (d.L =3D +n[0], i + n[0].length) : -1; } function parseMicroseconds(d, string, i) { var n =3D numberRe.exec(string.slice(i, i + 6)); return n ? (d.L =3D Math.floor(n[0] / 1000), i + n[0].length) : -1; } function parseLiteralPercent(d, string, i) { var n =3D percentRe.exec(string.slice(i, i + 1)); return n ? i + n[0].length : -1; } function parseUnixTimestamp(d, string, i) { var n =3D numberRe.exec(string.slice(i)); return n ? (d.Q =3D +n[0], i + n[0].length) : -1; } function parseUnixTimestampSeconds(d, string, i) { var n =3D numberRe.exec(string.slice(i)); return n ? (d.Q =3D (+n[0]) * 1000, i + n[0].length) : -1; } function formatDayOfMonth(d, p) { return pad$1(d.getDate(), p, 2); } function formatHour24(d, p) { return pad$1(d.getHours(), p, 2); } function formatHour12(d, p) { return pad$1(d.getHours() % 12 || 12, p, 2); } function formatDayOfYear(d, p) { return pad$1(1 + day.count(year(d), d), p, 3); } function formatMilliseconds(d, p) { return pad$1(d.getMilliseconds(), p, 3); } function formatMicroseconds(d, p) { return formatMilliseconds(d, p) + "000"; } function formatMonthNumber(d, p) { return pad$1(d.getMonth() + 1, p, 2); } function formatMinutes(d, p) { return pad$1(d.getMinutes(), p, 2); } function formatSeconds(d, p) { return pad$1(d.getSeconds(), p, 2); } function formatWeekdayNumberMonday(d) { var day$$1 =3D d.getDay(); return day$$1 =3D=3D=3D 0 ? 7 : day$$1; } function formatWeekNumberSunday(d, p) { return pad$1(sunday.count(year(d), d), p, 2); } function formatWeekNumberISO(d, p) { var day$$1 =3D d.getDay(); d =3D (day$$1 >=3D 4 || day$$1 =3D=3D=3D 0) ? thursday(d) : thursday.ceil= (d); return pad$1(thursday.count(year(d), d) + (year(d).getDay() =3D=3D=3D 4),= p, 2); } function formatWeekdayNumberSunday(d) { return d.getDay(); } function formatWeekNumberMonday(d, p) { return pad$1(monday.count(year(d), d), p, 2); } function formatYear$1(d, p) { return pad$1(d.getFullYear() % 100, p, 2); } function formatFullYear(d, p) { return pad$1(d.getFullYear() % 10000, p, 4); } function formatZone(d) { var z =3D d.getTimezoneOffset(); return (z > 0 ? "-" : (z *=3D -1, "+")) + pad$1(z / 60 | 0, "0", 2) + pad$1(z % 60, "0", 2); } function formatUTCDayOfMonth(d, p) { return pad$1(d.getUTCDate(), p, 2); } function formatUTCHour24(d, p) { return pad$1(d.getUTCHours(), p, 2); } function formatUTCHour12(d, p) { return pad$1(d.getUTCHours() % 12 || 12, p, 2); } function formatUTCDayOfYear(d, p) { return pad$1(1 + utcDay.count(utcYear(d), d), p, 3); } function formatUTCMilliseconds(d, p) { return pad$1(d.getUTCMilliseconds(), p, 3); } function formatUTCMicroseconds(d, p) { return formatUTCMilliseconds(d, p) + "000"; } function formatUTCMonthNumber(d, p) { return pad$1(d.getUTCMonth() + 1, p, 2); } function formatUTCMinutes(d, p) { return pad$1(d.getUTCMinutes(), p, 2); } function formatUTCSeconds(d, p) { return pad$1(d.getUTCSeconds(), p, 2); } function formatUTCWeekdayNumberMonday(d) { var dow =3D d.getUTCDay(); return dow =3D=3D=3D 0 ? 7 : dow; } function formatUTCWeekNumberSunday(d, p) { return pad$1(utcSunday.count(utcYear(d), d), p, 2); } function formatUTCWeekNumberISO(d, p) { var day$$1 =3D d.getUTCDay(); d =3D (day$$1 >=3D 4 || day$$1 =3D=3D=3D 0) ? utcThursday(d) : utcThursda= y.ceil(d); return pad$1(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() = =3D=3D=3D 4), p, 2); } function formatUTCWeekdayNumberSunday(d) { return d.getUTCDay(); } function formatUTCWeekNumberMonday(d, p) { return pad$1(utcMonday.count(utcYear(d), d), p, 2); } function formatUTCYear(d, p) { return pad$1(d.getUTCFullYear() % 100, p, 2); } function formatUTCFullYear(d, p) { return pad$1(d.getUTCFullYear() % 10000, p, 4); } function formatUTCZone() { return "+0000"; } function formatLiteralPercent() { return "%"; } function formatUnixTimestamp(d) { return +d; } function formatUnixTimestampSeconds(d) { return Math.floor(+d / 1000); } var locale$1; defaultLocale$1({ dateTime: "%x, %X", date: "%-m/%-d/%Y", time: "%-I:%M:%S %p", periods: ["AM", "PM"], days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", = "Saturday"], shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], months: ["January", "February", "March", "April", "May", "June", "July", = "August", "September", "October", "November", "December"], shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Se= p", "Oct", "Nov", "Dec"] }); function defaultLocale$1(definition) { locale$1 =3D formatLocale$1(definition); exports.timeFormat =3D locale$1.format; exports.timeParse =3D locale$1.parse; exports.utcFormat =3D locale$1.utcFormat; exports.utcParse =3D locale$1.utcParse; return locale$1; } var isoSpecifier =3D "%Y-%m-%dT%H:%M:%S.%LZ"; function formatIsoNative(date) { return date.toISOString(); } var formatIso =3D Date.prototype.toISOString ? formatIsoNative : exports.utcFormat(isoSpecifier); function parseIsoNative(string) { var date =3D new Date(string); return isNaN(date) ? null : date; } var parseIso =3D +new Date("2000-01-01T00:00:00.000Z") ? parseIsoNative : exports.utcParse(isoSpecifier); var durationSecond$1 =3D 1000, durationMinute$1 =3D durationSecond$1 * 60, durationHour$1 =3D durationMinute$1 * 60, durationDay$1 =3D durationHour$1 * 24, durationWeek$1 =3D durationDay$1 * 7, durationMonth =3D durationDay$1 * 30, durationYear =3D durationDay$1 * 365; function date$1(t) { return new Date(t); } function number$3(t) { return t instanceof Date ? +t : +new Date(+t); } function calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, seco= nd$$1, millisecond$$1, format) { var scale =3D continuous(identity$6, identity$6), invert =3D scale.invert, domain =3D scale.domain; var formatMillisecond =3D format(".%L"), formatSecond =3D format(":%S"), formatMinute =3D format("%I:%M"), formatHour =3D format("%I %p"), formatDay =3D format("%a %d"), formatWeek =3D format("%b %d"), formatMonth =3D format("%B"), formatYear =3D format("%Y"); var tickIntervals =3D [ [second$$1, 1, durationSecond$1], [second$$1, 5, 5 * durationSecond$1], [second$$1, 15, 15 * durationSecond$1], [second$$1, 30, 30 * durationSecond$1], [minute$$1, 1, durationMinute$1], [minute$$1, 5, 5 * durationMinute$1], [minute$$1, 15, 15 * durationMinute$1], [minute$$1, 30, 30 * durationMinute$1], [ hour$$1, 1, durationHour$1 ], [ hour$$1, 3, 3 * durationHour$1 ], [ hour$$1, 6, 6 * durationHour$1 ], [ hour$$1, 12, 12 * durationHour$1 ], [ day$$1, 1, durationDay$1 ], [ day$$1, 2, 2 * durationDay$1 ], [ week, 1, durationWeek$1 ], [ month$$1, 1, durationMonth ], [ month$$1, 3, 3 * durationMonth ], [ year$$1, 1, durationYear ] ]; function tickFormat(date) { return (second$$1(date) < date ? formatMillisecond : minute$$1(date) < date ? formatSecond : hour$$1(date) < date ? formatMinute : day$$1(date) < date ? formatHour : month$$1(date) < date ? (week(date) < date ? formatDay : formatWe= ek) : year$$1(date) < date ? formatMonth : formatYear)(date); } function tickInterval(interval, start, stop, step) { if (interval =3D=3D null) interval =3D 10; // If a desired tick count is specified, pick a reasonable tick interval // based on the extent of the domain and a rough estimate of tick size. // Otherwise, assume interval is already a time interval and use it. if (typeof interval =3D=3D=3D "number") { var target =3D Math.abs(stop - start) / interval, i =3D bisector(function(i) { return i[2]; }).right(tickIntervals,= target); if (i =3D=3D=3D tickIntervals.length) { step =3D tickStep(start / durationYear, stop / durationYear, interv= al); interval =3D year$$1; } else if (i) { i =3D tickIntervals[target / tickIntervals[i - 1][2] < tickInterval= s[i][2] / target ? i - 1 : i]; step =3D i[1]; interval =3D i[0]; } else { step =3D Math.max(tickStep(start, stop, interval), 1); interval =3D millisecond$$1; } } return step =3D=3D null ? interval : interval.every(step); } scale.invert =3D function(y) { return new Date(invert(y)); }; scale.domain =3D function(_) { return arguments.length ? domain(map$2.call(_, number$3)) : domain().ma= p(date$1); }; scale.ticks =3D function(interval, step) { var d =3D domain(), t0 =3D d[0], t1 =3D d[d.length - 1], r =3D t1 < t0, t; if (r) t =3D t0, t0 =3D t1, t1 =3D t; t =3D tickInterval(interval, t0, t1, step); t =3D t ? t.range(t0, t1 + 1) : []; // inclusive stop return r ? t.reverse() : t; }; scale.tickFormat =3D function(count, specifier) { return specifier =3D=3D null ? tickFormat : format(specifier); }; scale.nice =3D function(interval, step) { var d =3D domain(); return (interval =3D tickInterval(interval, d[0], d[d.length - 1], step= )) ? domain(nice(d, interval)) : scale; }; scale.copy =3D function() { return copy(scale, calendar(year$$1, month$$1, week, day$$1, hour$$1, m= inute$$1, second$$1, millisecond$$1, format)); }; return scale; } function time() { return initRange.apply(calendar(year, month, sunday, day, hour, minute, s= econd, millisecond, exports.timeFormat).domain([new Date(2000, 0, 1), new D= ate(2000, 0, 2)]), arguments); } function utcTime() { return initRange.apply(calendar(utcYear, utcMonth, utcSunday, utcDay, utc= Hour, utcMinute, second, millisecond, exports.utcFormat).domain([Date.UTC(2= 000, 0, 1), Date.UTC(2000, 0, 2)]), arguments); } function transformer$2() { var x0 =3D 0, x1 =3D 1, t0, t1, k10, transform, interpolator =3D identity$6, clamp =3D false, unknown; function scale(x) { return isNaN(x =3D +x) ? unknown : interpolator(k10 =3D=3D=3D 0 ? 0.5 := (x =3D (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)= ); } scale.domain =3D function(_) { return arguments.length ? (t0 =3D transform(x0 =3D +_[0]), t1 =3D trans= form(x1 =3D +_[1]), k10 =3D t0 =3D=3D=3D t1 ? 0 : 1 / (t1 - t0), scale) : [= x0, x1]; }; scale.clamp =3D function(_) { return arguments.length ? (clamp =3D !!_, scale) : clamp; }; scale.interpolator =3D function(_) { return arguments.length ? (interpolator =3D _, scale) : interpolator; }; scale.unknown =3D function(_) { return arguments.length ? (unknown =3D _, scale) : unknown; }; return function(t) { transform =3D t, t0 =3D t(x0), t1 =3D t(x1), k10 =3D t0 =3D=3D=3D t1 ? = 0 : 1 / (t1 - t0); return scale; }; } function copy$1(source, target) { return target .domain(source.domain()) .interpolator(source.interpolator()) .clamp(source.clamp()) .unknown(source.unknown()); } function sequential() { var scale =3D linearish(transformer$2()(identity$6)); scale.copy =3D function() { return copy$1(scale, sequential()); }; return initInterpolator.apply(scale, arguments); } function sequentialLog() { var scale =3D loggish(transformer$2()).domain([1, 10]); scale.copy =3D function() { return copy$1(scale, sequentialLog()).base(scale.base()); }; return initInterpolator.apply(scale, arguments); } function sequentialSymlog() { var scale =3D symlogish(transformer$2()); scale.copy =3D function() { return copy$1(scale, sequentialSymlog()).constant(scale.constant()); }; return initInterpolator.apply(scale, arguments); } function sequentialPow() { var scale =3D powish(transformer$2()); scale.copy =3D function() { return copy$1(scale, sequentialPow()).exponent(scale.exponent()); }; return initInterpolator.apply(scale, arguments); } function sequentialSqrt() { return sequentialPow.apply(null, arguments).exponent(0.5); } function sequentialQuantile() { var domain =3D [], interpolator =3D identity$6; function scale(x) { if (!isNaN(x =3D +x)) return interpolator((bisectRight(domain, x) - 1) = / (domain.length - 1)); } scale.domain =3D function(_) { if (!arguments.length) return domain.slice(); domain =3D []; for (var i =3D 0, n =3D _.length, d; i < n; ++i) if (d =3D _[i], d !=3D= null && !isNaN(d =3D +d)) domain.push(d); domain.sort(ascending); return scale; }; scale.interpolator =3D function(_) { return arguments.length ? (interpolator =3D _, scale) : interpolator; }; scale.copy =3D function() { return sequentialQuantile(interpolator).domain(domain); }; return initInterpolator.apply(scale, arguments); } function transformer$3() { var x0 =3D 0, x1 =3D 0.5, x2 =3D 1, t0, t1, t2, k10, k21, interpolator =3D identity$6, transform, clamp =3D false, unknown; function scale(x) { return isNaN(x =3D +x) ? unknown : (x =3D 0.5 + ((x =3D +transform(x)) = - t1) * (x < t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, = x)) : x)); } scale.domain =3D function(_) { return arguments.length ? (t0 =3D transform(x0 =3D +_[0]), t1 =3D trans= form(x1 =3D +_[1]), t2 =3D transform(x2 =3D +_[2]), k10 =3D t0 =3D=3D=3D t1= ? 0 : 0.5 / (t1 - t0), k21 =3D t1 =3D=3D=3D t2 ? 0 : 0.5 / (t2 - t1), scal= e) : [x0, x1, x2]; }; scale.clamp =3D function(_) { return arguments.length ? (clamp =3D !!_, scale) : clamp; }; scale.interpolator =3D function(_) { return arguments.length ? (interpolator =3D _, scale) : interpolator; }; scale.unknown =3D function(_) { return arguments.length ? (unknown =3D _, scale) : unknown; }; return function(t) { transform =3D t, t0 =3D t(x0), t1 =3D t(x1), t2 =3D t(x2), k10 =3D t0 = =3D=3D=3D t1 ? 0 : 0.5 / (t1 - t0), k21 =3D t1 =3D=3D=3D t2 ? 0 : 0.5 / (t2= - t1); return scale; }; } function diverging() { var scale =3D linearish(transformer$3()(identity$6)); scale.copy =3D function() { return copy$1(scale, diverging()); }; return initInterpolator.apply(scale, arguments); } function divergingLog() { var scale =3D loggish(transformer$3()).domain([0.1, 1, 10]); scale.copy =3D function() { return copy$1(scale, divergingLog()).base(scale.base()); }; return initInterpolator.apply(scale, arguments); } function divergingSymlog() { var scale =3D symlogish(transformer$3()); scale.copy =3D function() { return copy$1(scale, divergingSymlog()).constant(scale.constant()); }; return initInterpolator.apply(scale, arguments); } function divergingPow() { var scale =3D powish(transformer$3()); scale.copy =3D function() { return copy$1(scale, divergingPow()).exponent(scale.exponent()); }; return initInterpolator.apply(scale, arguments); } function divergingSqrt() { return divergingPow.apply(null, arguments).exponent(0.5); } function colors(specifier) { var n =3D specifier.length / 6 | 0, colors =3D new Array(n), i =3D 0; while (i < n) colors[i] =3D "#" + specifier.slice(i * 6, ++i * 6); return colors; } var category10 =3D colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7f= bcbd2217becf"); var Accent =3D colors("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"); var Dark2 =3D colors("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"); var Paired =3D colors("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2= d66a3d9affff99b15928"); var Pastel1 =3D colors("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f= 2f2"); var Pastel2 =3D colors("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"); var Set1 =3D colors("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999= "); var Set2 =3D colors("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"); var Set3 =3D colors("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9= bc80bdccebc5ffed6f"); function ramp(scheme) { return rgbBasis(scheme[scheme.length - 1]); } var scheme =3D new Array(3).concat( "d8b365f5f5f55ab4ac", "a6611adfc27d80cdc1018571", "a6611adfc27df5f5f580cdc1018571", "8c510ad8b365f6e8c3c7eae55ab4ac01665e", "8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e", "8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e", "8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e", "5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30", "5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30" ).map(colors); var BrBG =3D ramp(scheme); var scheme$1 =3D new Array(3).concat( "af8dc3f7f7f77fbf7b", "7b3294c2a5cfa6dba0008837", "7b3294c2a5cff7f7f7a6dba0008837", "762a83af8dc3e7d4e8d9f0d37fbf7b1b7837", "762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837", "762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837", "762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837", "40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b", "40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b" ).map(colors); var PRGn =3D ramp(scheme$1); var scheme$2 =3D new Array(3).concat( "e9a3c9f7f7f7a1d76a", "d01c8bf1b6dab8e1864dac26", "d01c8bf1b6daf7f7f7b8e1864dac26", "c51b7de9a3c9fde0efe6f5d0a1d76a4d9221", "c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221", "c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221", "c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221", "8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419", "8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419" ).map(colors); var PiYG =3D ramp(scheme$2); var scheme$3 =3D new Array(3).concat( "998ec3f7f7f7f1a340", "5e3c99b2abd2fdb863e66101", "5e3c99b2abd2f7f7f7fdb863e66101", "542788998ec3d8daebfee0b6f1a340b35806", "542788998ec3d8daebf7f7f7fee0b6f1a340b35806", "5427888073acb2abd2d8daebfee0b6fdb863e08214b35806", "5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806", "2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08", "2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08" ).map(colors); var PuOr =3D ramp(scheme$3); var scheme$4 =3D new Array(3).concat( "ef8a62f7f7f767a9cf", "ca0020f4a58292c5de0571b0", "ca0020f4a582f7f7f792c5de0571b0", "b2182bef8a62fddbc7d1e5f067a9cf2166ac", "b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac", "b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac", "b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac", "67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061", "67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061" ).map(colors); var RdBu =3D ramp(scheme$4); var scheme$5 =3D new Array(3).concat( "ef8a62ffffff999999", "ca0020f4a582bababa404040", "ca0020f4a582ffffffbababa404040", "b2182bef8a62fddbc7e0e0e09999994d4d4d", "b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d", "b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d", "b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d", "67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a", "67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a" ).map(colors); var RdGy =3D ramp(scheme$5); var scheme$6 =3D new Array(3).concat( "fc8d59ffffbf91bfdb", "d7191cfdae61abd9e92c7bb6", "d7191cfdae61ffffbfabd9e92c7bb6", "d73027fc8d59fee090e0f3f891bfdb4575b4", "d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4", "d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4", "d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4", "a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695", "a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695" ).map(colors); var RdYlBu =3D ramp(scheme$6); var scheme$7 =3D new Array(3).concat( "fc8d59ffffbf91cf60", "d7191cfdae61a6d96a1a9641", "d7191cfdae61ffffbfa6d96a1a9641", "d73027fc8d59fee08bd9ef8b91cf601a9850", "d73027fc8d59fee08bffffbfd9ef8b91cf601a9850", "d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850", "d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850", "a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837", "a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837" ).map(colors); var RdYlGn =3D ramp(scheme$7); var scheme$8 =3D new Array(3).concat( "fc8d59ffffbf99d594", "d7191cfdae61abdda42b83ba", "d7191cfdae61ffffbfabdda42b83ba", "d53e4ffc8d59fee08be6f59899d5943288bd", "d53e4ffc8d59fee08bffffbfe6f59899d5943288bd", "d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd", "d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd", "9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2", "9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2" ).map(colors); var Spectral =3D ramp(scheme$8); var scheme$9 =3D new Array(3).concat( "e5f5f999d8c92ca25f", "edf8fbb2e2e266c2a4238b45", "edf8fbb2e2e266c2a42ca25f006d2c", "edf8fbccece699d8c966c2a42ca25f006d2c", "edf8fbccece699d8c966c2a441ae76238b45005824", "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824", "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b" ).map(colors); var BuGn =3D ramp(scheme$9); var scheme$a =3D new Array(3).concat( "e0ecf49ebcda8856a7", "edf8fbb3cde38c96c688419d", "edf8fbb3cde38c96c68856a7810f7c", "edf8fbbfd3e69ebcda8c96c68856a7810f7c", "edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b", "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b", "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b" ).map(colors); var BuPu =3D ramp(scheme$a); var scheme$b =3D new Array(3).concat( "e0f3dba8ddb543a2ca", "f0f9e8bae4bc7bccc42b8cbe", "f0f9e8bae4bc7bccc443a2ca0868ac", "f0f9e8ccebc5a8ddb57bccc443a2ca0868ac", "f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e", "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e", "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081" ).map(colors); var GnBu =3D ramp(scheme$b); var scheme$c =3D new Array(3).concat( "fee8c8fdbb84e34a33", "fef0d9fdcc8afc8d59d7301f", "fef0d9fdcc8afc8d59e34a33b30000", "fef0d9fdd49efdbb84fc8d59e34a33b30000", "fef0d9fdd49efdbb84fc8d59ef6548d7301f990000", "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000", "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000" ).map(colors); var OrRd =3D ramp(scheme$c); var scheme$d =3D new Array(3).concat( "ece2f0a6bddb1c9099", "f6eff7bdc9e167a9cf02818a", "f6eff7bdc9e167a9cf1c9099016c59", "f6eff7d0d1e6a6bddb67a9cf1c9099016c59", "f6eff7d0d1e6a6bddb67a9cf3690c002818a016450", "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450", "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636" ).map(colors); var PuBuGn =3D ramp(scheme$d); var scheme$e =3D new Array(3).concat( "ece7f2a6bddb2b8cbe", "f1eef6bdc9e174a9cf0570b0", "f1eef6bdc9e174a9cf2b8cbe045a8d", "f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d", "f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b", "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b", "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858" ).map(colors); var PuBu =3D ramp(scheme$e); var scheme$f =3D new Array(3).concat( "e7e1efc994c7dd1c77", "f1eef6d7b5d8df65b0ce1256", "f1eef6d7b5d8df65b0dd1c77980043", "f1eef6d4b9dac994c7df65b0dd1c77980043", "f1eef6d4b9dac994c7df65b0e7298ace125691003f", "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f", "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f" ).map(colors); var PuRd =3D ramp(scheme$f); var scheme$g =3D new Array(3).concat( "fde0ddfa9fb5c51b8a", "feebe2fbb4b9f768a1ae017e", "feebe2fbb4b9f768a1c51b8a7a0177", "feebe2fcc5c0fa9fb5f768a1c51b8a7a0177", "feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177", "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177", "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a" ).map(colors); var RdPu =3D ramp(scheme$g); var scheme$h =3D new Array(3).concat( "edf8b17fcdbb2c7fb8", "ffffcca1dab441b6c4225ea8", "ffffcca1dab441b6c42c7fb8253494", "ffffccc7e9b47fcdbb41b6c42c7fb8253494", "ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84", "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84", "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58" ).map(colors); var YlGnBu =3D ramp(scheme$h); var scheme$i =3D new Array(3).concat( "f7fcb9addd8e31a354", "ffffccc2e69978c679238443", "ffffccc2e69978c67931a354006837", "ffffccd9f0a3addd8e78c67931a354006837", "ffffccd9f0a3addd8e78c67941ab5d238443005a32", "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32", "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529" ).map(colors); var YlGn =3D ramp(scheme$i); var scheme$j =3D new Array(3).concat( "fff7bcfec44fd95f0e", "ffffd4fed98efe9929cc4c02", "ffffd4fed98efe9929d95f0e993404", "ffffd4fee391fec44ffe9929d95f0e993404", "ffffd4fee391fec44ffe9929ec7014cc4c028c2d04", "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04", "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506" ).map(colors); var YlOrBr =3D ramp(scheme$j); var scheme$k =3D new Array(3).concat( "ffeda0feb24cf03b20", "ffffb2fecc5cfd8d3ce31a1c", "ffffb2fecc5cfd8d3cf03b20bd0026", "ffffb2fed976feb24cfd8d3cf03b20bd0026", "ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026", "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026", "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026" ).map(colors); var YlOrRd =3D ramp(scheme$k); var scheme$l =3D new Array(3).concat( "deebf79ecae13182bd", "eff3ffbdd7e76baed62171b5", "eff3ffbdd7e76baed63182bd08519c", "eff3ffc6dbef9ecae16baed63182bd08519c", "eff3ffc6dbef9ecae16baed64292c62171b5084594", "f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594", "f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b" ).map(colors); var Blues =3D ramp(scheme$l); var scheme$m =3D new Array(3).concat( "e5f5e0a1d99b31a354", "edf8e9bae4b374c476238b45", "edf8e9bae4b374c47631a354006d2c", "edf8e9c7e9c0a1d99b74c47631a354006d2c", "edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32", "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32", "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b" ).map(colors); var Greens =3D ramp(scheme$m); var scheme$n =3D new Array(3).concat( "f0f0f0bdbdbd636363", "f7f7f7cccccc969696525252", "f7f7f7cccccc969696636363252525", "f7f7f7d9d9d9bdbdbd969696636363252525", "f7f7f7d9d9d9bdbdbd969696737373525252252525", "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525", "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000" ).map(colors); var Greys =3D ramp(scheme$n); var scheme$o =3D new Array(3).concat( "efedf5bcbddc756bb1", "f2f0f7cbc9e29e9ac86a51a3", "f2f0f7cbc9e29e9ac8756bb154278f", "f2f0f7dadaebbcbddc9e9ac8756bb154278f", "f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486", "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486", "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d" ).map(colors); var Purples =3D ramp(scheme$o); var scheme$p =3D new Array(3).concat( "fee0d2fc9272de2d26", "fee5d9fcae91fb6a4acb181d", "fee5d9fcae91fb6a4ade2d26a50f15", "fee5d9fcbba1fc9272fb6a4ade2d26a50f15", "fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d", "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d", "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d" ).map(colors); var Reds =3D ramp(scheme$p); var scheme$q =3D new Array(3).concat( "fee6cefdae6be6550d", "feeddefdbe85fd8d3cd94701", "feeddefdbe85fd8d3ce6550da63603", "feeddefdd0a2fdae6bfd8d3ce6550da63603", "feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04", "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04", "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704" ).map(colors); var Oranges =3D ramp(scheme$q); var cubehelix$3 =3D cubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240,= 0.5, 1.0)); var warm =3D cubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50,= 0.8)); var cool =3D cubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, = 0.8)); var c =3D cubehelix(); function rainbow(t) { if (t < 0 || t > 1) t -=3D Math.floor(t); var ts =3D Math.abs(t - 0.5); c.h =3D 360 * t - 100; c.s =3D 1.5 - 1.5 * ts; c.l =3D 0.8 - 0.9 * ts; return c + ""; } var c$1 =3D rgb(), pi_1_3 =3D Math.PI / 3, pi_2_3 =3D Math.PI * 2 / 3; function sinebow(t) { var x; t =3D (0.5 - t) * Math.PI; c$1.r =3D 255 * (x =3D Math.sin(t)) * x; c$1.g =3D 255 * (x =3D Math.sin(t + pi_1_3)) * x; c$1.b =3D 255 * (x =3D Math.sin(t + pi_2_3)) * x; return c$1 + ""; } function ramp$1(range) { var n =3D range.length; return function(t) { return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; }; } var viridis =3D ramp$1(colors("44015444025645045745055946075a46085c460a5d46= 0b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6= e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a47= 2d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b8= 4433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e= 4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588= c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32= 658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718= e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e28= 7d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888= e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f= 948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa08= 81fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225= ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67= 935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4a= c16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5= f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81= d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da3= 9a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2= df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e41= 8e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")); var magma =3D ramp$1(colors("00000401000501010601010802010902020b02020d0303= 0f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290= e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11= 471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f11633= 1116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510= 774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5= a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d= 816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828= 125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c= 80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327da= a337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd39= 77bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd= 2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e= 65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef= 1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf876= 5cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63f= c8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea5= 71fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81f= ebd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed3= 95fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aaf= debacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")); var inferno =3D ramp$1(colors("00000401000501010601010802010a02020c02020e03= 021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092= b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c4821= 0c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f36096= 13809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c= 0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136= e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e74= 1a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216= b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b= 29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305= cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c1= 3a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d2464= 4d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e1= 5635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec672= 6ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f5= 7d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa920= 7fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfc= aa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac22= 8fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5= db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f17= 9f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")); var plasma =3D ramp$1(colors("0d088710078813078916078a19068c1b068d1d068e200= 68f2206902406912605912805922a05932c05942e05952f0596310597330597350498370499= 38049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c0= 2a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a6= 6100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a8740= 1a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a6= 8707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a1981= 4a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197= a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb63= 08bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80= c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4= c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6a= da5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe46= 95ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754= ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48= 849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983e= f99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fda= b33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2a= febe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd= 225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626= f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")); function constant$b(x) { return function constant() { return x; }; } var abs$1 =3D Math.abs; var atan2$1 =3D Math.atan2; var cos$2 =3D Math.cos; var max$2 =3D Math.max; var min$1 =3D Math.min; var sin$2 =3D Math.sin; var sqrt$2 =3D Math.sqrt; var epsilon$3 =3D 1e-12; var pi$4 =3D Math.PI; var halfPi$3 =3D pi$4 / 2; var tau$4 =3D 2 * pi$4; function acos$1(x) { return x > 1 ? 0 : x < -1 ? pi$4 : Math.acos(x); } function asin$1(x) { return x >=3D 1 ? halfPi$3 : x <=3D -1 ? -halfPi$3 : Math.asin(x); } function arcInnerRadius(d) { return d.innerRadius; } function arcOuterRadius(d) { return d.outerRadius; } function arcStartAngle(d) { return d.startAngle; } function arcEndAngle(d) { return d.endAngle; } function arcPadAngle(d) { return d && d.padAngle; // Note: optional! } function intersect(x0, y0, x1, y1, x2, y2, x3, y3) { var x10 =3D x1 - x0, y10 =3D y1 - y0, x32 =3D x3 - x2, y32 =3D y3 - y2, t =3D y32 * x10 - x32 * y10; if (t * t < epsilon$3) return; t =3D (x32 * (y0 - y2) - y32 * (x0 - x2)) / t; return [x0 + t * x10, y0 + t * y10]; } // Compute perpendicular offset line of length rc. // http://mathworld.wolfram.com/Circle-LineIntersection.html function cornerTangents(x0, y0, x1, y1, r1, rc, cw) { var x01 =3D x0 - x1, y01 =3D y0 - y1, lo =3D (cw ? rc : -rc) / sqrt$2(x01 * x01 + y01 * y01), ox =3D lo * y01, oy =3D -lo * x01, x11 =3D x0 + ox, y11 =3D y0 + oy, x10 =3D x1 + ox, y10 =3D y1 + oy, x00 =3D (x11 + x10) / 2, y00 =3D (y11 + y10) / 2, dx =3D x10 - x11, dy =3D y10 - y11, d2 =3D dx * dx + dy * dy, r =3D r1 - rc, D =3D x11 * y10 - x10 * y11, d =3D (dy < 0 ? -1 : 1) * sqrt$2(max$2(0, r * r * d2 - D * D)), cx0 =3D (D * dy - dx * d) / d2, cy0 =3D (-D * dx - dy * d) / d2, cx1 =3D (D * dy + dx * d) / d2, cy1 =3D (-D * dx + dy * d) / d2, dx0 =3D cx0 - x00, dy0 =3D cy0 - y00, dx1 =3D cx1 - x00, dy1 =3D cy1 - y00; // Pick the closer of the two intersection points. // TODO Is there a faster way to determine which intersection to use? if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 =3D cx1, cy0 =3D c= y1; return { cx: cx0, cy: cy0, x01: -ox, y01: -oy, x11: cx0 * (r1 / r - 1), y11: cy0 * (r1 / r - 1) }; } function arc() { var innerRadius =3D arcInnerRadius, outerRadius =3D arcOuterRadius, cornerRadius =3D constant$b(0), padRadius =3D null, startAngle =3D arcStartAngle, endAngle =3D arcEndAngle, padAngle =3D arcPadAngle, context =3D null; function arc() { var buffer, r, r0 =3D +innerRadius.apply(this, arguments), r1 =3D +outerRadius.apply(this, arguments), a0 =3D startAngle.apply(this, arguments) - halfPi$3, a1 =3D endAngle.apply(this, arguments) - halfPi$3, da =3D abs$1(a1 - a0), cw =3D a1 > a0; if (!context) context =3D buffer =3D path(); // Ensure that the outer radius is always larger than the inner radius. if (r1 < r0) r =3D r1, r1 =3D r0, r0 =3D r; // Is it a point? if (!(r1 > epsilon$3)) context.moveTo(0, 0); // Or is it a circle or annulus? else if (da > tau$4 - epsilon$3) { context.moveTo(r1 * cos$2(a0), r1 * sin$2(a0)); context.arc(0, 0, r1, a0, a1, !cw); if (r0 > epsilon$3) { context.moveTo(r0 * cos$2(a1), r0 * sin$2(a1)); context.arc(0, 0, r0, a1, a0, cw); } } // Or is it a circular or annular sector? else { var a01 =3D a0, a11 =3D a1, a00 =3D a0, a10 =3D a1, da0 =3D da, da1 =3D da, ap =3D padAngle.apply(this, arguments) / 2, rp =3D (ap > epsilon$3) && (padRadius ? +padRadius.apply(this, ar= guments) : sqrt$2(r0 * r0 + r1 * r1)), rc =3D min$1(abs$1(r1 - r0) / 2, +cornerRadius.apply(this, argume= nts)), rc0 =3D rc, rc1 =3D rc, t0, t1; // Apply padding? Note that since r1 =E2=89=A5 r0, da1 =E2=89=A5 da0. if (rp > epsilon$3) { var p0 =3D asin$1(rp / r0 * sin$2(ap)), p1 =3D asin$1(rp / r1 * sin$2(ap)); if ((da0 -=3D p0 * 2) > epsilon$3) p0 *=3D (cw ? 1 : -1), a00 +=3D = p0, a10 -=3D p0; else da0 =3D 0, a00 =3D a10 =3D (a0 + a1) / 2; if ((da1 -=3D p1 * 2) > epsilon$3) p1 *=3D (cw ? 1 : -1), a01 +=3D = p1, a11 -=3D p1; else da1 =3D 0, a01 =3D a11 =3D (a0 + a1) / 2; } var x01 =3D r1 * cos$2(a01), y01 =3D r1 * sin$2(a01), x10 =3D r0 * cos$2(a10), y10 =3D r0 * sin$2(a10); // Apply rounded corners? if (rc > epsilon$3) { var x11 =3D r1 * cos$2(a11), y11 =3D r1 * sin$2(a11), x00 =3D r0 * cos$2(a00), y00 =3D r0 * sin$2(a00), oc; // Restrict the corner radius according to the sector angle. if (da < pi$4 && (oc =3D intersect(x01, y01, x00, y00, x11, y11, x1= 0, y10))) { var ax =3D x01 - oc[0], ay =3D y01 - oc[1], bx =3D x11 - oc[0], by =3D y11 - oc[1], kc =3D 1 / sin$2(acos$1((ax * bx + ay * by) / (sqrt$2(ax * ax= + ay * ay) * sqrt$2(bx * bx + by * by))) / 2), lc =3D sqrt$2(oc[0] * oc[0] + oc[1] * oc[1]); rc0 =3D min$1(rc, (r0 - lc) / (kc - 1)); rc1 =3D min$1(rc, (r1 - lc) / (kc + 1)); } } // Is the sector collapsed to a line? if (!(da1 > epsilon$3)) context.moveTo(x01, y01); // Does the sector=E2=80=99s outer ring have rounded corners? else if (rc1 > epsilon$3) { t0 =3D cornerTangents(x00, y00, x01, y01, r1, rc1, cw); t1 =3D cornerTangents(x11, y11, x10, y10, r1, rc1, cw); context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); // Have the corners merged? if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2$1(t0.y01, t0.x01= ), atan2$1(t1.y01, t1.x01), !cw); // Otherwise, draw the two corners and the ring. else { context.arc(t0.cx, t0.cy, rc1, atan2$1(t0.y01, t0.x01), atan2$1(t= 0.y11, t0.x11), !cw); context.arc(0, 0, r1, atan2$1(t0.cy + t0.y11, t0.cx + t0.x11), at= an2$1(t1.cy + t1.y11, t1.cx + t1.x11), !cw); context.arc(t1.cx, t1.cy, rc1, atan2$1(t1.y11, t1.x11), atan2$1(t= 1.y01, t1.x01), !cw); } } // Or is the outer ring just a circular arc? else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); // Is there no inner ring, and it=E2=80=99s a circular sector? // Or perhaps it=E2=80=99s an annular sector collapsed due to padding? if (!(r0 > epsilon$3) || !(da0 > epsilon$3)) context.lineTo(x10, y10); // Does the sector=E2=80=99s inner ring (or point) have rounded corne= rs? else if (rc0 > epsilon$3) { t0 =3D cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); t1 =3D cornerTangents(x01, y01, x00, y00, r0, -rc0, cw); context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); // Have the corners merged? if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2$1(t0.y01, t0.x01= ), atan2$1(t1.y01, t1.x01), !cw); // Otherwise, draw the two corners and the ring. else { context.arc(t0.cx, t0.cy, rc0, atan2$1(t0.y01, t0.x01), atan2$1(t= 0.y11, t0.x11), !cw); context.arc(0, 0, r0, atan2$1(t0.cy + t0.y11, t0.cx + t0.x11), at= an2$1(t1.cy + t1.y11, t1.cx + t1.x11), cw); context.arc(t1.cx, t1.cy, rc0, atan2$1(t1.y11, t1.x11), atan2$1(t= 1.y01, t1.x01), !cw); } } // Or is the inner ring just a circular arc? else context.arc(0, 0, r0, a10, a00, cw); } context.closePath(); if (buffer) return context =3D null, buffer + "" || null; } arc.centroid =3D function() { var r =3D (+innerRadius.apply(this, arguments) + +outerRadius.apply(thi= s, arguments)) / 2, a =3D (+startAngle.apply(this, arguments) + +endAngle.apply(this, a= rguments)) / 2 - pi$4 / 2; return [cos$2(a) * r, sin$2(a) * r]; }; arc.innerRadius =3D function(_) { return arguments.length ? (innerRadius =3D typeof _ =3D=3D=3D "function= " ? _ : constant$b(+_), arc) : innerRadius; }; arc.outerRadius =3D function(_) { return arguments.length ? (outerRadius =3D typeof _ =3D=3D=3D "function= " ? _ : constant$b(+_), arc) : outerRadius; }; arc.cornerRadius =3D function(_) { return arguments.length ? (cornerRadius =3D typeof _ =3D=3D=3D "functio= n" ? _ : constant$b(+_), arc) : cornerRadius; }; arc.padRadius =3D function(_) { return arguments.length ? (padRadius =3D _ =3D=3D null ? null : typeof = _ =3D=3D=3D "function" ? _ : constant$b(+_), arc) : padRadius; }; arc.startAngle =3D function(_) { return arguments.length ? (startAngle =3D typeof _ =3D=3D=3D "function"= ? _ : constant$b(+_), arc) : startAngle; }; arc.endAngle =3D function(_) { return arguments.length ? (endAngle =3D typeof _ =3D=3D=3D "function" ?= _ : constant$b(+_), arc) : endAngle; }; arc.padAngle =3D function(_) { return arguments.length ? (padAngle =3D typeof _ =3D=3D=3D "function" ?= _ : constant$b(+_), arc) : padAngle; }; arc.context =3D function(_) { return arguments.length ? ((context =3D _ =3D=3D null ? null : _), arc)= : context; }; return arc; } function Linear(context) { this._context =3D context; } Linear.prototype =3D { areaStart: function() { this._line =3D 0; }, areaEnd: function() { this._line =3D NaN; }, lineStart: function() { this._point =3D 0; }, lineEnd: function() { if (this._line || (this._line !=3D=3D 0 && this._point =3D=3D=3D 1)) th= is._context.closePath(); this._line =3D 1 - this._line; }, point: function(x, y) { x =3D +x, y =3D +y; switch (this._point) { case 0: this._point =3D 1; this._line ? this._context.lineTo(x, y) : = this._context.moveTo(x, y); break; case 1: this._point =3D 2; // proceed default: this._context.lineTo(x, y); break; } } }; function curveLinear(context) { return new Linear(context); } function x$3(p) { return p[0]; } function y$3(p) { return p[1]; } function line() { var x$$1 =3D x$3, y$$1 =3D y$3, defined =3D constant$b(true), context =3D null, curve =3D curveLinear, output =3D null; function line(data) { var i, n =3D data.length, d, defined0 =3D false, buffer; if (context =3D=3D null) output =3D curve(buffer =3D path()); for (i =3D 0; i <=3D n; ++i) { if (!(i < n && defined(d =3D data[i], i, data)) =3D=3D=3D defined0) { if (defined0 =3D !defined0) output.lineStart(); else output.lineEnd(); } if (defined0) output.point(+x$$1(d, i, data), +y$$1(d, i, data)); } if (buffer) return output =3D null, buffer + "" || null; } line.x =3D function(_) { return arguments.length ? (x$$1 =3D typeof _ =3D=3D=3D "function" ? _ := constant$b(+_), line) : x$$1; }; line.y =3D function(_) { return arguments.length ? (y$$1 =3D typeof _ =3D=3D=3D "function" ? _ := constant$b(+_), line) : y$$1; }; line.defined =3D function(_) { return arguments.length ? (defined =3D typeof _ =3D=3D=3D "function" ? = _ : constant$b(!!_), line) : defined; }; line.curve =3D function(_) { return arguments.length ? (curve =3D _, context !=3D null && (output = =3D curve(context)), line) : curve; }; line.context =3D function(_) { return arguments.length ? (_ =3D=3D null ? context =3D output =3D null = : output =3D curve(context =3D _), line) : context; }; return line; } function area$3() { var x0 =3D x$3, x1 =3D null, y0 =3D constant$b(0), y1 =3D y$3, defined =3D constant$b(true), context =3D null, curve =3D curveLinear, output =3D null; function area(data) { var i, j, k, n =3D data.length, d, defined0 =3D false, buffer, x0z =3D new Array(n), y0z =3D new Array(n); if (context =3D=3D null) output =3D curve(buffer =3D path()); for (i =3D 0; i <=3D n; ++i) { if (!(i < n && defined(d =3D data[i], i, data)) =3D=3D=3D defined0) { if (defined0 =3D !defined0) { j =3D i; output.areaStart(); output.lineStart(); } else { output.lineEnd(); output.lineStart(); for (k =3D i - 1; k >=3D j; --k) { output.point(x0z[k], y0z[k]); } output.lineEnd(); output.areaEnd(); } } if (defined0) { x0z[i] =3D +x0(d, i, data), y0z[i] =3D +y0(d, i, data); output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : = y0z[i]); } } if (buffer) return output =3D null, buffer + "" || null; } function arealine() { return line().defined(defined).curve(curve).context(context); } area.x =3D function(_) { return arguments.length ? (x0 =3D typeof _ =3D=3D=3D "function" ? _ : c= onstant$b(+_), x1 =3D null, area) : x0; }; area.x0 =3D function(_) { return arguments.length ? (x0 =3D typeof _ =3D=3D=3D "function" ? _ : c= onstant$b(+_), area) : x0; }; area.x1 =3D function(_) { return arguments.length ? (x1 =3D _ =3D=3D null ? null : typeof _ =3D= =3D=3D "function" ? _ : constant$b(+_), area) : x1; }; area.y =3D function(_) { return arguments.length ? (y0 =3D typeof _ =3D=3D=3D "function" ? _ : c= onstant$b(+_), y1 =3D null, area) : y0; }; area.y0 =3D function(_) { return arguments.length ? (y0 =3D typeof _ =3D=3D=3D "function" ? _ : c= onstant$b(+_), area) : y0; }; area.y1 =3D function(_) { return arguments.length ? (y1 =3D _ =3D=3D null ? null : typeof _ =3D= =3D=3D "function" ? _ : constant$b(+_), area) : y1; }; area.lineX0 =3D area.lineY0 =3D function() { return arealine().x(x0).y(y0); }; area.lineY1 =3D function() { return arealine().x(x0).y(y1); }; area.lineX1 =3D function() { return arealine().x(x1).y(y0); }; area.defined =3D function(_) { return arguments.length ? (defined =3D typeof _ =3D=3D=3D "function" ? = _ : constant$b(!!_), area) : defined; }; area.curve =3D function(_) { return arguments.length ? (curve =3D _, context !=3D null && (output = =3D curve(context)), area) : curve; }; area.context =3D function(_) { return arguments.length ? (_ =3D=3D null ? context =3D output =3D null = : output =3D curve(context =3D _), area) : context; }; return area; } function descending$1(a, b) { return b < a ? -1 : b > a ? 1 : b >=3D a ? 0 : NaN; } function identity$8(d) { return d; } function pie() { var value =3D identity$8, sortValues =3D descending$1, sort =3D null, startAngle =3D constant$b(0), endAngle =3D constant$b(tau$4), padAngle =3D constant$b(0); function pie(data) { var i, n =3D data.length, j, k, sum =3D 0, index =3D new Array(n), arcs =3D new Array(n), a0 =3D +startAngle.apply(this, arguments), da =3D Math.min(tau$4, Math.max(-tau$4, endAngle.apply(this, argume= nts) - a0)), a1, p =3D Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa =3D p * (da < 0 ? -1 : 1), v; for (i =3D 0; i < n; ++i) { if ((v =3D arcs[index[i] =3D i] =3D +value(data[i], i, data)) > 0) { sum +=3D v; } } // Optionally sort the arcs by previously-computed values or by data. if (sortValues !=3D null) index.sort(function(i, j) { return sortValues= (arcs[i], arcs[j]); }); else if (sort !=3D null) index.sort(function(i, j) { return sort(data[i= ], data[j]); }); // Compute the arcs! They are stored in the original data's order. for (i =3D 0, k =3D sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 =3D a= 1) { j =3D index[i], v =3D arcs[j], a1 =3D a0 + (v > 0 ? v * k : 0) + pa, = arcs[j] =3D { data: data[j], index: i, value: v, startAngle: a0, endAngle: a1, padAngle: p }; } return arcs; } pie.value =3D function(_) { return arguments.length ? (value =3D typeof _ =3D=3D=3D "function" ? _ = : constant$b(+_), pie) : value; }; pie.sortValues =3D function(_) { return arguments.length ? (sortValues =3D _, sort =3D null, pie) : sort= Values; }; pie.sort =3D function(_) { return arguments.length ? (sort =3D _, sortValues =3D null, pie) : sort; }; pie.startAngle =3D function(_) { return arguments.length ? (startAngle =3D typeof _ =3D=3D=3D "function"= ? _ : constant$b(+_), pie) : startAngle; }; pie.endAngle =3D function(_) { return arguments.length ? (endAngle =3D typeof _ =3D=3D=3D "function" ?= _ : constant$b(+_), pie) : endAngle; }; pie.padAngle =3D function(_) { return arguments.length ? (padAngle =3D typeof _ =3D=3D=3D "function" ?= _ : constant$b(+_), pie) : padAngle; }; return pie; } var curveRadialLinear =3D curveRadial(curveLinear); function Radial(curve) { this._curve =3D curve; } Radial.prototype =3D { areaStart: function() { this._curve.areaStart(); }, areaEnd: function() { this._curve.areaEnd(); }, lineStart: function() { this._curve.lineStart(); }, lineEnd: function() { this._curve.lineEnd(); }, point: function(a, r) { this._curve.point(r * Math.sin(a), r * -Math.cos(a)); } }; function curveRadial(curve) { function radial(context) { return new Radial(curve(context)); } radial._curve =3D curve; return radial; } function lineRadial(l) { var c =3D l.curve; l.angle =3D l.x, delete l.x; l.radius =3D l.y, delete l.y; l.curve =3D function(_) { return arguments.length ? c(curveRadial(_)) : c()._curve; }; return l; } function lineRadial$1() { return lineRadial(line().curve(curveRadialLinear)); } function areaRadial() { var a =3D area$3().curve(curveRadialLinear), c =3D a.curve, x0 =3D a.lineX0, x1 =3D a.lineX1, y0 =3D a.lineY0, y1 =3D a.lineY1; a.angle =3D a.x, delete a.x; a.startAngle =3D a.x0, delete a.x0; a.endAngle =3D a.x1, delete a.x1; a.radius =3D a.y, delete a.y; a.innerRadius =3D a.y0, delete a.y0; a.outerRadius =3D a.y1, delete a.y1; a.lineStartAngle =3D function() { return lineRadial(x0()); }, delete a.li= neX0; a.lineEndAngle =3D function() { return lineRadial(x1()); }, delete a.line= X1; a.lineInnerRadius =3D function() { return lineRadial(y0()); }, delete a.l= ineY0; a.lineOuterRadius =3D function() { return lineRadial(y1()); }, delete a.l= ineY1; a.curve =3D function(_) { return arguments.length ? c(curveRadial(_)) : c()._curve; }; return a; } function pointRadial(x, y) { return [(y =3D +y) * Math.cos(x -=3D Math.PI / 2), y * Math.sin(x)]; } var slice$6 =3D Array.prototype.slice; function linkSource(d) { return d.source; } function linkTarget(d) { return d.target; } function link$2(curve) { var source =3D linkSource, target =3D linkTarget, x$$1 =3D x$3, y$$1 =3D y$3, context =3D null; function link() { var buffer, argv =3D slice$6.call(arguments), s =3D source.apply(this, = argv), t =3D target.apply(this, argv); if (!context) context =3D buffer =3D path(); curve(context, +x$$1.apply(this, (argv[0] =3D s, argv)), +y$$1.apply(th= is, argv), +x$$1.apply(this, (argv[0] =3D t, argv)), +y$$1.apply(this, argv= )); if (buffer) return context =3D null, buffer + "" || null; } link.source =3D function(_) { return arguments.length ? (source =3D _, link) : source; }; link.target =3D function(_) { return arguments.length ? (target =3D _, link) : target; }; link.x =3D function(_) { return arguments.length ? (x$$1 =3D typeof _ =3D=3D=3D "function" ? _ := constant$b(+_), link) : x$$1; }; link.y =3D function(_) { return arguments.length ? (y$$1 =3D typeof _ =3D=3D=3D "function" ? _ := constant$b(+_), link) : y$$1; }; link.context =3D function(_) { return arguments.length ? ((context =3D _ =3D=3D null ? null : _), link= ) : context; }; return link; } function curveHorizontal(context, x0, y0, x1, y1) { context.moveTo(x0, y0); context.bezierCurveTo(x0 =3D (x0 + x1) / 2, y0, x0, y1, x1, y1); } function curveVertical(context, x0, y0, x1, y1) { context.moveTo(x0, y0); context.bezierCurveTo(x0, y0 =3D (y0 + y1) / 2, x1, y0, x1, y1); } function curveRadial$1(context, x0, y0, x1, y1) { var p0 =3D pointRadial(x0, y0), p1 =3D pointRadial(x0, y0 =3D (y0 + y1) / 2), p2 =3D pointRadial(x1, y0), p3 =3D pointRadial(x1, y1); context.moveTo(p0[0], p0[1]); context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]); } function linkHorizontal() { return link$2(curveHorizontal); } function linkVertical() { return link$2(curveVertical); } function linkRadial() { var l =3D link$2(curveRadial$1); l.angle =3D l.x, delete l.x; l.radius =3D l.y, delete l.y; return l; } var circle$2 =3D { draw: function(context, size) { var r =3D Math.sqrt(size / pi$4); context.moveTo(r, 0); context.arc(0, 0, r, 0, tau$4); } }; var cross$2 =3D { draw: function(context, size) { var r =3D Math.sqrt(size / 5) / 2; context.moveTo(-3 * r, -r); context.lineTo(-r, -r); context.lineTo(-r, -3 * r); context.lineTo(r, -3 * r); context.lineTo(r, -r); context.lineTo(3 * r, -r); context.lineTo(3 * r, r); context.lineTo(r, r); context.lineTo(r, 3 * r); context.lineTo(-r, 3 * r); context.lineTo(-r, r); context.lineTo(-3 * r, r); context.closePath(); } }; var tan30 =3D Math.sqrt(1 / 3), tan30_2 =3D tan30 * 2; var diamond =3D { draw: function(context, size) { var y =3D Math.sqrt(size / tan30_2), x =3D y * tan30; context.moveTo(0, -y); context.lineTo(x, 0); context.lineTo(0, y); context.lineTo(-x, 0); context.closePath(); } }; var ka =3D 0.89081309152928522810, kr =3D Math.sin(pi$4 / 10) / Math.sin(7 * pi$4 / 10), kx =3D Math.sin(tau$4 / 10) * kr, ky =3D -Math.cos(tau$4 / 10) * kr; var star =3D { draw: function(context, size) { var r =3D Math.sqrt(size * ka), x =3D kx * r, y =3D ky * r; context.moveTo(0, -r); context.lineTo(x, y); for (var i =3D 1; i < 5; ++i) { var a =3D tau$4 * i / 5, c =3D Math.cos(a), s =3D Math.sin(a); context.lineTo(s * r, -c * r); context.lineTo(c * x - s * y, s * x + c * y); } context.closePath(); } }; var square =3D { draw: function(context, size) { var w =3D Math.sqrt(size), x =3D -w / 2; context.rect(x, x, w, w); } }; var sqrt3 =3D Math.sqrt(3); var triangle =3D { draw: function(context, size) { var y =3D -Math.sqrt(size / (sqrt3 * 3)); context.moveTo(0, y * 2); context.lineTo(-sqrt3 * y, -y); context.lineTo(sqrt3 * y, -y); context.closePath(); } }; var c$2 =3D -0.5, s =3D Math.sqrt(3) / 2, k =3D 1 / Math.sqrt(12), a =3D (k / 2 + 1) * 3; var wye =3D { draw: function(context, size) { var r =3D Math.sqrt(size / a), x0 =3D r / 2, y0 =3D r * k, x1 =3D x0, y1 =3D r * k + r, x2 =3D -x1, y2 =3D y1; context.moveTo(x0, y0); context.lineTo(x1, y1); context.lineTo(x2, y2); context.lineTo(c$2 * x0 - s * y0, s * x0 + c$2 * y0); context.lineTo(c$2 * x1 - s * y1, s * x1 + c$2 * y1); context.lineTo(c$2 * x2 - s * y2, s * x2 + c$2 * y2); context.lineTo(c$2 * x0 + s * y0, c$2 * y0 - s * x0); context.lineTo(c$2 * x1 + s * y1, c$2 * y1 - s * x1); context.lineTo(c$2 * x2 + s * y2, c$2 * y2 - s * x2); context.closePath(); } }; var symbols =3D [ circle$2, cross$2, diamond, square, star, triangle, wye ]; function symbol() { var type =3D constant$b(circle$2), size =3D constant$b(64), context =3D null; function symbol() { var buffer; if (!context) context =3D buffer =3D path(); type.apply(this, arguments).draw(context, +size.apply(this, arguments)); if (buffer) return context =3D null, buffer + "" || null; } symbol.type =3D function(_) { return arguments.length ? (type =3D typeof _ =3D=3D=3D "function" ? _ := constant$b(_), symbol) : type; }; symbol.size =3D function(_) { return arguments.length ? (size =3D typeof _ =3D=3D=3D "function" ? _ := constant$b(+_), symbol) : size; }; symbol.context =3D function(_) { return arguments.length ? (context =3D _ =3D=3D null ? null : _, symbol= ) : context; }; return symbol; } function noop$3() {} function point$2(that, x, y) { that._context.bezierCurveTo( (2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, (that._x0 + 2 * that._x1) / 3, (that._y0 + 2 * that._y1) / 3, (that._x0 + 4 * that._x1 + x) / 6, (that._y0 + 4 * that._y1 + y) / 6 ); } function Basis(context) { this._context =3D context; } Basis.prototype =3D { areaStart: function() { this._line =3D 0; }, areaEnd: function() { this._line =3D NaN; }, lineStart: function() { this._x0 =3D this._x1 =3D this._y0 =3D this._y1 =3D NaN; this._point =3D 0; }, lineEnd: function() { switch (this._point) { case 3: point$2(this, this._x1, this._y1); // proceed case 2: this._context.lineTo(this._x1, this._y1); break; } if (this._line || (this._line !=3D=3D 0 && this._point =3D=3D=3D 1)) th= is._context.closePath(); this._line =3D 1 - this._line; }, point: function(x, y) { x =3D +x, y =3D +y; switch (this._point) { case 0: this._point =3D 1; this._line ? this._context.lineTo(x, y) : = this._context.moveTo(x, y); break; case 1: this._point =3D 2; break; case 2: this._point =3D 3; this._context.lineTo((5 * this._x0 + this.= _x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed default: point$2(this, x, y); break; } this._x0 =3D this._x1, this._x1 =3D x; this._y0 =3D this._y1, this._y1 =3D y; } }; function basis$2(context) { return new Basis(context); } function BasisClosed(context) { this._context =3D context; } BasisClosed.prototype =3D { areaStart: noop$3, areaEnd: noop$3, lineStart: function() { this._x0 =3D this._x1 =3D this._x2 =3D this._x3 =3D this._x4 =3D this._y0 =3D this._y1 =3D this._y2 =3D this._y3 =3D this._y4 =3D NaN; this._point =3D 0; }, lineEnd: function() { switch (this._point) { case 1: { this._context.moveTo(this._x2, this._y2); this._context.closePath(); break; } case 2: { this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 *= this._y3) / 3); this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 *= this._y2) / 3); this._context.closePath(); break; } case 3: { this.point(this._x2, this._y2); this.point(this._x3, this._y3); this.point(this._x4, this._y4); break; } } }, point: function(x, y) { x =3D +x, y =3D +y; switch (this._point) { case 0: this._point =3D 1; this._x2 =3D x, this._y2 =3D y; break; case 1: this._point =3D 2; this._x3 =3D x, this._y3 =3D y; break; case 2: this._point =3D 3; this._x4 =3D x, this._y4 =3D y; this._cont= ext.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y)= / 6); break; default: point$2(this, x, y); break; } this._x0 =3D this._x1, this._x1 =3D x; this._y0 =3D this._y1, this._y1 =3D y; } }; function basisClosed$1(context) { return new BasisClosed(context); } function BasisOpen(context) { this._context =3D context; } BasisOpen.prototype =3D { areaStart: function() { this._line =3D 0; }, areaEnd: function() { this._line =3D NaN; }, lineStart: function() { this._x0 =3D this._x1 =3D this._y0 =3D this._y1 =3D NaN; this._point =3D 0; }, lineEnd: function() { if (this._line || (this._line !=3D=3D 0 && this._point =3D=3D=3D 3)) th= is._context.closePath(); this._line =3D 1 - this._line; }, point: function(x, y) { x =3D +x, y =3D +y; switch (this._point) { case 0: this._point =3D 1; break; case 1: this._point =3D 2; break; case 2: this._point =3D 3; var x0 =3D (this._x0 + 4 * this._x1 + x) /= 6, y0 =3D (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.li= neTo(x0, y0) : this._context.moveTo(x0, y0); break; case 3: this._point =3D 4; // proceed default: point$2(this, x, y); break; } this._x0 =3D this._x1, this._x1 =3D x; this._y0 =3D this._y1, this._y1 =3D y; } }; function basisOpen(context) { return new BasisOpen(context); } function Bundle(context, beta) { this._basis =3D new Basis(context); this._beta =3D beta; } Bundle.prototype =3D { lineStart: function() { this._x =3D []; this._y =3D []; this._basis.lineStart(); }, lineEnd: function() { var x =3D this._x, y =3D this._y, j =3D x.length - 1; if (j > 0) { var x0 =3D x[0], y0 =3D y[0], dx =3D x[j] - x0, dy =3D y[j] - y0, i =3D -1, t; while (++i <=3D j) { t =3D i / j; this._basis.point( this._beta * x[i] + (1 - this._beta) * (x0 + t * dx), this._beta * y[i] + (1 - this._beta) * (y0 + t * dy) ); } } this._x =3D this._y =3D null; this._basis.lineEnd(); }, point: function(x, y) { this._x.push(+x); this._y.push(+y); } }; var bundle =3D (function custom(beta) { function bundle(context) { return beta =3D=3D=3D 1 ? new Basis(context) : new Bundle(context, beta= ); } bundle.beta =3D function(beta) { return custom(+beta); }; return bundle; })(0.85); function point$3(that, x, y) { that._context.bezierCurveTo( that._x1 + that._k * (that._x2 - that._x0), that._y1 + that._k * (that._y2 - that._y0), that._x2 + that._k * (that._x1 - x), that._y2 + that._k * (that._y1 - y), that._x2, that._y2 ); } function Cardinal(context, tension) { this._context =3D context; this._k =3D (1 - tension) / 6; } Cardinal.prototype =3D { areaStart: function() { this._line =3D 0; }, areaEnd: function() { this._line =3D NaN; }, lineStart: function() { this._x0 =3D this._x1 =3D this._x2 =3D this._y0 =3D this._y1 =3D this._y2 =3D NaN; this._point =3D 0; }, lineEnd: function() { switch (this._point) { case 2: this._context.lineTo(this._x2, this._y2); break; case 3: point$3(this, this._x1, this._y1); break; } if (this._line || (this._line !=3D=3D 0 && this._point =3D=3D=3D 1)) th= is._context.closePath(); this._line =3D 1 - this._line; }, point: function(x, y) { x =3D +x, y =3D +y; switch (this._point) { case 0: this._point =3D 1; this._line ? this._context.lineTo(x, y) : = this._context.moveTo(x, y); break; case 1: this._point =3D 2; this._x1 =3D x, this._y1 =3D y; break; case 2: this._point =3D 3; // proceed default: point$3(this, x, y); break; } this._x0 =3D this._x1, this._x1 =3D this._x2, this._x2 =3D x; this._y0 =3D this._y1, this._y1 =3D this._y2, this._y2 =3D y; } }; var cardinal =3D (function custom(tension) { function cardinal(context) { return new Cardinal(context, tension); } cardinal.tension =3D function(tension) { return custom(+tension); }; return cardinal; })(0); function CardinalClosed(context, tension) { this._context =3D context; this._k =3D (1 - tension) / 6; } CardinalClosed.prototype =3D { areaStart: noop$3, areaEnd: noop$3, lineStart: function() { this._x0 =3D this._x1 =3D this._x2 =3D this._x3 =3D this._x4 =3D this._= x5 =3D this._y0 =3D this._y1 =3D this._y2 =3D this._y3 =3D this._y4 =3D this._= y5 =3D NaN; this._point =3D 0; }, lineEnd: function() { switch (this._point) { case 1: { this._context.moveTo(this._x3, this._y3); this._context.closePath(); break; } case 2: { this._context.lineTo(this._x3, this._y3); this._context.closePath(); break; } case 3: { this.point(this._x3, this._y3); this.point(this._x4, this._y4); this.point(this._x5, this._y5); break; } } }, point: function(x, y) { x =3D +x, y =3D +y; switch (this._point) { case 0: this._point =3D 1; this._x3 =3D x, this._y3 =3D y; break; case 1: this._point =3D 2; this._context.moveTo(this._x4 =3D x, this.= _y4 =3D y); break; case 2: this._point =3D 3; this._x5 =3D x, this._y5 =3D y; break; default: point$3(this, x, y); break; } this._x0 =3D this._x1, this._x1 =3D this._x2, this._x2 =3D x; this._y0 =3D this._y1, this._y1 =3D this._y2, this._y2 =3D y; } }; var cardinalClosed =3D (function custom(tension) { function cardinal$$1(context) { return new CardinalClosed(context, tension); } cardinal$$1.tension =3D function(tension) { return custom(+tension); }; return cardinal$$1; })(0); function CardinalOpen(context, tension) { this._context =3D context; this._k =3D (1 - tension) / 6; } CardinalOpen.prototype =3D { areaStart: function() { this._line =3D 0; }, areaEnd: function() { this._line =3D NaN; }, lineStart: function() { this._x0 =3D this._x1 =3D this._x2 =3D this._y0 =3D this._y1 =3D this._y2 =3D NaN; this._point =3D 0; }, lineEnd: function() { if (this._line || (this._line !=3D=3D 0 && this._point =3D=3D=3D 3)) th= is._context.closePath(); this._line =3D 1 - this._line; }, point: function(x, y) { x =3D +x, y =3D +y; switch (this._point) { case 0: this._point =3D 1; break; case 1: this._point =3D 2; break; case 2: this._point =3D 3; this._line ? this._context.lineTo(this._x2= , this._y2) : this._context.moveTo(this._x2, this._y2); break; case 3: this._point =3D 4; // proceed default: point$3(this, x, y); break; } this._x0 =3D this._x1, this._x1 =3D this._x2, this._x2 =3D x; this._y0 =3D this._y1, this._y1 =3D this._y2, this._y2 =3D y; } }; var cardinalOpen =3D (function custom(tension) { function cardinal$$1(context) { return new CardinalOpen(context, tension); } cardinal$$1.tension =3D function(tension) { return custom(+tension); }; return cardinal$$1; })(0); function point$4(that, x, y) { var x1 =3D that._x1, y1 =3D that._y1, x2 =3D that._x2, y2 =3D that._y2; if (that._l01_a > epsilon$3) { var a =3D 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_= 2a, n =3D 3 * that._l01_a * (that._l01_a + that._l12_a); x1 =3D (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; y1 =3D (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; } if (that._l23_a > epsilon$3) { var b =3D 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_= 2a, m =3D 3 * that._l23_a * (that._l23_a + that._l12_a); x2 =3D (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m; y2 =3D (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m; } that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2); } function CatmullRom(context, alpha) { this._context =3D context; this._alpha =3D alpha; } CatmullRom.prototype =3D { areaStart: function() { this._line =3D 0; }, areaEnd: function() { this._line =3D NaN; }, lineStart: function() { this._x0 =3D this._x1 =3D this._x2 =3D this._y0 =3D this._y1 =3D this._y2 =3D NaN; this._l01_a =3D this._l12_a =3D this._l23_a =3D this._l01_2a =3D this._l12_2a =3D this._l23_2a =3D this._point =3D 0; }, lineEnd: function() { switch (this._point) { case 2: this._context.lineTo(this._x2, this._y2); break; case 3: this.point(this._x2, this._y2); break; } if (this._line || (this._line !=3D=3D 0 && this._point =3D=3D=3D 1)) th= is._context.closePath(); this._line =3D 1 - this._line; }, point: function(x, y) { x =3D +x, y =3D +y; if (this._point) { var x23 =3D this._x2 - x, y23 =3D this._y2 - y; this._l23_a =3D Math.sqrt(this._l23_2a =3D Math.pow(x23 * x23 + y23 *= y23, this._alpha)); } switch (this._point) { case 0: this._point =3D 1; this._line ? this._context.lineTo(x, y) : = this._context.moveTo(x, y); break; case 1: this._point =3D 2; break; case 2: this._point =3D 3; // proceed default: point$4(this, x, y); break; } this._l01_a =3D this._l12_a, this._l12_a =3D this._l23_a; this._l01_2a =3D this._l12_2a, this._l12_2a =3D this._l23_2a; this._x0 =3D this._x1, this._x1 =3D this._x2, this._x2 =3D x; this._y0 =3D this._y1, this._y1 =3D this._y2, this._y2 =3D y; } }; var catmullRom =3D (function custom(alpha) { function catmullRom(context) { return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0= ); } catmullRom.alpha =3D function(alpha) { return custom(+alpha); }; return catmullRom; })(0.5); function CatmullRomClosed(context, alpha) { this._context =3D context; this._alpha =3D alpha; } CatmullRomClosed.prototype =3D { areaStart: noop$3, areaEnd: noop$3, lineStart: function() { this._x0 =3D this._x1 =3D this._x2 =3D this._x3 =3D this._x4 =3D this._= x5 =3D this._y0 =3D this._y1 =3D this._y2 =3D this._y3 =3D this._y4 =3D this._= y5 =3D NaN; this._l01_a =3D this._l12_a =3D this._l23_a =3D this._l01_2a =3D this._l12_2a =3D this._l23_2a =3D this._point =3D 0; }, lineEnd: function() { switch (this._point) { case 1: { this._context.moveTo(this._x3, this._y3); this._context.closePath(); break; } case 2: { this._context.lineTo(this._x3, this._y3); this._context.closePath(); break; } case 3: { this.point(this._x3, this._y3); this.point(this._x4, this._y4); this.point(this._x5, this._y5); break; } } }, point: function(x, y) { x =3D +x, y =3D +y; if (this._point) { var x23 =3D this._x2 - x, y23 =3D this._y2 - y; this._l23_a =3D Math.sqrt(this._l23_2a =3D Math.pow(x23 * x23 + y23 *= y23, this._alpha)); } switch (this._point) { case 0: this._point =3D 1; this._x3 =3D x, this._y3 =3D y; break; case 1: this._point =3D 2; this._context.moveTo(this._x4 =3D x, this.= _y4 =3D y); break; case 2: this._point =3D 3; this._x5 =3D x, this._y5 =3D y; break; default: point$4(this, x, y); break; } this._l01_a =3D this._l12_a, this._l12_a =3D this._l23_a; this._l01_2a =3D this._l12_2a, this._l12_2a =3D this._l23_2a; this._x0 =3D this._x1, this._x1 =3D this._x2, this._x2 =3D x; this._y0 =3D this._y1, this._y1 =3D this._y2, this._y2 =3D y; } }; var catmullRomClosed =3D (function custom(alpha) { function catmullRom$$1(context) { return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClose= d(context, 0); } catmullRom$$1.alpha =3D function(alpha) { return custom(+alpha); }; return catmullRom$$1; })(0.5); function CatmullRomOpen(context, alpha) { this._context =3D context; this._alpha =3D alpha; } CatmullRomOpen.prototype =3D { areaStart: function() { this._line =3D 0; }, areaEnd: function() { this._line =3D NaN; }, lineStart: function() { this._x0 =3D this._x1 =3D this._x2 =3D this._y0 =3D this._y1 =3D this._y2 =3D NaN; this._l01_a =3D this._l12_a =3D this._l23_a =3D this._l01_2a =3D this._l12_2a =3D this._l23_2a =3D this._point =3D 0; }, lineEnd: function() { if (this._line || (this._line !=3D=3D 0 && this._point =3D=3D=3D 3)) th= is._context.closePath(); this._line =3D 1 - this._line; }, point: function(x, y) { x =3D +x, y =3D +y; if (this._point) { var x23 =3D this._x2 - x, y23 =3D this._y2 - y; this._l23_a =3D Math.sqrt(this._l23_2a =3D Math.pow(x23 * x23 + y23 *= y23, this._alpha)); } switch (this._point) { case 0: this._point =3D 1; break; case 1: this._point =3D 2; break; case 2: this._point =3D 3; this._line ? this._context.lineTo(this._x2= , this._y2) : this._context.moveTo(this._x2, this._y2); break; case 3: this._point =3D 4; // proceed default: point$4(this, x, y); break; } this._l01_a =3D this._l12_a, this._l12_a =3D this._l23_a; this._l01_2a =3D this._l12_2a, this._l12_2a =3D this._l23_2a; this._x0 =3D this._x1, this._x1 =3D this._x2, this._x2 =3D x; this._y0 =3D this._y1, this._y1 =3D this._y2, this._y2 =3D y; } }; var catmullRomOpen =3D (function custom(alpha) { function catmullRom$$1(context) { return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(co= ntext, 0); } catmullRom$$1.alpha =3D function(alpha) { return custom(+alpha); }; return catmullRom$$1; })(0.5); function LinearClosed(context) { this._context =3D context; } LinearClosed.prototype =3D { areaStart: noop$3, areaEnd: noop$3, lineStart: function() { this._point =3D 0; }, lineEnd: function() { if (this._point) this._context.closePath(); }, point: function(x, y) { x =3D +x, y =3D +y; if (this._point) this._context.lineTo(x, y); else this._point =3D 1, this._context.moveTo(x, y); } }; function linearClosed(context) { return new LinearClosed(context); } function sign$1(x) { return x < 0 ? -1 : 1; } // Calculate the slopes of the tangents (Hermite-type interpolation) based = on // the following paper: Steffen, M. 1990. A Simple Method for Monotonic // Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO. // NOV(II), P. 443, 1990. function slope3(that, x2, y2) { var h0 =3D that._x1 - that._x0, h1 =3D x2 - that._x1, s0 =3D (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 =3D (y2 - that._y1) / (h1 || h0 < 0 && -0), p =3D (s0 * h1 + s1 * h0) / (h0 + h1); return (sign$1(s0) + sign$1(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0= =2E5 * Math.abs(p)) || 0; } // Calculate a one-sided slope. function slope2(that, t) { var h =3D that._x1 - that._x0; return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t; } // According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Represen= tations // "you can express cubic Hermite interpolation in terms of cubic B=C3=A9zi= er curves // with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". function point$5(that, t0, t1) { var x0 =3D that._x0, y0 =3D that._y0, x1 =3D that._x1, y1 =3D that._y1, dx =3D (x1 - x0) / 3; that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1,= x1, y1); } function MonotoneX(context) { this._context =3D context; } MonotoneX.prototype =3D { areaStart: function() { this._line =3D 0; }, areaEnd: function() { this._line =3D NaN; }, lineStart: function() { this._x0 =3D this._x1 =3D this._y0 =3D this._y1 =3D this._t0 =3D NaN; this._point =3D 0; }, lineEnd: function() { switch (this._point) { case 2: this._context.lineTo(this._x1, this._y1); break; case 3: point$5(this, this._t0, slope2(this, this._t0)); break; } if (this._line || (this._line !=3D=3D 0 && this._point =3D=3D=3D 1)) th= is._context.closePath(); this._line =3D 1 - this._line; }, point: function(x, y) { var t1 =3D NaN; x =3D +x, y =3D +y; if (x =3D=3D=3D this._x1 && y =3D=3D=3D this._y1) return; // Ignore coi= ncident points. switch (this._point) { case 0: this._point =3D 1; this._line ? this._context.lineTo(x, y) : = this._context.moveTo(x, y); break; case 1: this._point =3D 2; break; case 2: this._point =3D 3; point$5(this, slope2(this, t1 =3D slope3(t= his, x, y)), t1); break; default: point$5(this, this._t0, t1 =3D slope3(this, x, y)); break; } this._x0 =3D this._x1, this._x1 =3D x; this._y0 =3D this._y1, this._y1 =3D y; this._t0 =3D t1; } }; function MonotoneY(context) { this._context =3D new ReflectContext(context); } (MonotoneY.prototype =3D Object.create(MonotoneX.prototype)).point =3D func= tion(x, y) { MonotoneX.prototype.point.call(this, y, x); }; function ReflectContext(context) { this._context =3D context; } ReflectContext.prototype =3D { moveTo: function(x, y) { this._context.moveTo(y, x); }, closePath: function() { this._context.closePath(); }, lineTo: function(x, y) { this._context.lineTo(y, x); }, bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurve= To(y1, x1, y2, x2, y, x); } }; function monotoneX(context) { return new MonotoneX(context); } function monotoneY(context) { return new MonotoneY(context); } function Natural(context) { this._context =3D context; } Natural.prototype =3D { areaStart: function() { this._line =3D 0; }, areaEnd: function() { this._line =3D NaN; }, lineStart: function() { this._x =3D []; this._y =3D []; }, lineEnd: function() { var x =3D this._x, y =3D this._y, n =3D x.length; if (n) { this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(= x[0], y[0]); if (n =3D=3D=3D 2) { this._context.lineTo(x[1], y[1]); } else { var px =3D controlPoints(x), py =3D controlPoints(y); for (var i0 =3D 0, i1 =3D 1; i1 < n; ++i0, ++i1) { this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1= ][i0], x[i1], y[i1]); } } } if (this._line || (this._line !=3D=3D 0 && n =3D=3D=3D 1)) this._contex= t.closePath(); this._line =3D 1 - this._line; this._x =3D this._y =3D null; }, point: function(x, y) { this._x.push(+x); this._y.push(+y); } }; // See https://www.particleincell.com/2012/bezier-splines/ for derivation. function controlPoints(x) { var i, n =3D x.length - 1, m, a =3D new Array(n), b =3D new Array(n), r =3D new Array(n); a[0] =3D 0, b[0] =3D 2, r[0] =3D x[0] + 2 * x[1]; for (i =3D 1; i < n - 1; ++i) a[i] =3D 1, b[i] =3D 4, r[i] =3D 4 * x[i] += 2 * x[i + 1]; a[n - 1] =3D 2, b[n - 1] =3D 7, r[n - 1] =3D 8 * x[n - 1] + x[n]; for (i =3D 1; i < n; ++i) m =3D a[i] / b[i - 1], b[i] -=3D m, r[i] -=3D m= * r[i - 1]; a[n - 1] =3D r[n - 1] / b[n - 1]; for (i =3D n - 2; i >=3D 0; --i) a[i] =3D (r[i] - a[i + 1]) / b[i]; b[n - 1] =3D (x[n] + a[n - 1]) / 2; for (i =3D 0; i < n - 1; ++i) b[i] =3D 2 * x[i + 1] - a[i + 1]; return [a, b]; } function natural(context) { return new Natural(context); } function Step(context, t) { this._context =3D context; this._t =3D t; } Step.prototype =3D { areaStart: function() { this._line =3D 0; }, areaEnd: function() { this._line =3D NaN; }, lineStart: function() { this._x =3D this._y =3D NaN; this._point =3D 0; }, lineEnd: function() { if (0 < this._t && this._t < 1 && this._point =3D=3D=3D 2) this._contex= t.lineTo(this._x, this._y); if (this._line || (this._line !=3D=3D 0 && this._point =3D=3D=3D 1)) th= is._context.closePath(); if (this._line >=3D 0) this._t =3D 1 - this._t, this._line =3D 1 - this= =2E_line; }, point: function(x, y) { x =3D +x, y =3D +y; switch (this._point) { case 0: this._point =3D 1; this._line ? this._context.lineTo(x, y) : = this._context.moveTo(x, y); break; case 1: this._point =3D 2; // proceed default: { if (this._t <=3D 0) { this._context.lineTo(this._x, y); this._context.lineTo(x, y); } else { var x1 =3D this._x * (1 - this._t) + x * this._t; this._context.lineTo(x1, this._y); this._context.lineTo(x1, y); } break; } } this._x =3D x, this._y =3D y; } }; function step(context) { return new Step(context, 0.5); } function stepBefore(context) { return new Step(context, 0); } function stepAfter(context) { return new Step(context, 1); } function none$1(series, order) { if (!((n =3D series.length) > 1)) return; for (var i =3D 1, j, s0, s1 =3D series[order[0]], n, m =3D s1.length; i <= n; ++i) { s0 =3D s1, s1 =3D series[order[i]]; for (j =3D 0; j < m; ++j) { s1[j][1] +=3D s1[j][0] =3D isNaN(s0[j][1]) ? s0[j][0] : s0[j][1]; } } } function none$2(series) { var n =3D series.length, o =3D new Array(n); while (--n >=3D 0) o[n] =3D n; return o; } function stackValue(d, key) { return d[key]; } function stack() { var keys =3D constant$b([]), order =3D none$2, offset =3D none$1, value =3D stackValue; function stack(data) { var kz =3D keys.apply(this, arguments), i, m =3D data.length, n =3D kz.length, sz =3D new Array(n), oz; for (i =3D 0; i < n; ++i) { for (var ki =3D kz[i], si =3D sz[i] =3D new Array(m), j =3D 0, sij; j= < m; ++j) { si[j] =3D sij =3D [0, +value(data[j], ki, j, data)]; sij.data =3D data[j]; } si.key =3D ki; } for (i =3D 0, oz =3D order(sz); i < n; ++i) { sz[oz[i]].index =3D i; } offset(sz, oz); return sz; } stack.keys =3D function(_) { return arguments.length ? (keys =3D typeof _ =3D=3D=3D "function" ? _ := constant$b(slice$6.call(_)), stack) : keys; }; stack.value =3D function(_) { return arguments.length ? (value =3D typeof _ =3D=3D=3D "function" ? _ = : constant$b(+_), stack) : value; }; stack.order =3D function(_) { return arguments.length ? (order =3D _ =3D=3D null ? none$2 : typeof _ = =3D=3D=3D "function" ? _ : constant$b(slice$6.call(_)), stack) : order; }; stack.offset =3D function(_) { return arguments.length ? (offset =3D _ =3D=3D null ? none$1 : _, stack= ) : offset; }; return stack; } function expand(series, order) { if (!((n =3D series.length) > 0)) return; for (var i, n, j =3D 0, m =3D series[0].length, y; j < m; ++j) { for (y =3D i =3D 0; i < n; ++i) y +=3D series[i][j][1] || 0; if (y) for (i =3D 0; i < n; ++i) series[i][j][1] /=3D y; } none$1(series, order); } function diverging$1(series, order) { if (!((n =3D series.length) > 0)) return; for (var i, j =3D 0, d, dy, yp, yn, n, m =3D series[order[0]].length; j <= m; ++j) { for (yp =3D yn =3D 0, i =3D 0; i < n; ++i) { if ((dy =3D (d =3D series[order[i]][j])[1] - d[0]) >=3D 0) { d[0] =3D yp, d[1] =3D yp +=3D dy; } else if (dy < 0) { d[1] =3D yn, d[0] =3D yn +=3D dy; } else { d[0] =3D yp; } } } } function silhouette(series, order) { if (!((n =3D series.length) > 0)) return; for (var j =3D 0, s0 =3D series[order[0]], n, m =3D s0.length; j < m; ++j= ) { for (var i =3D 0, y =3D 0; i < n; ++i) y +=3D series[i][j][1] || 0; s0[j][1] +=3D s0[j][0] =3D -y / 2; } none$1(series, order); } function wiggle(series, order) { if (!((n =3D series.length) > 0) || !((m =3D (s0 =3D series[order[0]]).le= ngth) > 0)) return; for (var y =3D 0, j =3D 1, s0, m, n; j < m; ++j) { for (var i =3D 0, s1 =3D 0, s2 =3D 0; i < n; ++i) { var si =3D series[order[i]], sij0 =3D si[j][1] || 0, sij1 =3D si[j - 1][1] || 0, s3 =3D (sij0 - sij1) / 2; for (var k =3D 0; k < i; ++k) { var sk =3D series[order[k]], skj0 =3D sk[j][1] || 0, skj1 =3D sk[j - 1][1] || 0; s3 +=3D skj0 - skj1; } s1 +=3D sij0, s2 +=3D s3 * sij0; } s0[j - 1][1] +=3D s0[j - 1][0] =3D y; if (s1) y -=3D s2 / s1; } s0[j - 1][1] +=3D s0[j - 1][0] =3D y; none$1(series, order); } function appearance(series) { var peaks =3D series.map(peak); return none$2(series).sort(function(a, b) { return peaks[a] - peaks[b]; }= ); } function peak(series) { var i =3D -1, j =3D 0, n =3D series.length, vi, vj =3D -Infinity; while (++i < n) if ((vi =3D +series[i][1]) > vj) vj =3D vi, j =3D i; return j; } function ascending$3(series) { var sums =3D series.map(sum$2); return none$2(series).sort(function(a, b) { return sums[a] - sums[b]; }); } function sum$2(series) { var s =3D 0, i =3D -1, n =3D series.length, v; while (++i < n) if (v =3D +series[i][1]) s +=3D v; return s; } function descending$2(series) { return ascending$3(series).reverse(); } function insideOut(series) { var n =3D series.length, i, j, sums =3D series.map(sum$2), order =3D appearance(series), top =3D 0, bottom =3D 0, tops =3D [], bottoms =3D []; for (i =3D 0; i < n; ++i) { j =3D order[i]; if (top < bottom) { top +=3D sums[j]; tops.push(j); } else { bottom +=3D sums[j]; bottoms.push(j); } } return bottoms.reverse().concat(tops); } function reverse(series) { return none$2(series).reverse(); } function constant$c(x) { return function() { return x; }; } function x$4(d) { return d[0]; } function y$4(d) { return d[1]; } function RedBlackTree() { this._ =3D null; // root node } function RedBlackNode(node) { node.U =3D // parent node node.C =3D // color - true for red, false for black node.L =3D // left node node.R =3D // right node node.P =3D // previous node node.N =3D null; // next node } RedBlackTree.prototype =3D { constructor: RedBlackTree, insert: function(after, node) { var parent, grandpa, uncle; if (after) { node.P =3D after; node.N =3D after.N; if (after.N) after.N.P =3D node; after.N =3D node; if (after.R) { after =3D after.R; while (after.L) after =3D after.L; after.L =3D node; } else { after.R =3D node; } parent =3D after; } else if (this._) { after =3D RedBlackFirst(this._); node.P =3D null; node.N =3D after; after.P =3D after.L =3D node; parent =3D after; } else { node.P =3D node.N =3D null; this._ =3D node; parent =3D null; } node.L =3D node.R =3D null; node.U =3D parent; node.C =3D true; after =3D node; while (parent && parent.C) { grandpa =3D parent.U; if (parent =3D=3D=3D grandpa.L) { uncle =3D grandpa.R; if (uncle && uncle.C) { parent.C =3D uncle.C =3D false; grandpa.C =3D true; after =3D grandpa; } else { if (after =3D=3D=3D parent.R) { RedBlackRotateLeft(this, parent); after =3D parent; parent =3D after.U; } parent.C =3D false; grandpa.C =3D true; RedBlackRotateRight(this, grandpa); } } else { uncle =3D grandpa.L; if (uncle && uncle.C) { parent.C =3D uncle.C =3D false; grandpa.C =3D true; after =3D grandpa; } else { if (after =3D=3D=3D parent.L) { RedBlackRotateRight(this, parent); after =3D parent; parent =3D after.U; } parent.C =3D false; grandpa.C =3D true; RedBlackRotateLeft(this, grandpa); } } parent =3D after.U; } this._.C =3D false; }, remove: function(node) { if (node.N) node.N.P =3D node.P; if (node.P) node.P.N =3D node.N; node.N =3D node.P =3D null; var parent =3D node.U, sibling, left =3D node.L, right =3D node.R, next, red; if (!left) next =3D right; else if (!right) next =3D left; else next =3D RedBlackFirst(right); if (parent) { if (parent.L =3D=3D=3D node) parent.L =3D next; else parent.R =3D next; } else { this._ =3D next; } if (left && right) { red =3D next.C; next.C =3D node.C; next.L =3D left; left.U =3D next; if (next !=3D=3D right) { parent =3D next.U; next.U =3D node.U; node =3D next.R; parent.L =3D node; next.R =3D right; right.U =3D next; } else { next.U =3D parent; parent =3D next; node =3D next.R; } } else { red =3D node.C; node =3D next; } if (node) node.U =3D parent; if (red) return; if (node && node.C) { node.C =3D false; return; } do { if (node =3D=3D=3D this._) break; if (node =3D=3D=3D parent.L) { sibling =3D parent.R; if (sibling.C) { sibling.C =3D false; parent.C =3D true; RedBlackRotateLeft(this, parent); sibling =3D parent.R; } if ((sibling.L && sibling.L.C) || (sibling.R && sibling.R.C)) { if (!sibling.R || !sibling.R.C) { sibling.L.C =3D false; sibling.C =3D true; RedBlackRotateRight(this, sibling); sibling =3D parent.R; } sibling.C =3D parent.C; parent.C =3D sibling.R.C =3D false; RedBlackRotateLeft(this, parent); node =3D this._; break; } } else { sibling =3D parent.L; if (sibling.C) { sibling.C =3D false; parent.C =3D true; RedBlackRotateRight(this, parent); sibling =3D parent.L; } if ((sibling.L && sibling.L.C) || (sibling.R && sibling.R.C)) { if (!sibling.L || !sibling.L.C) { sibling.R.C =3D false; sibling.C =3D true; RedBlackRotateLeft(this, sibling); sibling =3D parent.L; } sibling.C =3D parent.C; parent.C =3D sibling.L.C =3D false; RedBlackRotateRight(this, parent); node =3D this._; break; } } sibling.C =3D true; node =3D parent; parent =3D parent.U; } while (!node.C); if (node) node.C =3D false; } }; function RedBlackRotateLeft(tree, node) { var p =3D node, q =3D node.R, parent =3D p.U; if (parent) { if (parent.L =3D=3D=3D p) parent.L =3D q; else parent.R =3D q; } else { tree._ =3D q; } q.U =3D parent; p.U =3D q; p.R =3D q.L; if (p.R) p.R.U =3D p; q.L =3D p; } function RedBlackRotateRight(tree, node) { var p =3D node, q =3D node.L, parent =3D p.U; if (parent) { if (parent.L =3D=3D=3D p) parent.L =3D q; else parent.R =3D q; } else { tree._ =3D q; } q.U =3D parent; p.U =3D q; p.L =3D q.R; if (p.L) p.L.U =3D p; q.R =3D p; } function RedBlackFirst(node) { while (node.L) node =3D node.L; return node; } function createEdge(left, right, v0, v1) { var edge =3D [null, null], index =3D edges.push(edge) - 1; edge.left =3D left; edge.right =3D right; if (v0) setEdgeEnd(edge, left, right, v0); if (v1) setEdgeEnd(edge, right, left, v1); cells[left.index].halfedges.push(index); cells[right.index].halfedges.push(index); return edge; } function createBorderEdge(left, v0, v1) { var edge =3D [v0, v1]; edge.left =3D left; return edge; } function setEdgeEnd(edge, left, right, vertex) { if (!edge[0] && !edge[1]) { edge[0] =3D vertex; edge.left =3D left; edge.right =3D right; } else if (edge.left =3D=3D=3D right) { edge[1] =3D vertex; } else { edge[0] =3D vertex; } } // Liang=E2=80=93Barsky line clipping. function clipEdge(edge, x0, y0, x1, y1) { var a =3D edge[0], b =3D edge[1], ax =3D a[0], ay =3D a[1], bx =3D b[0], by =3D b[1], t0 =3D 0, t1 =3D 1, dx =3D bx - ax, dy =3D by - ay, r; r =3D x0 - ax; if (!dx && r > 0) return; r /=3D dx; if (dx < 0) { if (r < t0) return; if (r < t1) t1 =3D r; } else if (dx > 0) { if (r > t1) return; if (r > t0) t0 =3D r; } r =3D x1 - ax; if (!dx && r < 0) return; r /=3D dx; if (dx < 0) { if (r > t1) return; if (r > t0) t0 =3D r; } else if (dx > 0) { if (r < t0) return; if (r < t1) t1 =3D r; } r =3D y0 - ay; if (!dy && r > 0) return; r /=3D dy; if (dy < 0) { if (r < t0) return; if (r < t1) t1 =3D r; } else if (dy > 0) { if (r > t1) return; if (r > t0) t0 =3D r; } r =3D y1 - ay; if (!dy && r < 0) return; r /=3D dy; if (dy < 0) { if (r > t1) return; if (r > t0) t0 =3D r; } else if (dy > 0) { if (r < t0) return; if (r < t1) t1 =3D r; } if (!(t0 > 0) && !(t1 < 1)) return true; // TODO Better check? if (t0 > 0) edge[0] =3D [ax + t0 * dx, ay + t0 * dy]; if (t1 < 1) edge[1] =3D [ax + t1 * dx, ay + t1 * dy]; return true; } function connectEdge(edge, x0, y0, x1, y1) { var v1 =3D edge[1]; if (v1) return true; var v0 =3D edge[0], left =3D edge.left, right =3D edge.right, lx =3D left[0], ly =3D left[1], rx =3D right[0], ry =3D right[1], fx =3D (lx + rx) / 2, fy =3D (ly + ry) / 2, fm, fb; if (ry =3D=3D=3D ly) { if (fx < x0 || fx >=3D x1) return; if (lx > rx) { if (!v0) v0 =3D [fx, y0]; else if (v0[1] >=3D y1) return; v1 =3D [fx, y1]; } else { if (!v0) v0 =3D [fx, y1]; else if (v0[1] < y0) return; v1 =3D [fx, y0]; } } else { fm =3D (lx - rx) / (ry - ly); fb =3D fy - fm * fx; if (fm < -1 || fm > 1) { if (lx > rx) { if (!v0) v0 =3D [(y0 - fb) / fm, y0]; else if (v0[1] >=3D y1) return; v1 =3D [(y1 - fb) / fm, y1]; } else { if (!v0) v0 =3D [(y1 - fb) / fm, y1]; else if (v0[1] < y0) return; v1 =3D [(y0 - fb) / fm, y0]; } } else { if (ly < ry) { if (!v0) v0 =3D [x0, fm * x0 + fb]; else if (v0[0] >=3D x1) return; v1 =3D [x1, fm * x1 + fb]; } else { if (!v0) v0 =3D [x1, fm * x1 + fb]; else if (v0[0] < x0) return; v1 =3D [x0, fm * x0 + fb]; } } } edge[0] =3D v0; edge[1] =3D v1; return true; } function clipEdges(x0, y0, x1, y1) { var i =3D edges.length, edge; while (i--) { if (!connectEdge(edge =3D edges[i], x0, y0, x1, y1) || !clipEdge(edge, x0, y0, x1, y1) || !(Math.abs(edge[0][0] - edge[1][0]) > epsilon$4 || Math.abs(edge[0][1] - edge[1][1]) > epsilon$4)) { delete edges[i]; } } } function createCell(site) { return cells[site.index] =3D { site: site, halfedges: [] }; } function cellHalfedgeAngle(cell, edge) { var site =3D cell.site, va =3D edge.left, vb =3D edge.right; if (site =3D=3D=3D vb) vb =3D va, va =3D site; if (vb) return Math.atan2(vb[1] - va[1], vb[0] - va[0]); if (site =3D=3D=3D va) va =3D edge[1], vb =3D edge[0]; else va =3D edge[0], vb =3D edge[1]; return Math.atan2(va[0] - vb[0], vb[1] - va[1]); } function cellHalfedgeStart(cell, edge) { return edge[+(edge.left !=3D=3D cell.site)]; } function cellHalfedgeEnd(cell, edge) { return edge[+(edge.left =3D=3D=3D cell.site)]; } function sortCellHalfedges() { for (var i =3D 0, n =3D cells.length, cell, halfedges, j, m; i < n; ++i) { if ((cell =3D cells[i]) && (m =3D (halfedges =3D cell.halfedges).length= )) { var index =3D new Array(m), array =3D new Array(m); for (j =3D 0; j < m; ++j) index[j] =3D j, array[j] =3D cellHalfedgeAn= gle(cell, edges[halfedges[j]]); index.sort(function(i, j) { return array[j] - array[i]; }); for (j =3D 0; j < m; ++j) array[j] =3D halfedges[index[j]]; for (j =3D 0; j < m; ++j) halfedges[j] =3D array[j]; } } } function clipCells(x0, y0, x1, y1) { var nCells =3D cells.length, iCell, cell, site, iHalfedge, halfedges, nHalfedges, start, startX, startY, end, endX, endY, cover =3D true; for (iCell =3D 0; iCell < nCells; ++iCell) { if (cell =3D cells[iCell]) { site =3D cell.site; halfedges =3D cell.halfedges; iHalfedge =3D halfedges.length; // Remove any dangling clipped edges. while (iHalfedge--) { if (!edges[halfedges[iHalfedge]]) { halfedges.splice(iHalfedge, 1); } } // Insert any border edges as necessary. iHalfedge =3D 0, nHalfedges =3D halfedges.length; while (iHalfedge < nHalfedges) { end =3D cellHalfedgeEnd(cell, edges[halfedges[iHalfedge]]), endX = =3D end[0], endY =3D end[1]; start =3D cellHalfedgeStart(cell, edges[halfedges[++iHalfedge % nHa= lfedges]]), startX =3D start[0], startY =3D start[1]; if (Math.abs(endX - startX) > epsilon$4 || Math.abs(endY - startY) = > epsilon$4) { halfedges.splice(iHalfedge, 0, edges.push(createBorderEdge(site, = end, Math.abs(endX - x0) < epsilon$4 && y1 - endY > epsilon$4 ? [x= 0, Math.abs(startX - x0) < epsilon$4 ? startY : y1] : Math.abs(endY - y1) < epsilon$4 && x1 - endX > epsilon$4 ? = [Math.abs(startY - y1) < epsilon$4 ? startX : x1, y1] : Math.abs(endX - x1) < epsilon$4 && endY - y0 > epsilon$4 ? = [x1, Math.abs(startX - x1) < epsilon$4 ? startY : y0] : Math.abs(endY - y0) < epsilon$4 && endX - x0 > epsilon$4 ? = [Math.abs(startY - y0) < epsilon$4 ? startX : x0, y0] : null)) - 1); ++nHalfedges; } } if (nHalfedges) cover =3D false; } } // If there weren=E2=80=99t any edges, have the closest site cover the ex= tent. // It doesn=E2=80=99t matter which corner of the extent we measure! if (cover) { var dx, dy, d2, dc =3D Infinity; for (iCell =3D 0, cover =3D null; iCell < nCells; ++iCell) { if (cell =3D cells[iCell]) { site =3D cell.site; dx =3D site[0] - x0; dy =3D site[1] - y0; d2 =3D dx * dx + dy * dy; if (d2 < dc) dc =3D d2, cover =3D cell; } } if (cover) { var v00 =3D [x0, y0], v01 =3D [x0, y1], v11 =3D [x1, y1], v10 =3D [x1= , y0]; cover.halfedges.push( edges.push(createBorderEdge(site =3D cover.site, v00, v01)) - 1, edges.push(createBorderEdge(site, v01, v11)) - 1, edges.push(createBorderEdge(site, v11, v10)) - 1, edges.push(createBorderEdge(site, v10, v00)) - 1 ); } } // Lastly delete any cells with no edges; these were entirely clipped. for (iCell =3D 0; iCell < nCells; ++iCell) { if (cell =3D cells[iCell]) { if (!cell.halfedges.length) { delete cells[iCell]; } } } } var circlePool =3D []; var firstCircle; function Circle() { RedBlackNode(this); this.x =3D this.y =3D this.arc =3D this.site =3D this.cy =3D null; } function attachCircle(arc) { var lArc =3D arc.P, rArc =3D arc.N; if (!lArc || !rArc) return; var lSite =3D lArc.site, cSite =3D arc.site, rSite =3D rArc.site; if (lSite =3D=3D=3D rSite) return; var bx =3D cSite[0], by =3D cSite[1], ax =3D lSite[0] - bx, ay =3D lSite[1] - by, cx =3D rSite[0] - bx, cy =3D rSite[1] - by; var d =3D 2 * (ax * cy - ay * cx); if (d >=3D -epsilon2$2) return; var ha =3D ax * ax + ay * ay, hc =3D cx * cx + cy * cy, x =3D (cy * ha - ay * hc) / d, y =3D (ax * hc - cx * ha) / d; var circle =3D circlePool.pop() || new Circle; circle.arc =3D arc; circle.site =3D cSite; circle.x =3D x + bx; circle.y =3D (circle.cy =3D y + by) + Math.sqrt(x * x + y * y); // y bott= om arc.circle =3D circle; var before =3D null, node =3D circles._; while (node) { if (circle.y < node.y || (circle.y =3D=3D=3D node.y && circle.x <=3D no= de.x)) { if (node.L) node =3D node.L; else { before =3D node.P; break; } } else { if (node.R) node =3D node.R; else { before =3D node; break; } } } circles.insert(before, circle); if (!before) firstCircle =3D circle; } function detachCircle(arc) { var circle =3D arc.circle; if (circle) { if (!circle.P) firstCircle =3D circle.N; circles.remove(circle); circlePool.push(circle); RedBlackNode(circle); arc.circle =3D null; } } var beachPool =3D []; function Beach() { RedBlackNode(this); this.edge =3D this.site =3D this.circle =3D null; } function createBeach(site) { var beach =3D beachPool.pop() || new Beach; beach.site =3D site; return beach; } function detachBeach(beach) { detachCircle(beach); beaches.remove(beach); beachPool.push(beach); RedBlackNode(beach); } function removeBeach(beach) { var circle =3D beach.circle, x =3D circle.x, y =3D circle.cy, vertex =3D [x, y], previous =3D beach.P, next =3D beach.N, disappearing =3D [beach]; detachBeach(beach); var lArc =3D previous; while (lArc.circle && Math.abs(x - lArc.circle.x) < epsilon$4 && Math.abs(y - lArc.circle.cy) < epsilon$4) { previous =3D lArc.P; disappearing.unshift(lArc); detachBeach(lArc); lArc =3D previous; } disappearing.unshift(lArc); detachCircle(lArc); var rArc =3D next; while (rArc.circle && Math.abs(x - rArc.circle.x) < epsilon$4 && Math.abs(y - rArc.circle.cy) < epsilon$4) { next =3D rArc.N; disappearing.push(rArc); detachBeach(rArc); rArc =3D next; } disappearing.push(rArc); detachCircle(rArc); var nArcs =3D disappearing.length, iArc; for (iArc =3D 1; iArc < nArcs; ++iArc) { rArc =3D disappearing[iArc]; lArc =3D disappearing[iArc - 1]; setEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex); } lArc =3D disappearing[0]; rArc =3D disappearing[nArcs - 1]; rArc.edge =3D createEdge(lArc.site, rArc.site, null, vertex); attachCircle(lArc); attachCircle(rArc); } function addBeach(site) { var x =3D site[0], directrix =3D site[1], lArc, rArc, dxl, dxr, node =3D beaches._; while (node) { dxl =3D leftBreakPoint(node, directrix) - x; if (dxl > epsilon$4) node =3D node.L; else { dxr =3D x - rightBreakPoint(node, directrix); if (dxr > epsilon$4) { if (!node.R) { lArc =3D node; break; } node =3D node.R; } else { if (dxl > -epsilon$4) { lArc =3D node.P; rArc =3D node; } else if (dxr > -epsilon$4) { lArc =3D node; rArc =3D node.N; } else { lArc =3D rArc =3D node; } break; } } } createCell(site); var newArc =3D createBeach(site); beaches.insert(lArc, newArc); if (!lArc && !rArc) return; if (lArc =3D=3D=3D rArc) { detachCircle(lArc); rArc =3D createBeach(lArc.site); beaches.insert(newArc, rArc); newArc.edge =3D rArc.edge =3D createEdge(lArc.site, newArc.site); attachCircle(lArc); attachCircle(rArc); return; } if (!rArc) { // && lArc newArc.edge =3D createEdge(lArc.site, newArc.site); return; } // else lArc !=3D=3D rArc detachCircle(lArc); detachCircle(rArc); var lSite =3D lArc.site, ax =3D lSite[0], ay =3D lSite[1], bx =3D site[0] - ax, by =3D site[1] - ay, rSite =3D rArc.site, cx =3D rSite[0] - ax, cy =3D rSite[1] - ay, d =3D 2 * (bx * cy - by * cx), hb =3D bx * bx + by * by, hc =3D cx * cx + cy * cy, vertex =3D [(cy * hb - by * hc) / d + ax, (bx * hc - cx * hb) / d + a= y]; setEdgeEnd(rArc.edge, lSite, rSite, vertex); newArc.edge =3D createEdge(lSite, site, null, vertex); rArc.edge =3D createEdge(site, rSite, null, vertex); attachCircle(lArc); attachCircle(rArc); } function leftBreakPoint(arc, directrix) { var site =3D arc.site, rfocx =3D site[0], rfocy =3D site[1], pby2 =3D rfocy - directrix; if (!pby2) return rfocx; var lArc =3D arc.P; if (!lArc) return -Infinity; site =3D lArc.site; var lfocx =3D site[0], lfocy =3D site[1], plby2 =3D lfocy - directrix; if (!plby2) return lfocx; var hl =3D lfocx - rfocx, aby2 =3D 1 / pby2 - 1 / plby2, b =3D hl / plby2; if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby= 2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx; return (rfocx + lfocx) / 2; } function rightBreakPoint(arc, directrix) { var rArc =3D arc.N; if (rArc) return leftBreakPoint(rArc, directrix); var site =3D arc.site; return site[1] =3D=3D=3D directrix ? site[0] : Infinity; } var epsilon$4 =3D 1e-6; var epsilon2$2 =3D 1e-12; var beaches; var cells; var circles; var edges; function triangleArea(a, b, c) { return (a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]); } function lexicographic(a, b) { return b[1] - a[1] || b[0] - a[0]; } function Diagram(sites, extent) { var site =3D sites.sort(lexicographic).pop(), x, y, circle; edges =3D []; cells =3D new Array(sites.length); beaches =3D new RedBlackTree; circles =3D new RedBlackTree; while (true) { circle =3D firstCircle; if (site && (!circle || site[1] < circle.y || (site[1] =3D=3D=3D circle= =2Ey && site[0] < circle.x))) { if (site[0] !=3D=3D x || site[1] !=3D=3D y) { addBeach(site); x =3D site[0], y =3D site[1]; } site =3D sites.pop(); } else if (circle) { removeBeach(circle.arc); } else { break; } } sortCellHalfedges(); if (extent) { var x0 =3D +extent[0][0], y0 =3D +extent[0][1], x1 =3D +extent[1][0], y1 =3D +extent[1][1]; clipEdges(x0, y0, x1, y1); clipCells(x0, y0, x1, y1); } this.edges =3D edges; this.cells =3D cells; beaches =3D circles =3D edges =3D cells =3D null; } Diagram.prototype =3D { constructor: Diagram, polygons: function() { var edges =3D this.edges; return this.cells.map(function(cell) { var polygon =3D cell.halfedges.map(function(i) { return cellHalfedgeS= tart(cell, edges[i]); }); polygon.data =3D cell.site.data; return polygon; }); }, triangles: function() { var triangles =3D [], edges =3D this.edges; this.cells.forEach(function(cell, i) { if (!(m =3D (halfedges =3D cell.halfedges).length)) return; var site =3D cell.site, halfedges, j =3D -1, m, s0, e1 =3D edges[halfedges[m - 1]], s1 =3D e1.left =3D=3D=3D site ? e1.right : e1.left; while (++j < m) { s0 =3D s1; e1 =3D edges[halfedges[j]]; s1 =3D e1.left =3D=3D=3D site ? e1.right : e1.left; if (s0 && s1 && i < s0.index && i < s1.index && triangleArea(site, = s0, s1) < 0) { triangles.push([site.data, s0.data, s1.data]); } } }); return triangles; }, links: function() { return this.edges.filter(function(edge) { return edge.right; }).map(function(edge) { return { source: edge.left.data, target: edge.right.data }; }); }, find: function(x, y, radius) { var that =3D this, i0, i1 =3D that._found || 0, n =3D that.cells.length= , cell; // Use the previously-found cell, or start with an arbitrary one. while (!(cell =3D that.cells[i1])) if (++i1 >=3D n) return null; var dx =3D x - cell.site[0], dy =3D y - cell.site[1], d2 =3D dx * dx + = dy * dy; // Traverse the half-edges to find a closer cell, if any. do { cell =3D that.cells[i0 =3D i1], i1 =3D null; cell.halfedges.forEach(function(e) { var edge =3D that.edges[e], v =3D edge.left; if ((v =3D=3D=3D cell.site || !v) && !(v =3D edge.right)) return; var vx =3D x - v[0], vy =3D y - v[1], v2 =3D vx * vx + vy * vy; if (v2 < d2) d2 =3D v2, i1 =3D v.index; }); } while (i1 !=3D=3D null); that._found =3D i0; return radius =3D=3D null || d2 <=3D radius * radius ? cell.site : null; } }; function voronoi() { var x$$1 =3D x$4, y$$1 =3D y$4, extent =3D null; function voronoi(data) { return new Diagram(data.map(function(d, i) { var s =3D [Math.round(x$$1(d, i, data) / epsilon$4) * epsilon$4, Math= =2Eround(y$$1(d, i, data) / epsilon$4) * epsilon$4]; s.index =3D i; s.data =3D d; return s; }), extent); } voronoi.polygons =3D function(data) { return voronoi(data).polygons(); }; voronoi.links =3D function(data) { return voronoi(data).links(); }; voronoi.triangles =3D function(data) { return voronoi(data).triangles(); }; voronoi.x =3D function(_) { return arguments.length ? (x$$1 =3D typeof _ =3D=3D=3D "function" ? _ := constant$c(+_), voronoi) : x$$1; }; voronoi.y =3D function(_) { return arguments.length ? (y$$1 =3D typeof _ =3D=3D=3D "function" ? _ := constant$c(+_), voronoi) : y$$1; }; voronoi.extent =3D function(_) { return arguments.length ? (extent =3D _ =3D=3D null ? null : [[+_[0][0]= , +_[0][1]], [+_[1][0], +_[1][1]]], voronoi) : extent && [[extent[0][0], ex= tent[0][1]], [extent[1][0], extent[1][1]]]; }; voronoi.size =3D function(_) { return arguments.length ? (extent =3D _ =3D=3D null ? null : [[0, 0], [= +_[0], +_[1]]], voronoi) : extent && [extent[1][0] - extent[0][0], extent[1= ][1] - extent[0][1]]; }; return voronoi; } function constant$d(x) { return function() { return x; }; } function ZoomEvent(target, type, transform) { this.target =3D target; this.type =3D type; this.transform =3D transform; } function Transform(k, x, y) { this.k =3D k; this.x =3D x; this.y =3D y; } Transform.prototype =3D { constructor: Transform, scale: function(k) { return k =3D=3D=3D 1 ? this : new Transform(this.k * k, this.x, this.y); }, translate: function(x, y) { return x =3D=3D=3D 0 & y =3D=3D=3D 0 ? this : new Transform(this.k, thi= s.x + this.k * x, this.y + this.k * y); }, apply: function(point) { return [point[0] * this.k + this.x, point[1] * this.k + this.y]; }, applyX: function(x) { return x * this.k + this.x; }, applyY: function(y) { return y * this.k + this.y; }, invert: function(location) { return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.= k]; }, invertX: function(x) { return (x - this.x) / this.k; }, invertY: function(y) { return (y - this.y) / this.k; }, rescaleX: function(x) { return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, = x)); }, rescaleY: function(y) { return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, = y)); }, toString: function() { return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")"; } }; var identity$9 =3D new Transform(1, 0, 0); transform$1.prototype =3D Transform.prototype; function transform$1(node) { return node.__zoom || identity$9; } function nopropagation$2() { exports.event.stopImmediatePropagation(); } function noevent$2() { exports.event.preventDefault(); exports.event.stopImmediatePropagation(); } // Ignore right-click, since that should open the context menu. function defaultFilter$2() { return !exports.event.button; } function defaultExtent$1() { var e =3D this, w, h; if (e instanceof SVGElement) { e =3D e.ownerSVGElement || e; w =3D e.width.baseVal.value; h =3D e.height.baseVal.value; } else { w =3D e.clientWidth; h =3D e.clientHeight; } return [[0, 0], [w, h]]; } function defaultTransform() { return this.__zoom || identity$9; } function defaultWheelDelta() { return -exports.event.deltaY * (exports.event.deltaMode ? 120 : 1) / 500; } function defaultTouchable$1() { return "ontouchstart" in this; } function defaultConstrain(transform, extent, translateExtent) { var dx0 =3D transform.invertX(extent[0][0]) - translateExtent[0][0], dx1 =3D transform.invertX(extent[1][0]) - translateExtent[1][0], dy0 =3D transform.invertY(extent[0][1]) - translateExtent[0][1], dy1 =3D transform.invertY(extent[1][1]) - translateExtent[1][1]; return transform.translate( dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1), dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1) ); } function zoom() { var filter =3D defaultFilter$2, extent =3D defaultExtent$1, constrain =3D defaultConstrain, wheelDelta =3D defaultWheelDelta, touchable =3D defaultTouchable$1, scaleExtent =3D [0, Infinity], translateExtent =3D [[-Infinity, -Infinity], [Infinity, Infinity]], duration =3D 250, interpolate =3D interpolateZoom, gestures =3D [], listeners =3D dispatch("start", "zoom", "end"), touchstarting, touchending, touchDelay =3D 500, wheelDelay =3D 150, clickDistance2 =3D 0; function zoom(selection$$1) { selection$$1 .property("__zoom", defaultTransform) .on("wheel.zoom", wheeled) .on("mousedown.zoom", mousedowned) .on("dblclick.zoom", dblclicked) .filter(touchable) .on("touchstart.zoom", touchstarted) .on("touchmove.zoom", touchmoved) .on("touchend.zoom touchcancel.zoom", touchended) .style("touch-action", "none") .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)"); } zoom.transform =3D function(collection, transform) { var selection$$1 =3D collection.selection ? collection.selection() : co= llection; selection$$1.property("__zoom", defaultTransform); if (collection !=3D=3D selection$$1) { schedule(collection, transform); } else { selection$$1.interrupt().each(function() { gesture(this, arguments) .start() .zoom(null, typeof transform =3D=3D=3D "function" ? transform.a= pply(this, arguments) : transform) .end(); }); } }; zoom.scaleBy =3D function(selection$$1, k) { zoom.scaleTo(selection$$1, function() { var k0 =3D this.__zoom.k, k1 =3D typeof k =3D=3D=3D "function" ? k.apply(this, arguments) := k; return k0 * k1; }); }; zoom.scaleTo =3D function(selection$$1, k) { zoom.transform(selection$$1, function() { var e =3D extent.apply(this, arguments), t0 =3D this.__zoom, p0 =3D centroid(e), p1 =3D t0.invert(p0), k1 =3D typeof k =3D=3D=3D "function" ? k.apply(this, arguments) := k; return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent= ); }); }; zoom.translateBy =3D function(selection$$1, x, y) { zoom.transform(selection$$1, function() { return constrain(this.__zoom.translate( typeof x =3D=3D=3D "function" ? x.apply(this, arguments) : x, typeof y =3D=3D=3D "function" ? y.apply(this, arguments) : y ), extent.apply(this, arguments), translateExtent); }); }; zoom.translateTo =3D function(selection$$1, x, y) { zoom.transform(selection$$1, function() { var e =3D extent.apply(this, arguments), t =3D this.__zoom, p =3D centroid(e); return constrain(identity$9.translate(p[0], p[1]).scale(t.k).translat= e( typeof x =3D=3D=3D "function" ? -x.apply(this, arguments) : -x, typeof y =3D=3D=3D "function" ? -y.apply(this, arguments) : -y ), e, translateExtent); }); }; function scale(transform, k) { k =3D Math.max(scaleExtent[0], Math.min(scaleExtent[1], k)); return k =3D=3D=3D transform.k ? transform : new Transform(k, transform= =2Ex, transform.y); } function translate(transform, p0, p1) { var x =3D p0[0] - p1[0] * transform.k, y =3D p0[1] - p1[1] * transform.= k; return x =3D=3D=3D transform.x && y =3D=3D=3D transform.y ? transform := new Transform(transform.k, x, y); } function centroid(extent) { return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1= ][1]) / 2]; } function schedule(transition$$1, transform, center) { transition$$1 .on("start.zoom", function() { gesture(this, arguments).start(); }) .on("interrupt.zoom end.zoom", function() { gesture(this, arguments= ).end(); }) .tween("zoom", function() { var that =3D this, args =3D arguments, g =3D gesture(that, args), e =3D extent.apply(that, args), p =3D center || centroid(e), w =3D Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), a =3D that.__zoom, b =3D typeof transform =3D=3D=3D "function" ? transform.apply= (that, args) : transform, i =3D interpolate(a.invert(p).concat(w / a.k), b.invert(p).co= ncat(w / b.k)); return function(t) { if (t =3D=3D=3D 1) t =3D b; // Avoid rounding error on end. else { var l =3D i(t), k =3D w / l[2]; t =3D new Transform(k, p= [0] - l[0] * k, p[1] - l[1] * k); } g.zoom(null, t); }; }); } function gesture(that, args) { for (var i =3D 0, n =3D gestures.length, g; i < n; ++i) { if ((g =3D gestures[i]).that =3D=3D=3D that) { return g; } } return new Gesture(that, args); } function Gesture(that, args) { this.that =3D that; this.args =3D args; this.index =3D -1; this.active =3D 0; this.extent =3D extent.apply(that, args); } Gesture.prototype =3D { start: function() { if (++this.active =3D=3D=3D 1) { this.index =3D gestures.push(this) - 1; this.emit("start"); } return this; }, zoom: function(key, transform) { if (this.mouse && key !=3D=3D "mouse") this.mouse[1] =3D transform.in= vert(this.mouse[0]); if (this.touch0 && key !=3D=3D "touch") this.touch0[1] =3D transform.= invert(this.touch0[0]); if (this.touch1 && key !=3D=3D "touch") this.touch1[1] =3D transform.= invert(this.touch1[0]); this.that.__zoom =3D transform; this.emit("zoom"); return this; }, end: function() { if (--this.active =3D=3D=3D 0) { gestures.splice(this.index, 1); this.index =3D -1; this.emit("end"); } return this; }, emit: function(type) { customEvent(new ZoomEvent(zoom, type, this.that.__zoom), listeners.ap= ply, listeners, [type, this.that, this.args]); } }; function wheeled() { if (!filter.apply(this, arguments)) return; var g =3D gesture(this, arguments), t =3D this.__zoom, k =3D Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.= pow(2, wheelDelta.apply(this, arguments)))), p =3D mouse(this); // If the mouse is in the same location as before, reuse it. // If there were recent wheel events, reset the wheel idle timeout. if (g.wheel) { if (g.mouse[0][0] !=3D=3D p[0] || g.mouse[0][1] !=3D=3D p[1]) { g.mouse[1] =3D t.invert(g.mouse[0] =3D p); } clearTimeout(g.wheel); } // If this wheel event won=E2=80=99t trigger a transform change, ignore= it. else if (t.k =3D=3D=3D k) return; // Otherwise, capture the mouse point and location at the start. else { g.mouse =3D [p, t.invert(p)]; interrupt(this); g.start(); } noevent$2(); g.wheel =3D setTimeout(wheelidled, wheelDelay); g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]= ), g.extent, translateExtent)); function wheelidled() { g.wheel =3D null; g.end(); } } function mousedowned() { if (touchending || !filter.apply(this, arguments)) return; var g =3D gesture(this, arguments), v =3D select(exports.event.view).on("mousemove.zoom", mousemoved, t= rue).on("mouseup.zoom", mouseupped, true), p =3D mouse(this), x0 =3D exports.event.clientX, y0 =3D exports.event.clientY; dragDisable(exports.event.view); nopropagation$2(); g.mouse =3D [p, this.__zoom.invert(p)]; interrupt(this); g.start(); function mousemoved() { noevent$2(); if (!g.moved) { var dx =3D exports.event.clientX - x0, dy =3D exports.event.clientY= - y0; g.moved =3D dx * dx + dy * dy > clickDistance2; } g.zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] =3D mou= se(g.that), g.mouse[1]), g.extent, translateExtent)); } function mouseupped() { v.on("mousemove.zoom mouseup.zoom", null); yesdrag(exports.event.view, g.moved); noevent$2(); g.end(); } } function dblclicked() { if (!filter.apply(this, arguments)) return; var t0 =3D this.__zoom, p0 =3D mouse(this), p1 =3D t0.invert(p0), k1 =3D t0.k * (exports.event.shiftKey ? 0.5 : 2), t1 =3D constrain(translate(scale(t0, k1), p0, p1), extent.apply(thi= s, arguments), translateExtent); noevent$2(); if (duration > 0) select(this).transition().duration(duration).call(sch= edule, t1, p0); else select(this).call(zoom.transform, t1); } function touchstarted() { if (!filter.apply(this, arguments)) return; var g =3D gesture(this, arguments), touches$$1 =3D exports.event.changedTouches, started, n =3D touches$$1.length, i, t, p; nopropagation$2(); for (i =3D 0; i < n; ++i) { t =3D touches$$1[i], p =3D touch(this, touches$$1, t.identifier); p =3D [p, this.__zoom.invert(p), t.identifier]; if (!g.touch0) g.touch0 =3D p, started =3D true; else if (!g.touch1) g.touch1 =3D p; } // If this is a dbltap, reroute to the (optional) dblclick.zoom handler. if (touchstarting) { touchstarting =3D clearTimeout(touchstarting); if (!g.touch1) { g.end(); p =3D select(this).on("dblclick.zoom"); if (p) p.apply(this, arguments); return; } } if (started) { touchstarting =3D setTimeout(function() { touchstarting =3D null; }, = touchDelay); interrupt(this); g.start(); } } function touchmoved() { var g =3D gesture(this, arguments), touches$$1 =3D exports.event.changedTouches, n =3D touches$$1.length, i, t, p, l; noevent$2(); if (touchstarting) touchstarting =3D clearTimeout(touchstarting); for (i =3D 0; i < n; ++i) { t =3D touches$$1[i], p =3D touch(this, touches$$1, t.identifier); if (g.touch0 && g.touch0[2] =3D=3D=3D t.identifier) g.touch0[0] =3D p; else if (g.touch1 && g.touch1[2] =3D=3D=3D t.identifier) g.touch1[0] = =3D p; } t =3D g.that.__zoom; if (g.touch1) { var p0 =3D g.touch0[0], l0 =3D g.touch0[1], p1 =3D g.touch1[0], l1 =3D g.touch1[1], dp =3D (dp =3D p1[0] - p0[0]) * dp + (dp =3D p1[1] - p0[1]) * dp, dl =3D (dl =3D l1[0] - l0[0]) * dl + (dl =3D l1[1] - l0[1]) * dl; t =3D scale(t, Math.sqrt(dp / dl)); p =3D [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2]; l =3D [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2]; } else if (g.touch0) p =3D g.touch0[0], l =3D g.touch0[1]; else return; g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent= )); } function touchended() { var g =3D gesture(this, arguments), touches$$1 =3D exports.event.changedTouches, n =3D touches$$1.length, i, t; nopropagation$2(); if (touchending) clearTimeout(touchending); touchending =3D setTimeout(function() { touchending =3D null; }, touchD= elay); for (i =3D 0; i < n; ++i) { t =3D touches$$1[i]; if (g.touch0 && g.touch0[2] =3D=3D=3D t.identifier) delete g.touch0; else if (g.touch1 && g.touch1[2] =3D=3D=3D t.identifier) delete g.tou= ch1; } if (g.touch1 && !g.touch0) g.touch0 =3D g.touch1, delete g.touch1; if (g.touch0) g.touch0[1] =3D this.__zoom.invert(g.touch0[0]); else g.end(); } zoom.wheelDelta =3D function(_) { return arguments.length ? (wheelDelta =3D typeof _ =3D=3D=3D "function"= ? _ : constant$d(+_), zoom) : wheelDelta; }; zoom.filter =3D function(_) { return arguments.length ? (filter =3D typeof _ =3D=3D=3D "function" ? _= : constant$d(!!_), zoom) : filter; }; zoom.touchable =3D function(_) { return arguments.length ? (touchable =3D typeof _ =3D=3D=3D "function" = ? _ : constant$d(!!_), zoom) : touchable; }; zoom.extent =3D function(_) { return arguments.length ? (extent =3D typeof _ =3D=3D=3D "function" ? _= : constant$d([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent; }; zoom.scaleExtent =3D function(_) { return arguments.length ? (scaleExtent[0] =3D +_[0], scaleExtent[1] =3D= +_[1], zoom) : [scaleExtent[0], scaleExtent[1]]; }; zoom.translateExtent =3D function(_) { return arguments.length ? (translateExtent[0][0] =3D +_[0][0], translat= eExtent[1][0] =3D +_[1][0], translateExtent[0][1] =3D +_[0][1], translateEx= tent[1][1] =3D +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0= ][1]], [translateExtent[1][0], translateExtent[1][1]]]; }; zoom.constrain =3D function(_) { return arguments.length ? (constrain =3D _, zoom) : constrain; }; zoom.duration =3D function(_) { return arguments.length ? (duration =3D +_, zoom) : duration; }; zoom.interpolate =3D function(_) { return arguments.length ? (interpolate =3D _, zoom) : interpolate; }; zoom.on =3D function() { var value =3D listeners.on.apply(listeners, arguments); return value =3D=3D=3D listeners ? zoom : value; }; zoom.clickDistance =3D function(_) { return arguments.length ? (clickDistance2 =3D (_ =3D +_) * _, zoom) : M= ath.sqrt(clickDistance2); }; return zoom; } exports.version =3D version; exports.bisect =3D bisectRight; exports.bisectRight =3D bisectRight; exports.bisectLeft =3D bisectLeft; exports.ascending =3D ascending; exports.bisector =3D bisector; exports.cross =3D cross; exports.descending =3D descending; exports.deviation =3D deviation; exports.extent =3D extent; exports.histogram =3D histogram; exports.thresholdFreedmanDiaconis =3D freedmanDiaconis; exports.thresholdScott =3D scott; exports.thresholdSturges =3D thresholdSturges; exports.max =3D max; exports.mean =3D mean; exports.median =3D median; exports.merge =3D merge; exports.min =3D min; exports.pairs =3D pairs; exports.permute =3D permute; exports.quantile =3D threshold; exports.range =3D sequence; exports.scan =3D scan; exports.shuffle =3D shuffle; exports.sum =3D sum; exports.ticks =3D ticks; exports.tickIncrement =3D tickIncrement; exports.tickStep =3D tickStep; exports.transpose =3D transpose; exports.variance =3D variance; exports.zip =3D zip; exports.axisTop =3D axisTop; exports.axisRight =3D axisRight; exports.axisBottom =3D axisBottom; exports.axisLeft =3D axisLeft; exports.brush =3D brush; exports.brushX =3D brushX; exports.brushY =3D brushY; exports.brushSelection =3D brushSelection; exports.chord =3D chord; exports.ribbon =3D ribbon; exports.nest =3D nest; exports.set =3D set$2; exports.map =3D map$1; exports.keys =3D keys; exports.values =3D values; exports.entries =3D entries; exports.color =3D color; exports.rgb =3D rgb; exports.hsl =3D hsl; exports.lab =3D lab; exports.hcl =3D hcl; exports.lch =3D lch; exports.gray =3D gray; exports.cubehelix =3D cubehelix; exports.contours =3D contours; exports.contourDensity =3D density; exports.dispatch =3D dispatch; exports.drag =3D drag; exports.dragDisable =3D dragDisable; exports.dragEnable =3D yesdrag; exports.dsvFormat =3D dsvFormat; exports.csvParse =3D csvParse; exports.csvParseRows =3D csvParseRows; exports.csvFormat =3D csvFormat; exports.csvFormatBody =3D csvFormatBody; exports.csvFormatRows =3D csvFormatRows; exports.tsvParse =3D tsvParse; exports.tsvParseRows =3D tsvParseRows; exports.tsvFormat =3D tsvFormat; exports.tsvFormatBody =3D tsvFormatBody; exports.tsvFormatRows =3D tsvFormatRows; exports.autoType =3D autoType; exports.easeLinear =3D linear$1; exports.easeQuad =3D quadInOut; exports.easeQuadIn =3D quadIn; exports.easeQuadOut =3D quadOut; exports.easeQuadInOut =3D quadInOut; exports.easeCubic =3D cubicInOut; exports.easeCubicIn =3D cubicIn; exports.easeCubicOut =3D cubicOut; exports.easeCubicInOut =3D cubicInOut; exports.easePoly =3D polyInOut; exports.easePolyIn =3D polyIn; exports.easePolyOut =3D polyOut; exports.easePolyInOut =3D polyInOut; exports.easeSin =3D sinInOut; exports.easeSinIn =3D sinIn; exports.easeSinOut =3D sinOut; exports.easeSinInOut =3D sinInOut; exports.easeExp =3D expInOut; exports.easeExpIn =3D expIn; exports.easeExpOut =3D expOut; exports.easeExpInOut =3D expInOut; exports.easeCircle =3D circleInOut; exports.easeCircleIn =3D circleIn; exports.easeCircleOut =3D circleOut; exports.easeCircleInOut =3D circleInOut; exports.easeBounce =3D bounceOut; exports.easeBounceIn =3D bounceIn; exports.easeBounceOut =3D bounceOut; exports.easeBounceInOut =3D bounceInOut; exports.easeBack =3D backInOut; exports.easeBackIn =3D backIn; exports.easeBackOut =3D backOut; exports.easeBackInOut =3D backInOut; exports.easeElastic =3D elasticOut; exports.easeElasticIn =3D elasticIn; exports.easeElasticOut =3D elasticOut; exports.easeElasticInOut =3D elasticInOut; exports.blob =3D blob; exports.buffer =3D buffer; exports.dsv =3D dsv; exports.csv =3D csv$1; exports.tsv =3D tsv$1; exports.image =3D image; exports.json =3D json; exports.text =3D text; exports.xml =3D xml; exports.html =3D html; exports.svg =3D svg; exports.forceCenter =3D center$1; exports.forceCollide =3D collide; exports.forceLink =3D link; exports.forceManyBody =3D manyBody; exports.forceRadial =3D radial; exports.forceSimulation =3D simulation; exports.forceX =3D x$2; exports.forceY =3D y$2; exports.formatDefaultLocale =3D defaultLocale; exports.formatLocale =3D formatLocale; exports.formatSpecifier =3D formatSpecifier; exports.precisionFixed =3D precisionFixed; exports.precisionPrefix =3D precisionPrefix; exports.precisionRound =3D precisionRound; exports.geoArea =3D area$1; exports.geoBounds =3D bounds; exports.geoCentroid =3D centroid; exports.geoCircle =3D circle; exports.geoClipAntimeridian =3D clipAntimeridian; exports.geoClipCircle =3D clipCircle; exports.geoClipExtent =3D extent$1; exports.geoClipRectangle =3D clipRectangle; exports.geoContains =3D contains$1; exports.geoDistance =3D distance; exports.geoGraticule =3D graticule; exports.geoGraticule10 =3D graticule10; exports.geoInterpolate =3D interpolate$1; exports.geoLength =3D length$1; exports.geoPath =3D index$1; exports.geoAlbers =3D albers; exports.geoAlbersUsa =3D albersUsa; exports.geoAzimuthalEqualArea =3D azimuthalEqualArea; exports.geoAzimuthalEqualAreaRaw =3D azimuthalEqualAreaRaw; exports.geoAzimuthalEquidistant =3D azimuthalEquidistant; exports.geoAzimuthalEquidistantRaw =3D azimuthalEquidistantRaw; exports.geoConicConformal =3D conicConformal; exports.geoConicConformalRaw =3D conicConformalRaw; exports.geoConicEqualArea =3D conicEqualArea; exports.geoConicEqualAreaRaw =3D conicEqualAreaRaw; exports.geoConicEquidistant =3D conicEquidistant; exports.geoConicEquidistantRaw =3D conicEquidistantRaw; exports.geoEqualEarth =3D equalEarth; exports.geoEqualEarthRaw =3D equalEarthRaw; exports.geoEquirectangular =3D equirectangular; exports.geoEquirectangularRaw =3D equirectangularRaw; exports.geoGnomonic =3D gnomonic; exports.geoGnomonicRaw =3D gnomonicRaw; exports.geoIdentity =3D identity$5; exports.geoProjection =3D projection; exports.geoProjectionMutator =3D projectionMutator; exports.geoMercator =3D mercator; exports.geoMercatorRaw =3D mercatorRaw; exports.geoNaturalEarth1 =3D naturalEarth1; exports.geoNaturalEarth1Raw =3D naturalEarth1Raw; exports.geoOrthographic =3D orthographic; exports.geoOrthographicRaw =3D orthographicRaw; exports.geoStereographic =3D stereographic; exports.geoStereographicRaw =3D stereographicRaw; exports.geoTransverseMercator =3D transverseMercator; exports.geoTransverseMercatorRaw =3D transverseMercatorRaw; exports.geoRotation =3D rotation; exports.geoStream =3D geoStream; exports.geoTransform =3D transform; exports.cluster =3D cluster; exports.hierarchy =3D hierarchy; exports.pack =3D index$2; exports.packSiblings =3D siblings; exports.packEnclose =3D enclose; exports.partition =3D partition; exports.stratify =3D stratify; exports.tree =3D tree; exports.treemap =3D index$3; exports.treemapBinary =3D binary; exports.treemapDice =3D treemapDice; exports.treemapSlice =3D treemapSlice; exports.treemapSliceDice =3D sliceDice; exports.treemapSquarify =3D squarify; exports.treemapResquarify =3D resquarify; exports.interpolate =3D interpolateValue; exports.interpolateArray =3D array$1; exports.interpolateBasis =3D basis$1; exports.interpolateBasisClosed =3D basisClosed; exports.interpolateDate =3D date; exports.interpolateDiscrete =3D discrete; exports.interpolateHue =3D hue$1; exports.interpolateNumber =3D interpolateNumber; exports.interpolateObject =3D object; exports.interpolateRound =3D interpolateRound; exports.interpolateString =3D interpolateString; exports.interpolateTransformCss =3D interpolateTransformCss; exports.interpolateTransformSvg =3D interpolateTransformSvg; exports.interpolateZoom =3D interpolateZoom; exports.interpolateRgb =3D interpolateRgb; exports.interpolateRgbBasis =3D rgbBasis; exports.interpolateRgbBasisClosed =3D rgbBasisClosed; exports.interpolateHsl =3D hsl$2; exports.interpolateHslLong =3D hslLong; exports.interpolateLab =3D lab$1; exports.interpolateHcl =3D hcl$2; exports.interpolateHclLong =3D hclLong; exports.interpolateCubehelix =3D cubehelix$2; exports.interpolateCubehelixLong =3D cubehelixLong; exports.piecewise =3D piecewise; exports.quantize =3D quantize; exports.path =3D path; exports.polygonArea =3D area$2; exports.polygonCentroid =3D centroid$1; exports.polygonHull =3D hull; exports.polygonContains =3D contains$2; exports.polygonLength =3D length$2; exports.quadtree =3D quadtree; exports.randomUniform =3D uniform; exports.randomNormal =3D normal; exports.randomLogNormal =3D logNormal; exports.randomBates =3D bates; exports.randomIrwinHall =3D irwinHall; exports.randomExponential =3D exponential$1; exports.scaleBand =3D band; exports.scalePoint =3D point$1; exports.scaleIdentity =3D identity$7; exports.scaleLinear =3D linear$2; exports.scaleLog =3D log$1; exports.scaleSymlog =3D symlog; exports.scaleOrdinal =3D ordinal; exports.scaleImplicit =3D implicit; exports.scalePow =3D pow$1; exports.scaleSqrt =3D sqrt$1; exports.scaleQuantile =3D quantile$$1; exports.scaleQuantize =3D quantize$1; exports.scaleThreshold =3D threshold$1; exports.scaleTime =3D time; exports.scaleUtc =3D utcTime; exports.scaleSequential =3D sequential; exports.scaleSequentialLog =3D sequentialLog; exports.scaleSequentialPow =3D sequentialPow; exports.scaleSequentialSqrt =3D sequentialSqrt; exports.scaleSequentialSymlog =3D sequentialSymlog; exports.scaleSequentialQuantile =3D sequentialQuantile; exports.scaleDiverging =3D diverging; exports.scaleDivergingLog =3D divergingLog; exports.scaleDivergingPow =3D divergingPow; exports.scaleDivergingSqrt =3D divergingSqrt; exports.scaleDivergingSymlog =3D divergingSymlog; exports.tickFormat =3D tickFormat; exports.schemeCategory10 =3D category10; exports.schemeAccent =3D Accent; exports.schemeDark2 =3D Dark2; exports.schemePaired =3D Paired; exports.schemePastel1 =3D Pastel1; exports.schemePastel2 =3D Pastel2; exports.schemeSet1 =3D Set1; exports.schemeSet2 =3D Set2; exports.schemeSet3 =3D Set3; exports.interpolateBrBG =3D BrBG; exports.schemeBrBG =3D scheme; exports.interpolatePRGn =3D PRGn; exports.schemePRGn =3D scheme$1; exports.interpolatePiYG =3D PiYG; exports.schemePiYG =3D scheme$2; exports.interpolatePuOr =3D PuOr; exports.schemePuOr =3D scheme$3; exports.interpolateRdBu =3D RdBu; exports.schemeRdBu =3D scheme$4; exports.interpolateRdGy =3D RdGy; exports.schemeRdGy =3D scheme$5; exports.interpolateRdYlBu =3D RdYlBu; exports.schemeRdYlBu =3D scheme$6; exports.interpolateRdYlGn =3D RdYlGn; exports.schemeRdYlGn =3D scheme$7; exports.interpolateSpectral =3D Spectral; exports.schemeSpectral =3D scheme$8; exports.interpolateBuGn =3D BuGn; exports.schemeBuGn =3D scheme$9; exports.interpolateBuPu =3D BuPu; exports.schemeBuPu =3D scheme$a; exports.interpolateGnBu =3D GnBu; exports.schemeGnBu =3D scheme$b; exports.interpolateOrRd =3D OrRd; exports.schemeOrRd =3D scheme$c; exports.interpolatePuBuGn =3D PuBuGn; exports.schemePuBuGn =3D scheme$d; exports.interpolatePuBu =3D PuBu; exports.schemePuBu =3D scheme$e; exports.interpolatePuRd =3D PuRd; exports.schemePuRd =3D scheme$f; exports.interpolateRdPu =3D RdPu; exports.schemeRdPu =3D scheme$g; exports.interpolateYlGnBu =3D YlGnBu; exports.schemeYlGnBu =3D scheme$h; exports.interpolateYlGn =3D YlGn; exports.schemeYlGn =3D scheme$i; exports.interpolateYlOrBr =3D YlOrBr; exports.schemeYlOrBr =3D scheme$j; exports.interpolateYlOrRd =3D YlOrRd; exports.schemeYlOrRd =3D scheme$k; exports.interpolateBlues =3D Blues; exports.schemeBlues =3D scheme$l; exports.interpolateGreens =3D Greens; exports.schemeGreens =3D scheme$m; exports.interpolateGreys =3D Greys; exports.schemeGreys =3D scheme$n; exports.interpolatePurples =3D Purples; exports.schemePurples =3D scheme$o; exports.interpolateReds =3D Reds; exports.schemeReds =3D scheme$p; exports.interpolateOranges =3D Oranges; exports.schemeOranges =3D scheme$q; exports.interpolateCubehelixDefault =3D cubehelix$3; exports.interpolateRainbow =3D rainbow; exports.interpolateWarm =3D warm; exports.interpolateCool =3D cool; exports.interpolateSinebow =3D sinebow; exports.interpolateViridis =3D viridis; exports.interpolateMagma =3D magma; exports.interpolateInferno =3D inferno; exports.interpolatePlasma =3D plasma; exports.create =3D create; exports.creator =3D creator; exports.local =3D local; exports.matcher =3D matcher; exports.mouse =3D mouse; exports.namespace =3D namespace; exports.namespaces =3D namespaces; exports.clientPoint =3D point; exports.select =3D select; exports.selectAll =3D selectAll; exports.selection =3D selection; exports.selector =3D selector; exports.selectorAll =3D selectorAll; exports.style =3D styleValue; exports.touch =3D touch; exports.touches =3D touches; exports.window =3D defaultView; exports.customEvent =3D customEvent; exports.arc =3D arc; exports.area =3D area$3; exports.line =3D line; exports.pie =3D pie; exports.areaRadial =3D areaRadial; exports.radialArea =3D areaRadial; exports.lineRadial =3D lineRadial$1; exports.radialLine =3D lineRadial$1; exports.pointRadial =3D pointRadial; exports.linkHorizontal =3D linkHorizontal; exports.linkVertical =3D linkVertical; exports.linkRadial =3D linkRadial; exports.symbol =3D symbol; exports.symbols =3D symbols; exports.symbolCircle =3D circle$2; exports.symbolCross =3D cross$2; exports.symbolDiamond =3D diamond; exports.symbolSquare =3D square; exports.symbolStar =3D star; exports.symbolTriangle =3D triangle; exports.symbolWye =3D wye; exports.curveBasisClosed =3D basisClosed$1; exports.curveBasisOpen =3D basisOpen; exports.curveBasis =3D basis$2; exports.curveBundle =3D bundle; exports.curveCardinalClosed =3D cardinalClosed; exports.curveCardinalOpen =3D cardinalOpen; exports.curveCardinal =3D cardinal; exports.curveCatmullRomClosed =3D catmullRomClosed; exports.curveCatmullRomOpen =3D catmullRomOpen; exports.curveCatmullRom =3D catmullRom; exports.curveLinearClosed =3D linearClosed; exports.curveLinear =3D curveLinear; exports.curveMonotoneX =3D monotoneX; exports.curveMonotoneY =3D monotoneY; exports.curveNatural =3D natural; exports.curveStep =3D step; exports.curveStepAfter =3D stepAfter; exports.curveStepBefore =3D stepBefore; exports.stack =3D stack; exports.stackOffsetExpand =3D expand; exports.stackOffsetDiverging =3D diverging$1; exports.stackOffsetNone =3D none$1; exports.stackOffsetSilhouette =3D silhouette; exports.stackOffsetWiggle =3D wiggle; exports.stackOrderAppearance =3D appearance; exports.stackOrderAscending =3D ascending$3; exports.stackOrderDescending =3D descending$2; exports.stackOrderInsideOut =3D insideOut; exports.stackOrderNone =3D none$2; exports.stackOrderReverse =3D reverse; exports.timeInterval =3D newInterval; exports.timeMillisecond =3D millisecond; exports.timeMilliseconds =3D milliseconds; exports.utcMillisecond =3D millisecond; exports.utcMilliseconds =3D milliseconds; exports.timeSecond =3D second; exports.timeSeconds =3D seconds; exports.utcSecond =3D second; exports.utcSeconds =3D seconds; exports.timeMinute =3D minute; exports.timeMinutes =3D minutes; exports.timeHour =3D hour; exports.timeHours =3D hours; exports.timeDay =3D day; exports.timeDays =3D days; exports.timeWeek =3D sunday; exports.timeWeeks =3D sundays; exports.timeSunday =3D sunday; exports.timeSundays =3D sundays; exports.timeMonday =3D monday; exports.timeMondays =3D mondays; exports.timeTuesday =3D tuesday; exports.timeTuesdays =3D tuesdays; exports.timeWednesday =3D wednesday; exports.timeWednesdays =3D wednesdays; exports.timeThursday =3D thursday; exports.timeThursdays =3D thursdays; exports.timeFriday =3D friday; exports.timeFridays =3D fridays; exports.timeSaturday =3D saturday; exports.timeSaturdays =3D saturdays; exports.timeMonth =3D month; exports.timeMonths =3D months; exports.timeYear =3D year; exports.timeYears =3D years; exports.utcMinute =3D utcMinute; exports.utcMinutes =3D utcMinutes; exports.utcHour =3D utcHour; exports.utcHours =3D utcHours; exports.utcDay =3D utcDay; exports.utcDays =3D utcDays; exports.utcWeek =3D utcSunday; exports.utcWeeks =3D utcSundays; exports.utcSunday =3D utcSunday; exports.utcSundays =3D utcSundays; exports.utcMonday =3D utcMonday; exports.utcMondays =3D utcMondays; exports.utcTuesday =3D utcTuesday; exports.utcTuesdays =3D utcTuesdays; exports.utcWednesday =3D utcWednesday; exports.utcWednesdays =3D utcWednesdays; exports.utcThursday =3D utcThursday; exports.utcThursdays =3D utcThursdays; exports.utcFriday =3D utcFriday; exports.utcFridays =3D utcFridays; exports.utcSaturday =3D utcSaturday; exports.utcSaturdays =3D utcSaturdays; exports.utcMonth =3D utcMonth; exports.utcMonths =3D utcMonths; exports.utcYear =3D utcYear; exports.utcYears =3D utcYears; exports.timeFormatDefaultLocale =3D defaultLocale$1; exports.timeFormatLocale =3D formatLocale$1; exports.isoFormat =3D formatIso; exports.isoParse =3D parseIso; exports.now =3D now; exports.timer =3D timer; exports.timerFlush =3D timerFlush; exports.timeout =3D timeout$1; exports.interval =3D interval$1; exports.transition =3D transition; exports.active =3D active; exports.interrupt =3D interrupt; exports.voronoi =3D voronoi; exports.zoom =3D zoom; exports.zoomTransform =3D transform$1; exports.zoomIdentity =3D identity$9; Object.defineProperty(exports, '__esModule', { value: true }); }))); --kLqR5wKUBEbm+NQl-- --Ax9lNzlugw8JBjpt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAmAmxZ4ACgkQJkb6MLrK fwhbohAA4NjAlfe+EHYyDBkUs3qD+7YuiivhEK3jXbkcGVE6i8KK4OHtN0PXReaM 1f7jIJ7iMbpFMMCsUkbacH8RM1Cq9PspPNhEPiSTTygjN3qXmQCsHtKLQoBaq53t j5LGwJwRUlcunNfU6fjhiMQWpLMkfBxjtJYLcFLgc65AuBkqqk8A3uHx+4b8pem7 tMP23MKYrVtO1dSldjuAUz9KGPvl69B6kL++im56czeYt3Bqn7/ru4i3a5R9nmKt qDODodenxt9FLq+C/r5ubdrENeVAiXyTvDxTfhP7iqUknIxhod6f9l+heiisBLLW RFl87j/KDMQCgwtecs8OKPK2qkYK0K06j/LeuDy8zEPua/R2HDp/aMFbs//Mg5ZJ Xc/bcbYlfbirxsgAZYk7VWlDP4y5eaI5OJyLCstHfwvgUZhU1DVLT5TVVp4yEf9O SZeIuCcSTZkaNOrpNMsC+JidqiKtZZvHZSr11CsNgGumTVtJiNe1SAYRYD1Ap+bD Ja5MFtR4EtEkU5eUvxUBOs6qamdRb4KGTBpZlWrHoOfKRtp6Vojd0mpZCRsKfy2l wbe2K/2xdJ3V7yVb9AYn7cQUgt7tUZfbhvoFD6bJwOthseSvalvmyrnrSiTUl9mz SN67DQstbOJLBI6GrJTD2M6IUuzZkMF5v7JNbdqEU7lS2F4aIfk= =PCKV -----END PGP SIGNATURE----- --Ax9lNzlugw8JBjpt--