08-27-周三_17-09-29

This commit is contained in:
2025-08-27 17:10:05 +08:00
commit 86df397d8f
12735 changed files with 1145479 additions and 0 deletions

2
node_modules/d3/.gitattributes generated vendored Normal file
View File

@@ -0,0 +1,2 @@
d3.js -diff merge=ours
d3.min.js -diff merge=ours

6
node_modules/d3/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,6 @@
examples/
test/
lib/
.DS_Store
_site
d3.zip

4
node_modules/d3/.spmignore generated vendored Normal file
View File

@@ -0,0 +1,4 @@
bin
lib
src
test

27
node_modules/d3/CONTRIBUTING.md generated vendored Normal file
View File

@@ -0,0 +1,27 @@
# Contributing
**Important:** these GitHub issues are for *bug reports and feature requests only*. Please use [StackOverflow](http://stackoverflow.com/questions/tagged/d3.js) or the [d3-js Google group](https://groups.google.com/d/forum/d3-js) for general help.
If youre looking for ways to contribute, please [peruse open issues](https://github.com/mbostock/d3/issues?milestone=&page=1&state=open). The icebox is a good place to find ideas that are not currently in development. If you already have an idea, please check past issues to see whether your idea or a similar one was previously discussed.
Before submitting a pull request, consider implementing a live example first, say using [bl.ocks.org](http://bl.ocks.org). Real-world use cases go a long way to demonstrating the usefulness of a proposed feature. The more complex a features implementation, the more usefulness it should provide. Share your demo using the #d3js tag on Twitter or by sending it to the [d3-js Google group](https://groups.google.com/d/forum/d3-js).
If your proposed feature does not involve changing core functionality, consider submitting it instead as a [D3 plugin](https://github.com/d3/d3-plugins). New core features should be for general use, whereas plugins are suitable for more specialized use cases. When in doubt, its easier to start with a plugin before “graduating” to core.
To contribute new documentation or add examples to the gallery, just [edit the Wiki](https://github.com/mbostock/d3/wiki)!
## How to Submit a Pull Request
1. Click the “Fork” button to create your personal fork of the D3 repository.
2. After cloning your fork of the D3 repository in the terminal, run `npm install` to install D3s dependencies.
3. Create a new branch for your new feature. For example: `git checkout -b my-awesome-feature`. A dedicated branch for your pull request means you can develop multiple features at the same time, and ensures that your pull request is stable even if you later decide to develop an unrelated feature.
4. The `d3.js` and `d3.min.js` files are built from source files in the `src` directory. _Do not edit `d3.js` directly._ Instead, edit the source files, and then run `make` to build the generated files.
5. Use `make test` to run tests and verify your changes. If you are adding a new feature, you should add new tests! If you are changing existing functionality, make sure the existing tests run, or update them as appropriate.
6. Sign D3s [Individual Contributor License Agreement](https://docs.google.com/forms/d/1CzjdBKtDuA8WeuFJinadx956xLQ4Xriv7-oDvXnZMaI/viewform). Unless you are submitting a trivial patch (such as fixing a typo), this form is needed to verify that you are able to contribute.
7. Submit your pull request, and good luck!

26
node_modules/d3/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,26 @@
Copyright (c) 2010-2016, Michael Bostock
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* The name Michael Bostock may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

13
node_modules/d3/README.md generated vendored Normal file
View File

@@ -0,0 +1,13 @@
# Data-Driven Documents
<a href="https://d3js.org"><img src="https://d3js.org/logo.svg" align="left" hspace="10" vspace="6"></a>
**D3.js** is a JavaScript library for manipulating documents based on data. **D3** helps you bring data to life using HTML, SVG, and CSS. **D3** emphasizes web standards and combines powerful visualization components with a data-driven approach to DOM manipulation, giving you the full capabilities of modern browsers without tying yourself to a proprietary framework.
Want to learn more? [See the wiki.](https://github.com/mbostock/d3/wiki)
For examples, [see the gallery](https://github.com/mbostock/d3/wiki/Gallery) and [mbostocks bl.ocks](http://bl.ocks.org/mbostock).
## Good News, Everyone!
The next major release of D3, 4.0, is coming! See the [4.0 development branch](https://github.com/mbostock/d3/tree/4) and read the [new API reference](https://github.com/mbostock/d3/blob/4/README.md) to get ready.

20
node_modules/d3/bin/meteor generated vendored Normal file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env node
var fs = require("fs"),
package = require("../package.json");
console.log(
"// Package metadata for Meteor.js.\n" +
"\n" +
"Package.describe({\n" +
" name: \"d3js:d3\", // http://atmospherejs.com/d3js/d3\n" +
" summary: \"D3 (official): " + package.description + "\",\n" +
" version: \"" + package.version + "\",\n" +
" git: \"https://github.com/mbostock/d3.git\"\n" +
"});\n" +
"\n" +
"Package.onUse(function(api) {\n" +
" api.versionsFrom([\"METEOR@1.0\"]);\n" +
" api.addFiles(\"d3.js\", \"client\");\n" +
"});"
);

3
node_modules/d3/bin/start generated vendored Normal file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env node
console.log("!function(){\n var d3 = {version: " + JSON.stringify(require("../package.json").version) + "}; // semver");

34
node_modules/d3/bin/uglify generated vendored Normal file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env node
var fs = require("fs"),
uglify = require("uglify-js");
var filename = process.argv[2],
toplevel = uglify.parse(fs.readFileSync(filename, "utf8"), {filename: filename}),
output = uglify.OutputStream({ascii_only: true}),
compressor = uglify.Compressor(true),
warn = uglify.AST_Node.warn;
uglify.AST_Node.warn = function(s, o) {
if (o.msg === "Accidental global?" && o.name === "d3" && o.line === 1 && !o.col) return;
warn.apply(this, arguments);
};
toplevel.figure_out_scope();
toplevel.scope_warnings({
undeclared: false,
unreferenced: false,
assign_to_global: true,
func_arguments: false,
nested_defuns: false,
eval: false
});
toplevel = toplevel.transform(compressor);
toplevel.figure_out_scope();
toplevel.compute_char_frequency(true);
toplevel.mangle_names(true);
toplevel.print(output);
process.stdout.write(output.get());

26
node_modules/d3/composer.json generated vendored Normal file
View File

@@ -0,0 +1,26 @@
{
"name": "mbostock/d3",
"description": "A JavaScript visualization library for HTML and SVG.",
"keywords": [
"dom",
"w3c",
"visualization",
"svg",
"animation",
"canvas"
],
"homepage": "http://d3js.org/",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Mike Bostock",
"homepage": "http://bost.ocks.org/mike"
}
],
"support": {
"issues": "https://github.com/mbostock/d3/issues",
"wiki": "https://github.com/mbostock/d3/wiki",
"API": "https://github.com/mbostock/d3/wiki/API-Reference",
"source": "https://github.com/mbostock/d3"
}
}

9554
node_modules/d3/d3.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

5
node_modules/d3/d3.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

13
node_modules/d3/package.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
// Package metadata for Meteor.js.
Package.describe({
name: "d3js:d3", // http://atmospherejs.com/d3js/d3
summary: "D3 (official): A JavaScript visualization library for HTML and SVG.",
version: "3.5.17",
git: "https://github.com/mbostock/d3.git"
});
Package.onUse(function(api) {
api.versionsFrom(["METEOR@1.0"]);
api.addFiles("d3.js", "client");
});

141
node_modules/d3/package.json generated vendored Normal file
View File

@@ -0,0 +1,141 @@
{
"_args": [
[
{
"name": "d3",
"raw": "d3@3.5.17",
"rawSpec": "3.5.17",
"scope": null,
"spec": "3.5.17",
"type": "version"
},
"/root/gitbook/node_modules/mermaid"
]
],
"_from": "d3@3.5.17",
"_id": "d3@3.5.17",
"_inCache": true,
"_installable": true,
"_location": "/d3",
"_nodeVersion": "0.12.7",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/d3-3.5.17.tgz_1462408194546_0.654020820511505"
},
"_npmUser": {
"email": "mbostock@gmail.com",
"name": "mbostock"
},
"_npmVersion": "2.11.3",
"_phantomChildren": {},
"_requested": {
"name": "d3",
"raw": "d3@3.5.17",
"rawSpec": "3.5.17",
"scope": null,
"spec": "3.5.17",
"type": "version"
},
"_requiredBy": [
"/dagre-d3-renderer",
"/mermaid"
],
"_resolved": "https://registry.npmjs.org/d3/-/d3-3.5.17.tgz",
"_shasum": "bc46748004378b21a360c9fc7cf5231790762fb8",
"_shrinkwrap": null,
"_spec": "d3@3.5.17",
"_where": "/root/gitbook/node_modules/mermaid",
"author": {
"name": "Mike Bostock",
"url": "http://bost.ocks.org/mike"
},
"browser": "d3.js",
"bugs": {
"url": "https://github.com/mbostock/d3/issues"
},
"contributors": [
{
"name": "Jason Davies",
"url": "http://jasondavies.com"
}
],
"dependencies": {},
"description": "A JavaScript visualization library for HTML and SVG.",
"devDependencies": {
"jsdom": "3",
"seedrandom": "2",
"smash": "0.0",
"uglify-js": "2.6.2",
"vows": "0.8"
},
"directories": {},
"dist": {
"integrity": "sha512-yFk/2idb8OHPKkbAL8QaOaqENNoMhIaSHZerk3oQsECwkObkCpJyjYwCe+OHiq6UEdhe1m8ZGARRRO3ljFjlKg==",
"shasum": "bc46748004378b21a360c9fc7cf5231790762fb8",
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEQCIDeJtRe3rHflVtAlE5n6QoInMYQsLLNY2rajBTq3AjgDAiBgB1/rMpvzjHtHSy4osdF926kRBQD5u9xq1tieQ434Ow=="
}
],
"tarball": "https://registry.npmjs.org/d3/-/d3-3.5.17.tgz"
},
"gitHead": "9cc9a875e636a1dcf36cc1e07bdf77e1ad6e2c74",
"homepage": "http://d3js.org",
"jam": {
"main": "d3.js",
"shim": {
"exports": "d3"
}
},
"jspm": {
"buildConfig": {
"uglify": true
},
"files": [
"d3.js"
],
"main": "d3",
"shim": {
"d3": {
"exports": "d3"
}
}
},
"keywords": [
"dom",
"w3c",
"visualization",
"svg",
"animation",
"canvas"
],
"license": "BSD-3-Clause",
"main": "d3.js",
"maintainers": [
{
"email": "mbostock@gmail.com",
"name": "mbostock"
},
{
"email": "jason@jasondavies.com",
"name": "jasondavies"
}
],
"name": "d3",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/mbostock/d3.git"
},
"scripts": {
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp -v README.md LICENSE d3.js d3.min.js ../d3-bower && cd ../d3-bower && git add README.md LICENSE d3.js d3.min.js && git commit -m \"Release $VERSION.\" && git tag -am \"Release $VERSION.\" v${VERSION} && git push && git push --tags && cd - && cp -v d3.js ../d3.github.com/d3.v3.js && cp -v d3.min.js ../d3.github.com/d3.v3.min.js && cd ../d3.github.com && git add d3.v3.js d3.v3.min.js && git commit -m \"d3 ${VERSION}\" && git push",
"prepublish": "npm test && rm -f package.js src/start.js d3.js d3.min.js d3.zip && bin/start > src/start.js && bin/meteor > package.js && smash src/d3.js | uglifyjs - -b indent-level=2 -o d3.js && bin/uglify d3.js > d3.min.js && chmod a-w d3.js d3.min.js package.js && zip d3.zip LICENSE d3.js d3.min.js",
"test": "vows && echo"
},
"spm": {
"main": "d3.js"
},
"version": "3.5.17"
}

5
node_modules/d3/src/arrays/ascending.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
d3.ascending = d3_ascending;
function d3_ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}

36
node_modules/d3/src/arrays/bisect.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import "ascending";
function d3_bisector(compare) {
return {
left: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) < 0) lo = mid + 1;
else hi = mid;
}
return lo;
},
right: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) > 0) hi = mid;
else lo = mid + 1;
}
return lo;
}
};
}
var d3_bisect = d3_bisector(d3_ascending);
d3.bisectLeft = d3_bisect.left;
d3.bisect = d3.bisectRight = d3_bisect.right;
d3.bisector = function(f) {
return d3_bisector(f.length === 1
? function(d, x) { return d3_ascending(f(d), x); }
: f);
};

3
node_modules/d3/src/arrays/descending.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
d3.descending = function(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
};

6
node_modules/d3/src/arrays/deviation.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import "variance";
d3.deviation = function() {
var v = d3.variance.apply(this, arguments);
return v ? Math.sqrt(v) : v;
};

5
node_modules/d3/src/arrays/entries.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
d3.entries = function(map) {
var entries = [];
for (var key in map) entries.push({key: key, value: map[key]});
return entries;
};

21
node_modules/d3/src/arrays/extent.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
d3.extent = function(array, f) {
var i = -1,
n = array.length,
a,
b,
c;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = c = b; break; }
while (++i < n) if ((b = array[i]) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
} else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = c = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
}
return [a, c];
};

25
node_modules/d3/src/arrays/index.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import "ascending";
import "descending";
import "min";
import "max";
import "extent";
import "sum";
import "mean";
import "median";
import "quantile";
import "variance";
import "deviation";
import "bisect";
import "shuffle";
import "permute";
import "pairs";
import "zip";
import "transpose";
import "keys";
import "values";
import "entries";
import "merge";
import "range";
import "nest";
import "map";
import "set";

5
node_modules/d3/src/arrays/keys.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
d3.keys = function(map) {
var keys = [];
for (var key in map) keys.push(key);
return keys;
};

84
node_modules/d3/src/arrays/map.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
import "../core/class";
d3.map = function(object, f) {
var map = new d3_Map;
if (object instanceof d3_Map) {
object.forEach(function(key, value) { map.set(key, value); });
} else if (Array.isArray(object)) {
var i = -1,
n = object.length,
o;
if (arguments.length === 1) while (++i < n) map.set(i, object[i]);
else while (++i < n) map.set(f.call(object, o = object[i], i), o);
} else {
for (var key in object) map.set(key, object[key]);
}
return map;
};
function d3_Map() {
this._ = Object.create(null);
}
var d3_map_proto = "__proto__",
d3_map_zero = "\0";
d3_class(d3_Map, {
has: d3_map_has,
get: function(key) {
return this._[d3_map_escape(key)];
},
set: function(key, value) {
return this._[d3_map_escape(key)] = value;
},
remove: d3_map_remove,
keys: d3_map_keys,
values: function() {
var values = [];
for (var key in this._) values.push(this._[key]);
return values;
},
entries: function() {
var entries = [];
for (var key in this._) entries.push({key: d3_map_unescape(key), value: this._[key]});
return entries;
},
size: d3_map_size,
empty: d3_map_empty,
forEach: function(f) {
for (var key in this._) f.call(this, d3_map_unescape(key), this._[key]);
}
});
function d3_map_escape(key) {
return (key += "") === d3_map_proto || key[0] === d3_map_zero ? d3_map_zero + key : key;
}
function d3_map_unescape(key) {
return (key += "")[0] === d3_map_zero ? key.slice(1) : key;
}
function d3_map_has(key) {
return d3_map_escape(key) in this._;
}
function d3_map_remove(key) {
return (key = d3_map_escape(key)) in this._ && delete this._[key];
}
function d3_map_keys() {
var keys = [];
for (var key in this._) keys.push(d3_map_unescape(key));
return keys;
}
function d3_map_size() {
var size = 0;
for (var key in this._) ++size;
return size;
}
function d3_map_empty() {
for (var key in this._) return false;
return true;
}

14
node_modules/d3/src/arrays/max.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
d3.max = function(array, f) {
var i = -1,
n = array.length,
a,
b;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = array[i]) != null && b > a) a = b;
} else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
}
return a;
};

15
node_modules/d3/src/arrays/mean.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import "../math/number";
d3.mean = function(array, f) {
var s = 0,
n = array.length,
a,
i = -1,
j = n;
if (arguments.length === 1) {
while (++i < n) if (d3_numeric(a = d3_number(array[i]))) s += a; else --j;
} else {
while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) s += a; else --j;
}
if (j) return s / j;
};

16
node_modules/d3/src/arrays/median.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import "../math/number";
import "ascending";
import "quantile";
d3.median = function(array, f) {
var numbers = [],
n = array.length,
a,
i = -1;
if (arguments.length === 1) {
while (++i < n) if (d3_numeric(a = d3_number(array[i]))) numbers.push(a);
} else {
while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) numbers.push(a);
}
if (numbers.length) return d3.quantile(numbers.sort(d3_ascending), 0.5);
};

21
node_modules/d3/src/arrays/merge.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
d3.merge = function(arrays) {
var n = arrays.length,
m,
i = -1,
j = 0,
merged,
array;
while (++i < n) j += arrays[i].length;
merged = new Array(j);
while (--n >= 0) {
array = arrays[n];
m = array.length;
while (--m >= 0) {
merged[--j] = array[m];
}
}
return merged;
};

14
node_modules/d3/src/arrays/min.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
d3.min = function(array, f) {
var i = -1,
n = array.length,
a,
b;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = array[i]) != null && a > b) a = b;
} else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
}
return a;
};

97
node_modules/d3/src/arrays/nest.js generated vendored Normal file
View File

@@ -0,0 +1,97 @@
import "map";
d3.nest = function() {
var nest = {},
keys = [],
sortKeys = [],
sortValues,
rollup;
function map(mapType, array, depth) {
if (depth >= keys.length) return rollup
? rollup.call(nest, array) : (sortValues
? array.sort(sortValues)
: array);
var i = -1,
n = array.length,
key = keys[depth++],
keyValue,
object,
setter,
valuesByKey = new d3_Map,
values;
while (++i < n) {
if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
values.push(object);
} else {
valuesByKey.set(keyValue, [object]);
}
}
if (mapType) {
object = mapType();
setter = function(keyValue, values) {
object.set(keyValue, map(mapType, values, depth));
};
} else {
object = {};
setter = function(keyValue, values) {
object[keyValue] = map(mapType, values, depth);
};
}
valuesByKey.forEach(setter);
return object;
}
function entries(map, depth) {
if (depth >= keys.length) return map;
var array = [],
sortKey = sortKeys[depth++];
map.forEach(function(key, keyMap) {
array.push({key: key, values: entries(keyMap, depth)});
});
return sortKey
? array.sort(function(a, b) { return sortKey(a.key, b.key); })
: array;
}
nest.map = function(array, mapType) {
return map(mapType, array, 0);
};
nest.entries = function(array) {
return entries(map(d3.map, array, 0), 0);
};
nest.key = function(d) {
keys.push(d);
return nest;
};
// Specifies the order for the most-recently specified key.
// Note: only applies to entries. Map keys are unordered!
nest.sortKeys = function(order) {
sortKeys[keys.length - 1] = order;
return nest;
};
// Specifies the order for leaf values.
// Applies to both maps and entries array.
nest.sortValues = function(order) {
sortValues = order;
return nest;
};
nest.rollup = function(f) {
rollup = f;
return nest;
};
return nest;
};

5
node_modules/d3/src/arrays/pairs.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
d3.pairs = function(array) {
var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n);
while (i < n) pairs[i] = [p0 = p1, p1 = array[++i]];
return pairs;
};

5
node_modules/d3/src/arrays/permute.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
d3.permute = function(array, indexes) {
var i = indexes.length, permutes = new Array(i);
while (i--) permutes[i] = array[indexes[i]];
return permutes;
};

8
node_modules/d3/src/arrays/quantile.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
// R-7 per <http://en.wikipedia.org/wiki/Quantile>
d3.quantile = function(values, p) {
var H = (values.length - 1) * p + 1,
h = Math.floor(H),
v = +values[h - 1],
e = H - h;
return e ? v + e * (values[h] - v) : v;
};

26
node_modules/d3/src/arrays/range.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import "../math/abs";
d3.range = function(start, stop, step) {
if (arguments.length < 3) {
step = 1;
if (arguments.length < 2) {
stop = start;
start = 0;
}
}
if ((stop - start) / step === Infinity) throw new Error("infinite range");
var range = [],
k = d3_range_integerScale(abs(step)),
i = -1,
j;
start *= k, stop *= k, step *= k;
if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k);
else while ((j = start + step * ++i) < stop) range.push(j / k);
return range;
};
function d3_range_integerScale(x) {
var k = 1;
while (x * k % 1) k *= 10;
return k;
}

27
node_modules/d3/src/arrays/set.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import "../core/class";
import "map";
d3.set = function(array) {
var set = new d3_Set;
if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]);
return set;
};
function d3_Set() {
this._ = Object.create(null);
}
d3_class(d3_Set, {
has: d3_map_has,
add: function(key) {
this._[d3_map_escape(key += "")] = true;
return key;
},
remove: d3_map_remove,
values: d3_map_keys,
size: d3_map_size,
empty: d3_map_empty,
forEach: function(f) {
for (var key in this._) f.call(this, d3_map_unescape(key));
}
});

9
node_modules/d3/src/arrays/shuffle.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
d3.shuffle = function(array, i0, i1) {
if ((m = arguments.length) < 3) { i1 = array.length; if (m < 2) i0 = 0; }
var m = i1 - i0, t, i;
while (m) {
i = Math.random() * m-- | 0;
t = array[m + i0], array[m + i0] = array[i + i0], array[i + i0] = t;
}
return array;
};

14
node_modules/d3/src/arrays/sum.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import "../math/number";
d3.sum = function(array, f) {
var s = 0,
n = array.length,
a,
i = -1;
if (arguments.length === 1) {
while (++i < n) if (d3_numeric(a = +array[i])) s += a; // zero and null are equivalent
} else {
while (++i < n) if (d3_numeric(a = +f.call(array, array[i], i))) s += a;
}
return s;
};

15
node_modules/d3/src/arrays/transpose.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import "min";
d3.transpose = function(matrix) {
if (!(n = matrix.length)) return [];
for (var i = -1, m = d3.min(matrix, d3_transposeLength), transpose = new Array(m); ++i < m;) {
for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {
row[j] = matrix[j][i];
}
}
return transpose;
};
function d3_transposeLength(d) {
return d.length;
}

5
node_modules/d3/src/arrays/values.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
d3.values = function(map) {
var values = [];
for (var key in map) values.push(map[key]);
return values;
};

29
node_modules/d3/src/arrays/variance.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
import "../math/number";
d3.variance = function(array, f) {
var n = array.length,
m = 0,
a,
d,
s = 0,
i = -1,
j = 0;
if (arguments.length === 1) {
while (++i < n) {
if (d3_numeric(a = d3_number(array[i]))) {
d = a - m;
m += d / ++j;
s += d * (a - m);
}
}
} else {
while (++i < n) {
if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) {
d = a - m;
m += d / ++j;
s += d * (a - m);
}
}
}
if (j > 1) return s / (j - 1);
};

5
node_modules/d3/src/arrays/zip.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import "transpose";
d3.zip = function() {
return d3.transpose(arguments);
};

1
node_modules/d3/src/behavior/behavior.js generated vendored Normal file
View File

@@ -0,0 +1 @@
d3.behavior = {};

88
node_modules/d3/src/behavior/drag.js generated vendored Normal file
View File

@@ -0,0 +1,88 @@
import "../core/document";
import "../core/identity";
import "../core/rebind";
import "../event/drag";
import "../event/event";
import "../event/mouse";
import "../event/touch";
import "behavior";
d3.behavior.drag = function() {
var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"),
origin = null,
mousedown = dragstart(d3_noop, d3.mouse, d3_window, "mousemove", "mouseup"),
touchstart = dragstart(d3_behavior_dragTouchId, d3.touch, d3_identity, "touchmove", "touchend");
function drag() {
this.on("mousedown.drag", mousedown)
.on("touchstart.drag", touchstart);
}
function dragstart(id, position, subject, move, end) {
return function() {
var that = this,
target = d3.event.target.correspondingElement || d3.event.target,
parent = that.parentNode,
dispatch = event.of(that, arguments),
dragged = 0,
dragId = id(),
dragName = ".drag" + (dragId == null ? "" : "-" + dragId),
dragOffset,
dragSubject = d3.select(subject(target)).on(move + dragName, moved).on(end + dragName, ended),
dragRestore = d3_event_dragSuppress(target),
position0 = position(parent, dragId);
if (origin) {
dragOffset = origin.apply(that, arguments);
dragOffset = [dragOffset.x - position0[0], dragOffset.y - position0[1]];
} else {
dragOffset = [0, 0];
}
dispatch({type: "dragstart"});
function moved() {
var position1 = position(parent, dragId), dx, dy;
if (!position1) return; // this touch didnt move
dx = position1[0] - position0[0];
dy = position1[1] - position0[1];
dragged |= dx | dy;
position0 = position1;
dispatch({
type: "drag",
x: position1[0] + dragOffset[0],
y: position1[1] + dragOffset[1],
dx: dx,
dy: dy
});
}
function ended() {
if (!position(parent, dragId)) return; // this touch didnt end
dragSubject.on(move + dragName, null).on(end + dragName, null);
dragRestore(dragged);
dispatch({type: "dragend"});
}
};
}
drag.origin = function(x) {
if (!arguments.length) return origin;
origin = x;
return drag;
};
return d3.rebind(drag, event, "on");
};
// While it is possible to receive a touchstart event with more than one changed
// touch, the event is only shared by touches on the same target; for new
// touches targetting different elements, multiple touchstart events are
// received even when the touches start simultaneously. Since multiple touches
// cannot move the same target to different locations concurrently without
// tearing the fabric of spacetime, we allow the first touch to win.
function d3_behavior_dragTouchId() {
return d3.event.changedTouches[0].identifier;
}

3
node_modules/d3/src/behavior/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import "behavior";
import "drag";
import "zoom";

348
node_modules/d3/src/behavior/zoom.js generated vendored Normal file
View File

@@ -0,0 +1,348 @@
import "../core/document";
import "../core/rebind";
import "../event/drag";
import "../event/event";
import "../event/mouse";
import "../event/touches";
import "../selection/selection";
import "../interpolate/zoom";
import "behavior";
d3.behavior.zoom = function() {
var view = {x: 0, y: 0, k: 1},
translate0, // translate when we started zooming (to avoid drift)
center0, // implicit desired position of translate0 after zooming
center, // explicit desired position of translate0 after zooming
size = [960, 500], // viewport size; required for zoom interpolation
scaleExtent = d3_behavior_zoomInfinity,
duration = 250,
zooming = 0,
mousedown = "mousedown.zoom",
mousemove = "mousemove.zoom",
mouseup = "mouseup.zoom",
mousewheelTimer,
touchstart = "touchstart.zoom",
touchtime, // time of last touchstart (to detect double-tap)
event = d3_eventDispatch(zoom, "zoomstart", "zoom", "zoomend"),
x0,
x1,
y0,
y1;
// Lazily determine the DOMs support for Wheel events.
// https://developer.mozilla.org/en-US/docs/Mozilla_event_reference/wheel
if (!d3_behavior_zoomWheel) {
d3_behavior_zoomWheel = "onwheel" in d3_document ? (d3_behavior_zoomDelta = function() { return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1); }, "wheel")
: "onmousewheel" in d3_document ? (d3_behavior_zoomDelta = function() { return d3.event.wheelDelta; }, "mousewheel")
: (d3_behavior_zoomDelta = function() { return -d3.event.detail; }, "MozMousePixelScroll");
}
function zoom(g) {
g .on(mousedown, mousedowned)
.on(d3_behavior_zoomWheel + ".zoom", mousewheeled)
.on("dblclick.zoom", dblclicked)
.on(touchstart, touchstarted);
}
zoom.event = function(g) {
g.each(function() {
var dispatch = event.of(this, arguments),
view1 = view;
if (d3_transitionInheritId) {
d3.select(this).transition()
.each("start.zoom", function() {
view = this.__chart__ || {x: 0, y: 0, k: 1}; // pre-transition state
zoomstarted(dispatch);
})
.tween("zoom:zoom", function() {
var dx = size[0],
dy = size[1],
cx = center0 ? center0[0] : dx / 2,
cy = center0 ? center0[1] : dy / 2,
i = d3.interpolateZoom(
[(cx - view.x) / view.k, (cy - view.y) / view.k, dx / view.k],
[(cx - view1.x) / view1.k, (cy - view1.y) / view1.k, dx / view1.k]
);
return function(t) {
var l = i(t), k = dx / l[2];
this.__chart__ = view = {x: cx - l[0] * k, y: cy - l[1] * k, k: k};
zoomed(dispatch);
};
})
.each("interrupt.zoom", function() {
zoomended(dispatch);
})
.each("end.zoom", function() {
zoomended(dispatch);
});
} else {
this.__chart__ = view;
zoomstarted(dispatch);
zoomed(dispatch);
zoomended(dispatch);
}
});
}
zoom.translate = function(_) {
if (!arguments.length) return [view.x, view.y];
view = {x: +_[0], y: +_[1], k: view.k}; // copy-on-write
rescale();
return zoom;
};
zoom.scale = function(_) {
if (!arguments.length) return view.k;
view = {x: view.x, y: view.y, k: null}; // copy-on-write
scaleTo(+_);
rescale();
return zoom;
};
zoom.scaleExtent = function(_) {
if (!arguments.length) return scaleExtent;
scaleExtent = _ == null ? d3_behavior_zoomInfinity : [+_[0], +_[1]];
return zoom;
};
zoom.center = function(_) {
if (!arguments.length) return center;
center = _ && [+_[0], +_[1]];
return zoom;
};
zoom.size = function(_) {
if (!arguments.length) return size;
size = _ && [+_[0], +_[1]];
return zoom;
};
zoom.duration = function(_) {
if (!arguments.length) return duration;
duration = +_; // TODO function based on interpolateZoom distance?
return zoom;
};
zoom.x = function(z) {
if (!arguments.length) return x1;
x1 = z;
x0 = z.copy();
view = {x: 0, y: 0, k: 1}; // copy-on-write
return zoom;
};
zoom.y = function(z) {
if (!arguments.length) return y1;
y1 = z;
y0 = z.copy();
view = {x: 0, y: 0, k: 1}; // copy-on-write
return zoom;
};
function location(p) {
return [(p[0] - view.x) / view.k, (p[1] - view.y) / view.k];
}
function point(l) {
return [l[0] * view.k + view.x, l[1] * view.k + view.y];
}
function scaleTo(s) {
view.k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
}
function translateTo(p, l) {
l = point(l);
view.x += p[0] - l[0];
view.y += p[1] - l[1];
}
function zoomTo(that, p, l, k) {
that.__chart__ = {x: view.x, y: view.y, k: view.k};
scaleTo(Math.pow(2, k));
translateTo(center0 = p, l);
that = d3.select(that);
if (duration > 0) that = that.transition().duration(duration);
that.call(zoom.event);
}
function rescale() {
if (x1) x1.domain(x0.range().map(function(x) { return (x - view.x) / view.k; }).map(x0.invert));
if (y1) y1.domain(y0.range().map(function(y) { return (y - view.y) / view.k; }).map(y0.invert));
}
function zoomstarted(dispatch) {
if (!zooming++) dispatch({type: "zoomstart"});
}
function zoomed(dispatch) {
rescale();
dispatch({type: "zoom", scale: view.k, translate: [view.x, view.y]});
}
function zoomended(dispatch) {
if (!--zooming) dispatch({type: "zoomend"}), center0 = null;
}
function mousedowned() {
var that = this,
dispatch = event.of(that, arguments),
dragged = 0,
subject = d3.select(d3_window(that)).on(mousemove, moved).on(mouseup, ended),
location0 = location(d3.mouse(that)),
dragRestore = d3_event_dragSuppress(that);
d3_selection_interrupt.call(that);
zoomstarted(dispatch);
function moved() {
dragged = 1;
translateTo(d3.mouse(that), location0);
zoomed(dispatch);
}
function ended() {
subject.on(mousemove, null).on(mouseup, null);
dragRestore(dragged);
zoomended(dispatch);
}
}
// These closures persist for as long as at least one touch is active.
function touchstarted() {
var that = this,
dispatch = event.of(that, arguments),
locations0 = {}, // touchstart locations
distance0 = 0, // distance² between initial touches
scale0, // scale when we started touching
zoomName = ".zoom-" + d3.event.changedTouches[0].identifier,
touchmove = "touchmove" + zoomName,
touchend = "touchend" + zoomName,
targets = [],
subject = d3.select(that),
dragRestore = d3_event_dragSuppress(that);
started();
zoomstarted(dispatch);
// Workaround for Chrome issue 412723: the touchstart listener must be set
// after the touchmove listener.
subject.on(mousedown, null).on(touchstart, started); // prevent duplicate events
// Updates locations of any touches in locations0.
function relocate() {
var touches = d3.touches(that);
scale0 = view.k;
touches.forEach(function(t) {
if (t.identifier in locations0) locations0[t.identifier] = location(t);
});
return touches;
}
// Temporarily override touchstart while gesture is active.
function started() {
// Listen for touchmove and touchend on the target of touchstart.
var target = d3.event.target;
d3.select(target).on(touchmove, moved).on(touchend, ended);
targets.push(target);
// Only track touches started on the same subject element.
var changed = d3.event.changedTouches;
for (var i = 0, n = changed.length; i < n; ++i) {
locations0[changed[i].identifier] = null;
}
var touches = relocate(),
now = Date.now();
if (touches.length === 1) {
if (now - touchtime < 500) { // dbltap
var p = touches[0];
zoomTo(that, p, locations0[p.identifier], Math.floor(Math.log(view.k) / Math.LN2) + 1);
d3_eventPreventDefault();
}
touchtime = now;
} else if (touches.length > 1) {
var p = touches[0], q = touches[1],
dx = p[0] - q[0], dy = p[1] - q[1];
distance0 = dx * dx + dy * dy;
}
}
function moved() {
var touches = d3.touches(that),
p0, l0,
p1, l1;
d3_selection_interrupt.call(that);
for (var i = 0, n = touches.length; i < n; ++i, l1 = null) {
p1 = touches[i];
if (l1 = locations0[p1.identifier]) {
if (l0) break;
p0 = p1, l0 = l1;
}
}
if (l1) {
var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1,
scale1 = distance0 && Math.sqrt(distance1 / distance0);
p0 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
l0 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
scaleTo(scale1 * scale0);
}
touchtime = null;
translateTo(p0, l0);
zoomed(dispatch);
}
function ended() {
// If there are any globally-active touches remaining, remove the ended
// touches from locations0.
if (d3.event.touches.length) {
var changed = d3.event.changedTouches;
for (var i = 0, n = changed.length; i < n; ++i) {
delete locations0[changed[i].identifier];
}
// If locations0 is not empty, then relocate and continue listening for
// touchmove and touchend.
for (var identifier in locations0) {
return void relocate(); // locations may have detached due to rotation
}
}
// Otherwise, remove touchmove and touchend listeners.
d3.selectAll(targets).on(zoomName, null);
subject.on(mousedown, mousedowned).on(touchstart, touchstarted);
dragRestore();
zoomended(dispatch);
}
}
function mousewheeled() {
var dispatch = event.of(this, arguments);
if (mousewheelTimer) clearTimeout(mousewheelTimer);
else d3_selection_interrupt.call(this), translate0 = location(center0 = center || d3.mouse(this)), zoomstarted(dispatch);
mousewheelTimer = setTimeout(function() { mousewheelTimer = null; zoomended(dispatch); }, 50);
d3_eventPreventDefault();
scaleTo(Math.pow(2, d3_behavior_zoomDelta() * 0.002) * view.k);
translateTo(center0, translate0);
zoomed(dispatch);
}
function dblclicked() {
var p = d3.mouse(this),
k = Math.log(view.k) / Math.LN2;
zoomTo(this, p, location(p), d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1);
}
return d3.rebind(zoom, event, "on");
};
var d3_behavior_zoomInfinity = [0, Infinity], // default scale extent
d3_behavior_zoomDelta, // initialized lazily
d3_behavior_zoomWheel;

7
node_modules/d3/src/color/color.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
d3.color = d3_color;
function d3_color() {}
d3_color.prototype.toString = function() {
return this.rgb() + "";
};

34
node_modules/d3/src/color/hcl.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import "../math/trigonometry";
import "color";
import "lab";
import "rgb";
d3.hcl = d3_hcl;
function d3_hcl(h, c, l) {
return this instanceof d3_hcl ? void (this.h = +h, this.c = +c, this.l = +l)
: arguments.length < 2 ? (h instanceof d3_hcl ? new d3_hcl(h.h, h.c, h.l)
: (h instanceof d3_lab ? d3_lab_hcl(h.l, h.a, h.b)
: d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b)))
: new d3_hcl(h, c, l);
}
var d3_hclPrototype = d3_hcl.prototype = new d3_color;
d3_hclPrototype.brighter = function(k) {
return new d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));
};
d3_hclPrototype.darker = function(k) {
return new d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));
};
d3_hclPrototype.rgb = function() {
return d3_hcl_lab(this.h, this.c, this.l).rgb();
};
function d3_hcl_lab(h, c, l) {
if (isNaN(h)) h = 0;
if (isNaN(c)) c = 0;
return new d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c);
}

56
node_modules/d3/src/color/hsl.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
import "color";
import "rgb";
d3.hsl = d3_hsl;
function d3_hsl(h, s, l) {
return this instanceof d3_hsl ? void (this.h = +h, this.s = +s, this.l = +l)
: arguments.length < 2 ? (h instanceof d3_hsl ? new d3_hsl(h.h, h.s, h.l)
: d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl))
: new d3_hsl(h, s, l);
}
var d3_hslPrototype = d3_hsl.prototype = new d3_color;
d3_hslPrototype.brighter = function(k) {
k = Math.pow(0.7, arguments.length ? k : 1);
return new d3_hsl(this.h, this.s, this.l / k);
};
d3_hslPrototype.darker = function(k) {
k = Math.pow(0.7, arguments.length ? k : 1);
return new d3_hsl(this.h, this.s, k * this.l);
};
d3_hslPrototype.rgb = function() {
return d3_hsl_rgb(this.h, this.s, this.l);
};
function d3_hsl_rgb(h, s, l) {
var m1,
m2;
/* Some simple corrections for h, s and l. */
h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h;
s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s;
l = l < 0 ? 0 : l > 1 ? 1 : l;
/* From FvD 13.37, CSS Color Module Level 3 */
m2 = l <= 0.5 ? l * (1 + s) : l + s - l * s;
m1 = 2 * l - m2;
function v(h) {
if (h > 360) h -= 360;
else if (h < 0) h += 360;
if (h < 60) return m1 + (m2 - m1) * h / 60;
if (h < 180) return m2;
if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
return m1;
}
function vv(h) {
return Math.round(v(h) * 255);
}
return new d3_rgb(vv(h + 120), vv(h), vv(h - 120));
}

6
node_modules/d3/src/color/index.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import "color";
import "rgb";
import "hsl";
import "hcl";
import "lab";
import "xyz";

60
node_modules/d3/src/color/lab.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import "../math/trigonometry";
import "color";
import "hcl";
import "rgb";
d3.lab = d3_lab;
function d3_lab(l, a, b) {
return this instanceof d3_lab ? void (this.l = +l, this.a = +a, this.b = +b)
: arguments.length < 2 ? (l instanceof d3_lab ? new d3_lab(l.l, l.a, l.b)
: (l instanceof d3_hcl ? d3_hcl_lab(l.h, l.c, l.l)
: d3_rgb_lab((l = d3_rgb(l)).r, l.g, l.b)))
: new d3_lab(l, a, b);
}
// Corresponds roughly to RGB brighter/darker
var d3_lab_K = 18;
// D65 standard referent
var d3_lab_X = 0.950470,
d3_lab_Y = 1,
d3_lab_Z = 1.088830;
var d3_labPrototype = d3_lab.prototype = new d3_color;
d3_labPrototype.brighter = function(k) {
return new d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
};
d3_labPrototype.darker = function(k) {
return new d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
};
d3_labPrototype.rgb = function() {
return d3_lab_rgb(this.l, this.a, this.b);
};
function d3_lab_rgb(l, a, b) {
var y = (l + 16) / 116,
x = y + a / 500,
z = y - b / 200;
x = d3_lab_xyz(x) * d3_lab_X;
y = d3_lab_xyz(y) * d3_lab_Y;
z = d3_lab_xyz(z) * d3_lab_Z;
return new d3_rgb(
d3_xyz_rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z),
d3_xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
d3_xyz_rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z)
);
}
function d3_lab_hcl(l, a, b) {
return l > 0
? new d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l)
: new d3_hcl(NaN, NaN, l);
}
function d3_lab_xyz(x) {
return x > 0.206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
}

301
node_modules/d3/src/color/rgb.js generated vendored Normal file
View File

@@ -0,0 +1,301 @@
import "../arrays/map";
import "color";
import "hsl";
import "lab";
import "xyz";
d3.rgb = d3_rgb;
function d3_rgb(r, g, b) {
return this instanceof d3_rgb ? void (this.r = ~~r, this.g = ~~g, this.b = ~~b)
: arguments.length < 2 ? (r instanceof d3_rgb ? new d3_rgb(r.r, r.g, r.b)
: d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb))
: new d3_rgb(r, g, b);
}
function d3_rgbNumber(value) {
return new d3_rgb(value >> 16, value >> 8 & 0xff, value & 0xff);
}
function d3_rgbString(value) {
return d3_rgbNumber(value) + "";
}
var d3_rgbPrototype = d3_rgb.prototype = new d3_color;
d3_rgbPrototype.brighter = function(k) {
k = Math.pow(0.7, arguments.length ? k : 1);
var r = this.r,
g = this.g,
b = this.b,
i = 30;
if (!r && !g && !b) return new d3_rgb(i, i, i);
if (r && r < i) r = i;
if (g && g < i) g = i;
if (b && b < i) b = i;
return new d3_rgb(Math.min(255, r / k), Math.min(255, g / k), Math.min(255, b / k));
};
d3_rgbPrototype.darker = function(k) {
k = Math.pow(0.7, arguments.length ? k : 1);
return new d3_rgb(k * this.r, k * this.g, k * this.b);
};
d3_rgbPrototype.hsl = function() {
return d3_rgb_hsl(this.r, this.g, this.b);
};
d3_rgbPrototype.toString = function() {
return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
};
function d3_rgb_hex(v) {
return v < 0x10
? "0" + Math.max(0, v).toString(16)
: Math.min(255, v).toString(16);
}
function d3_rgb_parse(format, rgb, hsl) {
var r = 0, // red channel; int in [0, 255]
g = 0, // green channel; int in [0, 255]
b = 0, // blue channel; int in [0, 255]
m1, // CSS color specification match
m2, // CSS color specification type (e.g., rgb)
color;
/* Handle hsl, rgb. */
m1 = /([a-z]+)\((.*)\)/.exec(format = format.toLowerCase());
if (m1) {
m2 = m1[2].split(",");
switch (m1[1]) {
case "hsl": {
return hsl(
parseFloat(m2[0]), // degrees
parseFloat(m2[1]) / 100, // percentage
parseFloat(m2[2]) / 100 // percentage
);
}
case "rgb": {
return rgb(
d3_rgb_parseNumber(m2[0]),
d3_rgb_parseNumber(m2[1]),
d3_rgb_parseNumber(m2[2])
);
}
}
}
/* Named colors. */
if (color = d3_rgb_names.get(format)) {
return rgb(color.r, color.g, color.b);
}
/* Hexadecimal colors: #rgb and #rrggbb. */
if (format != null && format.charAt(0) === "#" && !isNaN(color = parseInt(format.slice(1), 16))) {
if (format.length === 4) {
r = (color & 0xf00) >> 4; r = (r >> 4) | r;
g = (color & 0xf0); g = (g >> 4) | g;
b = (color & 0xf); b = (b << 4) | b;
} else if (format.length === 7) {
r = (color & 0xff0000) >> 16;
g = (color & 0xff00) >> 8;
b = (color & 0xff);
}
}
return rgb(r, g, b);
}
function d3_rgb_hsl(r, g, b) {
var min = Math.min(r /= 255, g /= 255, b /= 255),
max = Math.max(r, g, b),
d = max - min,
h,
s,
l = (max + min) / 2;
if (d) {
s = l < 0.5 ? d / (max + min) : d / (2 - max - min);
if (r == max) h = (g - b) / d + (g < b ? 6 : 0);
else if (g == max) h = (b - r) / d + 2;
else h = (r - g) / d + 4;
h *= 60;
} else {
h = NaN;
s = l > 0 && l < 1 ? 0 : h;
}
return new d3_hsl(h, s, l);
}
function d3_rgb_lab(r, g, b) {
r = d3_rgb_xyz(r);
g = d3_rgb_xyz(g);
b = d3_rgb_xyz(b);
var x = d3_xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / d3_lab_X),
y = d3_xyz_lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / d3_lab_Y),
z = d3_xyz_lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / d3_lab_Z);
return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
}
function d3_rgb_xyz(r) {
return (r /= 255) <= 0.04045 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4);
}
function d3_rgb_parseNumber(c) { // either integer or percentage
var f = parseFloat(c);
return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
}
var d3_rgb_names = d3.map({
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
});
d3_rgb_names.forEach(function(key, value) {
d3_rgb_names.set(key, d3_rgbNumber(value));
});

7
node_modules/d3/src/color/xyz.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
function d3_xyz_lab(x) {
return x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
}
function d3_xyz_rgb(r) {
return Math.round(255 * (r <= 0.00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055));
}

15
node_modules/d3/src/compat/array.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import "../core/array";
import "../core/document";
// Redefine d3_array if the browser doesnt support slice-based conversion.
if (d3_document) {
try {
d3_array(d3_document.documentElement.childNodes)[0].nodeType;
} catch (e) {
d3_array = function(list) {
var i = list.length, array = new Array(i);
while (i--) array[i] = list[i];
return array;
};
}
}

3
node_modules/d3/src/compat/date.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
if (!Date.now) Date.now = function() {
return +new Date;
};

3
node_modules/d3/src/compat/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import "array";
import "date";
import "style";

23
node_modules/d3/src/compat/style.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
import "../core/document";
// Redefine style.setProperty et al. if the browser doesnt coerce arguments.
if (d3_document) {
try {
d3_document.createElement("DIV").style.setProperty("opacity", 0, "");
} catch (error) {
var d3_element_prototype = this.Element.prototype,
d3_element_setAttribute = d3_element_prototype.setAttribute,
d3_element_setAttributeNS = d3_element_prototype.setAttributeNS,
d3_style_prototype = this.CSSStyleDeclaration.prototype,
d3_style_setProperty = d3_style_prototype.setProperty;
d3_element_prototype.setAttribute = function(name, value) {
d3_element_setAttribute.call(this, name, value + "");
};
d3_element_prototype.setAttributeNS = function(space, local, value) {
d3_element_setAttributeNS.call(this, space, local, value + "");
};
d3_style_prototype.setProperty = function(name, value, priority) {
d3_style_setProperty.call(this, name, value + "", priority);
};
}
}

2
node_modules/d3/src/core/array.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
var d3_arraySlice = [].slice,
d3_array = function(list) { return d3_arraySlice.call(list); }; // conversion for NodeLists

8
node_modules/d3/src/core/class.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
function d3_class(ctor, properties) {
for (var key in properties) {
Object.defineProperty(ctor.prototype, key, {
value: properties[key],
enumerable: false
});
}
}

15
node_modules/d3/src/core/document.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
var d3_document = this.document;
function d3_documentElement(node) {
return node
&& (node.ownerDocument // node is a Node
|| node.document // node is a Window
|| node).documentElement; // node is a Document
}
function d3_window(node) {
return node
&& ((node.ownerDocument && node.ownerDocument.defaultView) // node is a Node
|| (node.document && node) // node is a Window
|| node.defaultView); // node is a Document
}

5
node_modules/d3/src/core/functor.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
function d3_functor(v) {
return typeof v === "function" ? v : function() { return v; };
}
d3.functor = d3_functor;

3
node_modules/d3/src/core/identity.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
function d3_identity(d) {
return d;
}

3
node_modules/d3/src/core/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import "functor";
import "ns";
import "rebind";

1
node_modules/d3/src/core/noop.js generated vendored Normal file
View File

@@ -0,0 +1 @@
function d3_noop() {}

18
node_modules/d3/src/core/ns.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
var d3_nsXhtml = "http://www.w3.org/1999/xhtml";
var d3_nsPrefix = {
svg: "http://www.w3.org/2000/svg",
xhtml: d3_nsXhtml,
xlink: "http://www.w3.org/1999/xlink",
xml: "http://www.w3.org/XML/1998/namespace",
xmlns: "http://www.w3.org/2000/xmlns/"
};
d3.ns = {
prefix: d3_nsPrefix,
qualify: function(name) {
var i = name.indexOf(":"), prefix = name;
if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
return d3_nsPrefix.hasOwnProperty(prefix) ? {space: d3_nsPrefix[prefix], local: name} : name;
}
};

16
node_modules/d3/src/core/rebind.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
// Copies a variable number of methods from source to target.
d3.rebind = function(target, source) {
var i = 1, n = arguments.length, method;
while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
return target;
};
// Method is assumed to be a standard D3 getter-setter:
// If passed with no arguments, gets the value.
// If passed with arguments, sets the value and returns the target.
function d3_rebind(target, source, method) {
return function() {
var value = method.apply(source, arguments);
return value === source ? target : value;
};
}

3
node_modules/d3/src/core/source.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
function d3_source(d) {
return d.source;
}

11
node_modules/d3/src/core/subclass.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
var d3_subclass = {}.__proto__?
// Until ECMAScript supports array subclassing, prototype injection works well.
function(object, prototype) {
object.__proto__ = prototype;
}:
// And if your browser doesn't support __proto__, we'll use direct extension.
function(object, prototype) {
for (var property in prototype) object[property] = prototype[property];
};

3
node_modules/d3/src/core/target.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
function d3_target(d) {
return d.target;
}

3
node_modules/d3/src/core/true.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
function d3_true() {
return true;
}

10
node_modules/d3/src/core/vendor.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
function d3_vendorSymbol(object, name) {
if (name in object) return name;
name = name.charAt(0).toUpperCase() + name.slice(1);
for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) {
var prefixName = d3_vendorPrefixes[i] + name;
if (prefixName in object) return prefixName;
}
}
var d3_vendorPrefixes = ["webkit", "ms", "moz", "Moz", "o", "O"];

3
node_modules/d3/src/core/zero.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
function d3_zero() {
return 0;
}

23
node_modules/d3/src/d3.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
import "start";
import "compat/";
import "arrays/";
import "behavior/";
import "color/";
import "core/";
import "dsv/";
import "event/";
import "format/";
import "geo/";
import "geom/";
import "interpolate/";
import "layout/";
import "math/";
import "scale/";
import "selection/";
import "svg/";
import "time/";
import "transition/";
import "xhr/";
import "end";

3
node_modules/d3/src/dsv/csv.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import "dsv";
d3.csv = d3.dsv(",", "text/csv");

136
node_modules/d3/src/dsv/dsv.js generated vendored Normal file
View File

@@ -0,0 +1,136 @@
import "../arrays/set";
import "../xhr/xhr";
d3.dsv = function(delimiter, mimeType) {
var reFormat = new RegExp("[\"" + delimiter + "\n]"),
delimiterCode = delimiter.charCodeAt(0);
function dsv(url, row, callback) {
if (arguments.length < 3) callback = row, row = null;
var xhr = d3_xhr(url, mimeType, row == null ? response : typedResponse(row), callback);
xhr.row = function(_) {
return arguments.length
? xhr.response((row = _) == null ? response : typedResponse(_))
: row;
};
return xhr;
}
function response(request) {
return dsv.parse(request.responseText);
}
function typedResponse(f) {
return function(request) {
return dsv.parse(request.responseText, f);
};
}
dsv.parse = function(text, f) {
var o;
return dsv.parseRows(text, function(row, i) {
if (o) return o(row, i - 1);
var a = new Function("d", "return {" + row.map(function(name, i) {
return JSON.stringify(name) + ": d[" + i + "]";
}).join(",") + "}");
o = f ? function(row, i) { return f(a(row), i); } : a;
});
};
dsv.parseRows = function(text, f) {
var EOL = {}, // sentinel value for end-of-line
EOF = {}, // sentinel value for end-of-file
rows = [], // output rows
N = text.length,
I = 0, // current character index
n = 0, // the current line number
t, // the current token
eol; // is the current token followed by EOL?
function token() {
if (I >= N) return EOF; // special case: end of file
if (eol) return eol = false, EOL; // special case: end of line
// special case: quotes
var j = I;
if (text.charCodeAt(j) === 34) {
var i = j;
while (i++ < N) {
if (text.charCodeAt(i) === 34) {
if (text.charCodeAt(i + 1) !== 34) break;
++i;
}
}
I = i + 2;
var c = text.charCodeAt(i + 1);
if (c === 13) {
eol = true;
if (text.charCodeAt(i + 2) === 10) ++I;
} else if (c === 10) {
eol = true;
}
return text.slice(j + 1, i).replace(/""/g, "\"");
}
// common case: find next delimiter or newline
while (I < N) {
var c = text.charCodeAt(I++), k = 1;
if (c === 10) eol = true; // \n
else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } // \r|\r\n
else if (c !== delimiterCode) continue;
return text.slice(j, I - k);
}
// special case: last token before EOF
return text.slice(j);
}
while ((t = token()) !== EOF) {
var a = [];
while (t !== EOL && t !== EOF) {
a.push(t);
t = token();
}
if (f && (a = f(a, n++)) == null) continue;
rows.push(a);
}
return rows;
};
dsv.format = function(rows) {
if (Array.isArray(rows[0])) return dsv.formatRows(rows); // deprecated; use formatRows
var fieldSet = new d3_Set, fields = [];
// Compute unique fields in order of discovery.
rows.forEach(function(row) {
for (var field in row) {
if (!fieldSet.has(field)) {
fields.push(fieldSet.add(field));
}
}
});
return [fields.map(formatValue).join(delimiter)].concat(rows.map(function(row) {
return fields.map(function(field) {
return formatValue(row[field]);
}).join(delimiter);
})).join("\n");
};
dsv.formatRows = function(rows) {
return rows.map(formatRow).join("\n");
};
function formatRow(row) {
return row.map(formatValue).join(delimiter);
}
function formatValue(text) {
return reFormat.test(text) ? "\"" + text.replace(/\"/g, "\"\"") + "\"" : text;
}
return dsv;
};

3
node_modules/d3/src/dsv/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import "dsv";
import "csv";
import "tsv";

3
node_modules/d3/src/dsv/tsv.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import "dsv";
d3.tsv = d3.dsv("\t", "text/tab-separated-values");

4
node_modules/d3/src/end.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
if (typeof define === "function" && define.amd) this.d3 = d3, define(d3);
else if (typeof module === "object" && module.exports) module.exports = d3;
else this.d3 = d3;
}();

69
node_modules/d3/src/event/dispatch.js generated vendored Normal file
View File

@@ -0,0 +1,69 @@
import "../arrays/map";
d3.dispatch = function() {
var dispatch = new d3_dispatch,
i = -1,
n = arguments.length;
while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
return dispatch;
};
function d3_dispatch() {}
d3_dispatch.prototype.on = function(type, listener) {
var i = type.indexOf("."),
name = "";
// Extract optional namespace, e.g., "click.foo"
if (i >= 0) {
name = type.slice(i + 1);
type = type.slice(0, i);
}
if (type) return arguments.length < 2
? this[type].on(name)
: this[type].on(name, listener);
if (arguments.length === 2) {
if (listener == null) for (type in this) {
if (this.hasOwnProperty(type)) this[type].on(name, null);
}
return this;
}
};
function d3_dispatch_event(dispatch) {
var listeners = [],
listenerByName = new d3_Map;
function event() {
var z = listeners, // defensive reference
i = -1,
n = z.length,
l;
while (++i < n) if (l = z[i].on) l.apply(this, arguments);
return dispatch;
}
event.on = function(name, listener) {
var l = listenerByName.get(name),
i;
// return the current listener, if any
if (arguments.length < 2) return l && l.on;
// remove the old listener, if any (with copy-on-write)
if (l) {
l.on = null;
listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
listenerByName.remove(name);
}
// add the new listener, if any
if (listener) listeners.push(listenerByName.set(name, {on: listener}));
return dispatch;
};
return event;
}

36
node_modules/d3/src/event/drag.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import "../core/document";
import "../core/vendor";
import "../selection/on";
var d3_event_dragSelect,
d3_event_dragId = 0;
function d3_event_dragSuppress(node) {
var name = ".dragsuppress-" + ++d3_event_dragId,
click = "click" + name,
w = d3.select(d3_window(node))
.on("touchmove" + name, d3_eventPreventDefault)
.on("dragstart" + name, d3_eventPreventDefault)
.on("selectstart" + name, d3_eventPreventDefault);
if (d3_event_dragSelect == null) {
d3_event_dragSelect = "onselectstart" in node ? false
: d3_vendorSymbol(node.style, "userSelect");
}
if (d3_event_dragSelect) {
var style = d3_documentElement(node).style,
select = style[d3_event_dragSelect];
style[d3_event_dragSelect] = "none";
}
return function(suppressClick) {
w.on(name, null);
if (d3_event_dragSelect) style[d3_event_dragSelect] = select;
if (suppressClick) { // suppress the next click, but only if its immediate
var off = function() { w.on(click, null); };
w.on(click, function() { d3_eventPreventDefault(); off(); }, true);
setTimeout(off, 0);
}
};
}

50
node_modules/d3/src/event/event.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
import "dispatch";
d3.event = null;
function d3_eventPreventDefault() {
d3.event.preventDefault();
}
function d3_eventSource() {
var e = d3.event, s;
while (s = e.sourceEvent) e = s;
return e;
}
// Like d3.dispatch, but for custom events abstracting native UI events. These
// events have a target component (such as a brush), a target element (such as
// the svg:g element containing the brush) and the standard arguments `d` (the
// target element's data) and `i` (the selection index of the target element).
function d3_eventDispatch(target) {
var dispatch = new d3_dispatch,
i = 0,
n = arguments.length;
while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
// Creates a dispatch context for the specified `thiz` (typically, the target
// DOM element that received the source event) and `argumentz` (typically, the
// data `d` and index `i` of the target element). The returned function can be
// used to dispatch an event to any registered listeners; the function takes a
// single argument as input, being the event to dispatch. The event must have
// a "type" attribute which corresponds to a type registered in the
// constructor. This context will automatically populate the "sourceEvent" and
// "target" attributes of the event, as well as setting the `d3.event` global
// for the duration of the notification.
dispatch.of = function(thiz, argumentz) {
return function(e1) {
try {
var e0 =
e1.sourceEvent = d3.event;
e1.target = target;
d3.event = e1;
dispatch[e1.type].apply(thiz, argumentz);
} finally {
d3.event = e0;
}
};
};
return dispatch;
}

6
node_modules/d3/src/event/index.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import "dispatch";
import "event";
import "mouse";
import "touch";
import "touches";
import "timer";

39
node_modules/d3/src/event/mouse.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
import "../core/document";
import "event";
d3.mouse = function(container) {
return d3_mousePoint(container, d3_eventSource());
};
// https://bugs.webkit.org/show_bug.cgi?id=44083
var d3_mouse_bug44083 = this.navigator && /WebKit/.test(this.navigator.userAgent) ? -1 : 0;
function d3_mousePoint(container, e) {
if (e.changedTouches) e = e.changedTouches[0];
var svg = container.ownerSVGElement || container;
if (svg.createSVGPoint) {
var point = svg.createSVGPoint();
if (d3_mouse_bug44083 < 0) {
var window = d3_window(container);
if (window.scrollX || window.scrollY) {
svg = d3.select("body").append("svg").style({
position: "absolute",
top: 0,
left: 0,
margin: 0,
padding: 0,
border: "none"
}, "important");
var ctm = svg[0][0].getScreenCTM();
d3_mouse_bug44083 = !(ctm.f || ctm.e);
svg.remove();
}
}
if (d3_mouse_bug44083) point.x = e.pageX, point.y = e.pageY;
else point.x = e.clientX, point.y = e.clientY;
point = point.matrixTransform(container.getScreenCTM().inverse());
return [point.x, point.y];
}
var rect = container.getBoundingClientRect();
return [e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop];
};

82
node_modules/d3/src/event/timer.js generated vendored Normal file
View File

@@ -0,0 +1,82 @@
import "../core/document";
import "../core/vendor";
var d3_timer_queueHead,
d3_timer_queueTail,
d3_timer_interval, // is an interval (or frame) active?
d3_timer_timeout, // is a timeout active?
d3_timer_frame = this[d3_vendorSymbol(this, "requestAnimationFrame")] || function(callback) { setTimeout(callback, 17); };
// The timer will continue to fire until callback returns true.
d3.timer = function() {
d3_timer.apply(this, arguments);
};
function d3_timer(callback, delay, then) {
var n = arguments.length;
if (n < 2) delay = 0;
if (n < 3) then = Date.now();
// Add the callback to the tail of the queue.
var time = then + delay, timer = {c: callback, t: time, n: null};
if (d3_timer_queueTail) d3_timer_queueTail.n = timer;
else d3_timer_queueHead = timer;
d3_timer_queueTail = timer;
// Start animatin'!
if (!d3_timer_interval) {
d3_timer_timeout = clearTimeout(d3_timer_timeout);
d3_timer_interval = 1;
d3_timer_frame(d3_timer_step);
}
return timer;
}
function d3_timer_step() {
var now = d3_timer_mark(),
delay = d3_timer_sweep() - now;
if (delay > 24) {
if (isFinite(delay)) {
clearTimeout(d3_timer_timeout);
d3_timer_timeout = setTimeout(d3_timer_step, delay);
}
d3_timer_interval = 0;
} else {
d3_timer_interval = 1;
d3_timer_frame(d3_timer_step);
}
}
d3.timer.flush = function() {
d3_timer_mark();
d3_timer_sweep();
};
function d3_timer_mark() {
var now = Date.now(),
timer = d3_timer_queueHead;
while (timer) {
if (now >= timer.t && timer.c(now - timer.t)) timer.c = null;
timer = timer.n;
}
return now;
}
// Flush after callbacks to avoid concurrent queue modification.
// Returns the time of the earliest active timer, post-sweep.
function d3_timer_sweep() {
var t0,
t1 = d3_timer_queueHead,
time = Infinity;
while (t1) {
if (t1.c) {
if (t1.t < time) time = t1.t;
t1 = (t0 = t1).n;
} else {
t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;
}
}
d3_timer_queueTail = t0;
return time;
}

11
node_modules/d3/src/event/touch.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import "event";
import "mouse";
d3.touch = function(container, touches, identifier) {
if (arguments.length < 3) identifier = touches, touches = d3_eventSource().changedTouches;
if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) {
if ((touch = touches[i]).identifier === identifier) {
return d3_mousePoint(container, touch);
}
}
};

12
node_modules/d3/src/event/touches.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import "../core/array";
import "event";
import "mouse";
d3.touches = function(container, touches) {
if (arguments.length < 2) touches = d3_eventSource().touches;
return touches ? d3_array(touches).map(function(touch) {
var point = d3_mousePoint(container, touch);
point.identifier = touch.identifier;
return point;
}) : [];
};

3
node_modules/d3/src/format/collapse.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
function d3_collapse(s) {
return s.trim().replace(/\s+/g, " ");
}

3
node_modules/d3/src/format/format.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import "../locale/en-US";
d3.format = d3_locale_enUS.numberFormat;

24
node_modules/d3/src/format/formatPrefix.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import "precision";
import "round";
import "../math/abs";
var d3_formatPrefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix);
d3.formatPrefix = function(value, precision) {
var i = 0;
if (value = +value) {
if (value < 0) value *= -1;
if (precision) value = d3.round(value, d3_format_precision(value, precision));
i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
i = Math.max(-24, Math.min(24, Math.floor((i - 1) / 3) * 3));
}
return d3_formatPrefixes[8 + i / 3];
};
function d3_formatPrefix(d, i) {
var k = Math.pow(10, abs(8 - i) * 3);
return {
scale: i > 8 ? function(d) { return d / k; } : function(d) { return d * k; },
symbol: d
};
}

4
node_modules/d3/src/format/index.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import "format";
import "formatPrefix";
import "requote";
import "round";

3
node_modules/d3/src/format/precision.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
function d3_format_precision(x, p) {
return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1);
}

5
node_modules/d3/src/format/requote.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
d3.requote = function(s) {
return s.replace(d3_requote_re, "\\$&");
};
var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;

5
node_modules/d3/src/format/round.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
d3.round = function(x, n) {
return n
? Math.round(x * (n = Math.pow(10, n))) / n
: Math.round(x);
};

129
node_modules/d3/src/geo/albers-usa.js generated vendored Normal file
View File

@@ -0,0 +1,129 @@
import "albers";
import "conic-equal-area";
import "geo";
// A composite projection for the United States, configured by default for
// 960×500. Also works quite well at 960×600 with scale 1285. 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
d3.geo.albersUsa = function() {
var lower48 = d3.geo.albers();
// EPSG:3338
var alaska = d3.geo.conicEqualArea()
.rotate([154, 0])
.center([-2, 58.5])
.parallels([55, 65]);
// ESRI:102007
var hawaii = d3.geo.conicEqualArea()
.rotate([157, 0])
.center([-3, 19.9])
.parallels([8, 18]);
var point,
pointStream = {point: function(x, y) { point = [x, y]; }},
lower48Point,
alaskaPoint,
hawaiiPoint;
function albersUsa(coordinates) {
var x = coordinates[0], y = coordinates[1];
point = null;
(lower48Point(x, y), point)
|| (alaskaPoint(x, y), point)
|| hawaiiPoint(x, y);
return point;
}
albersUsa.invert = function(coordinates) {
var k = lower48.scale(),
t = lower48.translate(),
x = (coordinates[0] - t[0]) / k,
y = (coordinates[1] - t[1]) / k;
return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska
: y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii
: lower48).invert(coordinates);
};
// A naïve multi-projection stream.
// The projections must have mutually exclusive clip regions on the sphere,
// as this will avoid emitting interleaving lines and polygons.
albersUsa.stream = function(stream) {
var lower48Stream = lower48.stream(stream),
alaskaStream = alaska.stream(stream),
hawaiiStream = hawaii.stream(stream);
return {
point: function(x, y) {
lower48Stream.point(x, y);
alaskaStream.point(x, y);
hawaiiStream.point(x, y);
},
sphere: function() {
lower48Stream.sphere();
alaskaStream.sphere();
hawaiiStream.sphere();
},
lineStart: function() {
lower48Stream.lineStart();
alaskaStream.lineStart();
hawaiiStream.lineStart();
},
lineEnd: function() {
lower48Stream.lineEnd();
alaskaStream.lineEnd();
hawaiiStream.lineEnd();
},
polygonStart: function() {
lower48Stream.polygonStart();
alaskaStream.polygonStart();
hawaiiStream.polygonStart();
},
polygonEnd: function() {
lower48Stream.polygonEnd();
alaskaStream.polygonEnd();
hawaiiStream.polygonEnd();
}
};
};
albersUsa.precision = function(_) {
if (!arguments.length) return lower48.precision();
lower48.precision(_);
alaska.precision(_);
hawaii.precision(_);
return albersUsa;
};
albersUsa.scale = function(_) {
if (!arguments.length) return lower48.scale();
lower48.scale(_);
alaska.scale(_ * 0.35);
hawaii.scale(_);
return albersUsa.translate(lower48.translate());
};
albersUsa.translate = function(_) {
if (!arguments.length) return lower48.translate();
var k = lower48.scale(), x = +_[0], y = +_[1];
lower48Point = lower48
.translate(_)
.clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]])
.stream(pointStream).point;
alaskaPoint = alaska
.translate([x - 0.307 * k, y + 0.201 * k])
.clipExtent([[x - 0.425 * k + ε, y + 0.120 * k + ε], [x - 0.214 * k - ε, y + 0.234 * k - ε]])
.stream(pointStream).point;
hawaiiPoint = hawaii
.translate([x - 0.205 * k, y + 0.212 * k])
.clipExtent([[x - 0.214 * k + ε, y + 0.166 * k + ε], [x - 0.115 * k - ε, y + 0.234 * k - ε]])
.stream(pointStream).point;
return albersUsa;
};
return albersUsa.scale(1070);
};

11
node_modules/d3/src/geo/albers.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import "conic-equal-area";
import "geo";
// ESRI:102003
d3.geo.albers = function() {
return d3.geo.conicEqualArea()
.rotate([96, 0])
.center([-0.6, 38.7])
.parallels([29.5, 45.5])
.scale(1070);
};

69
node_modules/d3/src/geo/area.js generated vendored Normal file
View File

@@ -0,0 +1,69 @@
import "../core/noop";
import "../math/adder";
import "../math/trigonometry";
import "geo";
import "stream";
d3.geo.area = function(object) {
d3_geo_areaSum = 0;
d3.geo.stream(object, d3_geo_area);
return d3_geo_areaSum;
};
var d3_geo_areaSum,
d3_geo_areaRingSum = new d3_adder;
var d3_geo_area = {
sphere: function() { d3_geo_areaSum += 4 * π; },
point: d3_noop,
lineStart: d3_noop,
lineEnd: d3_noop,
// Only count area for polygon rings.
polygonStart: function() {
d3_geo_areaRingSum.reset();
d3_geo_area.lineStart = d3_geo_areaRingStart;
},
polygonEnd: function() {
var area = 2 * d3_geo_areaRingSum;
d3_geo_areaSum += area < 0 ? 4 * π + area : area;
d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop;
}
};
function d3_geo_areaRingStart() {
var λ00, φ00, λ0, cosφ0, sinφ0; // start point and previous point
// For the first point, …
d3_geo_area.point = function(λ, φ) {
d3_geo_area.point = nextPoint;
λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4), sinφ0 = Math.sin(φ);
};
// For subsequent points, …
function nextPoint(λ, φ) {
λ *= d3_radians;
φ = φ * d3_radians / 2 + π / 4; // 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 Cagnolis
// theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2).
var = λ - λ0,
sdλ = >= 0 ? 1 : -1,
adλ = sdλ * ,
cosφ = Math.cos(φ),
sinφ = Math.sin(φ),
k = sinφ0 * sinφ,
u = cosφ0 * cosφ + k * Math.cos(adλ),
v = k * sdλ * Math.sin(adλ);
d3_geo_areaRingSum.add(Math.atan2(v, u));
// Advance the previous points.
λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ;
}
// For the last point, return to the start.
d3_geo_area.lineEnd = function() {
nextPoint(λ00, φ00);
};
}

12
node_modules/d3/src/geo/azimuthal-equal-area.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import "azimuthal";
import "geo";
import "projection";
var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(
function(cosλcosφ) { return Math.sqrt(2 / (1 + cosλcosφ)); },
function(ρ) { return 2 * Math.asin(ρ / 2); }
);
(d3.geo.azimuthalEqualArea = function() {
return d3_geo_projection(d3_geo_azimuthalEqualArea);
}).raw = d3_geo_azimuthalEqualArea;

13
node_modules/d3/src/geo/azimuthal-equidistant.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import "../core/identity";
import "azimuthal";
import "geo";
import "projection";
var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(
function(cosλcosφ) { var c = Math.acos(cosλcosφ); return c && c / Math.sin(c); },
d3_identity
);
(d3.geo.azimuthalEquidistant = function() {
return d3_geo_projection(d3_geo_azimuthalEquidistant);
}).raw = d3_geo_azimuthalEquidistant;

25
node_modules/d3/src/geo/azimuthal.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
// Abstract azimuthal projection.
function d3_geo_azimuthal(scale, angle) {
function azimuthal(λ, φ) {
var cosλ = Math.cos(λ),
cosφ = Math.cos(φ),
k = scale(cosλ * cosφ);
return [
k * cosφ * Math.sin(λ),
k * Math.sin(φ)
];
}
azimuthal.invert = function(x, y) {
var ρ = Math.sqrt(x * x + y * y),
c = angle(ρ),
sinc = Math.sin(c),
cosc = Math.cos(c);
return [
Math.atan2(x * sinc, ρ * cosc),
Math.asin(ρ && y * sinc / ρ)
];
};
return azimuthal;
}

168
node_modules/d3/src/geo/bounds.js generated vendored Normal file
View File

@@ -0,0 +1,168 @@
import "../math/abs";
import "geo";
import "stream";
import "area";
import "cartesian";
import "spherical";
d3.geo.bounds = (function() {
var λ0, φ0, λ1, φ1, // bounds
λ_, // previous λ-coordinate
λ__, φ__, // first point
p0, // previous 3D point
dλSum,
ranges,
range;
var bound = {
point: point,
lineStart: lineStart,
lineEnd: lineEnd,
polygonStart: function() {
bound.point = ringPoint;
bound.lineStart = ringStart;
bound.lineEnd = ringEnd;
dλSum = 0;
d3_geo_area.polygonStart();
},
polygonEnd: function() {
d3_geo_area.polygonEnd();
bound.point = point;
bound.lineStart = lineStart;
bound.lineEnd = lineEnd;
if (d3_geo_areaRingSum < 0) λ0 = -(λ1 = 180), φ0 = -(φ1 = 90);
else if (dλSum > ε) φ1 = 90;
else if (dλSum < -ε) φ0 = -90;
range[0] = λ0, range[1] = λ1;
}
};
function point(λ, φ) {
ranges.push(range = [λ0 = λ, λ1 = λ]);
if (φ < φ0) φ0 = φ;
if (φ > φ1) φ1 = φ;
}
function linePoint(λ, φ) {
var p = d3_geo_cartesian([λ * d3_radians, φ * d3_radians]);
if (p0) {
var normal = d3_geo_cartesianCross(p0, p),
equatorial = [normal[1], -normal[0], 0],
inflection = d3_geo_cartesianCross(equatorial, normal);
d3_geo_cartesianNormalize(inflection);
inflection = d3_geo_spherical(inflection);
var = λ - λ_,
s = > 0 ? 1 : -1,
λi = inflection[0] * d3_degrees * s,
antimeridian = abs() > 180;
if (antimeridian ^ (s * λ_ < λi && λi < s * λ)) {
var φi = inflection[1] * d3_degrees;
if (φi > φ1) φ1 = φi;
} else if (λi = (λi + 360) % 360 - 180, antimeridian ^ (s * λ_ < λi && λi < s * λ)) {
var φi = -inflection[1] * d3_degrees;
if (φi < φ0) φ0 = φi;
} else {
if (φ < φ0) φ0 = φ;
if (φ > φ1) φ1 = φ;
}
if (antimeridian) {
if (λ < λ_) {
if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ;
} else {
if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ;
}
} else {
if (λ1 >= λ0) {
if (λ < λ0) λ0 = λ;
if (λ > λ1) λ1 = λ;
} else {
if (λ > λ_) {
if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ;
} else {
if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ;
}
}
}
} else {
point(λ, φ);
}
p0 = p, λ_ = λ;
}
function lineStart() { bound.point = linePoint; }
function lineEnd() {
range[0] = λ0, range[1] = λ1;
bound.point = point;
p0 = null;
}
function ringPoint(λ, φ) {
if (p0) {
var = λ - λ_;
dλSum += abs() > 180 ? + ( > 0 ? 360 : -360) : ;
} else λ__ = λ, φ__ = φ;
d3_geo_area.point(λ, φ);
linePoint(λ, φ);
}
function ringStart() {
d3_geo_area.lineStart();
}
function ringEnd() {
ringPoint(λ__, φ__);
d3_geo_area.lineEnd();
if (abs(dλSum) > ε) λ0 = -(λ1 = 180);
range[0] = λ0, range[1] = λ1;
p0 = null;
}
// Finds the left-right distance between two longitudes.
// This is almost the same as (λ1 - λ0 + 360°) % 360°, except that we want
// the distance between ±180° to be 360°.
function angle(λ0, λ1) { return (λ1 -= λ0) < 0 ? λ1 + 360 : λ1; }
function compareRanges(a, b) { return a[0] - b[0]; }
function withinRange(x, range) {
return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;
}
return function(feature) {
φ1 = λ1 = -(λ0 = φ0 = Infinity);
ranges = [];
d3.geo.stream(feature, bound);
var n = ranges.length;
if (n) {
// First, sort ranges by their minimum longitudes.
ranges.sort(compareRanges);
// Then, merge any ranges that overlap.
for (var i = 1, a = ranges[0], b, merged = [a]; i < n; ++i) {
b = ranges[i];
if (withinRange(b[0], a) || withinRange(b[1], a)) {
if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1];
if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0];
} else {
merged.push(a = b);
}
}
// Finally, find the largest gap between the merged ranges.
// The final bounding box will be the inverse of this gap.
var best = -Infinity, ;
for (var n = merged.length - 1, i = 0, a = merged[n], b; i <= n; a = b, ++i) {
b = merged[i];
if (( = angle(a[1], b[0])) > best) best = , λ0 = b[0], λ1 = a[1];
}
}
ranges = range = null;
return λ0 === Infinity || φ0 === Infinity
? [[NaN, NaN], [NaN, NaN]]
: [[λ0, φ0], [λ1, φ1]];
};
})();

47
node_modules/d3/src/geo/cartesian.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
// TODO
// cross and scale return new vectors,
// whereas add and normalize operate in-place
function d3_geo_cartesian(spherical) {
var λ = spherical[0],
φ = spherical[1],
cosφ = Math.cos(φ);
return [
cosφ * Math.cos(λ),
cosφ * Math.sin(λ),
Math.sin(φ)
];
}
function d3_geo_cartesianDot(a, b) {
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}
function d3_geo_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]
];
}
function d3_geo_cartesianAdd(a, b) {
a[0] += b[0];
a[1] += b[1];
a[2] += b[2];
}
function d3_geo_cartesianScale(vector, k) {
return [
vector[0] * k,
vector[1] * k,
vector[2] * k
];
}
function d3_geo_cartesianNormalize(d) {
var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
d[0] /= l;
d[1] /= l;
d[2] /= l;
}

149
node_modules/d3/src/geo/centroid.js generated vendored Normal file
View File

@@ -0,0 +1,149 @@
import "../core/noop";
import "../math/trigonometry";
import "geo";
import "stream";
d3.geo.centroid = function(object) {
d3_geo_centroidW0 = d3_geo_centroidW1 =
d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 =
d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 =
d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0;
d3.geo.stream(object, d3_geo_centroid);
var x = d3_geo_centroidX2,
y = d3_geo_centroidY2,
z = d3_geo_centroidZ2,
m = x * x + y * y + z * z;
// If the area-weighted centroid is undefined, fall back to length-weighted centroid.
if (m < ε2) {
x = d3_geo_centroidX1, y = d3_geo_centroidY1, z = d3_geo_centroidZ1;
// If the feature has zero length, fall back to arithmetic mean of point vectors.
if (d3_geo_centroidW1 < ε) x = d3_geo_centroidX0, y = d3_geo_centroidY0, z = d3_geo_centroidZ0;
m = x * x + y * y + z * z;
// If the feature still has an undefined centroid, then return.
if (m < ε2) return [NaN, NaN];
}
return [Math.atan2(y, x) * d3_degrees, d3_asin(z / Math.sqrt(m)) * d3_degrees];
};
var d3_geo_centroidW0,
d3_geo_centroidW1,
d3_geo_centroidX0,
d3_geo_centroidY0,
d3_geo_centroidZ0,
d3_geo_centroidX1,
d3_geo_centroidY1,
d3_geo_centroidZ1,
d3_geo_centroidX2,
d3_geo_centroidY2,
d3_geo_centroidZ2;
var d3_geo_centroid = {
sphere: d3_noop,
point: d3_geo_centroidPoint,
lineStart: d3_geo_centroidLineStart,
lineEnd: d3_geo_centroidLineEnd,
polygonStart: function() {
d3_geo_centroid.lineStart = d3_geo_centroidRingStart;
},
polygonEnd: function() {
d3_geo_centroid.lineStart = d3_geo_centroidLineStart;
}
};
// Arithmetic mean of Cartesian vectors.
function d3_geo_centroidPoint(λ, φ) {
λ *= d3_radians;
var cosφ = Math.cos(φ *= d3_radians);
d3_geo_centroidPointXYZ(cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ));
}
function d3_geo_centroidPointXYZ(x, y, z) {
++d3_geo_centroidW0;
d3_geo_centroidX0 += (x - d3_geo_centroidX0) / d3_geo_centroidW0;
d3_geo_centroidY0 += (y - d3_geo_centroidY0) / d3_geo_centroidW0;
d3_geo_centroidZ0 += (z - d3_geo_centroidZ0) / d3_geo_centroidW0;
}
function d3_geo_centroidLineStart() {
var x0, y0, z0; // previous point
d3_geo_centroid.point = function(λ, φ) {
λ *= d3_radians;
var cosφ = Math.cos(φ *= d3_radians);
x0 = cosφ * Math.cos(λ);
y0 = cosφ * Math.sin(λ);
z0 = Math.sin(φ);
d3_geo_centroid.point = nextPoint;
d3_geo_centroidPointXYZ(x0, y0, z0);
};
function nextPoint(λ, φ) {
λ *= d3_radians;
var cosφ = Math.cos(φ *= d3_radians),
x = cosφ * Math.cos(λ),
y = cosφ * Math.sin(λ),
z = Math.sin(φ),
w = Math.atan2(
Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w),
x0 * x + y0 * y + z0 * z);
d3_geo_centroidW1 += w;
d3_geo_centroidX1 += w * (x0 + (x0 = x));
d3_geo_centroidY1 += w * (y0 + (y0 = y));
d3_geo_centroidZ1 += w * (z0 + (z0 = z));
d3_geo_centroidPointXYZ(x0, y0, z0);
}
}
function d3_geo_centroidLineEnd() {
d3_geo_centroid.point = d3_geo_centroidPoint;
}
// See J. E. Brock, The Inertia Tensor for a Spherical Triangle,
// J. Applied Mechanics 42, 239 (1975).
function d3_geo_centroidRingStart() {
var λ00, φ00, // first point
x0, y0, z0; // previous point
d3_geo_centroid.point = function(λ, φ) {
λ00 = λ, φ00 = φ;
d3_geo_centroid.point = nextPoint;
λ *= d3_radians;
var cosφ = Math.cos(φ *= d3_radians);
x0 = cosφ * Math.cos(λ);
y0 = cosφ * Math.sin(λ);
z0 = Math.sin(φ);
d3_geo_centroidPointXYZ(x0, y0, z0);
};
d3_geo_centroid.lineEnd = function() {
nextPoint(λ00, φ00);
d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd;
d3_geo_centroid.point = d3_geo_centroidPoint;
};
function nextPoint(λ, φ) {
λ *= d3_radians;
var cosφ = Math.cos(φ *= d3_radians),
x = cosφ * Math.cos(λ),
y = cosφ * Math.sin(λ),
z = Math.sin(φ),
cx = y0 * z - z0 * y,
cy = z0 * x - x0 * z,
cz = x0 * y - y0 * x,
m = Math.sqrt(cx * cx + cy * cy + cz * cz),
u = x0 * x + y0 * y + z0 * z,
v = m && -d3_acos(u) / m, // area weight
w = Math.atan2(m, u); // line weight
d3_geo_centroidX2 += v * cx;
d3_geo_centroidY2 += v * cy;
d3_geo_centroidZ2 += v * cz;
d3_geo_centroidW1 += w;
d3_geo_centroidX1 += w * (x0 + (x0 = x));
d3_geo_centroidY1 += w * (y0 + (y0 = y));
d3_geo_centroidZ1 += w * (z0 + (z0 = z));
d3_geo_centroidPointXYZ(x0, y0, z0);
}
}

Some files were not shown because too many files have changed in this diff Show More